Bulletproof: messages novices, kiosk port auto, reset compteur, sync booth event_id

- Messages erreur camera/impression: texte novice ("Oups!", "Reessayez") au lieu de jargon technique
- kiosk-session.sh: lit le port depuis config.json (plus de http://localhost en dur), healthcheck /api/config, supprime git pull auto au boot
- Activer evenement: reset automatique du compteur photos
- Activer evenement: sync booth.event_id quand galerie live active
- Port par defaut backend: 80 → 8080

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-09-13 09:17:26 +02:00
parent 96464ccca1
commit f1299fd6a7
5 changed files with 41 additions and 23 deletions

View File

@@ -4,6 +4,18 @@
exec 9>/tmp/photobooth-kiosk.lock
flock -n 9 || { echo "[kiosk] Déjà en cours, abandon."; exit 0; }
PHOTOBOOTH_DIR=/home/jules/photobooth
# Port du backend (lu depuis config.json, fallback 8080)
BACKEND_PORT=$(python3 -c "
import json, sys
try:
d = json.load(open('$PHOTOBOOTH_DIR/data/config.json'))
print(d.get('serveur', {}).get('port', 8080))
except: print(8080)
" 2>/dev/null)
BACKEND_URL="http://localhost:${BACKEND_PORT}"
# Tuer tout backend orphelin d'une session precedente
pkill -f 'python.*backend.main' 2>/dev/null || true
sleep 1
@@ -23,8 +35,7 @@ pkill -f gvfs-gphoto2-volume-monitor 2>/dev/null || true
_backend_loop() {
while true; do
while [ -f /tmp/photobooth-maintenance ]; do sleep 2; done
cd /home/jules/photobooth
git pull --ff-only 2>&1 | logger -t photobooth-git
cd "$PHOTOBOOTH_DIR"
source .venv/bin/activate
authbind --deep python -m backend.main 2>&1 | tee -a /tmp/photobooth-backend.log
echo "[kiosk] backend terminé, redémarrage dans 3s..."
@@ -37,9 +48,9 @@ BACKEND_LOOP_PID=$!
# Nettoyer le backend si le kiosk est tue
trap "kill $BACKEND_LOOP_PID 2>/dev/null; pkill -f 'python.*backend.main' 2>/dev/null" EXIT
# Attendre que le backend soit pret (max 15s)
for i in $(seq 1 15); do
curl -sf http://localhost/ > /dev/null 2>&1 && break
# Attendre que le backend soit pret (max 30s)
for i in $(seq 1 30); do
curl -sf "${BACKEND_URL}/api/config" > /dev/null 2>&1 && break
sleep 1
done
@@ -64,7 +75,7 @@ while true; do
--password-store=basic \
--lang=fr \
--remote-debugging-port=9222 \
http://localhost
"${BACKEND_URL}"
echo "[kiosk] Chromium terminé, redémarrage dans 2s..."
sleep 2
done