feat: 支持 AstrBot 更新使用 Github 加速地址

This commit is contained in:
崔永亮
2025-02-22 18:17:34 +08:00
parent 1fa13d0177
commit 2188ea82de
5 changed files with 16 additions and 5 deletions
+5 -1
View File
@@ -48,7 +48,7 @@ class AstrBotUpdator(RepoZipUpdator):
async def check_update(self, url: str, current_version: str) -> ReleaseInfo:
return await super().check_update(self.ASTRBOT_RELEASE_API, VERSION)
async def update(self, reboot = False, latest = True, version = None):
async def update(self, reboot = False, latest = True, version = None, proxy = ""):
update_data = await self.fetch_release_info(self.ASTRBOT_RELEASE_API, latest)
file_url = None
@@ -70,6 +70,10 @@ class AstrBotUpdator(RepoZipUpdator):
raise Exception("commit hash 长度不正确,应为 40")
logger.info(f"正在尝试更新到指定 commit: {version}")
file_url = "https://github.com/Soulter/AstrBot/archive/" + version + ".zip"
if proxy:
proxy = proxy.removesuffix("/")
file_url = f"{proxy}/{file_url}"
try:
await download_file(file_url, "temp.zip")