feat: 支持升级的同时更新到指定版本的 WebUI

This commit is contained in:
Soulter
2025-08-31 19:55:46 +08:00
parent c1202cda63
commit b1e4bff3ec
8 changed files with 65 additions and 32 deletions
+3 -3
View File
@@ -89,7 +89,6 @@ class AstrBotUpdator(RepoZipUpdator):
file_url = update_data[0]["zipball_url"]
elif str(version).startswith("v"):
# 更新到指定版本
logger.info(f"正在更新到指定版本: {version}")
for data in update_data:
if data["tag_name"] == version:
file_url = data["zipball_url"]
@@ -98,8 +97,8 @@ class AstrBotUpdator(RepoZipUpdator):
else:
if len(str(version)) != 40:
raise Exception("commit hash 长度不正确,应为 40")
logger.info(f"正在尝试更新到指定 commit: {version}")
file_url = "https://github.com/Soulter/AstrBot/archive/" + version + ".zip"
file_url = f"https://github.com/Soulter/AstrBot/archive/{version}.zip"
logger.info(f"准备更新至指定版本的 AstrBot Core: {version}")
if proxy:
proxy = proxy.removesuffix("/")
@@ -107,6 +106,7 @@ class AstrBotUpdator(RepoZipUpdator):
try:
await download_file(file_url, "temp.zip")
logger.info("下载 AstrBot Core 更新文件完成,正在执行解压...")
self.unzip_file("temp.zip", self.MAIN_PATH)
except BaseException as e:
raise e