From 545d8cd6ada4be25398be7f775f195ea586dbf6a Mon Sep 17 00:00:00 2001 From: Jules Date: Tue, 23 Jun 2026 00:05:47 +0200 Subject: [PATCH] Admin : galerie en ligne dans Destinations + booth envoie toutes les photos MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remplace le toggle "Site internet" par "Galerie en ligne" dans le panneau Destinations - Supprime la section dupliquée "Galerie Live" du panneau Fonctions - Le booth reçoit toutes les photos (imprimées ou non), le filtre sauvegarder_tout ne s'applique qu'à USB/FTP Co-Authored-By: Claude Opus 4.6 --- backend/destinations.py | 18 +++++++++--------- frontend/index.html | 31 ++++++++++++------------------- frontend/js/admin.js | 29 +++++++++++++++++------------ 3 files changed, 38 insertions(+), 40 deletions(-) diff --git a/backend/destinations.py b/backend/destinations.py index 378e5d4..8670ca3 100644 --- a/backend/destinations.py +++ b/backend/destinations.py @@ -16,6 +16,15 @@ def distribuer_photo(chemin_photo: Path, imprimee: bool = False): config = charger_config() dest = config.get("destinations", {}) + # Galerie live (booth) — toujours envoyer, imprimee ou non + booth = config.get("booth", {}) + if booth.get("actif", False): + threading.Thread( + target=envoyer_booth, + args=(chemin_photo, booth), + daemon=True, + ).start() + # Verifier si on sauvegarde tout ou seulement les imprimees if not dest.get("sauvegarder_tout", True) and not imprimee: log.info(f"Photo non imprimee, pas de distribution : {chemin_photo.name}") @@ -29,15 +38,6 @@ def distribuer_photo(chemin_photo: Path, imprimee: bool = False): if dest.get("ftp", False): envoyer_ftp(chemin_photo, dest) - # Galerie live (booth) - booth = config.get("booth", {}) - if booth.get("actif", False): - threading.Thread( - target=envoyer_booth, - args=(chemin_photo, booth), - daemon=True, - ).start() - # Incrementer le compteur compteur = config.get("compteur", {}) if compteur.get("actif", False): diff --git a/frontend/index.html b/frontend/index.html index f85e956..15a26c9 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -477,10 +477,18 @@
- +
-
-
+
+
+
+
+
+ +
+ + +
@@ -630,21 +638,6 @@
-

Galerie Live

-

Photos envoyees en temps reel. QR code + code sur l'ecran d'accueil.

-
- -
-
-
-
-
- -
- - - -

Galerie locale

@@ -751,6 +744,6 @@ - + diff --git a/frontend/js/admin.js b/frontend/js/admin.js index 28ff83f..7c4a79e 100644 --- a/frontend/js/admin.js +++ b/frontend/js/admin.js @@ -186,24 +186,29 @@ async function resetCompteur() { function chargerDestinations() { const dest = config.destinations || {}; + const booth = config.booth || {}; document.getElementById('tog-dest-memoire').checked = dest.memoire_interne !== false; document.getElementById('tog-dest-usb').checked = dest.cle_usb || false; document.getElementById('tog-dest-ftp').checked = dest.ftp || false; - document.getElementById('tog-dest-web').checked = dest.site_web || false; + document.getElementById('tog-dest-galerie').checked = booth.actif || false; document.getElementById('tog-dest-email-auto').checked = dest.email_auto || false; // Sous-configs visibles si actives toggleSousConfig('tog-dest-usb', 'dest-usb-details'); toggleSousConfig('tog-dest-ftp', 'dest-ftp-details'); - toggleSousConfig('tog-dest-web', 'dest-web-details'); + toggleSousConfig('tog-dest-galerie', 'dest-galerie-details'); setValue('admin-ftp-host', dest.ftp_host); setValue('admin-ftp-port', dest.ftp_port || 21); setValue('admin-ftp-user', dest.ftp_user); setValue('admin-ftp-pass', dest.ftp_password); setValue('admin-ftp-chemin', dest.ftp_chemin || '/photobooth'); - setValue('admin-web-url', dest.site_web_url); + + // Booth fields + setValue('admin-booth-url', booth.url || 'https://booth.copydev.fr'); + setValue('admin-booth-apikey', booth.api_key || 'booth-photobooth-2026'); + setValue('admin-booth-eventid', booth.event_id || 'default'); // Radio sauvegarder tout / imprimees if (dest.sauvegarder_tout === false) { @@ -213,10 +218,10 @@ function chargerDestinations() { } // Listeners pour afficher/cacher sous-configs - ['tog-dest-usb', 'tog-dest-ftp', 'tog-dest-web'].forEach(id => { + ['tog-dest-usb', 'tog-dest-ftp', 'tog-dest-galerie'].forEach(id => { const el = document.getElementById(id); el.onchange = () => { - const map = { 'tog-dest-usb': 'dest-usb-details', 'tog-dest-ftp': 'dest-ftp-details', 'tog-dest-web': 'dest-web-details' }; + const map = { 'tog-dest-usb': 'dest-usb-details', 'tog-dest-ftp': 'dest-ftp-details', 'tog-dest-galerie': 'dest-galerie-details' }; toggleSousConfig(id, map[id]); }; }); @@ -260,11 +265,15 @@ async function sauvegarderDestinations() { ftp_user: getValue('admin-ftp-user'), ftp_password: getValue('admin-ftp-pass'), ftp_chemin: getValue('admin-ftp-chemin') || '/photobooth', - site_web: document.getElementById('tog-dest-web').checked, - site_web_url: getValue('admin-web-url'), email_auto: document.getElementById('tog-dest-email-auto').checked, sauvegarder_tout: document.getElementById('sauv-tout').checked, }, + booth: { + actif: document.getElementById('tog-dest-galerie').checked, + url: getValue('admin-booth-url'), + api_key: getValue('admin-booth-apikey'), + event_id: getValue('admin-booth-eventid'), + }, }); afficherStatut('Destinations sauvegardees', 'succes'); } @@ -815,10 +824,6 @@ function getValue(id) { async function chargerBoothAdmin() { const booth = config.booth || {}; - document.getElementById('admin-booth-actif').checked = booth.actif || false; - setValue('admin-booth-url', booth.url || 'https://booth.copydev.fr'); - setValue('admin-booth-apikey', booth.api_key || 'booth-photobooth-2026'); - setValue('admin-booth-eventid', booth.event_id || 'default'); // Recuperer le code actuel if (booth.actif && booth.url) { @@ -836,7 +841,7 @@ async function chargerBoothAdmin() { async function sauvegarderBooth() { await apiPost('/api/config', { booth: { - actif: document.getElementById('admin-booth-actif').checked, + actif: document.getElementById('tog-dest-galerie').checked, url: getValue('admin-booth-url'), api_key: getValue('admin-booth-apikey'), event_id: getValue('admin-booth-eventid'),