Skip to content

Commit 718449d

Browse files
authored
fix(core): use correct asset filename in GitHub fallback download URL (AstrBotDevs#8046)
* fix(core): use correct asset filename in GitHub fallback download URL * fix(core):resolve the tag via GitHub API with certifi SSL and proxy support.
1 parent d1059cd commit 718449d

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

astrbot/core/utils/io.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,9 +289,23 @@ async def download_dashboard(
289289
)
290290
except BaseException as _:
291291
if latest:
292-
dashboard_release_url = "https://github.com/AstrBotDevs/AstrBot/releases/latest/download/dist.zip"
292+
# Resolve latest release tag from GitHub API to construct correct asset URL
293+
ssl_context = ssl.create_default_context(cafile=certifi.where())
294+
async with aiohttp.ClientSession(
295+
connector=aiohttp.TCPConnector(ssl=ssl_context),
296+
trust_env=True,
297+
) as session:
298+
async with session.get(
299+
"https://api.github.com/repos/AstrBotDevs/AstrBot/releases/latest",
300+
timeout=30,
301+
headers={"Accept": "application/vnd.github+json"},
302+
) as api_resp:
303+
api_resp.raise_for_status()
304+
release_data = await api_resp.json()
305+
tag = release_data["tag_name"]
293306
else:
294-
dashboard_release_url = f"https://github.com/AstrBotDevs/AstrBot/releases/download/{version}/dist.zip"
307+
tag = version
308+
dashboard_release_url = f"https://github.com/AstrBotDevs/AstrBot/releases/download/{tag}/AstrBot-{tag}-dashboard.zip"
295309
if proxy:
296310
dashboard_release_url = f"{proxy}/{dashboard_release_url}"
297311
await download_file(

0 commit comments

Comments
 (0)