v0.1.31: админский UI /admin, юзерский UI без слова «тенант»

This commit is contained in:
“Naeel”
2026-08-14 10:19:35 +04:00
parent e83ae1e376
commit afa9a1a7e4
5 changed files with 443 additions and 15 deletions
+15 -1
View File
@@ -10,7 +10,7 @@ import (
"strings"
)
//go:embed index.html info.html static
//go:embed index.html info.html admin.html static
var content embed.FS
// Handler — возвращает http.Handler, раздающий встроенный index.html
@@ -32,6 +32,20 @@ func InfoHandler(version string) http.Handler {
})
}
// AdminHandler — админская консоль (GET /admin) с подстановкой версии
func AdminHandler(version string) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
body, err := content.ReadFile("admin.html")
if err != nil {
http.Error(w, "admin page unavailable", http.StatusInternalServerError)
return
}
html := strings.ReplaceAll(string(body), "{{VERSION}}", version)
w.Header().Set("Content-Type", "text/html; charset=utf-8")
_, _ = w.Write([]byte(html))
})
}
// StaticHandler — раздаёт /static/* (логотип, favicon) для публичных страниц
func StaticHandler() http.Handler {
sub, err := fs.Sub(content, "static")