v0.1.32: главная — пошаговый старт; примеры команд — на /examples крупным шрифтом; консоль сразу в аккаунт

This commit is contained in:
“Naeel”
2026-08-14 13:45:06 +04:00
parent 709127caf7
commit 94108eec48
6 changed files with 346 additions and 66 deletions
+15 -1
View File
@@ -10,7 +10,7 @@ import (
"strings"
)
//go:embed index.html info.html admin.html static
//go:embed index.html info.html admin.html examples.html static
var content embed.FS
// Handler — возвращает http.Handler, раздающий встроенный index.html
@@ -46,6 +46,20 @@ func AdminHandler(version string) http.Handler {
})
}
// ExamplesHandler — страница примеров команд (GET /examples) с подстановкой версии
func ExamplesHandler(version string) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
body, err := content.ReadFile("examples.html")
if err != nil {
http.Error(w, "examples 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")