chore (refactoring): main html cleanup

This commit is contained in:
MickaelK
2025-02-04 01:43:04 +11:00
parent 67275e32e9
commit fe830fb8e2
3 changed files with 209 additions and 204 deletions

View File

@ -23,11 +23,15 @@ import (
var (
WWWDir fs.FS
//go:embed static/www
WWWEmbed embed.FS
//go:embed static/404.html
HtmlPage404 []byte
//go:embed static/loader.html
TmplLoader []byte
)
func init() {
@ -441,7 +445,10 @@ func ServeIndex(indexPath string) func(*App, http.ResponseWriter, *http.Request)
}
head.Set("Content-Type", "text/html")
res.WriteHeader(http.StatusOK)
template.Must(template.New(indexPath).Parse(string(b))).Execute(res, map[string]any{
tmpl := template.Must(template.New(indexPath).Parse(string(b)))
tmpl = template.Must(tmpl.Parse(string(TmplLoader)))
tmpl.Execute(res, map[string]any{
"base": WithBase("/"),
"version": BUILD_REF,
"license": LICENSE,