adminui

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2026 License: Apache-2.0 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 adminui serves the self-hosted admin console: one page with its script, stylesheet and icon, embedded in the binary. The page talks to the admin API under /api/admin on the same origin; the admin token is kept in the browser's session storage and sent only as a bearer header.

Mount the handler under a prefix and strip the prefix, since the page references its assets relative to itself:

mux.Handle("/admin/", http.StripPrefix("/admin", adminui.Handler()))

"/" then answers index.html and "/static/<file>" an asset.

Index

Constants

View Source
const CSP = "default-src 'self'; connect-src 'self'; img-src 'self' data:; base-uri 'none'; frame-ancestors 'none'"

CSP is the Content-Security-Policy of every response: only same-origin scripts, styles and requests. The page therefore carries no inline script and no inline style; everything lives under static/.

Variables

This section is empty.

Functions

func Handler

func Handler() http.Handler

Handler returns the console. The server mounts it under a prefix it strips: "/" answers index.html, "/static/<file>" an asset, anything else 404. Only GET and HEAD are served. index.html is revalidated on every load; the assets, which never change content under the same name, cache for an hour.

Types

This section is empty.

Jump to

Keyboard shortcuts

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