feat: serve any file from dashboard folder (CSS/JS/images)
This commit is contained in:
@@ -96,6 +96,16 @@ async def dashboard_preview(theme_id: str, ext: str):
|
|||||||
raise HTTPException(404)
|
raise HTTPException(404)
|
||||||
|
|
||||||
|
|
||||||
|
@app.get("/dashboard/{theme_id}/{path:path}")
|
||||||
|
async def dashboard_static(theme_id: str, path: str):
|
||||||
|
from models.dashboard import BUILTIN_DASHBOARDS_DIR, USER_DASHBOARDS_DIR
|
||||||
|
for base in [BUILTIN_DASHBOARDS_DIR, USER_DASHBOARDS_DIR]:
|
||||||
|
filepath = base / theme_id / path
|
||||||
|
if filepath.exists() and filepath.is_file():
|
||||||
|
return FileResponse(filepath)
|
||||||
|
raise HTTPException(404)
|
||||||
|
|
||||||
|
|
||||||
@app.get("/scene/{scene_id}/preview.{ext}")
|
@app.get("/scene/{scene_id}/preview.{ext}")
|
||||||
async def scene_preview(scene_id: str, ext: str):
|
async def scene_preview(scene_id: str, ext: str):
|
||||||
from models.scene import SCENES_DIR
|
from models.scene import SCENES_DIR
|
||||||
|
|||||||
Reference in New Issue
Block a user