Skip to content

Commit d5b3ce8

Browse files
committed
fix: update download_dashboard to log specific dashboard release URLs
1 parent 80cbbfa commit d5b3ce8

1 file changed

Lines changed: 6 additions & 18 deletions

File tree

astrbot/core/utils/io.py

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -227,9 +227,11 @@ async def download_dashboard(
227227
path = os.path.join(get_astrbot_data_path(), "dashboard.zip")
228228

229229
if latest or len(str(version)) != 40:
230-
logger.info(f"准备下载 {version} 发行版本的 AstrBot WebUI 文件")
231230
ver_name = "latest" if latest else version
232231
dashboard_release_url = f"https://astrbot-registry.soulter.top/download/astrbot-dashboard/{ver_name}/dist.zip"
232+
logger.info(
233+
f"准备下载指定发行版本的 AstrBot WebUI 文件: {dashboard_release_url}"
234+
)
233235
try:
234236
await download_file(dashboard_release_url, path, show_progress=True)
235237
except BaseException as _:
@@ -241,24 +243,10 @@ async def download_dashboard(
241243
dashboard_release_url = f"{proxy}/{dashboard_release_url}"
242244
await download_file(dashboard_release_url, path, show_progress=True)
243245
else:
244-
logger.info(f"准备下载指定版本的 AstrBot WebUI: {version}")
245-
246-
url = (
247-
"https://api.github.com/repos/AstrBotDevs/astrbot-release-harbour/releases"
248-
)
246+
url = f"https://github.com/AstrBotDevs/astrbot-release-harbour/releases/download/release-{version}/dist.zip"
247+
logger.info(f"准备下载指定版本的 AstrBot WebUI: {url}")
249248
if proxy:
250249
url = f"{proxy}/{url}"
251-
async with aiohttp.ClientSession(trust_env=True) as session:
252-
async with session.get(url) as resp:
253-
if resp.status == 200:
254-
releases = await resp.json()
255-
for release in releases:
256-
if version in release["tag_name"]:
257-
download_url = release["assets"][0]["browser_download_url"]
258-
await download_file(download_url, path, show_progress=True)
259-
else:
260-
logger.warning(f"未找到指定的版本的 Dashboard 构建文件: {version}")
261-
return
262-
250+
await download_file(url, path, show_progress=True)
263251
with zipfile.ZipFile(path, "r") as z:
264252
z.extractall(extract_path)

0 commit comments

Comments
 (0)