Web version on the site: /app/ from website/static/app, precompressed Brotli/gzip

The site serves precompressed copies next to its files (the program is 19 MB,
6.3 MB in Brotli); the built program goes to website/static/app (ignored by git,
taken into the image); the device page's screenshots by the site's own paths.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
vrubelroman 2026-10-30 15:33:26 +03:00
parent dd1f3c6c28
commit 4ccf8099a5
4 changed files with 13 additions and 3 deletions

View file

@ -304,7 +304,14 @@ async fn main() {
.route("/stats", get(stats))
.route("/stats.csv", get(stats_csv))
.route("/healthz", get(|| async { "ok" }))
.fallback_service(ServeDir::new(static_dir).fallback(get(not_found)))
.fallback_service(
// Precompressed copies (`.br`, `.gz`) next to a file go to the browsers that
// take them: the web version's program (/app/) is 23 MB, 6 MB in Brotli.
ServeDir::new(static_dir)
.precompressed_br()
.precompressed_gzip()
.fallback(get(not_found)),
)
.with_state(state);
let listener = tokio::net::TcpListener::bind(("0.0.0.0", port))
.await