feat: 迁移自定义功能至 1.5.9.9 版本
包含音乐源限制、CI 防 OOM 优化、数据库连接池优化、管理端权限及 UI 细节定制等功能
This commit is contained in:
@@ -59,7 +59,7 @@ export interface SourceStatus {
|
||||
export interface MusicSearchParams {
|
||||
/** 搜索关键词 */
|
||||
keywords: string
|
||||
/** 音乐平台:tencent=QQ音乐, netease=网易云音乐 */
|
||||
/** 音乐平台:目前仅支持 kugou=酷狗音乐 */
|
||||
platform?: string
|
||||
/** 返回数量限制 */
|
||||
limit?: number
|
||||
@@ -67,8 +67,6 @@ export interface MusicSearchParams {
|
||||
offset?: number
|
||||
/** 搜索类型:1=单曲, 10=专辑, 100=歌手, 1000=歌单, 1009=播客/电台, 2000=声音 */
|
||||
type?: number
|
||||
/** 网易云音乐Cookie */
|
||||
cookie?: string
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -111,88 +109,24 @@ export interface SongDetailResult {
|
||||
|
||||
/**
|
||||
* 默认音源配置
|
||||
* 内置网易云和 QQ 音乐音源只保留已验证可用的请求路径。
|
||||
* 包含主音源 Vkeys 和两个网易云备用音源端点
|
||||
*/
|
||||
export const MUSIC_SOURCE_CONFIG: MusicSourceConfig = {
|
||||
primarySource: 'netease-backup-1',
|
||||
enableFailover: true,
|
||||
primarySource: 'kugou',
|
||||
enableFailover: false,
|
||||
timeout: 10000,
|
||||
retryAttempts: 2,
|
||||
sources: [
|
||||
{
|
||||
id: 'netease-backup-1',
|
||||
name: 'NeteaseCloudMusicApi',
|
||||
baseUrl: '/api/api-enhanced/netease',
|
||||
id: 'kugou',
|
||||
name: '酷狗音乐',
|
||||
baseUrl: '/api/music',
|
||||
priority: 1,
|
||||
enabled: true,
|
||||
timeout: 8000,
|
||||
timeout: 10000,
|
||||
headers: {
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36'
|
||||
}
|
||||
},
|
||||
{
|
||||
id: 'vkeys-v3',
|
||||
name: 'Vkeys QQ 音乐 (v3)',
|
||||
baseUrl: 'https://api.vkeys.cn/music',
|
||||
priority: 2,
|
||||
enabled: true,
|
||||
timeout: 10000
|
||||
},
|
||||
{
|
||||
id: 'vkeys',
|
||||
name: 'Vkeys QQ 音乐 (v2)',
|
||||
baseUrl: 'https://api.vkeys.cn/v2/music',
|
||||
priority: 3,
|
||||
enabled: true,
|
||||
timeout: 10000
|
||||
},
|
||||
{
|
||||
id: 'ygking-qq',
|
||||
name: 'Ygking QQ 音乐备用',
|
||||
baseUrl: 'https://api.ygking.top/api/song/url',
|
||||
priority: 4,
|
||||
enabled: true,
|
||||
timeout: 8000
|
||||
},
|
||||
{
|
||||
id: 'netease-gdstudio',
|
||||
name: 'GD Studio 网易云',
|
||||
baseUrl: 'https://music-api.gdstudio.xyz/api.php',
|
||||
priority: 5,
|
||||
enabled: true,
|
||||
timeout: 10000
|
||||
},
|
||||
{
|
||||
id: 'meting-1',
|
||||
name: 'Meting API 网易云备用源1',
|
||||
baseUrl: 'https://api.qijieya.cn/meting/',
|
||||
priority: 6,
|
||||
enabled: true,
|
||||
timeout: 8000
|
||||
},
|
||||
{
|
||||
id: 'meting-2',
|
||||
name: 'Meting API 网易云备用源2',
|
||||
baseUrl: 'https://api.injahow.cn/meting/',
|
||||
priority: 7,
|
||||
enabled: true,
|
||||
timeout: 8000
|
||||
},
|
||||
{
|
||||
id: 'bilibili',
|
||||
name: '哔哩哔哩',
|
||||
baseUrl: 'https://api.bilibili.com',
|
||||
priority: 8,
|
||||
enabled: true,
|
||||
timeout: 10000
|
||||
},
|
||||
{
|
||||
id: 'migu',
|
||||
name: '咪咕音乐',
|
||||
baseUrl: '/api/native-api/migu/playurl',
|
||||
priority: 9,
|
||||
enabled: true,
|
||||
timeout: 10000
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -226,28 +160,3 @@ export function getPrimarySource(): MusicSource | undefined {
|
||||
export function getBackupSources(): MusicSource[] {
|
||||
return getEnabledSources().filter((source) => source.id !== MUSIC_SOURCE_CONFIG.primarySource)
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否为纯数字(旧版 QQ 音乐数字 id)
|
||||
*/
|
||||
function isNumericId(id: string | number): boolean {
|
||||
return /^\d+$/.test(String(id))
|
||||
}
|
||||
|
||||
/**
|
||||
* 构造 vkeys 请求的身份参数
|
||||
* 网易云始终用 id;QQ 音乐旧版数字 id 用 id,新版 mid 用 mid
|
||||
*/
|
||||
export function getVkeysIdParam(
|
||||
platform: 'netease' | 'tencent',
|
||||
musicId: string | number
|
||||
): { key: string; value: string } {
|
||||
if (platform === 'netease') {
|
||||
return { key: 'id', value: String(musicId) }
|
||||
}
|
||||
// tencent
|
||||
if (isNumericId(musicId)) {
|
||||
return { key: 'id', value: String(musicId) }
|
||||
}
|
||||
return { key: 'mid', value: String(musicId) }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user