web

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2026 License: Apache-2.0 Imports: 58 Imported by: 0

Documentation

Overview

Package web is the HTML surface: the full route table, the middleware groups behind it, and the shared error rendering. Every page's handler and templates live under web/handler in a package that mirrors its URL path, and the components they share live under web/components.

Index

Constants

View Source
const PollHeader = "X-Stackr-Poll"

PollHeader marks a request htmx made on a timer rather than because someone did something. Set by the htmx:configRequest hook in frontend/static/js/main.js for any element whose hx-trigger has an interval.

Variables

This section is empty.

Functions

func RegisterRoutes

func RegisterRoutes(srv *server.Server, deps *Deps)

RegisterRoutes registers all web route handlers on the server.

func RegisterStaticPages

func RegisterStaticPages(srv *server.Server)

RegisterStaticPages registers handlers for static generation and runtime serving. Each call to StaticPage registers both a generation entry and a GET route. These handlers must not depend on database or session state.

Types

type Deps

type Deps struct {
	Store   repo.Store
	BaseURL string
	// CookieDomain is what the session cookie is scoped to (BASE_URL's host).
	CookieDomain  string
	StaticBaseURL string
	DevMode       bool
	// CookieSecure marks session, flash and CSRF cookies Secure. It follows
	// whether the install serves TLS, not DevMode: a Secure cookie is never
	// sent back over plain HTTP, so a LAN install with STACKR_TLS=off and this
	// left on cannot hold a session at all.
	CookieSecure   bool
	SessionManager *auth.SessionManager
	AuthService    *service.AuthService
	FileStorage    storage.FileStorage
	Hub            *websocket.Hub
	Notifier       *notify.Notifier
	StreamHub      *stream.Hub
	Engine         *deploy.Engine
	Runtime        *stackruntime.Runtime
	Proxy          *proxy.Proxy
	Databases      *managedtiles.Service
	Jobs           *jobs.Service
	Backups        *backup.Service
	Metrics        *metrics.Sampler
	Forwards       *forward.Registry
	GitHub         *githubapp.Client
	// Mail is nil when no provider is configured: invites then fall back to
	// copy-the-link, which is the only channel a self-hosted box always has.
	Mail *mail.Mailer
	// Applier drives config-as-code, shared with the API router.
	Applier stackconf.Applier
	// Work is the durable job runner; applies are enqueued, not run inline.
	Work    *workqueue.Queue
	DataDir string
	// RegistrySigner signs the managed registry's pull/push tokens. Nil means
	// the token route answers 503.
	RegistrySigner *registry.Signer
	RegistryPort   string
	// ACMEEmail is the Let's Encrypt account address. Environment-only, but
	// shown read-only next to the TLS settings it belongs with.
	ACMEEmail string
	// OrgConfig drives org-level config-as-code (§6).
	OrgConfig *orgconf.Runner

	// Nodes keeps the servers table in step with the swarm and issues join
	// keys. Cluster is every docker call on any node. Mover runs volume
	// moves (docs/plans/31-node-agent-open-questions.md, 35-cluster.md).
	Nodes   *nodes.Service
	Cluster *cluster.Cluster
	Mover   *volmove.Service
	// Version is the panel's build, shown against each node's agent version.
	Version string
}

Deps holds the dependencies for route registration.

Directories

Path Synopsis
Package avatar handles the two uploaded images in stackr, a user's avatar and an organization's logo, from the multipart form to the <img> tag.
Package avatar handles the two uploaded images in stackr, a user's avatar and an organization's logo, from the multipart form to the <img> tag.
templ: version: v0.3.1001
templ: version: v0.3.1001
canvas
templ: version: v0.3.1001
templ: version: v0.3.1001
form
templ: version: v0.3.1001
templ: version: v0.3.1001
templ: version: v0.3.1001
templ: version: v0.3.1001
Package graph derives a project topology (nodes + edges) from apps and databases.
Package graph derives a project topology (nodes + edges) from apps and databases.
handler
about
templ: version: v0.3.1001
templ: version: v0.3.1001
account
templ: version: v0.3.1001
templ: version: v0.3.1001
annotate
Package annotate is the HTTP half of canvas annotations: bind, validate and write one note against a canvas owner key the caller has already authorized.
Package annotate is the HTTP half of canvas annotations: bind, validate and write one note against a canvas owner key the caller has already authorized.
app
templ: version: v0.3.1001
templ: version: v0.3.1001
auth
Package auth holds web-layer auth helpers shared across the internal/web/handler/auth/* page packages (login, register, etc.).
Package auth holds web-layer auth helpers shared across the internal/web/handler/auth/* page packages (login, register, etc.).
auth/invite
Package invite handles org invite links: an existing session joins the org directly, a fresh visitor creates an account through the invite.
Package invite handles org invite links: an existing session joins the org directly, a fresh visitor creates an account through the invite.
auth/login
templ: version: v0.3.1001
templ: version: v0.3.1001
auth/register
templ: version: v0.3.1001
templ: version: v0.3.1001
backups
Package backups is the per-tile Backups tab: the schedules on one tile, their run history, and the buttons that run or restore them.
Package backups is the per-tile Backups tab: the schedules on one tile, their run history, and the buttons that run or restore them.
cli
templ: version: v0.3.1001
templ: version: v0.3.1001
container
templ: version: v0.3.1001
templ: version: v0.3.1001
db
templ: version: v0.3.1001
templ: version: v0.3.1001
deployment
templ: version: v0.3.1001
templ: version: v0.3.1001
notification
Package notification renders the in-app notification center and the live-updating rail bell badge.
Package notification renders the in-app notification center and the live-updating rail bell badge.
org
templ: version: v0.3.1001
templ: version: v0.3.1001
prhook
Package prhook turns GitHub pull_request webhooks into ephemeral environments: opened → clone the configured base env and deploy it, synchronize → redeploy the PR branch, closed → tear the env down.
Package prhook turns GitHub pull_request webhooks into ephemeral environments: opened → clone the configured base env and deploy it, synchronize → redeploy the PR branch, closed → tear the env down.
project
templ: version: v0.3.1001
templ: version: v0.3.1001
search
Package search is the global search palette's backend: one endpoint that substring-matches everything the viewer can navigate to and returns an HTML fragment of result rows.
Package search is the global search palette's backend: one endpoint that substring-matches everything the viewer can navigate to and returns an HTML fragment of result rows.
server
Package server renders the servers screen: host stats history, Docker daemon info, and the server-level default settings.
Package server renders the servers screen: host stats history, Docker daemon info, and the server-level default settings.
settings
templ: version: v0.3.1001
templ: version: v0.3.1001
sharepub
Package sharepub is the public face of a secret link: the pages someone with no account sees at /s/:token.
Package sharepub is the public face of a secret link: the pages someone with no account sees at /s/:token.
Package wsproxy bridges a websocket to a plain TCP connection, the server half of `stackr forward`.
Package wsproxy bridges a websocket to a plain TCP connection, the server half of `stackr forward`.
Package wsterm bridges a browser websocket to a docker exec TTY, the one implementation behind both the container terminal and the db console.
Package wsterm bridges a browser websocket to a docker exec TTY, the one implementation behind both the container terminal and the db console.

Jump to

Keyboard shortcuts

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