Add HTTPS support and a management-token gate for the web UI
Build and push server image / build-and-push (push) Successful in 31s

ESP32 side can now reach the tools server over HTTPS: the Tools Server
field accepts an https:// address for a TLS-terminating reverse proxy
in front of the server (which still only ever speaks plain HTTP
itself), trusting Cloudflare's Origin CA root (embedded at build time)
since that's the common way to get a real cert on a private origin.
Every URL the device builds -- image fetch, config check, manage-menu
data, the QR codes' own links -- goes through one build_url() helper
that picks the scheme from what's configured.

Also adds an optional MANAGEMENT_TOKEN (docker-compose.yml) that gates
the web UI (/, /api/*) behind a shared secret -- unset by default, so
existing trusted-LAN deployments are unaffected. The same token is
entered once during the ESP32's captive-portal setup and gets baked
into the manage-menu's QR code (?token=...), so scanning it just works;
visiting the page without a valid token shows a plain entry prompt
instead of the config UI, and a valid query-param hit sets a cookie so
the page's own fetch()/<img> calls stay authorized for the rest of the
visit. Device-facing /frame/* endpoints are unaffected -- a separate,
already-documented trust boundary.
This commit is contained in:
2026-07-19 09:42:38 -04:00
parent 461beed04f
commit 6c7468a36e
12 changed files with 253 additions and 30 deletions
+20 -7
View File
@@ -29,7 +29,17 @@ algorithm itself -- it just streams the response straight to the panel.
populated from the environment; changing them in the UI has no effect
as long as the env vars are set -- they win on every load.)
5. On the ESP32's captive portal setup form, set the **Tools Server** field
to `<this-machine>:8420`.
to `<this-machine>:8420`. This server always speaks plain HTTP itself --
for HTTPS, put a TLS-terminating reverse proxy (e.g. nginx) in front of
it and enter the proxy's `https://` address instead (see
`firmware/README.md`'s HTTPS section for what the ESP32 side needs).
6. **Optional: set `MANAGEMENT_TOKEN`** in `docker-compose.yml` to gate the
web UI behind a shared secret (leave unset to keep it open, the
previous default -- fine on a trusted LAN). If set, paste the same
value into the ESP32's captive portal setup form's **Access Token**
field so the manage-menu's "scan to manage" QR code embeds it
automatically (`?token=...`); visiting the page without a valid token
in the URL shows a plain token-entry prompt instead of the config UI.
## Endpoints
@@ -106,12 +116,15 @@ algorithm itself -- it just streams the response straight to the panel.
in sequential or shuffle order per the Order setting. Dragging photos
in the web UI (or using "Show next") only rearranges what's already in
that lookahead; it doesn't add or remove photos from the album.
- `/frame/image`, `/frame/advance`, `/frame/photo-info`, and
`/frame/share/{asset_id}` aren't authenticated yet. That's fine on a
trusted home LAN for now, but worth revisiting once the ESP32 side is
wired up to send a shared device token. `/frame/share` at least is
scoped to only ever create a link for a photo this frame is actually
showing or has queued, not any Immich asset ID someone might guess.
- `/frame/image`, `/frame/advance`, `/frame/photo-info`, `/frame/face-labels`,
and `/frame/share/{asset_id}` -- the device-facing endpoints -- aren't
authenticated. That's fine on a trusted home LAN for now, but worth
revisiting if this ever needs to sit somewhere less trusted.
`/frame/share` at least is scoped to only ever create a link for a
photo this frame is actually showing or has queued, not any Immich
asset ID someone might guess. The web UI (`/`, `/api/*`) is separately
gated by `MANAGEMENT_TOKEN` if set (see Setup above) -- these are two
independent trust boundaries, not one shared mechanism.
- The 6-color palette RGB values in `app/image_pipeline.py` are
approximations, not measured values (Waveshare doesn't publish exact
color primaries for this panel) -- tune them once you can compare a