v0.1.31: админский UI /admin, юзерский UI без слова «тенант»
This commit is contained in:
+15
-1
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user