diff --git a/packages/main/componentManager/installers/core.ts b/packages/main/componentManager/installers/core.ts index e3618bd7..31b4a459 100644 --- a/packages/main/componentManager/installers/core.ts +++ b/packages/main/componentManager/installers/core.ts @@ -15,28 +15,28 @@ export default class CoreInstaller extends InstallerBase { name: 'GitHub', urlReplacer: oldUrl => { const urlMatches = - /^https:\/\/(.+)\/MaaAssistantArknights\/MaaAssistantArknights\/releases\/download\/(.+)\/(.+)$/.exec( + /^https:\/\/(.+)\/MaaAssistantArknights\/MaaRelease\/releases\/download\/(.+)\/(.+)$/.exec( oldUrl ) if (!urlMatches) { throw new Error(`Invalid update url: ${oldUrl}`) } const [, host, version, filename] = urlMatches - return `https://github.com/MaaAssistantArknights/MaaAssistantArknights/releases/download/${version}/${filename}` + return `https://github.com/MaaAssistantArknights/MaaRelease/releases/download/${version}/${filename}` }, }, { name: '国内镜像', urlReplacer: oldUrl => { const urlMatches = - /^https:\/\/(.+)\/MaaAssistantArknights\/MaaAssistantArknights\/releases\/download\/(.+)\/(.+)$/.exec( + /^https:\/\/(.+)\/MaaAssistantArknights\/MaaRelease\/releases\/download\/(.+)\/(.+)$/.exec( oldUrl ) if (!urlMatches) { throw new Error(`Invalid update url: ${oldUrl}`) } const [, host, version, filename] = urlMatches - return `https://s3.maa-org.net:25240/maa-release/MaaAssistantArknights/MaaAssistantArknights/releases/download/${version}/${filename}` + return `https://s3.maa-org.net:25240/maa-release/MaaAssistantArknights/MaaRelease/releases/download/${version}/${filename}` }, }, // TODO: Maa R2 Bucket Replacer diff --git a/packages/main/componentManager/utils/release.ts b/packages/main/componentManager/utils/release.ts index 30f5a015..66a48174 100644 --- a/packages/main/componentManager/utils/release.ts +++ b/packages/main/componentManager/utils/release.ts @@ -1,6 +1,6 @@ import logger from '@main/utils/logger' import type { ComponentType } from '@type/componentManager' -import axios from 'axios' +import axios, { type AxiosResponse } from 'axios' import type { ReleaseObject } from '../types' import { getProxy } from './proxy' @@ -42,10 +42,16 @@ export function createGetRelease(urls: string[], component: ComponentType) { } for (const url of urls) { - const result = await tryRequest(url, component) + const result = await tryRequest(url, component) as AxiosResponse + // 由于资源链接变更,需要 merge 资源链接里所有的 assets 数组来查找到可用的最新下载源 + const assets = result?.data?.reduce((prev, curr) => prev.concat(curr?.assets ?? []), [] as ReleaseObject['assets']) if (result) { cache = { - data: result.data[0], + data: { + assets: assets!, + tag_name: result?.data?.[0].tag_name!, + published_at: result?.data?.[0].published_at!, + }, updated: Date.now(), } }