mirror of
https://github.com/TecharoHQ/anubis.git
synced 2025-10-04 05:41:59 +08:00
* refactor: make challenge pages return the challenge component This means that challenge pages will return only the little bit that actually matters, not the entire component. Signed-off-by: Xe Iaso <me@xeiaso.net> * fix(web): move Anubis version info to be implicitly in the footer Signed-off-by: Xe Iaso <me@xeiaso.net> * fix(web): embed challenge ID into generated pages Signed-off-by: Xe Iaso <me@xeiaso.net> * fix(lib): make tests pass Signed-off-by: Xe Iaso <me@xeiaso.net> * test(lib/policy/config): amend tests Signed-off-by: Xe Iaso <me@xeiaso.net> * test(lib): fix tests again Signed-off-by: Xe Iaso <me@xeiaso.net> --------- Signed-off-by: Xe Iaso <me@xeiaso.net> Signed-off-by: Xe Iaso <xe.iaso@techaro.lol>
31 lines
1.1 KiB
Go
31 lines
1.1 KiB
Go
package web
|
|
|
|
import (
|
|
"github.com/a-h/templ"
|
|
|
|
"github.com/TecharoHQ/anubis/lib/challenge"
|
|
"github.com/TecharoHQ/anubis/lib/localization"
|
|
"github.com/TecharoHQ/anubis/lib/policy/config"
|
|
)
|
|
|
|
func Base(title string, body templ.Component, impressum *config.Impressum, localizer *localization.SimpleLocalizer) templ.Component {
|
|
return base(title, body, impressum, nil, nil, localizer)
|
|
}
|
|
|
|
func BaseWithChallengeAndOGTags(title string, body templ.Component, impressum *config.Impressum, challenge *challenge.Challenge, rules *config.ChallengeRules, ogTags map[string]string, localizer *localization.SimpleLocalizer) templ.Component {
|
|
return base(title, body, impressum, struct {
|
|
Rules *config.ChallengeRules `json:"rules"`
|
|
Challenge any `json:"challenge"`
|
|
}{
|
|
Challenge: challenge,
|
|
Rules: rules,
|
|
}, ogTags, localizer)
|
|
}
|
|
|
|
func ErrorPage(msg, mail string, localizer *localization.SimpleLocalizer) templ.Component {
|
|
return errorPage(msg, mail, localizer)
|
|
}
|
|
|
|
func Bench(localizer *localization.SimpleLocalizer) templ.Component {
|
|
return bench(localizer)
|
|
}
|