mirror of
https://github.com/rystaf/mlmym.git
synced 2024-12-29 03:53:46 +00:00
root ref
This commit is contained in:
parent
17e4bc76b9
commit
1fe8e5a5b5
12
routes.go
12
routes.go
|
@ -365,18 +365,22 @@ func Render(w http.ResponseWriter, templateName string, state State) {
|
|||
func GetRoot(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
|
||||
data := make(map[string]any)
|
||||
data["Title"] = r.Host
|
||||
d := true
|
||||
if dark := getCookie(r, "Dark"); dark != "" {
|
||||
data["Dark"] = dark != "0"
|
||||
d = dark != "0"
|
||||
data["Dark"] = &d
|
||||
} else if dark := os.Getenv("DARK"); dark != "" {
|
||||
data["Dark"] = true
|
||||
data["Dark"] = &d
|
||||
}
|
||||
tmpl, err := GetTemplate("root.html")
|
||||
if err != nil {
|
||||
fmt.Println("execute fail", err)
|
||||
fmt.Println("template fail", err)
|
||||
w.Write([]byte("500 - Server Error"))
|
||||
return
|
||||
}
|
||||
tmpl.Execute(w, data)
|
||||
if err = tmpl.Execute(w, data); err != nil {
|
||||
fmt.Println("execute fail", err)
|
||||
}
|
||||
}
|
||||
|
||||
type NodeSoftware struct {
|
||||
|
|
Loading…
Reference in a new issue