mirror of
https://github.com/rystaf/mlmym.git
synced 2025-01-04 21:46:07 +00:00
make settings global
This commit is contained in:
parent
7760d7c226
commit
2a9a54f595
|
@ -514,7 +514,8 @@ func Settings(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
|
||||||
switch r.Method {
|
switch r.Method {
|
||||||
case "POST":
|
case "POST":
|
||||||
for _, name := range []string{"DefaultSortType", "DefaultListingType"} {
|
for _, name := range []string{"DefaultSortType", "DefaultListingType"} {
|
||||||
setCookie(w, state.Host, name, r.FormValue(name))
|
deleteCookie(w, state.Host, name)
|
||||||
|
setCookie(w, "", name, r.FormValue(name))
|
||||||
}
|
}
|
||||||
if r.FormValue("darkmode") != "" {
|
if r.FormValue("darkmode") != "" {
|
||||||
setCookie(w, "", "Dark", "1")
|
setCookie(w, "", "Dark", "1")
|
||||||
|
@ -525,10 +526,11 @@ func Settings(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
|
||||||
state.Dark = false
|
state.Dark = false
|
||||||
}
|
}
|
||||||
if r.FormValue("shownsfw") != "" {
|
if r.FormValue("shownsfw") != "" {
|
||||||
setCookie(w, state.Host, "ShowNSFW", "1")
|
setCookie(w, "", "ShowNSFW", "1")
|
||||||
state.ShowNSFW = true
|
state.ShowNSFW = true
|
||||||
} else {
|
} else {
|
||||||
deleteCookie(w, state.Host, "ShowNSFW")
|
deleteCookie(w, state.Host, "ShowNSFW")
|
||||||
|
deleteCookie(w, "", "ShowNSFW")
|
||||||
state.ShowNSFW = false
|
state.ShowNSFW = false
|
||||||
}
|
}
|
||||||
state.Listing = r.FormValue("DefaultListingType")
|
state.Listing = r.FormValue("DefaultListingType")
|
||||||
|
@ -1024,7 +1026,7 @@ func UserOp(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
|
||||||
}
|
}
|
||||||
case "shownsfw":
|
case "shownsfw":
|
||||||
if r.FormValue("submit") == "continue" {
|
if r.FormValue("submit") == "continue" {
|
||||||
setCookie(w, state.Host, "ShowNSFW", "1")
|
setCookie(w, "", "ShowNSFW", "1")
|
||||||
} else {
|
} else {
|
||||||
r.URL.Path = "/" + state.Host
|
r.URL.Path = "/" + state.Host
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue