cmd/pkgserver: flatten static site

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2026-05-02 03:21:02 +09:00
parent 5e50fede9a
commit 6d8fd7ec3b
4 changed files with 17 additions and 18 deletions

View File

@@ -3,19 +3,7 @@ package ui
import "net/http"
func serveWebUI(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate")
w.Header().Set("Pragma", "no-cache")
w.Header().Set("Expires", "0")
w.Header().Set("X-Content-Type-Options", "nosniff")
w.Header().Set("X-XSS-Protection", "1")
w.Header().Set("X-Frame-Options", "DENY")
http.ServeFileFS(w, r, content, "static/index.html")
}
// Register arranges for mux to serve the embedded frontend.
func Register(mux *http.ServeMux) {
mux.Handle("GET /", http.FileServer(http.FS(content)))
mux.HandleFunc("GET /{$}", serveWebUI)
mux.Handle("GET /", http.FileServer(http.FS(static)))
}