SIGN IN SIGN UP

perf: compress the app page for remote and tailnet sessions; woff2-only KaTeX (#1617) (#1619)

* perf: serve the app page compressed to remote and tailnet sessions; drop KaTeX woff/ttf fallbacks (#1617)

Remote-mode and --tailscale sessions now negotiate Accept-Encoding for the
single-file app HTML: brotli q5, else gzip 6, else identity, with Vary and an
exact Content-Length. Brotli is compressed once per process at server start
(off the event loop); gzip lazily on first use. Plain local sessions are
byte- and header-identical to before, because on loopback compression only
added latency. One shared helper (packages/shared/app-html.ts) serves every
app-HTML route in the Bun and Pi servers.

The single-file builds also keep only KaTeX's woff2 fonts (-1.09 MB per app).

* perf(#1617): prewarm the encoding each session will use; document origin-dependent br and cache lifetime

Browsers advertise br only to HTTPS and localhost origins, so direct
plain-http remote mode is served gzip in practice. Remote sessions now
prewarm gzip and --tailscale sessions brotli, compressing the other lazily.
Document that the module-level cache persists for the life of long-lived
Pi/OpenCode hosts, bounded to 4 bodies.
M
Michael Ramos committed
69d1dc1bee3097b3298ecca5cde3d8f887e060bd
Parent: e561a43
Committed by GitHub <noreply@github.com> on 9/26/2026, 7:04:00 PM