From bd9d3faefa0af60098127ea647c6a6026fe73431 Mon Sep 17 00:00:00 2001 From: huangxd- <649924757@qq.com> Date: Fri, 19 Sep 2025 07:28:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dedgeone=20pages=E9=83=A8?= =?UTF-8?q?=E7=BD=B2=E8=AE=BF=E9=97=AE=E4=B8=8D=E4=BA=86=E6=A0=B9=E8=B7=AF?= =?UTF-8?q?=E5=BE=84=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- danmu_api/worker.js | 2 +- node-functions/index.js | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/danmu_api/worker.js b/danmu_api/worker.js index 7ac6785..66b4cad 100644 --- a/danmu_api/worker.js +++ b/danmu_api/worker.js @@ -1,6 +1,6 @@ // 全局状态(Cloudflare 和 Vercel 都可能重用实例) // ⚠️ 不是持久化存储,每次冷启动会丢失 -const VERSION = "1.0.3"; +const VERSION = "1.0.4"; let animes = []; let episodeIds = []; let episodeNum = 10001; // 全局变量,用于自增 ID diff --git a/node-functions/index.js b/node-functions/index.js index 75c9b04..27cd4cc 100644 --- a/node-functions/index.js +++ b/node-functions/index.js @@ -13,7 +13,14 @@ export const onRequest = async (context) => { // 构造完整的 URL let fullUrl; try { - fullUrl = new URL(request.url, baseUrl).toString(); + let targetUrl = request.url; + + // 判断是否包含 node-functions/index.js,如果是则用 / 代替 + if (request.url.includes('node-functions/index.js')) { + targetUrl = '/'; + } + + fullUrl = new URL(targetUrl, baseUrl).toString(); console.log('Request fullUrl:', fullUrl); } catch (error) { console.error('URL Construction Error:', error);