From bf7897cd3026881c99dfef141933e333a38d4ed6 Mon Sep 17 00:00:00 2001 From: Eugene Blikh Date: Sat, 8 Aug 2026 21:58:19 +0300 Subject: [PATCH] web: draw the chrome from sr-ht-ecore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The brand, the service switcher, the login block, the environment banner and the database listing were a local port of core.sr.ht's nav — one of five such ports on this instance, and they had already drifted. They are now sourcecraft.dev/bigbes/sr-ht-ecore/chrome, the one copy every custom service draws from. Deleted: web/chrome.go entire (navEntry, networkOrder, networkExcluded, buildNetwork, basePage, loginURL, logoutURL), templates/nav.html, templates/icons/circle.svg (ecore inlines the identical SVG), the repoList partial, and the local dict/shortHash duplicates. Added: one chrome.Service built in newApp from our config section with the hashed stylesheet href set on it, a chrome.Page per request through app.page, chrome.Attach on every template set, and chrome.Funcs as the base of the funcmap. Handlers embed chrome.Page in their view structs instead of copying its fields; the row browser sets ContainerClass to container-fluid, since its column count is the table's and not ours. Three behaviour changes come with ecore's policy, all deliberate: the profile link now prefers hub's ~username page when hub.sr.ht is configured (it was always meta's /profile), the brand carries a fixed 15rem min-width so the switcher starts at the same x on every service, and a binary built without a stylesheet renders bare rather than linking an empty href. The nav test went with the code it tested — ordering, exclusions and login URLs are ecore's to cover — and what replaced it asserts only what is ours: that pages are drawn through the chrome at all, and that the row browser is full-bleed. The auth path is untouched: a foreign bearer token is still accepted as a meta.sr.ht PAT. --- docs/DESIGN.md | 27 ++++++---- go.mod | 1 + go.sum | 4 +- web/csrf.go | 3 +- web/deps.go | 15 +++++- web/handlers_browse.go | 40 ++++++++------ web/handlers_internal.go | 9 ++-- web/handlers_keys.go | 12 +++-- web/handlers_repo.go | 61 ++++++++++++++------- web/handlers_settings.go | 14 ++--- web/handlers_view.go | 10 ++-- web/router.go | 57 ++++++++++++++++---- web/templates.go | 104 ++++++++++++++++-------------------- web/templates/index.html | 10 ++-- web/templates/layout.html | 26 ++++++--- web/templates/log.html | 2 +- web/templates/overview.html | 4 +- web/templates/partials.html | 26 ++------- web/templates/table.html | 6 +-- web/templates/user.html | 2 +- web/web_test.go | 41 +++++++++----- 21 files changed, 281 insertions(+), 193 deletions(-) diff --git a/docs/DESIGN.md b/docs/DESIGN.md index 90df24d2bd4634edd90f667dfda7d7f4114b53e2..35b014dd6e59021c7ab92adeffead5e17b3bb7db 100644 --- a/docs/DESIGN.md +++ b/docs/DESIGN.md @@ -91,7 +91,8 @@ authn/ # ctx.go (Caller), cookie.go (optional unified-login middleware), storage/ # init.go (InitStore/DeleteStore via WriteEmptyRepo), dbcache.go (remotesrv.DBCache) remoteapi/ # server.go (remotesrv assembly), interceptors.go, credsvc.go (WhoAmI grpc server) browse/ # open.go, log.go, tables.go, diff.go — read-only doltdb over bare stores -web/ # router.go, handlers_*.go, chrome.go, templates.go, templates/*.html +web/ # router.go, handlers_*.go, templates.go, templates/*.html + # (nav/brand/login chrome comes from sr-ht-ecore/chrome) ``` Dependency direction: `core` ← all; `db`/`authn`/`storage`/`browse` mutually @@ -179,16 +180,20 @@ with both auth variants); `GET /~{user}/{db}/log?branch=&from=`; inline JS to prefill the form, since `dolt login` appends the pubkey as a fragment); `GET /static/*`. -**Chrome** (web/chrome.go + templates): Go `html/template` port of core.sr.ht -`layout.html`/`nav.html` — `