Gzip the text responses

Nothing was compressed: the list page shipped ~123 KB of HTML, CSS and JS in
the clear on every cold load, which is the wrong bill for a phone on mobile
data. A stdlib middleware compresses the four content types this server
actually serves in bulk and leaves woff2 alone, since it is already compressed.

Measured on the live server: style.css 21.8 KB -> 6.5, htmx 50.9 -> 16.4,
filter.js 7.6 -> 2.9.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-30 22:23:14 +07:00
parent e7d308ca87
commit 9158709dc9
3 changed files with 112 additions and 1 deletions
+1 -1
View File
@@ -179,7 +179,7 @@ func newRouter(store *Store, cfg Config) http.Handler {
web.register(mux)
}
return withCORS(cfg.AllowedOrigins, guardEmptyUserscriptToken(mux))
return withCORS(cfg.AllowedOrigins, withGzip(guardEmptyUserscriptToken(mux)))
}
// guardEmptyUserscriptToken heads off ServeMux's own path-cleaning redirect: