~sotirisp/kindleto

e43487d84a6e2b17611b21c200581c46df3bc021 — Sotiris Papatheodorou 1 year, 11 months ago 77bee3c
Serve the settings page before restarting

This prevents the "Your Kindle is unable to load the requested page."
message on the kindle when restarting.
1 files changed, 5 insertions(+), 1 deletions(-)

M handlers.go
M handlers.go => handlers.go +5 -1
@@ 16,6 16,7 @@ import (
	"os/exec"
	"strconv"
	"strings"
	"time"

	"git.sr.ht/~sotirisp/kindleto/certificates"
	"git.sr.ht/~sotirisp/kindleto/file"


@@ 311,7 312,10 @@ func handleSettings(w http.ResponseWriter, r *http.Request) {
			if settings.Current.LogLevel > 0 {
				log.Println("handleSettings: restarting kindleto")
			}
			exec.Command("/etc/init.d/kindleto-init", "restart").Run()
			go func() {
				time.Sleep(time.Second)
				exec.Command("/etc/init.d/kindleto-init", "restart").Run()
			}()
		} else if r.FormValue("reset") == "yes" {
			if settings.Current.LogLevel > 0 {
				log.Println("handleSettings: resetting settings to defaults")