Fix QR après photo : corriger share.js qui écrasait afficherQR()
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 <noreply@anthropic.com>
This commit is contained in:
@@ -920,7 +920,7 @@
|
|||||||
<script src="/js/camera.js?v=15"></script>
|
<script src="/js/camera.js?v=15"></script>
|
||||||
<script src="/js/effects.js?v=4"></script>
|
<script src="/js/effects.js?v=4"></script>
|
||||||
<script src="/js/gallery.js?v=3"></script>
|
<script src="/js/gallery.js?v=3"></script>
|
||||||
<script src="/js/share.js?v=7"></script>
|
<script src="/js/share.js?v=8"></script>
|
||||||
<script src="/js/admin.js?v=9"></script>
|
<script src="/js/admin.js?v=9"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -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() {
|
function fermerQR() {
|
||||||
document.getElementById('popup-qr').classList.add('cache');
|
document.getElementById('popup-qr').classList.add('cache');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -180,25 +180,14 @@ async function envoyerEmail() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function afficherQR() {
|
async function afficherQR() {
|
||||||
const zone = document.getElementById('zone-qr');
|
const booth = config.booth || {};
|
||||||
zone.classList.toggle('cache');
|
if (!booth.actif || !booth.url || !photoFinale) return;
|
||||||
|
try {
|
||||||
if (!zone.classList.contains('cache')) {
|
const info = await apiGet('/api/booth/info');
|
||||||
const booth = config.booth || {};
|
if (!info.password) return;
|
||||||
if (booth.actif && booth.url) {
|
const eventId = (config.evenement || {}).event_id || booth.event_id || 'default';
|
||||||
const info = await apiGet('/api/booth/info').catch(() => null);
|
const qrUrl = `${booth.url}/g/${eventId}/view/${photoFinale}?p=${info.password}`;
|
||||||
const eventId = booth.event_id || 'default';
|
document.getElementById('qr-photo').src = `/api/qr?url=${encodeURIComponent(qrUrl)}`;
|
||||||
const pw = info?.password || '';
|
document.getElementById('popup-qr').classList.remove('cache');
|
||||||
const qrUrl = `${booth.url}/${eventId}?p=${pw}`;
|
} catch (e) { console.error('afficherQR error:', e); }
|
||||||
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');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user