~bigbes/sr-ht-ecore

ref: 54025f42346afbf561683c1d32c321ea875a421d sr-ht-ecore/chrome/chrome_test.go -rw-r--r-- 12.9 KiB
34cf83d4 — Eugene Blikh 9 days ago
follow compare.sr.ht's rename to diff.sr.ht

The service renamed itself; what reaches this repository is the section name
in ecoretest's synthetic config.ini, which every service's switcher test is
built from, and the examples in the chrome docs and README that spelled the
old section. The fixture's custom services now read bench, cover, diff, dolt,
spec, tokens — alphabetical, which is the order BuildNav puts them in.
350dcb0b — Eugene Blikh 9 days ago
chrome: a default favicon, optional listing columns, and a table partial

Three services asked for a favicon field and bench argued against one: it
ships no icon deliberately, and its layout says why — a <link rel="icon">
pointing at an asset the binary does not have is a 404 on every page load, for
a file nobody asked for. A default that is a path hands that to every service
without a logo, so the default carries its own bytes instead: the brand's ring
as a data: URI, which cannot 404 and costs no request. It is a template.URL
because html/template rewrites any href whose scheme is not http, https or
mailto to "#ZgotmplZ" — the type is how a caller says it meant a data: URI.

Updated and Meta are optional for the reason the four listing services could
not agree: bench and spec have a modification time, dolt's schema has no
timestamp at all, and cover's index is a table of sparklines no shared partial
will render. A required column would have pushed dolt back onto a local copy.
Updated is a time.Time so the partial renders "3 hours ago" with the exact
stamp in the title once, rather than five services spelling it five ways.

srht-repo-table is a second partial over the same dot rather than a variadic
first one: growing columns on the cards would have made them worse cards for
the services that wanted cards.

Attach now installs Funcs itself, because the partials call reltime and
abstime and an unknown function is a parse error — a caller who had not merged
Funcs would have got a startup panic naming a template it never wrote. pages
consequently attaches before layering the service's own map on top, which is
what keeps a deliberate shadow working.
9377c43a — Eugene Blikh 9 days ago
chrome: carry the service's extra hashed assets

bench and cover each grew a pair of UplotCSSHref/UplotJSHref fields beside
the embedded Page, compare a BundleHref, and all three wrote the same
justification next to it: the hash in the name is a property of the binary
rather than of a page, so a page handed its own asset URLs is one that can be
written without them and silently render nothing where the chart was. That
argument is about the chrome, so the slot belongs to the chrome.

A map rather than named fields because ecore has no business knowing that
this instance vendors uPlot; the service names its own artefacts and its
layout reads them back with index, guarded on emptiness the way StyleHref is.
2fd6b3aa — Eugene Blikh 9 days ago
chrome: give the brand both halves, and share the login URL and time helpers

The brand was upstream's minus its hub link: core.sr.ht points the whole
brand at hub when the instance has one and drops the red service label,
while this package kept the label and pointed at the service root. Hub is
excluded from the switcher, so that left the chrome with no route to hub at
all. Split the brand in two — the site name to hub (to the service root on
an instance without one), the label to the service root — and neither half
has to lose. The label keeps its own <span class="text-danger"> because the
theme colours ".navbar-light .navbar-brand a", which outranks .text-danger
and would repaint a red <a> white in dark mode.

LoginURLFor exports the line Page already computed. A handler that gates a
page behind login was building an entire Page to read one field off it.

RelTime/AbsTime come up from the services, where the copies had already
drifted over what to print for a future instant: "in 3 hours" on one
service, "just now" on the next, for the same timestamp.
36315856 — Eugene Blikh 10 days ago
chrome: repo-list partial and fixed-width brand

srht-repo-list renders project listings (repos, databases, spaces) as
the family's event-list cards from a neutral ListItem shape, encoding
the rules the services converged on: h4 title link, visibility as small
muted lowercase text on the right for non-public entries only,
description as a paragraph. The empty state is a parameter.

The brand in srht-nav gains min-width: 15rem so the service switcher
starts at the same x-coordinate on every service — without it the menu
shifts by the width of the red service label when hopping between
services.
b739f927 — Eugene Blikh 11 days ago
chrome: shared page chrome for the instance's custom services

Extract the nav/chrome idiom that compare, spec, dolt and cover each
carried as a private copy (and bench was about to fork as a sixth):
BuildNav over the shared config.ini with the canonical ordering and
paste/pages/hub exclusions, a per-request Page with login/logout/profile
URLs against meta's unified login, embedded srht-nav / srht-env-banner
partials (circle brand + red service label + switcher + login box), and
the generic dict/shortsha template helpers.

Policy decisions the copies had drifted on are baked in: switcher only
for authenticated viewers, hub excluded in the builder rather than the
template, profile link prefers hub's ~username page, environment name
uppercased for the banner. Service-specific needs surfaced by the cover
survey get seams instead of copies: ExtraNav for extra switcher entries,
ContainerClass for full-bleed pages, the config section as an explicit
parameter for the active check.