Implement SEO optimizations and improve error handling and branch detection
This commit is contained in:
20
main.go
20
main.go
@ -20,7 +20,6 @@ import (
|
||||
"fmt"
|
||||
"net"
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
_ "embed"
|
||||
@ -67,14 +66,6 @@ var IndexPages = []string{
|
||||
"index.html",
|
||||
}
|
||||
|
||||
// ReservedUsernames specifies the usernames that are reserved by Gitea and thus may not be used as owner names.
|
||||
// The contents are taken from https://github.com/go-gitea/gitea/blob/master/models/user.go#L783; reserved names with
|
||||
// dots are removed as they are forbidden for Codeberg Pages anyways.
|
||||
var ReservedUsernames = createLookupMapFromWords(`
|
||||
admin api assets attachments avatars captcha commits debug error explore ghost help install issues less login metrics milestones new notifications org plugins pulls raw repo search stars template user
|
||||
|
||||
`)
|
||||
|
||||
// main sets up and starts the web server.
|
||||
func main() {
|
||||
// Make sure MainDomain has a trailing dot, and GiteaRoot has no trailing slash
|
||||
@ -122,14 +113,3 @@ func envOr(env string, or string) string {
|
||||
}
|
||||
return or
|
||||
}
|
||||
|
||||
func createLookupMapFromWords(input string) map[string]struct{} {
|
||||
var res = map[string]struct{}{}
|
||||
input = strings.NewReplacer("\t", " ", "\n", " ", "\r", " ").Replace(input)
|
||||
for _, word := range strings.Split(input, " ") {
|
||||
if len(word) > 0 {
|
||||
res[word] = struct{}{}
|
||||
}
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
Reference in New Issue
Block a user