playurl 的 baseUrl 大概率落在 PCDN(京东云无线宝 mcdn.bilivideo.cn、迅雷 mountaintoys 等),旧代码只取 baseUrl(backupUrl 0 处使用)且探测失败仍 原样返回坏地址,点歌端连 PCDN 挂死。现候选 = baseUrl+backupUrl 按 host 分级(upos/Akamai 正规 CDN > cn-* 等 bilivideo.com 系 > PCDN),探测改为 fetch 只读响应头即断开(不等 body,CDN 忽略 Range 回 200 全量时不再整文件 缓冲),单跳 8s / 总预算 20s / 至多 3 候选,全败回退最优候选(fail-soft); CDN 探测不再携带 Cookie(直链自带签名,避免登录态泄给第三方 PCDN 域名)。 getAudioUrl 返回 urls[],parse 改取 urls[0]。 新增 test/bili-cdn-test.ts(SDK 层 PCDN 硬断言,并入 pnpm test)与 smoke 「URL bili(CDN 分级选址)」软断言项。
34 lines
861 B
JSON
34 lines
861 B
JSON
{
|
|
"name": "music-server",
|
|
"version": "1.0.0",
|
|
"description": "多平台音乐聚合服务器",
|
|
"type": "module",
|
|
"main": "sdk/index.ts",
|
|
"packageManager": "pnpm@12.4.1",
|
|
"scripts": {
|
|
"typecheck": "tsc",
|
|
"start": "node src/server.ts",
|
|
"dev": "node scripts/dev.mjs",
|
|
"test": "pnpm run typecheck && node test/source-simple-test.ts && node test/bili-cdn-test.ts && node test/smoke-test.ts"
|
|
},
|
|
"dependencies": {
|
|
"@fastify/cors": "^11.3.0",
|
|
"@fastify/swagger": "^9.8.1",
|
|
"@fastify/swagger-ui": "^6.1.1",
|
|
"crypto-js": "^4.2.0",
|
|
"fastify": "^5.12.1",
|
|
"iconv-lite": "^0.6.3",
|
|
"isolated-vm": "^7.0.1",
|
|
"pako": "^2.1.0",
|
|
"qrcode": "^1.5.4"
|
|
},
|
|
"devDependencies": {
|
|
"@types/node": "^26.4.0",
|
|
"playwright": "^1.62.1",
|
|
"typescript": "^7.0.2"
|
|
},
|
|
"engines": {
|
|
"node": ">=22.18"
|
|
}
|
|
}
|