fix: 静态文件no-cache + app.js重命名防缓存
This commit is contained in:
@@ -63,7 +63,12 @@ class WebPanelManager:
|
||||
# URL 前缀: /SenSu/static/ -> 物理路径: .../static/web_panel/
|
||||
static_dir = self.project_root / "static" / "web_panel"
|
||||
if static_dir.exists():
|
||||
app.router.add_static(f'{self.base_path}/static/', path=str(static_dir))
|
||||
# 静态文件添加 no-cache
|
||||
async def _static_handler(request):
|
||||
resp = await static_handler(request)
|
||||
resp.headers['Cache-Control'] = 'no-cache, no-store, must-revalidate'
|
||||
return resp
|
||||
app.router.add_static(f'{self.base_path}/static/', path=str(static_dir))
|
||||
logger.info(f"📂 静态资源已挂载: {self.base_path}/static/")
|
||||
else:
|
||||
logger.warning(f"⚠️ 静态目录缺失: {static_dir}")
|
||||
|
||||
Reference in New Issue
Block a user