perf: embed challenge data in HTML (#279)
This commit is contained in:
parent
736c3ade09
commit
f844dba3dc
7 changed files with 63 additions and 42 deletions
14
web/index.go
14
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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue