Documentation
¶
Overview ¶
Package admin embeds the parsec administrative single-page application.
The UI is intentionally minimal: vanilla HTML/JS/CSS with no build step, no framework, no external assets. It calls the existing Twirp surface using the operator's mgmt bearer (pasted into a login form and held in sessionStorage). The package exposes a single Handler that the HTTP surface mounts at /admin/* when Options.AdminUI.Enabled is true.
Disabled mode returns 404 for every /admin/* path — the bytes never enter the response graph. Mount logic lives in internal/server/http.go.
Index ¶
Constants ¶
const IndexPath = "index.html"
IndexPath is the canonical landing-page name inside the embedded FS. The handler maps GET /admin and /admin/ to this file.
const LoginPath = "login.html"
LoginPath is the login form's filename. Routes hitting this name are always served; every other route requires the caller to have a bearer in sessionStorage (the JS guard enforces it client-side; the actual Twirp calls are bearer-gated server-side).
Variables ¶
var Files embed.FS
Files holds every embedded UI asset. Exposed so tests can introspect the bundle without going through the HTTP handler.
Functions ¶
func Handler ¶
Handler returns an http.Handler that serves the embedded SPA. The returned handler expects to be mounted at /admin/ — it strips that prefix before doing the file lookup.
Unknown paths return 404. The login page is served without any special-casing; the JS code on each protected page redirects to login.html when no token is in sessionStorage.
func KnownAssets ¶
func KnownAssets() []string
KnownAssets returns the names of every embedded asset, in stable order. Used by tests to confirm the embed bundle isn't drifting.
Types ¶
This section is empty.