Offer secure (HTTPS) and unsecured (HTTP) access side by side, add a QR codes page

Optional plain HTTP port next to HTTPS (server.http_port, off by default):
- open_sites()/serve() replace web.run_app: one AppRunner, two TCPSites, so the
  tablet picks https://<ip>:8765 or http://<ip>:8766 without a restart
- http_port requires TLS and must differ from port (validated in config.py)
- make http-on / http-off (--http-port N) write or remove the line, restoring
  the file if the result is invalid; make firewall accepts HTTP_PORT
- make url prints both addresses and QR codes

QR codes page (make qr, --qr):
- self-contained HTML written with mode 600 in $XDG_RUNTIME_DIR and opened as
  file://, never served: the codes contain the access token
- qrencode SVG with crispEdges (no seams between modules), fr/en from LANG
- cards for HTTPS, HTTP and the CA certificate, depending on the config

Tests: 107 (dual listeners with the local CA, set_http_port, QR page content
and file mode). Docs: README fr/en and CLAUDE.md updated.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Denis
2026-10-26 11:55:50 +01:00
parent e823b2d470
commit 27c8eeb37c
14 changed files with 726 additions and 27 deletions
+5
View File
@@ -13,6 +13,11 @@ port = 8765
# tls_cert = "~/.config/mediadeck/tls/server.pem"
# tls_key = "~/.config/mediadeck/tls/server.key"
# tls_ca = "~/.config/mediadeck/tls/mediadeck-ca.crt"
# Choix sécurisé / non sécurisé : avec HTTPS, ce port HTTP en clair (jeton non chiffré, LAN de confiance
# uniquement) est ouvert EN PLUS de `port`. La tablette choisit : https://<ip>:8765 ou http://<ip>:8766.
# 0 = désactivé. Exige tls_cert/tls_key (sans eux, `port` sert déjà du HTTP). `make http-on` / `make http-off`
# écrivent ou retirent cette ligne.
# http_port = 8766
# Généré par `make config` / `make token` (32 octets aléatoires, URL-safe)
token = "CHANGE_ME"