Documentation
¶
Overview ¶
Package web serves The Rabbit Hole's HTML frontend: the digest "triage" page, rendered server-side from the same internal/store the JSON API reads. Its templates and static assets are embedded via go:embed (this file), so the whole UI ships inside the single Go binary. internal/server mounts it.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultTrustedProxies = []netip.Prefix{ netip.MustParsePrefix("127.0.0.0/8"), netip.MustParsePrefix("::1/128"), }
DefaultTrustedProxies are the addresses whose forwarding headers are believed unless configured otherwise: loopback, where a reverse proxy on the same machine connects from.
Functions ¶
This section is empty.
Types ¶
type Web ¶
type Web struct {
// contains filtered or unexported fields
}
Web renders the HTML frontend over the same store the JSON API uses.
func New ¶
New returns a Web backed by db, using cfg for request defaults. cfgPath is the config file the viewer reads and displays read-only. ing owns the in-process ingest runs the UI triggers and watches.
func (*Web) Gate ¶ added in v0.2.0
Gate wraps the whole app, the JSON API included, in the login. Unless the owner switched it off, a request needs a live session. A fresh install has nobody to hold a session for, so every request lands on the setup page that claims it. It fails closed: if the auth state can't be read, nothing is served.
func (*Web) Routes ¶
Routes returns the web handler: the digest ("feed") page — the landing page, served at both "/" and "/feed" — the Maze day-to-day tools page at "/maze", their htmx mutation routes, and the embedded static assets at "/static/".
func (*Web) SetDev ¶ added in v0.2.0
SetDev turns on the asset handling that suits editing them: assets are served no-cache, so a rebuild shows on the next reload rather than after the normal cache window.
func (*Web) SetTrustedProxies ¶ added in v0.2.0
SetTrustedProxies replaces the networks whose X-Forwarded-For and X-Forwarded-Proto headers are believed. Nil or empty trusts none.