From afa9e221d07ac0e246daadef33e911bc86fd74eb Mon Sep 17 00:00:00 2001 From: KushBlazingJudah <59340248+KushBlazingJudah@users.noreply.github.com> Date: Thu, 19 Aug 2021 12:07:41 -0300 Subject: hack fix mod pages --- client.go | 1 + main.go | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/client.go b/client.go index d45e72d..f34b7d4 100644 --- a/client.go +++ b/client.go @@ -70,6 +70,7 @@ type AdminPage struct { IsLocal bool PostBlacklist []PostBlacklist AutoSubscribe bool + Themes *[]string } type Report struct { diff --git a/main.go b/main.go index 131211e..9c7f429 100644 --- a/main.go +++ b/main.go @@ -24,6 +24,7 @@ import ( "strconv" "strings" "time" + "log" ) var Port = ":" + GetConfigValue("instanceport", "3000") @@ -630,7 +631,13 @@ func main() { adminData.AutoSubscribe = GetActorAutoSubscribeDB(db, actor.Id) - t.ExecuteTemplate(w, "layout", adminData) + adminData.Themes = &Themes; + + err := t.ExecuteTemplate(w, "layout", adminData) + if err != nil { + // TODO: actual error handling + log.Printf("mod page: %s\n", err) + } } else if admin || actor.Id == Domain { t := template.Must(template.New("").Funcs(template.FuncMap{ @@ -665,7 +672,13 @@ func main() { adminData.PostBlacklist = GetRegexBlacklistDB(db) - t.ExecuteTemplate(w, "layout", adminData) + adminData.Themes = &Themes + + err := t.ExecuteTemplate(w, "layout", adminData) + if err != nil { + // TODO: actual error handling + log.Printf("mod page: %s\n", err) + } } }) -- cgit v1.2.3