Admin backoffice : rubriques General/Evenement + videos situation + surprise + rembobinage ruban
- Reorganisation menu admin en 2 rubriques (General / Evenement) - Destinations deplace dans Evenement - Nouveau panneau Videos : upload par situation (montage, depannage, bourrage, rechargement) - Nouveau panneau Surprise : photo/video affichee ~1s avant capture pour provoquer sourire - Toggle rembobinage ruban Mitsubishi (StpiDecklist) pour economiser le ruban sur petits formats - Historique email cloisonne par evenement - Memoire projet consolidee dans memoire.md Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -195,28 +195,47 @@ async def tache_spool_demarrage():
|
||||
FICHIER_EMAILS = RACINE / "data" / "emails_history.json"
|
||||
|
||||
|
||||
def _event_id_actif() -> str:
|
||||
return charger_config().get("evenement", {}).get("event_id") or "_sans_evenement"
|
||||
|
||||
|
||||
def _charger_toutes_historiques() -> dict:
|
||||
if not FICHIER_EMAILS.exists():
|
||||
return {}
|
||||
try:
|
||||
with open(FICHIER_EMAILS, "r", encoding="utf-8") as f:
|
||||
data = json.load(f)
|
||||
# Compatibilite avec l'ancien format (liste globale non cloisonnee)
|
||||
if isinstance(data, list):
|
||||
return {"_sans_evenement": data}
|
||||
return data
|
||||
except (json.JSONDecodeError, OSError):
|
||||
return {}
|
||||
|
||||
|
||||
def _sauvegarder_email_historique(email: str):
|
||||
historique = charger_emails_historique()
|
||||
toutes = _charger_toutes_historiques()
|
||||
event_id = _event_id_actif()
|
||||
historique = toutes.setdefault(event_id, [])
|
||||
email_lower = email.lower().strip()
|
||||
if email_lower not in historique:
|
||||
historique.append(email_lower)
|
||||
try:
|
||||
with open(FICHIER_EMAILS, "w", encoding="utf-8") as f:
|
||||
json.dump(historique, f, ensure_ascii=False)
|
||||
json.dump(toutes, f, ensure_ascii=False)
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
|
||||
def charger_emails_historique() -> list:
|
||||
if not FICHIER_EMAILS.exists():
|
||||
return []
|
||||
try:
|
||||
with open(FICHIER_EMAILS, "r", encoding="utf-8") as f:
|
||||
return json.load(f)
|
||||
except (json.JSONDecodeError, OSError):
|
||||
return []
|
||||
return _charger_toutes_historiques().get(_event_id_actif(), [])
|
||||
|
||||
|
||||
def effacer_emails_historique():
|
||||
if FICHIER_EMAILS.exists():
|
||||
FICHIER_EMAILS.unlink()
|
||||
toutes = _charger_toutes_historiques()
|
||||
toutes.pop(_event_id_actif(), None)
|
||||
try:
|
||||
with open(FICHIER_EMAILS, "w", encoding="utf-8") as f:
|
||||
json.dump(toutes, f, ensure_ascii=False)
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user