From 99d2dc8f5693772adbd245bf890c1d8de1964684 Mon Sep 17 00:00:00 2001 From: Jules Date: Tue, 7 Apr 2026 17:52:10 +0200 Subject: [PATCH] Onglet admin Galerie Live (booth) + config booth sur la borne - Onglet Galerie Live dans admin : activer, URL, API key, event ID - Affichage du code invites + bouton regenerer - QR code + code sur ecran d'accueil (si active) Co-Authored-By: Claude Opus 4.6 (1M context) --- frontend/index.html | 21 ++++++++++++++++ frontend/js/admin.js | 58 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 79 insertions(+) diff --git a/frontend/index.html b/frontend/index.html index aa7ad8a..d35445d 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -150,6 +150,7 @@ + @@ -359,6 +360,26 @@ + +
+

Galerie Live

+

Les photos sont envoyees en temps reel sur un site web. Les invites scannent le QR code sur l'ecran d'accueil.

+
+ +
+
+
+
+
+ +
+ + +
+
diff --git a/frontend/js/admin.js b/frontend/js/admin.js index a4b0f73..71b8f2f 100644 --- a/frontend/js/admin.js +++ b/frontend/js/admin.js @@ -24,6 +24,7 @@ async function chargerAdmin() { chargerEmailAdmin(); chargerFondsAdmin(); chargerGalerieAdmin(); + chargerBoothAdmin(); } // === MATERIEL === @@ -635,3 +636,60 @@ function getValue(id) { const el = document.getElementById(id); return el ? el.value : ''; } + +// === BOOTH (Galerie Live) === + +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) { + try { + const info = await apiGet('/api/booth/info'); + if (info.password) { + document.getElementById('admin-booth-password').textContent = info.password; + } + } catch (e) { + document.getElementById('admin-booth-password').textContent = '--'; + } + } +} + +async function sauvegarderBooth() { + await apiPost('/api/config', { + booth: { + actif: document.getElementById('admin-booth-actif').checked, + url: getValue('admin-booth-url'), + api_key: getValue('admin-booth-apikey'), + event_id: getValue('admin-booth-eventid'), + } + }); + afficherStatut('Galerie live sauvegardee', 'succes'); + chargerBoothAdmin(); + chargerBoothInfo(); +} + +async function regenererBoothPassword() { + const booth = config.booth || {}; + const url = getValue('admin-booth-url').replace(/\/$/, ''); + const apiKey = getValue('admin-booth-apikey'); + const eventId = getValue('admin-booth-eventid') || 'default'; + + try { + const resp = await fetch(`${url}/api/${eventId}/reset-password`, { + method: 'POST', + headers: { 'X-Api-Key': apiKey }, + }); + const data = await resp.json(); + if (data.password) { + document.getElementById('admin-booth-password').textContent = data.password; + afficherStatut('Nouveau code genere : ' + data.password, 'succes'); + } + } catch (e) { + afficherStatut('Erreur connexion au serveur booth', 'erreur'); + } +}