This avoids inadvertently exporting a go package. This change also cleans up generate layout. Signed-off-by: Ophestra <cat@gensokyo.uk>
22 lines
660 B
Go
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)
|
|
}
|