diff --git a/routes.go b/routes.go index b68144d..644c0ce 100644 --- a/routes.go +++ b/routes.go @@ -772,14 +772,14 @@ func Settings(w http.ResponseWriter, r *http.Request, ps httprouter.Params) { setCookie(w, "", name, r.FormValue(name)) } state.Dark = new(bool) - if r.FormValue("undarkmode") == "" { + dark := r.FormValue("darkmode") + undark := r.FormValue("undarkmode") + if dark == "0" && undark != "0" { + } else if dark == "0" && undark == "0" { setCookie(w, "", "Dark", "0") - } else if r.FormValue("darkmode") != "" { + } else { setCookie(w, "", "Dark", "1") *state.Dark = true - } else { - setCookie(w, "", "Dark", "0") - *state.Dark = false } if r.FormValue("shownsfw") != "" { setCookie(w, "", "ShowNSFW", "1") diff --git a/templates/settings.html b/templates/settings.html index f4de045..97ddb40 100644 --- a/templates/settings.html +++ b/templates/settings.html @@ -111,12 +111,16 @@ dark mode +