fix: restart photobooth-app après changement du bouton Supprimer
This commit is contained in:
@@ -65,19 +65,34 @@ async def get_delete_button(request: Request):
|
||||
async def set_delete_button(request: Request, visible: bool):
|
||||
"""Active ou désactive le bouton Supprimer dans l'UI de review photobooth-app.
|
||||
|
||||
Écrit userdata/private.css en temps réel — effectif à la prochaine capture,
|
||||
sans redémarrage.
|
||||
Écrit userdata/private.css puis redémarre photobooth-app pour que le CSS
|
||||
soit pris en compte.
|
||||
"""
|
||||
import asyncio, subprocess
|
||||
pb = request.app.state.photobooth_service
|
||||
config_svc = request.app.state.config_service
|
||||
|
||||
ok = await pb.set_delete_button_visible(visible)
|
||||
if ok:
|
||||
config_svc.save_show_delete_button(visible)
|
||||
# Redémarre photobooth-app en arrière-plan pour recharger le CSS
|
||||
asyncio.create_task(_restart_photobooth())
|
||||
|
||||
return {"ok": ok, "visible": visible}
|
||||
|
||||
|
||||
async def _restart_photobooth():
|
||||
import asyncio
|
||||
await asyncio.sleep(0.5)
|
||||
proc = await asyncio.create_subprocess_exec(
|
||||
"sudo", "systemctl", "restart", "photobooth-app.service",
|
||||
stdout=asyncio.subprocess.DEVNULL,
|
||||
stderr=asyncio.subprocess.DEVNULL,
|
||||
)
|
||||
await proc.wait()
|
||||
logger.info("photobooth-app redémarré après changement CSS")
|
||||
|
||||
|
||||
@router.post("/system/screen/refresh")
|
||||
async def screen_refresh(request: Request):
|
||||
"""Envoie F5 à l'écran HDMI connecté (Chromium kiosque Wayland/X11)."""
|
||||
|
||||
Reference in New Issue
Block a user