feat: 支持 AstrBot 更新使用 Github 加速地址
This commit is contained in:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user