Files
hakurei/cmd/pkgserver/internal/ui/ui.go
Ophestra 5e50fede9a cmd/pkgserver: move ui internal
This avoids inadvertently exporting a go package. This change also cleans up generate layout.

Signed-off-by: Ophestra <cat@gensokyo.uk>
2026-05-02 03:15:07 +09:00

22 lines
660 B
Go

// Package ui holds the static web UI.
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)
}