webui

package
v1.801.490 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package webui serves the Hanzo Cloud console — the single-page app, white-labelled per request Host.

It is a LEAF: stdlib + the brand registry + the fleet manifest's addresses + zip's net/http bridge, and NOTHING of package cloud (all three of those are themselves leaves). That is the whole reason it exists as its own package. The console has to be served from TWO places — every per-app plugin mounts it as its "/" catch-all through cloud.Listen, and the light host (cmd/cloud) owns "/" at the front door and cannot import package cloud (that would relink the fleet it was split to avoid). One console implementation, reachable from both.

IT CARRIES NO BYTES. The console used to be //go:embed'd from webui/dist, which the image build overwrote with the real static export — so the frontend's lifecycle was welded to this binary's: a CSS fix cost a ~22-minute cloud build plus a `strategy: Recreate` single-replica rollout, measured at 2m15s of api.hanzo.ai being down. The bytes are a PUBLISHED SITE RELEASE now (the same release subsystem that serves cd.hanzo.ai), read into memory by webui/release and handed in here as an fs.FS. A console release goes live in under a second and rolls back just as fast, with no build and no restart.

What did NOT change is the HOST ROUTING: console.hanzo.ai is still this binary and still answers /v1 on the same origin, so the console's session cookie stays first-party. Only the source of the bytes moved. The sites edge deliberately does not own that host — a site host serves bytes and nothing else.

This package decides how the bytes are SERVED: per-Host white-label <title>, static-export route shells, precompressed negotiation, cache policy by asset class, and the API-namespace 404 that keeps HTML out of a JSON caller's mouth.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Handler

func Handler(fsys fs.FS) (http.Handler, error)

Handler is the console as a stdlib http.Handler (correct Content-Type, conditional GET, precompressed negotiation, SPA fallback) — the form Mount adapts onto the zip router via zip.AdaptNetHTTP, and the form a test drives directly.

func Mount

func Mount(app *zip.App, fsys fs.FS) error

Mount registers the console at the web root as the app's terminal handler. Its caller registers it LAST — after every /v1 subsystem route, the /zap plane, and the health contract — so the router's in-order matching gives all real API routes precedence and only unmatched paths reach the SPA. Both cloud.Listen (every plugin) and cmd/cloud (the host front door) call it, so the "/" catch-all is spelled ONE way.

fsys is the console bundle, supplied by the CALLER — this package holds no bytes of its own (see the package doc). A nil fsys means this process serves no console: the catch-all still keeps the API namespaces honest and still answers the agent door, and a console path gets a 503 that says so.

Types

This section is empty.

Directories

Path Synopsis
Package release is the console's bytes: the ACTIVE release of a published site, held in memory and kept current.
Package release is the console's bytes: the ACTIVE release of a published site, held in memory and kept current.

Jump to

Keyboard shortcuts

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