7.1 KiB
Web UI
Status: phase 1 pages and the phase 2 repository browser are built. Last updated 2026-11-25.
Approach
The UI is rendered on the server by the same Rust binary that serves everything else. There is no separate frontend application and no Node build step.
| Concern | Choice | Notes |
|---|---|---|
| HTTP framework | axum | Lore's server uses it too |
| Templates | maud | Components are plain Rust functions, so a handler can return a whole page or one fragment. Askama is the alternative if HTML should live in template files |
| Interactivity | htmx | Vendored, not fetched from a CDN |
| Scripts | A few small hand-written ones | Only where HTML is not enough: diff viewer, image comparison, later 3D previews |
| Styles | Plain CSS with custom properties | One stylesheet, crates/forge-web/assets/app.css |
| Look | The desktop client's pixel style: IBM VGA 8x16 font, Sweetie 16 palette, bevelled buttons, square panels | Owner, 2026-11-25 ("a similar facelift"). The font is self-hosted under /static/; its CC BY-SA licence is at /licenses, linked from every footer |
| Assets | Embedded in the binary | One file to deploy |
| Live updates | Server-sent events | Fed by Lore's notification stream: activity, lock state, CI status |
| API | JSON under /api/v1 |
Calls the same core services as the pages; authenticated by API tokens |
All of these are confirmed by the owner; maud and htmx were confirmed on 2026-11-25.
One port for pages and gRPC
Lore reaches the user directory and repository registry over gRPC at user_url. lore-forge
serves them on the same port as its pages and issuer, routing requests whose content type is
application/grpc* to the gRPC services and everything else to the web routes. So one public
URL is both the issuer and user_url. A reverse proxy in front must speak HTTP/2 to
lore-forge and pass gRPC through.
htmx is not vendored yet: no phase 1 page needs it. Every phase 1 page works as plain forms:
a successful POST redirects with ?ok=<code> for its notice; a refused one re-renders the
form with the error and status 422.
Why server rendering suits Lore
Lore is content-addressed. A tree, a file and a diff between two revisions are each fixed by their hashes and never change.
- Rendered and syntax-highlighted output can be cached indefinitely, keyed by hash.
- The hash is a natural
ETag, so browsers and proxies cache correctly without extra logic. - Only branch tips, locks and activity are mutable; those are the parts driven by live updates.
Large files
Game repositories hold very large binary files. lore-forge does not relay them.
- Downloads redirect to presigned URLs served by
loreserver. - The browser fetches large assets directly from
loreserver. - Listings and diffs are streamed from Lore's gRPC streams into the response rather than buffered.
Security
The web UI shares a process with the token issuer, which holds the keys to every repository. Repository content is untrusted: Markdown, SVG and HTML files can carry script.
- Raw content on a separate origin. Raw files and previews are served from a different hostname than the UI and issuer, so a malicious file cannot read session cookies or call the UI as the user.
- Strict content security policy on the main origin, with no inline script or style:
default-src 'none'with'self'for scripts, styles, fonts and images (data:images too),form-action 'self',frame-ancestors 'none'. A test renders every page and fails on any<script>orstyle=. htmx is to be configured to work without inline handlers. - Repository content is shown as escaped text only. The browser renders files as text in a table or says they are binary; it serves no raw file, so the separate raw-content origin is not needed yet. It will be when downloads or rendered previews come.
- One-time secrets (API tokens, service account secrets) appear only in the response to the POST that made them, never in a URL or a redirect.
- Rendered Markdown is sanitised before it is placed in a page on the main origin.
- Server-side sessions with CSRF tokens on unsafe methods; see accounts-and-sign-in.md.
- The canonical public URL is configured, not inferred from request headers. Behind a reverse proxy, forwarded headers are trusted only when explicitly enabled.
Acting as the user
When a page needs data from loreserver, lore-forge mints a short-lived repository-scoped
token carrying the browsing user's identity, and calls loreserver with it. Built for the
repository browser: the token carries only read (pages only read) and lasts one minute;
each page view mints its own.
- The web UI and the CLI are authorised by the same rule, enforced in the same place.
- lore-forge holds no standing super-user credential for reading repositories.
- The one exception is landing a change on a review-gated branch, where lore-forge uses its own landing identity; see forge-features.md.
Routes
Built in phase 1:
| Path | Page |
|---|---|
/ |
Dashboard: your repositories, your namespaces, CLI instructions |
/setup, /login, /signup, /signup/<key> |
Account entry points |
/oauth/<provider>/start, /oauth/<provider>/callback |
Provider sign-in and linking |
/device |
Approve a CLI login |
/settings, /settings/sessions, /settings/providers, /settings/tokens, /settings/service-accounts |
Profile and password, sessions and CLI logins, linked providers, API tokens, personal service accounts |
/admin, /admin/invites, /admin/repos, /admin/audit |
Users, invites, all repositories, audit log (admins) |
/admin/settings, /admin/providers |
Signup mode, who creates organisations, key rotation; provider apps (owner) |
/orgs, /orgs/<org>/members, /teams, /settings, /service-accounts |
Organisations |
/<owner> |
A user's or organisation's repositories |
/<owner>/<repo> |
FILES: listing or file view; ?b=<branch>&rev=<signature>&path=<path> |
/<owner>/<repo>/graph, /<owner>/<repo>/tree |
GRAPH and TREE |
/<owner>/<repo>/revision/<signature> |
One revision and its diffs |
/<owner>/<repo>/access |
Grants, for holders of the admin action |
/licenses |
Third-party licences |
/download, /downloads/<file> |
The desktop client's archives, signed in only (owner, 2026-11-27): the files in LORE_FORGE_DOWNLOADS_DIR with size and SHA-256, served only by plain name and known type (.tar.gz, .zip, SHA256SUMS) |
/api/v1/user, /api/v1/repos |
JSON API, API tokens with the api scope |
Planned:
| Path | Page |
|---|---|
/<owner>/<repo>/changes, /changes/<n> |
Change requests |
/<owner>/<repo>/locks |
Lock dashboard |
/<owner>/<repo>/settings |
Branch rules |
/api/v1/... |
More of the JSON API |
Because owners occupy the top level of the path, reserved words such as login, settings
and api cannot be used as usernames or organisation names.
Open questions
- Hostname scheme for the raw-content origin, and how it is configured for small self-hosted installs that have only one hostname.
- Whether anonymous visitors can see anything.