From c7bd92edea1921bec663389cc418535a956acde2 Mon Sep 17 00:00:00 2001 From: Jules Date: Sat, 27 Jun 2026 15:20:21 +0200 Subject: [PATCH] =?UTF-8?q?Fix=20QR=20apr=C3=A8s=20photo=20:=20corriger=20?= =?UTF-8?q?share.js=20qui=20=C3=A9crasait=20afficherQR()?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit share.js était chargé après app.js et redéfinissait afficherQR() avec l'ancienne version (mauvaise URL, mauvais éléments DOM). Co-Authored-By: Claude Opus 4.6 --- frontend/index.html | 2 +- frontend/js/app.js | 17 ----------------- frontend/js/share.js | 31 ++++++++++--------------------- 3 files changed, 11 insertions(+), 39 deletions(-) diff --git a/frontend/index.html b/frontend/index.html index e65c4d4..a800a02 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -920,7 +920,7 @@ - + diff --git a/frontend/js/app.js b/frontend/js/app.js index e2cc6be..4d95a72 100644 --- a/frontend/js/app.js +++ b/frontend/js/app.js @@ -372,23 +372,6 @@ async function chargerBoothInfo() { } } -async function afficherQR() { - const booth = config.booth || {}; - if (!booth.actif || !booth.url || !photoFinale) { - console.warn('afficherQR skip:', {actif: booth.actif, url: booth.url, photoFinale}); - return; - } - try { - const info = await apiGet('/api/booth/info'); - if (!info.password) { console.warn('afficherQR: no password'); return; } - const eventId = (config.evenement || {}).event_id || booth.event_id || 'default'; - const qrUrl = `${booth.url}/g/${eventId}/view/${photoFinale}?p=${info.password}`; - console.log('QR URL:', qrUrl); - document.getElementById('qr-photo').src = `/api/qr?url=${encodeURIComponent(qrUrl)}`; - document.getElementById('popup-qr').classList.remove('cache'); - } catch (e) { console.error('afficherQR error:', e); } -} - function fermerQR() { document.getElementById('popup-qr').classList.add('cache'); } diff --git a/frontend/js/share.js b/frontend/js/share.js index 8e3bbd5..09ed748 100644 --- a/frontend/js/share.js +++ b/frontend/js/share.js @@ -180,25 +180,14 @@ async function envoyerEmail() { } async function afficherQR() { - const zone = document.getElementById('zone-qr'); - zone.classList.toggle('cache'); - - if (!zone.classList.contains('cache')) { - const booth = config.booth || {}; - if (booth.actif && booth.url) { - const info = await apiGet('/api/booth/info').catch(() => null); - const eventId = booth.event_id || 'default'; - const pw = info?.password || ''; - const qrUrl = `${booth.url}/${eventId}?p=${pw}`; - document.getElementById('img-qr').src = `/api/qr?url=${encodeURIComponent(qrUrl)}`; - } else { - const resultat = await apiGet('/api/qr/galerie'); - if (resultat.chemin) { - document.getElementById('img-qr').src = resultat.chemin; - } else { - afficherStatut('QR Code non configure', 'erreur'); - zone.classList.add('cache'); - } - } - } + const booth = config.booth || {}; + if (!booth.actif || !booth.url || !photoFinale) return; + try { + const info = await apiGet('/api/booth/info'); + if (!info.password) return; + const eventId = (config.evenement || {}).event_id || booth.event_id || 'default'; + const qrUrl = `${booth.url}/g/${eventId}/view/${photoFinale}?p=${info.password}`; + document.getElementById('qr-photo').src = `/api/qr?url=${encodeURIComponent(qrUrl)}`; + document.getElementById('popup-qr').classList.remove('cache'); + } catch (e) { console.error('afficherQR error:', e); } }