admin

package
v0.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 16, 2026 License: MIT Imports: 6 Imported by: 0

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

View Source
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.

View Source
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

View Source
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

func Handler() http.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.

func Routes

func Routes() []string

Routes returns the list of URL paths the admin UI mounts under /admin. The slice is kept stable so that operators (and tests) can probe each path without reading the file system. Order is informational — the router uses knownPaths internally.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL