feat: bouton restart photobooth-app après modification des actions
🚀 Deploy — JH Photomaton / 🔍 Vérification (push) Has been cancelled
🚀 Deploy — JH Photomaton / 🍓 Deploy sur le Pi (push) Has been cancelled

This commit is contained in:
2026-07-18 10:33:57 +02:00
parent 2b99ef6469
commit 3522d2d996
2 changed files with 55 additions and 4 deletions
+20 -1
View File
@@ -1,5 +1,6 @@
"""API de surveillance des ressources système."""
import asyncio
import logging
from typing import Optional
from fastapi import APIRouter, Request, Body
@@ -9,6 +10,16 @@ from pydantic import BaseModel
logger = logging.getLogger(__name__)
router = APIRouter()
# Services autorisés pour le restart individuel (jh-photomaton a son propre endpoint)
_ALLOWED_SERVICES = {
"photobooth-app",
"photobooth-kiosk",
"zoraxy",
"hostapd",
"dnsmasq",
"cups",
}
@router.get("/system/stats")
async def system_stats(request: Request):
@@ -90,7 +101,15 @@ async def _restart_photobooth():
stderr=asyncio.subprocess.DEVNULL,
)
await proc.wait()
logger.info("photobooth-app redémarré après changement CSS")
logger.info("photobooth-app redémarré")
@router.post("/system/restart-photobooth")
async def restart_photobooth(request: Request):
"""Redémarre photobooth-app.service pour recharger la config (actions, etc.)."""
import asyncio
asyncio.create_task(_restart_photobooth())
return {"ok": True, "message": "Redémarrage de photobooth-app en cours…"}
@router.post("/system/screen/refresh")