feat: make exception for voice 043 in kr and en

This commit is contained in:
Haoyu Xu
2025-08-02 21:16:13 +08:00
parent 57d5cac582
commit 8ad0aba8cf
6 changed files with 66 additions and 13 deletions

View File

@@ -7,21 +7,43 @@ import config from '../index.ts'
import type { UpdateList, ItemToDownload, AbInfosItem } from '../types.ts'
export default async (dataDir: string) => {
const pidSet: Set<string> = new Set()
const versionRes: Response = await fetch(
'https://ak-conf.hypergryph.com/config/prod/official/Android/version'
await Promise.all(
config.servers.map(async (server) => {
const networkConfResp = await fetch(server.url)
const networkConf = JSON.parse(
(await networkConfResp.json()).content.replace('\\', '')
)
const funcVer = networkConf.funcVer
const networkConfUrls = networkConf.configs[funcVer].network
await download(dataDir, {
hv: networkConfUrls.hv.replace('{0}', 'Android'),
hu: networkConfUrls.hu,
})
})
)
}
const download = async (
dataDir: string,
urls: {
hv: string
hu: string
}
) => {
const pidSet: Set<string> = new Set()
const versionRes: Response = await fetch(urls.hv)
const version: string = (await versionRes.json()).resVersion
const lpacksRes: Response = await fetch(
`https://ak.hycdn.cn/assetbundle/official/Android/assets/${version}/hot_update_list.json`
`${urls.hu}/Android/assets/${version}/hot_update_list.json`
)
const updateList: UpdateList = await lpacksRes.json()
const itemToDownload: Set<ItemToDownload> = new Set(config.item_to_download)
updateList.abInfos.map((item: AbInfosItem) => {
if (item.name.includes(config.dynchars)) {
const id = getOperatorId(item.name).replace('.ab', '')
const alternativeId = getOperatorAlternativeId(id)
itemToDownload.add(id)
itemToDownload.add(getOperatorAlternativeId(id))
itemToDownload.add(alternativeId)
}
})
mapping.musicFiles.map((item) => {
@@ -42,7 +64,7 @@ export default async (dataDir: string) => {
pidSet.forEach((item) => {
lpacksToDownload.push({
name: item,
url: `https://ak.hycdn.cn/assetbundle/official/Android/assets/${version}/${item}.dat`,
url: `${urls.hu}/Android/assets/${version}/${item}.dat`,
})
})
const regexs = []