mirror of
https://codeberg.org/Codeberg/pages-server.git
synced 2025-04-19 03:26:57 +00:00
Implement SEO optimizations and improve error handling and branch detection
This commit is contained in:
parent
c4bae34b71
commit
8ead10c82e
2 changed files with 111 additions and 71 deletions
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
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue