feat: users, roles and per-area permissions, production demo image

The controller checks every route against the signed-in user's role, with
levels none, view, control and edit per area. Guests get the permissions
of a built-in guest role. Auth stays off until the first user exists;
LED_ADMIN_USER and LED_ADMIN_PASSWORD create the first admin.

Sessions are cookies, passwords are PBKDF2-SHA256, and logins lock per
username after five failures. The simulator's WebSocket checks the view
permission at handshake and per frame; /ws needs devices control. The web
UI gets a sign-in button, a sign-in prompt on refused changes, and a users
and roles screen.

Also: the device build gets the bridge include path and forward type it
was missing, Dockerfile.sim runs non-root, and Dockerfile.prod with
docker-compose.prod.yml runs the controller on an internal network behind
Caddy for HTTPS.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
This commit is contained in:
jimmyandClaude Haiku 5.5 committed 2026-11-17 00:29:04 +13:00
1 parent 02440be55d
commit f0615dc1b7
26 files changed
+2116 -23

No files matched your search

+3 -3
View File
@@ -2,14 +2,14 @@ if(IDF_TARGET STREQUAL "linux")
# Host build for led-simulator (sim-controller/): no Ethernet, Wi-Fi, mic or OTA. The sim
# component has app_main and stands in for main.c, mic.c and ota.c.
idf_component_register(SRCS "beat.c" "beat_dsp.c" "espnow_tx.c" "bridge.c" "store.c" "api.c" "web.c" "envelope.c" "engine.c" "rel.c" "bench.c" "audio.c"
"res_profile.c" "res_misc.c" "res_device.c" "res_group.c" "seqplay.c" "res_bundle.c" "audio_api.c" "patterns.c" "outputs.c" "ws.c" "ws_client.c" "wifi_drv.c" "bridge_serial.c"
"res_profile.c" "res_misc.c" "res_device.c" "res_group.c" "seqplay.c" "res_bundle.c" "audio_api.c" "patterns.c" "outputs.c" "ws.c" "ws_client.c" "wifi_drv.c" "bridge_serial.c" "auth.c"
INCLUDE_DIRS "." "../sim-controller/components/sim/include" "../bridge/main"
REQUIRES esp_http_server esp_timer esp_event cjson
PRIV_REQUIRES mbedtls lwip esp_app_format)
else()
idf_component_register(SRCS "main.c" "mic.c" "beat.c" "beat_dsp.c" "espnow_tx.c" "bridge.c" "store.c" "api.c" "web.c" "envelope.c" "engine.c" "rel.c" "bench.c" "audio.c" "ota.c"
"res_profile.c" "res_misc.c" "res_device.c" "res_group.c" "seqplay.c" "res_bundle.c" "audio_api.c" "patterns.c" "outputs.c" "ws.c" "ws_client.c" "wifi_drv.c"
INCLUDE_DIRS "."
"res_profile.c" "res_misc.c" "res_device.c" "res_group.c" "seqplay.c" "res_bundle.c" "audio_api.c" "patterns.c" "outputs.c" "ws.c" "ws_client.c" "wifi_drv.c" "auth.c"
INCLUDE_DIRS "." "../bridge/main"
REQUIRES esp_eth esp_netif esp_event esp_driver_spi esp_driver_gpio nvs_flash app_update esp_app_format
esp_http_server esp_timer esp_driver_i2s esp_wifi esp_rom cjson esp_driver_gpio
PRIV_REQUIRES littlefs mdns mbedtls lwip w5500)