From c4bfa5979c5ee2b366120d2ee9c1076f301f4db8 Mon Sep 17 00:00:00 2001 From: hubian <908234780@qq.com> Date: Thu, 16 Apr 2026 11:01:51 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=A6=81=E7=94=A8=E9=9D=99=E6=80=81?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E7=BC=93=E5=AD=98=EF=BC=8C=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=8F=B7=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/app.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/web/app.py b/web/app.py index abf6077..29e8982 100644 --- a/web/app.py +++ b/web/app.py @@ -37,9 +37,14 @@ async def get_image(filename: str): @app.get("/", response_class=HTMLResponse) async def index(): """主页""" + # 添加时间戳参数防止缓存 index_file = STATIC_DIR / "index.html" if index_file.exists(): - return FileResponse(str(index_file)) + content = index_file.read_text(encoding='utf-8') + # 在引用静态文件时添加版本参数 + content = content.replace('/static/style.css', '/static/style.css?v=1.1') + content = content.replace('/static/app.js', '/static/app.js?v=1.1') + return HTMLResponse(content=content) return HTMLResponse("