aboutsummaryrefslogtreecommitdiff
path: root/web/index.go
diff options
context:
space:
mode:
authorRyan Cao <70191398+ryanccn@users.noreply.github.com>2025-04-18 04:06:37 +0000
committerGitHub <noreply@github.com>2025-04-18 00:06:37 -0400
commitf844dba3dcfc0c51bcc72bfe9707ceec0c09b7ed (patch)
treedda8006379d358741d0d679c860cb0627b3b6090 /web/index.go
parent736c3ade0944532690098c4f8a7fab0d92420a09 (diff)
downloadanubis-f844dba3dcfc0c51bcc72bfe9707ceec0c09b7ed.tar.xz
anubis-f844dba3dcfc0c51bcc72bfe9707ceec0c09b7ed.zip
perf: embed challenge data in HTML (#279)
Diffstat (limited to 'web/index.go')
-rw-r--r--web/index.go14
1 files changed, 11 insertions, 3 deletions
diff --git a/web/index.go b/web/index.go
index 5d2957b..ac4cbda 100644
--- a/web/index.go
+++ b/web/index.go
@@ -2,14 +2,22 @@ package web
import (
"github.com/a-h/templ"
+
+ "github.com/TecharoHQ/anubis/lib/policy/config"
)
func Base(title string, body templ.Component) templ.Component {
- return base(title, body, nil)
+ return base(title, body, nil, nil)
}
-func BaseWithOGTags(title string, body templ.Component, ogTags map[string]string) templ.Component {
- return base(title, body, ogTags)
+func BaseWithChallengeAndOGTags(title string, body templ.Component, challenge string, rules *config.ChallengeRules, ogTags map[string]string) (templ.Component, error) {
+ return base(title, body, struct {
+ Challenge string `json:"challenge"`
+ Rules *config.ChallengeRules `json:"rules"`
+ }{
+ Challenge: challenge,
+ Rules: rules,
+ }, ogTags), nil
}
func Index() templ.Component {