From 0622d88b220254e00a03ff88a4dd7ac042e5d8bc Mon Sep 17 00:00:00 2001 From: Soulter <37870767+Soulter@users.noreply.github.com> Date: Sun, 26 Oct 2025 21:26:48 +0800 Subject: [PATCH] fix: revert 3106 (#3153) * fix: revert 3106 Co-authored-by: Dt8333 <25431943+Dt8333@users.noreply.github.com> Co-authored-by: LIghtJUNction Co-authored-by: exynos <110159911+xiaoxi68@users.noreply.github.com> * Update astrbot/dashboard/routes/update.py Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com> * fix: remove unnecessary version file handling in download_dashboard function * fix: revert --------- Co-authored-by: Dt8333 <25431943+Dt8333@users.noreply.github.com> Co-authored-by: LIghtJUNction Co-authored-by: exynos <110159911+xiaoxi68@users.noreply.github.com> Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com> --- astrbot/core/utils/io.py | 11 ----------- astrbot/dashboard/routes/update.py | 12 ++---------- 2 files changed, 2 insertions(+), 21 deletions(-) diff --git a/astrbot/core/utils/io.py b/astrbot/core/utils/io.py index bc5d1f77..1d0f77b7 100644 --- a/astrbot/core/utils/io.py +++ b/astrbot/core/utils/io.py @@ -233,8 +233,6 @@ async def download_dashboard( else: zip_path = Path(path).absolute() - version_file = zip_path.parent / "dist" / "assets" / "version" - if latest or len(str(version)) != 40: ver_name = "latest" if latest else version dashboard_release_url = f"https://astrbot-registry.soulter.top/download/astrbot-dashboard/{ver_name}/dist.zip" @@ -263,12 +261,3 @@ async def download_dashboard( await download_file(url, str(zip_path), show_progress=True) with zipfile.ZipFile(zip_path, "r") as z: z.extractall(extract_path) - - if version_file.exists(): - return - - # 写入dist/version - # https://github.com/AstrBotDevs/AstrBot/pull/3106 - # 实际上压根没有dist/version文件,这里需要写入 - with version_file.open("w") as f: - f.write(f"{version}") diff --git a/astrbot/dashboard/routes/update.py b/astrbot/dashboard/routes/update.py index 24184354..426deb38 100644 --- a/astrbot/dashboard/routes/update.py +++ b/astrbot/dashboard/routes/update.py @@ -52,17 +52,10 @@ class UpdateRoute(Route): try: dv = await get_dashboard_version() - # WebUI 版本独立于核心版本:不再用 dv 与 v{VERSION} 比较,避免误报 if type_ == "dashboard": return ( Response() - .ok( - { - "has_new_version": False, - "current_version": dv, - "installed": bool(dv), - } - ) + .ok({"has_new_version": dv != f"v{VERSION}", "current_version": dv}) .__dict__ ) else: @@ -74,8 +67,7 @@ class UpdateRoute(Route): "version": f"v{VERSION}", "has_new_version": ret is not None, "dashboard_version": dv, - # dv正常获取则不会提示需要更新 - "dashboard_has_new_version": not bool(dv), + "dashboard_has_new_version": bool(dv and dv != f"v{VERSION}"), }, ).__dict__ except Exception as e: