web

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2026 License: BSD-3-Clause-Clear Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EchoError = server.EchoError

Functions

func CtxGetSession

func CtxGetSession(ctx context.Context) *auth.Session

func CtxWithSession

func CtxWithSession(ctx context.Context, session *auth.Session) context.Context

func RegisterHandlers

func RegisterHandlers(e *echo.Echo, storage *users.Storage, authProvider auth.Provider, branding Branding, brandingDir string, pages PageBuilder)

Types

type Branding

type Branding struct {
	Title      string // app name in topbar + <title> suffix
	Favicon    string // favicon filename under <data-dir>/branding/, "" = built-in default
	Primary    string // --brand-primary
	Accent     string // --brand-accent
	Surface    string // --surface-1 (page background)
	SurfaceAlt string // --surface-2 (content background)
	Text       string // --text-1
	// Dark-mode palette. Built-in defaults apply when colorsDark is omitted;
	// brand primary/accent are shared across modes (not duplicated here).
	SurfaceDark    string // --surface-1 in dark
	SurfaceAltDark string // --surface-2 in dark
	TextDark       string // --text-1 in dark
}

Branding holds the resolved branding values (defaults applied) used by both HTML templates and the templated CSS.

func LoadBranding

func LoadBranding(data []byte) Branding

LoadBranding applies any overrides in the given branding.json bytes onto the defaults. nil/empty input or a parse error yields the defaults unchanged.

type PageBuilder

type PageBuilder struct {
	// contains filtered or unexported fields
}

PageBuilder assembles the shared base.html page context (branding, nav, version, current user, csrf). It is the single place base page context is constructed, used by the web handlers as well as the auth providers' login pages (via the auth.PageContextBuilder interface).

func NewPageBuilder

func NewPageBuilder(branding Branding) PageBuilder

NewPageBuilder returns a PageBuilder for the given branding.

func (PageBuilder) Base

func (b PageBuilder) Base(c echo.Context, title, selected string) pagectx.Base

Base builds the base page context. It is safe to call when there is no authenticated session (e.g. the login page): in that case User is nil and no navigation items are included.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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