fix: add scene preview image route

This commit is contained in:
2026-07-27 11:43:43 +08:00
parent 1260566e75
commit 22bfd6fc19
+9
View File
@@ -96,6 +96,15 @@ async def dashboard_preview(theme_id: str, ext: str):
raise HTTPException(404) raise HTTPException(404)
@app.get("/scene/{scene_id}/preview.{ext}")
async def scene_preview(scene_id: str, ext: str):
from models.scene import SCENES_DIR
path = SCENES_DIR / scene_id / f"preview.{ext}"
if path.exists():
return FileResponse(path)
raise HTTPException(404)
@app.get("/scene/{scene_id}", response_class=HTMLResponse) @app.get("/scene/{scene_id}", response_class=HTMLResponse)
async def scene_render(request: Request, scene_id: str): async def scene_render(request: Request, scene_id: str):
from models.scene import scene_manager from models.scene import scene_manager