修复OpenList缓存未启用时仍走代理的问题
在replaceAudioUrlsWithOpenList函数中添加OpenListCacheEnabled检查, 确保只有在启用OpenList缓存时才会执行代理逻辑。
This commit is contained in:
@@ -125,14 +125,16 @@ async function replaceAudioUrlsWithOpenList(
|
|||||||
quality: string,
|
quality: string,
|
||||||
cachePath: string
|
cachePath: string
|
||||||
): Promise<any> {
|
): Promise<any> {
|
||||||
if (!openListClient || !data?.data) {
|
// 获取配置,检查是否启用 OpenList 缓存
|
||||||
|
const config = await getConfig();
|
||||||
|
const cacheEnabled = config?.MusicConfig?.OpenListCacheEnabled ?? false;
|
||||||
|
const cacheProxyEnabled = config?.MusicConfig?.OpenListCacheProxyEnabled ?? true;
|
||||||
|
|
||||||
|
// 如果没有启用 OpenList 缓存,直接返回原数据
|
||||||
|
if (!cacheEnabled || !openListClient || !data?.data) {
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取配置,检查是否启用缓存代理
|
|
||||||
const config = await getConfig();
|
|
||||||
const cacheProxyEnabled = config?.MusicConfig?.OpenListCacheProxyEnabled ?? true;
|
|
||||||
|
|
||||||
// TuneHub 返回的数据结构是 { code: 0, data: { data: [...], total: 1 } }
|
// TuneHub 返回的数据结构是 { code: 0, data: { data: [...], total: 1 } }
|
||||||
// 需要提取内层的 data 数组
|
// 需要提取内层的 data 数组
|
||||||
const songsData = data.data.data || data.data;
|
const songsData = data.data.data || data.data;
|
||||||
|
|||||||
Reference in New Issue
Block a user