From 8e2c55f8bda81c578509c0f9298bdfb43d580af6 Mon Sep 17 00:00:00 2001 From: Chris Sexton <3216719+chrissexton@users.noreply.github.com> Date: Wed, 28 Feb 2024 09:39:38 -0500 Subject: [PATCH] web: convert admin and secrets to foundation --- bot/web/index.templ | 46 ++++++++++++-------------- bot/web/index_templ.go | 55 ++++++++++++++++++++------------ bot/web/web.go | 4 +++ plugins/admin/admin.templ | 27 +++++++++------- plugins/admin/admin_templ.go | 20 ++++++------ plugins/secrets/secrets.templ | 34 +++++++++++++------- plugins/secrets/secrets_templ.go | 8 ++--- 7 files changed, 111 insertions(+), 83 deletions(-) diff --git a/bot/web/index.templ b/bot/web/index.templ index cc1a606..2b7d336 100644 --- a/bot/web/index.templ +++ b/bot/web/index.templ @@ -2,8 +2,7 @@ package web templ (w *Web) Header(title string) { - - + if title != "" { @@ -15,13 +14,14 @@ templ (w *Web) Header(title string) { } templ (w *Web) Footer() { - + + } templ (w *Web) Index(title string, contents templ.Component) { - - + + @w.Header(title) @@ -37,25 +37,21 @@ templ (w *Web) Index(title string, contents templ.Component) { } templ (w *Web) Nav(currentPage string) { - + } diff --git a/bot/web/index_templ.go b/bot/web/index_templ.go index 1354ff7..f5d096a 100644 --- a/bot/web/index_templ.go +++ b/bot/web/index_templ.go @@ -23,7 +23,7 @@ func (w *Web) Header(title string) templ.Component { templ_7745c5c3_Var1 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -35,7 +35,7 @@ func (w *Web) Header(title string) templ.Component { var templ_7745c5c3_Var2 string templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(title) if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `bot/web/index.templ`, Line: 9, Col: 36} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `bot/web/index.templ`, Line: 8, Col: 36} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2)) if templ_7745c5c3_Err != nil { @@ -75,7 +75,7 @@ func (w *Web) Footer() templ.Component { templ_7745c5c3_Var3 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -99,7 +99,7 @@ func (w *Web) Index(title string, contents templ.Component) templ.Component { templ_7745c5c3_Var4 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -149,22 +149,35 @@ func (w *Web) Nav(currentPage string) templ.Component { templ_7745c5c3_Var5 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/bot/web/web.go b/bot/web/web.go index 3819f15..31f5f75 100644 --- a/bot/web/web.go +++ b/bot/web/web.go @@ -103,3 +103,7 @@ func New(config *config.Config) *Web { w.setupHTTP() return w } + +func (ws *Web) botName() string { + return ws.config.Get("nick", "catbase") +} diff --git a/plugins/admin/admin.templ b/plugins/admin/admin.templ index 83157f1..2626243 100644 --- a/plugins/admin/admin.templ +++ b/plugins/admin/admin.templ @@ -3,28 +3,31 @@ package admin import "fmt" templ (a *AdminPlugin) page() { -
+
-
-
+
+

App Pass

+
+
+
-
+
-
- - +
+ +
-
-
+
+
} @@ -43,7 +46,8 @@ templ (a *AdminPlugin) entries(items []PassEntry) { for _, entry := range items {