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);