From 6b1f4da2790421dca4fcd5f0395266381718c6f0 Mon Sep 17 00:00:00 2001 From: bigbes Date: Sun, 9 Aug 2026 00:28:43 +0300 Subject: [PATCH] chrome: the head links from ecore, and no shipped favicon layout.html hardcoded , and web/static/logo.svg was this service's copy of the brand circle chrome now inlines as a data: URI. Both go: the head renders srht-head-links, which emits the stylesheet and the icon guarded on emptiness, and the icon costs no request and cannot 404. The static tree is two hashed artefacts now, so the arm of TestStaticBundleAndCSS that asserted an hour-cacheable unhashed asset has nothing left to ask about; TestFaviconIsInline takes its place and also pins that the data: URI reaches the page rather than #ZgotmplZ. --- README.md | 2 +- web/static/logo.svg | 14 -------------- web/templates.go | 5 +++-- web/templates/layout.html | 15 ++++++++------- web/web_test.go | 25 ++++++++++++++++++++----- 5 files changed, 32 insertions(+), 29 deletions(-) delete mode 100644 web/static/logo.svg diff --git a/README.md b/README.md index 4b67cf98b5a40d38bb536090a0eed5501860212e..0ba57ceaa8ac98081998326151b7cc11c654cc73 100644 --- a/README.md +++ b/README.md @@ -223,7 +223,7 @@ compare.sr.ht deploys like any other SourceHut web service. On the instance: ```sh make install PREFIX=/usr/local # → /usr/local/bin/comparesrht - # → /usr/share/sourcehut/compare.sr.ht/static/{bundle..js,main.min..css,logo.svg} + # → /usr/share/sourcehut/compare.sr.ht/static/{bundle..js,main.min..css} ``` 2. **Config.** Append the `[compare.sr.ht]` section (`origin=` and diff --git a/web/static/logo.svg b/web/static/logo.svg deleted file mode 100644 index 953592414791428a927096b765e30eac02fe096a..0000000000000000000000000000000000000000 --- a/web/static/logo.svg +++ /dev/null @@ -1,14 +0,0 @@ - - - - - diff --git a/web/templates.go b/web/templates.go index cc3c114e84c097aac6bd8b6329ea2c4a4f6c92ec..37fe60aeea8f545e72fa44d347f289e964c81450 100644 --- a/web/templates.go +++ b/web/templates.go @@ -19,8 +19,9 @@ import ( //go:embed templates/*.html var tmplFS embed.FS -// staticFS holds the built front-end assets (the hashed bundle..js, the -// hashed stylesheet, logo.svg). It is served read-only under /static/. +// staticFS holds the built front-end assets: the hashed bundle..js and +// the hashed stylesheet, and nothing else since the favicon became chrome's +// inlined one. It is served read-only under /static/. // //go:embed static var staticFS embed.FS diff --git a/web/templates/layout.html b/web/templates/layout.html index 815cac6596cfa1ca845bdb451564336d20af4497..3cc85d9f766061963a6d6b75c48a8b08eff0044b 100644 --- a/web/templates/layout.html +++ b/web/templates/layout.html @@ -19,13 +19,14 @@ {{.Title}} - - {{/* Guarded rather than emitted empty: re-requests the page - it is on, which is a page load per page load. assets.Resolve answers "" - for a binary built without `make css`, which is a checkout run from - source; a deployed build always has the artefact and always takes - this. */}} - {{if .StyleHref}}{{end}} + {{/* The stylesheet and the icon, both guarded rather than emitted empty: + re-requests the page it is on, which is a page load per + page load. assets.Resolve answers "" for a binary built without `make + css`, which is a checkout run from source; a deployed build always has + the artefact. The icon is chrome's own brand circle, inlined as a + data: URI — it cannot 404 and costs no request, which the copy of the + same circle this service shipped under /static/logo.svg did. */}} + {{template "srht-head-links" .}}