Admin : galerie en ligne dans Destinations + booth envoie toutes les photos
- 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 <noreply@anthropic.com>
This commit is contained in:
@@ -16,6 +16,15 @@ def distribuer_photo(chemin_photo: Path, imprimee: bool = False):
|
|||||||
config = charger_config()
|
config = charger_config()
|
||||||
dest = config.get("destinations", {})
|
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
|
# Verifier si on sauvegarde tout ou seulement les imprimees
|
||||||
if not dest.get("sauvegarder_tout", True) and not imprimee:
|
if not dest.get("sauvegarder_tout", True) and not imprimee:
|
||||||
log.info(f"Photo non imprimee, pas de distribution : {chemin_photo.name}")
|
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):
|
if dest.get("ftp", False):
|
||||||
envoyer_ftp(chemin_photo, dest)
|
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
|
# Incrementer le compteur
|
||||||
compteur = config.get("compteur", {})
|
compteur = config.get("compteur", {})
|
||||||
if compteur.get("actif", False):
|
if compteur.get("actif", False):
|
||||||
|
|||||||
@@ -477,10 +477,18 @@
|
|||||||
<div class="champ"><label>Chemin distant</label><input type="text" id="admin-ftp-chemin" value="/photobooth"></div>
|
<div class="champ"><label>Chemin distant</label><input type="text" id="admin-ftp-chemin" value="/photobooth"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="toggle-groupe">
|
<div class="toggle-groupe">
|
||||||
<label class="toggle"><input type="checkbox" id="tog-dest-web"><span class="toggle-slider"></span> Site internet</label>
|
<label class="toggle"><input type="checkbox" id="tog-dest-galerie"><span class="toggle-slider"></span> Galerie en ligne</label>
|
||||||
</div>
|
</div>
|
||||||
<div id="dest-web-details" class="sous-config cache">
|
<div id="dest-galerie-details" class="sous-config cache">
|
||||||
<div class="champ"><label>URL d'upload</label><input type="text" id="admin-web-url" placeholder="https://..."></div>
|
<div class="champ"><label>URL du serveur</label><input type="text" id="admin-booth-url" placeholder="https://booth.copydev.fr" value="https://booth.copydev.fr"></div>
|
||||||
|
<div class="champ"><label>Cle API</label><input type="text" id="admin-booth-apikey" placeholder="booth-photobooth-2026" value="booth-photobooth-2026"></div>
|
||||||
|
<div class="champ"><label>ID evenement</label><input type="text" id="admin-booth-eventid" placeholder="auto" value=""></div>
|
||||||
|
<div class="champ">
|
||||||
|
<label>Code invites : <span id="admin-booth-password" style="font-size:1.5rem;font-weight:bold;letter-spacing:4px">--</span></label>
|
||||||
|
</div>
|
||||||
|
<button class="btn-action" onclick="sauvegarderBooth()">Sauvegarder</button>
|
||||||
|
<button class="btn-secondaire" onclick="regenererBoothPassword()">Nouveau code</button>
|
||||||
|
<button class="btn-secondaire" onclick="imprimerFlyerQR()">🖨 Imprimer flyer QR</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="toggle-groupe">
|
<div class="toggle-groupe">
|
||||||
<label class="toggle"><input type="checkbox" id="tog-dest-email-auto"><span class="toggle-slider"></span> Email automatique</label>
|
<label class="toggle"><input type="checkbox" id="tog-dest-email-auto"><span class="toggle-slider"></span> Email automatique</label>
|
||||||
@@ -630,21 +638,6 @@
|
|||||||
<div class="champ"><label>Expediteur</label><input type="text" id="admin-expediteur" placeholder="photobooth@event.com"></div>
|
<div class="champ"><label>Expediteur</label><input type="text" id="admin-expediteur" placeholder="photobooth@event.com"></div>
|
||||||
<button class="btn-action" onclick="sauvegarderEmail()">Sauvegarder email</button>
|
<button class="btn-action" onclick="sauvegarderEmail()">Sauvegarder email</button>
|
||||||
|
|
||||||
<h3>Galerie Live</h3>
|
|
||||||
<p class="aide">Photos envoyees en temps reel. QR code + code sur l'ecran d'accueil.</p>
|
|
||||||
<div class="champ">
|
|
||||||
<label class="toggle"><input type="checkbox" id="admin-booth-actif" onchange="sauvegarderBooth()"><span class="toggle-slider"></span> Galerie live active</label>
|
|
||||||
</div>
|
|
||||||
<div class="champ"><label>URL du serveur</label><input type="text" id="admin-booth-url" placeholder="https://booth.copydev.fr" value="https://booth.copydev.fr"></div>
|
|
||||||
<div class="champ"><label>Cle API</label><input type="text" id="admin-booth-apikey" placeholder="booth-photobooth-2026" value="booth-photobooth-2026"></div>
|
|
||||||
<div class="champ"><label>ID evenement</label><input type="text" id="admin-booth-eventid" placeholder="default" value="default"></div>
|
|
||||||
<div class="champ">
|
|
||||||
<label>Code invites : <span id="admin-booth-password" style="font-size:1.5rem;font-weight:bold;letter-spacing:4px">--</span></label>
|
|
||||||
</div>
|
|
||||||
<button class="btn-action" onclick="sauvegarderBooth()">Sauvegarder booth</button>
|
|
||||||
<button class="btn-secondaire" onclick="regenererBoothPassword()">Nouveau code</button>
|
|
||||||
<button class="btn-secondaire" onclick="imprimerFlyerQR()">🖨 Imprimer flyer QR galerie</button>
|
|
||||||
|
|
||||||
<h3>Galerie locale</h3>
|
<h3>Galerie locale</h3>
|
||||||
<div class="champ">
|
<div class="champ">
|
||||||
<label>Photos prises : <span id="admin-nb-photos">0</span> | Exports : <span id="admin-nb-exports">0</span></label>
|
<label>Photos prises : <span id="admin-nb-photos">0</span> | Exports : <span id="admin-nb-exports">0</span></label>
|
||||||
@@ -751,6 +744,6 @@
|
|||||||
<script src="/js/effects.js?v=3"></script>
|
<script src="/js/effects.js?v=3"></script>
|
||||||
<script src="/js/gallery.js?v=3"></script>
|
<script src="/js/gallery.js?v=3"></script>
|
||||||
<script src="/js/share.js?v=6"></script>
|
<script src="/js/share.js?v=6"></script>
|
||||||
<script src="/js/admin.js?v=4"></script>
|
<script src="/js/admin.js?v=5"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -186,24 +186,29 @@ async function resetCompteur() {
|
|||||||
|
|
||||||
function chargerDestinations() {
|
function chargerDestinations() {
|
||||||
const dest = config.destinations || {};
|
const dest = config.destinations || {};
|
||||||
|
const booth = config.booth || {};
|
||||||
|
|
||||||
document.getElementById('tog-dest-memoire').checked = dest.memoire_interne !== false;
|
document.getElementById('tog-dest-memoire').checked = dest.memoire_interne !== false;
|
||||||
document.getElementById('tog-dest-usb').checked = dest.cle_usb || false;
|
document.getElementById('tog-dest-usb').checked = dest.cle_usb || false;
|
||||||
document.getElementById('tog-dest-ftp').checked = dest.ftp || 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;
|
document.getElementById('tog-dest-email-auto').checked = dest.email_auto || false;
|
||||||
|
|
||||||
// Sous-configs visibles si actives
|
// Sous-configs visibles si actives
|
||||||
toggleSousConfig('tog-dest-usb', 'dest-usb-details');
|
toggleSousConfig('tog-dest-usb', 'dest-usb-details');
|
||||||
toggleSousConfig('tog-dest-ftp', 'dest-ftp-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-host', dest.ftp_host);
|
||||||
setValue('admin-ftp-port', dest.ftp_port || 21);
|
setValue('admin-ftp-port', dest.ftp_port || 21);
|
||||||
setValue('admin-ftp-user', dest.ftp_user);
|
setValue('admin-ftp-user', dest.ftp_user);
|
||||||
setValue('admin-ftp-pass', dest.ftp_password);
|
setValue('admin-ftp-pass', dest.ftp_password);
|
||||||
setValue('admin-ftp-chemin', dest.ftp_chemin || '/photobooth');
|
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
|
// Radio sauvegarder tout / imprimees
|
||||||
if (dest.sauvegarder_tout === false) {
|
if (dest.sauvegarder_tout === false) {
|
||||||
@@ -213,10 +218,10 @@ function chargerDestinations() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Listeners pour afficher/cacher sous-configs
|
// 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);
|
const el = document.getElementById(id);
|
||||||
el.onchange = () => {
|
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]);
|
toggleSousConfig(id, map[id]);
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
@@ -260,11 +265,15 @@ async function sauvegarderDestinations() {
|
|||||||
ftp_user: getValue('admin-ftp-user'),
|
ftp_user: getValue('admin-ftp-user'),
|
||||||
ftp_password: getValue('admin-ftp-pass'),
|
ftp_password: getValue('admin-ftp-pass'),
|
||||||
ftp_chemin: getValue('admin-ftp-chemin') || '/photobooth',
|
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,
|
email_auto: document.getElementById('tog-dest-email-auto').checked,
|
||||||
sauvegarder_tout: document.getElementById('sauv-tout').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');
|
afficherStatut('Destinations sauvegardees', 'succes');
|
||||||
}
|
}
|
||||||
@@ -815,10 +824,6 @@ function getValue(id) {
|
|||||||
|
|
||||||
async function chargerBoothAdmin() {
|
async function chargerBoothAdmin() {
|
||||||
const booth = config.booth || {};
|
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
|
// Recuperer le code actuel
|
||||||
if (booth.actif && booth.url) {
|
if (booth.actif && booth.url) {
|
||||||
@@ -836,7 +841,7 @@ async function chargerBoothAdmin() {
|
|||||||
async function sauvegarderBooth() {
|
async function sauvegarderBooth() {
|
||||||
await apiPost('/api/config', {
|
await apiPost('/api/config', {
|
||||||
booth: {
|
booth: {
|
||||||
actif: document.getElementById('admin-booth-actif').checked,
|
actif: document.getElementById('tog-dest-galerie').checked,
|
||||||
url: getValue('admin-booth-url'),
|
url: getValue('admin-booth-url'),
|
||||||
api_key: getValue('admin-booth-apikey'),
|
api_key: getValue('admin-booth-apikey'),
|
||||||
event_id: getValue('admin-booth-eventid'),
|
event_id: getValue('admin-booth-eventid'),
|
||||||
|
|||||||
Reference in New Issue
Block a user