Add admin-only service status panel with restart, wired to Docker directly

This commit is contained in:
Myron Blair
2026-07-26 17:53:19 -05:00
parent 19374b694e
commit 4d77a36f99
6 changed files with 137 additions and 0 deletions
+15
View File
@@ -32,6 +32,7 @@ from seed import SAMPLE_MOVIES
import tmdb as tmdb_client
import radarr as radarr_client
import sonarr as sonarr_client
import services as services_client
import trakt as trakt_client
import opensubtitles as opensubs_client
from transcode import transcode_quick, transcode_abr, srt_to_vtt
@@ -1495,6 +1496,20 @@ async def _auto_fetch_subtitle(content_type: str, content_id: str, tmdb_id: Opti
logger.info(f"Auto-attached subtitle for {content_type} {content_id[:8]}")
# ============ SERVICES (admin) ============
@api.get("/services")
async def services_status(user: dict = Depends(require_admin)):
return await asyncio.to_thread(services_client.list_service_status)
@api.post("/services/{key}/restart")
async def services_restart(key: str, user: dict = Depends(require_admin)):
ok = await asyncio.to_thread(services_client.restart_service, key)
if not ok:
raise HTTPException(status_code=404, detail="Unknown service")
return {"ok": True}
# ============ HEALTH ============
@api.get("/")
async def root():