26 lines
818 B
Go
26 lines
818 B
Go
package server
|
|
|
|
import (
|
|
"embed"
|
|
"net/http"
|
|
)
|
|
|
|
// uiFS embeds the single-page web console so the binary stays self-contained —
|
|
// no external frontend to deploy. The HTML/CSS/JS is one file; the SPA calls
|
|
// the existing /api/* endpoints with a user-supplied password (X-Api-Key).
|
|
//
|
|
//go:embed ui/index.html
|
|
var uiHTML []byte
|
|
|
|
// handleUI serves the embedded console at the site root. It is public (the
|
|
// shell is just static markup); all sensitive data is fetched via the
|
|
// authenticated /api/* routes from the browser.
|
|
func (s *Server) handleUI(w http.ResponseWriter, r *http.Request) {
|
|
w.Header().Set("Content-Type", "text/html; charset=utf-8")
|
|
w.Header().Set("Cache-Control", "no-store")
|
|
_, _ = w.Write(uiHTML)
|
|
}
|
|
|
|
// keep embed.FS referenced for future file-tree growth without API churn.
|
|
var _ embed.FS
|