web

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2026 License: MIT Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package web serves the admin SPA (web/, built by `make web` into dist/) from the homed binary, through MCP Gatekeeper's webui: the SPA's client routes answer index.html (a reload of /devices/tv works), hashed assets under /assets/ are cached for a year, the top-level files of the build (theme.js, the icons, the manifest) revalidate by ETag, and every answer carries the strict CSP of csp.txt (no inline script or style, no eval). Before `make web` the pages answer 503 with a hint.

The public listener serves Routes (the admin at the root, the gatekeeper's /login, /setup, /join and /consent); v0.1's /admin paths answer 308 to /. The first-run listener serves the same build with its one route, /firstrun.

Index

Constants

View Source
const FirstRunRoute = "/firstrun"

FirstRunRoute is the first-run page's route on its own listener.

Variables

View Source
var Routes = []string{
	"/", "/home", "/login", "/setup", "/join", "/consent",
	"/connect", "/account", "/account/{rest...}",
	"/devices", "/devices/{rest...}", "/activity", "/activity/{rest...}",
	"/people", "/people/{rest...}", "/settings", "/settings/{rest...}",
}

Routes are the SPA's client routes on the public listener (docs/ADMIN-API.md §8). A new top-level page of the SPA needs its route here.

Functions

func CSP

func CSP() string

CSP returns the Content-Security-Policy every answer carries.

func FirstRun

func FirstRun(log *slog.Logger) (http.Handler, error)

FirstRun returns the SPA of the first-run listener: /firstrun, the assets and the public files; anything else 404.

func New

func New(log *slog.Logger) (core.RouteRegistrar, error)

New returns the SPA of the public listener: the client routes, the assets and the public files, plus the 308 of the old /admin paths.

Types

This section is empty.

Jump to

Keyboard shortcuts

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