feat: add versioning support for plugin assets and improve loading status handling

This commit is contained in:
shiyu
2026-01-08 10:13:09 +08:00
parent 4e16de973c
commit b7685db0e8
2 changed files with 37 additions and 8 deletions

View File

@@ -67,10 +67,12 @@ async def delete_plugin(request: Request, key_or_id: str):
async def get_bundle(request: Request, key_or_id: str):
"""获取插件前端 bundle"""
path = await PluginService.get_bundle_path(key_or_id)
v = (request.query_params.get("v") or "").strip()
cache_control = "public, max-age=31536000, immutable" if v else "no-cache"
return FileResponse(
path,
media_type="application/javascript",
headers={"Cache-Control": "no-store"},
headers={"Cache-Control": cache_control},
)