fix: revert 3106 (#3153)

* fix: revert 3106

Co-authored-by: Dt8333 <25431943+Dt8333@users.noreply.github.com>
Co-authored-by: LIghtJUNction <lightjunction.me@gmail.com>
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 <lightjunction.me@gmail.com>
Co-authored-by: exynos <110159911+xiaoxi68@users.noreply.github.com>
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
This commit is contained in:
Soulter
2025-10-26 21:26:48 +08:00
committed by GitHub
parent 594f0fed55
commit 0622d88b22
2 changed files with 2 additions and 21 deletions
-11
View File
@@ -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}")
+2 -10
View File
@@ -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: