add go templating engine for error page and make errors more clear

This commit is contained in:
crapStone 2023-11-16 00:15:07 +01:00
parent 7f0a4e5ca9
commit 9346dbfba9
No known key found for this signature in database
GPG key ID: D74B82E7CDD863FE
15 changed files with 228 additions and 201 deletions

View file

@ -49,7 +49,7 @@ func handleCustomDomain(log zerolog.Logger, ctx *context.Context, giteaClient *g
}, canonicalLink); works {
canonicalDomain, valid := targetOpt.CheckCanonicalDomain(giteaClient, trimmedHost, mainDomainSuffix, canonicalDomainCache)
if !valid {
html.ReturnErrorPage(ctx, "", http.StatusMisdirectedRequest)
html.ReturnErrorPage(ctx, "domain not specified in <code>.domains</code> file", http.StatusMisdirectedRequest)
return
} else if canonicalDomain != trimmedHost {
// only redirect if the target is also a codeberg page!