diff --git a/astrbot/core/utils/io.py b/astrbot/core/utils/io.py index bc5d1f77d..1d0f77b76 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 24184354c..426deb38a 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: