Fix the logo's pop-in with a traced vector logo

The logo was an 880 KB SVG wrapping a 1254px PNG, downloaded again on
every page load. Keep that PNG as the master (artwork/logo.png) and have
scripts/logo.py trace it with potrace into a 6 KB logo.svg (favicon,
README) and logo.js, which brand.js draws inline in the header and on the
login page so the logo arrives with the page. Remove the unused
logo-white.svg.

Static files now carry content ETags, so reloads get 304s instead of
downloading the UI again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
abrown38andClaude Opus 5.5 committed 2026-10-08 18:01:22 +00:00
1 parent cf49df0346
commit 0f04dbb4b1
15 files changed
+215 -23049

No files matched your search

+36
View File
@@ -0,0 +1,36 @@
package server
import (
"io"
"log/slog"
"net/http"
"net/http/httptest"
"testing"
"testing/fstest"
)
// Static files carry an ETag, so a browser's revalidation of an unchanged
// file is a 304 without a body.
func TestStaticETags(t *testing.T) {
web := fstest.MapFS{
"index.html": {Data: []byte("<!doctype html><title>Jarl</title>")},
"assets/logo.js": {Data: []byte("export const x = 1;\n")},
}
s := &Server{cfg: Config{}, log: slog.New(slog.NewTextHandler(io.Discard, nil)), mux: http.NewServeMux(), limiter: newRateLimiter(), web: web}
s.routes()
for _, path := range []string{"/", "/assets/logo.js"} {
w := httptest.NewRecorder()
s.mux.ServeHTTP(w, httptest.NewRequest("GET", path, nil))
tag := w.Header().Get("ETag")
if w.Code != 200 || tag == "" || w.Body.Len() == 0 {
t.Fatalf("%s: %d etag %q", path, w.Code, tag)
}
r := httptest.NewRequest("GET", path, nil)
r.Header.Set("If-None-Match", tag)
w = httptest.NewRecorder()
s.mux.ServeHTTP(w, r)
if w.Code != http.StatusNotModified || w.Body.Len() != 0 {
t.Errorf("%s revalidated: %d, %d bytes", path, w.Code, w.Body.Len())
}
}
}