Weighs the soul of incoming HTTP requests to stop AI crawlers
1package web
2
3import (
4 "github.com/a-h/templ"
5
6 "github.com/TecharoHQ/anubis/lib/localization"
7 "github.com/TecharoHQ/anubis/lib/policy/config"
8)
9
10func Base(title string, body templ.Component, impressum *config.Impressum, localizer *localization.SimpleLocalizer) templ.Component {
11 return base(title, body, impressum, nil, nil, localizer)
12}
13
14func BaseWithChallengeAndOGTags(title string, body templ.Component, impressum *config.Impressum, challenge string, rules *config.ChallengeRules, ogTags map[string]string, localizer *localization.SimpleLocalizer) (templ.Component, error) {
15 return base(title, body, impressum, struct {
16 Rules *config.ChallengeRules `json:"rules"`
17 Challenge string `json:"challenge"`
18 }{
19 Challenge: challenge,
20 Rules: rules,
21 }, ogTags, localizer), nil
22}
23
24func Index(localizer *localization.SimpleLocalizer) templ.Component {
25 return index(localizer)
26}
27
28func ErrorPage(msg string, mail string, localizer *localization.SimpleLocalizer) templ.Component {
29 return errorPage(msg, mail, localizer)
30}
31
32func Bench(localizer *localization.SimpleLocalizer) templ.Component {
33 return bench(localizer)
34}