53e56db2
web: draw the chrome from sr-ht-ecore
The nav/service-switcher, the login block, the environment banner and the brand were this service's own copy of code compare.sr.ht had already copied from somewhere else. They come from sourcecraft.dev/bigbes/sr-ht-ecore/chrome now: one chrome.Service built at startup from the shared config.ini, one chrome.Page per request, embedded in viewData so the shared partials find their fields on the dot. web/chrome.go is gone — buildNav, navItem, canonIndex, the login/logout/ profile URL building and the chrome half of viewData with it. The layout renders srht-env-banner and srht-nav instead of the local markup, the landing page's space list renders through srht-repo-list, and the template FuncMap starts from chrome.Funcs() (the local shortsha was a duplicate of the shared one). sameOrigin and the login redirect ask the chrome for our origin rather than keeping a second copy that could disagree with the links on the page. Three of ecore's policies differ from what this service did, and win, per that package's own doc: [sr.ht]site-name defaults to "sr.ht" rather than "sourcehut" and [sr.ht]environment to "development" rather than "production" when the key is absent, and the brand carries a fixed 15rem min-width so the switcher starts at the same x on every service. The instance's config.ini sets both keys, so on it only the brand width is visible. The nav tests that only restated ecore's rules — switcher order, the paste/pages/hub exclusion, the shape of a login URL — are dropped; ecore tests those. What is left covers this service's seam: that the identity authn resolved is the one the chrome is handed.
Eugene Blikh <bigbes@gmail.com> — 2026-08-08 18:52:29 UTC
Commit 53e56db27ab35117d0c2a91f15533f7dd528612c —
view raw patch
Parent(s):
a4d8cc52
| File | Status | + | − |
|---|---|---|---|
.gitignore
|
M | +5 | |
web/chrome.go
|
D | -146 | |
web/handlers.go
|
M | +34 | -15 |
web/inbox.go
|
M | +1 | -2 |
web/proposal.go
|
M | +2 | -3 |
web/server.go
|
M | +39 | -30 |
web/templates.go
|
M | +29 | -21 |
web/templates/index.html
|
M | +4 | -15 |
web/templates/layout.html
|
M | +19 | -38 |
web/view.go
|
A | +52 | |
web/web_test.go
|
M | +38 | -52 |