Documentation
¶
Overview ¶
Package web embeds the built bench dashboard so a self-hosted hub serves the same pages the hosted instance does, with no Node runtime and no configuration.
dist/ is produced by `pnpm build` in this directory and is git-ignored except for dist/.gitkeep, which exists because go:embed refuses a directory that is not there. The Astro build copies public/.gitkeep back into dist/, so building never deletes the tracked placeholder. A wb built from a clean clone therefore compiles, and Handler serves a one-line page explaining how to build the real dashboard.
Index ¶
Constants ¶
const MountPath = "/workbench/"
MountPath is where the dashboard is served. The Astro build hard-codes it as the site base, so every asset URL in the emitted HTML already starts here and the pages need no rewriting.
const PagePolicy = "" /* 167-byte string literal not displayed */
PagePolicy is the Content-Security-Policy of every response of this handler. The Astro build emits inline scripts (the two `is:inline` scripts of BaseLayout.astro, and any bundled script small enough for the build to inline), so this subtree alone still allows them; every other page of the daemon's listener refuses inline script. The pages here build what they show with createElement and textContent, and take a link's address only from a record whose parser accepted it as an http(s) address (src/data/worktrees.ts isSafeURL, src/data/github-app.ts safeGitHubURL), so no stored value becomes markup or a script address.
Variables ¶
var Dist embed.FS
Dist holds every file the Astro build emitted, or only .gitkeep in a clone where `pnpm build` has never run.
Functions ¶
func Handler ¶
Handler serves the embedded dashboard under MountPath. It implements the Astro build's trailingSlash: 'always' + build.format: 'directory' contract: a request for a directory is answered with that directory's index.html, and a request that omits the trailing slash is redirected to the one that has it — the same shape a static host gives the hosted instance.
Mount it on a mux at MountPath; the prefix is stripped here so the caller does not have to.
Types ¶
This section is empty.