From 815f5daa2e32836c6555b877d8746bd14e0ec70e Mon Sep 17 00:00:00 2001 From: mtvpls Date: Tue, 3 Feb 2026 22:56:29 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=AD=8C=E6=9B=B2=E5=B7=B2?= =?UTF-8?q?=E7=BC=93=E5=AD=98=E8=BF=98=E6=A3=80=E6=9F=A5openlist=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/api/music/route.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/app/api/music/route.ts b/src/app/api/music/route.ts index f0abf32..e24e5c3 100644 --- a/src/app/api/music/route.ts +++ b/src/app/api/music/route.ts @@ -142,8 +142,14 @@ async function replaceAudioUrlsWithOpenList( const audioPath = `${cachePath}/${platform}/audio/${song.id}-${quality}.mp3`; + // 如果缓存中已经标记为已缓存,且使用代理模式,直接返回代理URL + if (song.cached === true && cacheProxyEnabled) { + song.url = `/api/music/audio-proxy?platform=${platform}&id=${song.id}&quality=${quality}`; + continue; + } + try { - // 每次都动态获取最新的 raw_url(因为 OpenList 的 URL 会过期) + // 只有在未确认缓存状态时才调用 getFile() const fileResponse = await openListClient.getFile(audioPath); if (fileResponse.code === 200 && fileResponse.data?.raw_url) {