From 603d0ad555ec29929610a1e7ae014edba42a14ff Mon Sep 17 00:00:00 2001 From: Vuong Hoang Date: Mon, 20 Jul 2026 22:10:46 -0700 Subject: [PATCH] feat(booth): image viewer page with Fit/1:1, download, Esc-back (v0.1.2) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Clicking a gallery image now opens a dedicated viewer instead of dumping you on the raw file. - GET /b//view?f= — full-viewport viewer (registered before the file catch-all so /view wins; non-image f 307-redirects to the raw file, traversal and missing f 404). - Fit (downscale-only) / 1:1 (natural pixels, scroll-to-pan) toggle that only appears when the image is larger than the viewport — when it already fits, Fit ≡ 1:1 so the toggle is hidden. Re-evaluates on resize. - Download button + ✕/Esc back to the gallery. Australis-themed, progressive JS (degrades to fit-only, no-JS still shows the image + download + back). - 5 new tests (34 total, all green); verified Fit/1:1/hidden-toggle states in a real browser. --- services/booth/README.md | 4 +- services/booth/booth/app.py | 25 ++++++++++ services/booth/booth/templates/base.html | 25 ++++++++++ services/booth/booth/templates/booth.html | 2 +- services/booth/booth/templates/view.html | 57 +++++++++++++++++++++++ services/booth/pyproject.toml | 2 +- services/booth/tests/test_booth.py | 40 ++++++++++++++++ 7 files changed, 152 insertions(+), 3 deletions(-) create mode 100644 services/booth/booth/templates/view.html diff --git a/services/booth/README.md b/services/booth/README.md index 810a906..048bc30 100644 --- a/services/booth/README.md +++ b/services/booth/README.md @@ -66,7 +66,9 @@ to a safe basename (no path traversal). `chart.png`, `report.css` — resolve out of the same folder). Build whatever page you want. - **No `index.html`?** → **auto-gallery** of the folder's media: - - images (`png jpg jpeg gif webp avif svg bmp`) → `` + - images (`png jpg jpeg gif webp avif svg bmp`) → `` (click → full-screen + viewer with **Fit** / **1:1** — the toggle only appears when the image is + larger than the viewport — plus download and ✕/Esc back to the gallery) - video (`webm mp4 ogv m4v mov`) → `