~bigbes/sr-ht-compare: 5ca23c05

web: content-hash the bundle and colour the status column

Two diff-view fixes reported against the deployed instance.

Empty file tree after an upgrade: bundle.js had a stable filename served with a
1-hour cache, so browsers kept a pre-fix bundle and the @pierre/trees sidebar
rendered blank. Content-hash the bundle like the stylesheet — Makefile emits
bundle.<sha256[:8]>.js, server.go globs it into a BundleHref, the templates
reference {{.BundleHref}}, and the hashed name is served immutable. A deploy now
always busts the cache.

Unreadable status column: the changed-files table rendered A/M/D in the dim
default cell colour, near-invisible on the dark chrome. Render each status as a
semantic .diff-status badge (added=green, modified=amber, deleted=red,
renamed=blue) with light/dark variants, via statusClass/statusLabel helpers and
a small self-contained style block (the sourcehut-derived main.min.css can't be
rebuilt locally).

Tests resolve the hashed bundle via a bundleName helper and assert its immutable
cache header; docs updated for the hashed filename.

bigbes <bigbes@gmail.com> — 2026-07-18 21:51:08 UTC

Commit 5ca23c0553d1107eeb5f1199934af71749f40bb6view raw patch

Parent(s): 53d7b970

12 changed file(s)

FileStatus+
Makefile M +9 -2
README.md M +5 -4
config.example.ini M +2 -2
web/chrome.go M +2
web/router.go M +1 -1
web/server.go M +27 -1
web/static/bundle.jsweb/static/bundle.3e3b8462.js R
web/templates.go M +40 -2
web/templates/commit.html M +2 -2
web/templates/compare.html M +2 -2
web/templates/layout.html M +28
web/web_test.go M +21 -7