pages-server/pagerouter/types.go
hazycora edd35305e6
All checks were successful
Deploy to VPS / build_site (push) Successful in 5s
make requests add .html & .htm file extensions as fallback
this was in the JS version, and forgotten in the port
2024-04-26 14:59:19 -05:00

37 lines
858 B
Go

package pagerouter
import (
"regexp"
"strings"
"git.gay/gitgay/pages/forgejo"
"git.gay/gitgay/pages/redirects"
)
var (
commitRegex = regexp.MustCompile(`^[0-9a-fA-F]+$`)
)
type PagePathMapping struct {
File string `json:"path"`
IsDirectory bool `json:"isDirectory"`
}
type PagesSettings struct {
AllowPrivate bool `json:"allowPrivate"`
AllowInsecure bool `json:"allowInsecure"`
BasePath string `json:"basePath"`
}
type PageRouter struct {
Info *Target `json:"info"`
Files map[string]forgejo.TreeFile `json:"tree"`
Settings PagesSettings `json:"settings"`
Domains []string `json:"domains"`
Redirects *redirects.RedirectEngine `json:"redirects"`
}
func trimSlashes(path string) string {
return strings.TrimSuffix(strings.TrimPrefix(path, "/"), "/")
}