web

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2026 License: Apache-2.0 Imports: 37 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 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

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

func New(db *store.Store, cfg *config.Config, cfgPath string, ing *ingest.Manager) *Web

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

func (s *Web) Gate(next http.Handler) http.Handler

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

func (s *Web) Routes() http.Handler

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

func (s *Web) SetDev(on bool)

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

func (s *Web) SetTrustedProxies(nets []netip.Prefix)

SetTrustedProxies replaces the networks whose X-Forwarded-For and X-Forwarded-Proto headers are believed. Nil or empty trusts none.

Jump to

Keyboard shortcuts

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