From e217c87df4f97d9fb9eb2463a24b81480750d45b Mon Sep 17 00:00:00 2001 From: huangxd- <649924757@qq.com> Date: Thu, 2 Oct 2025 22:24:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=9F=A9=E5=89=A7tv(?= =?UTF-8?q?=E9=9F=A9=E5=B0=8F=E5=9C=88)=E5=BC=B9=E5=B9=95=E6=BA=90?= =?UTF-8?q?=E5=9C=A8hills=E5=92=8CAfuseKt=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 | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/danmu_api/worker.js b/danmu_api/worker.js index 998c5b8..5a7a50b 100644 --- a/danmu_api/worker.js +++ b/danmu_api/worker.js @@ -1,6 +1,6 @@ // 全局状态(Cloudflare 和 Vercel 都可能重用实例) // ⚠️ 不是持久化存储,每次冷启动会丢失 -const VERSION = "1.2.1"; +const VERSION = "1.2.2"; let animes = []; let episodeIds = []; let episodeNum = 10001; // 全局变量,用于自增 ID @@ -987,7 +987,9 @@ function convertToAsciiSum(sid) { for (let i = 0; i < sid.length; i++) { hash = (hash * 33) ^ sid.charCodeAt(i); } - return hash >>> 0; + hash = (hash >>> 0) % 9999999; + // 确保至少 5 位 + return hash < 10000 ? hash + 10000 : hash; } function canConvertToNumber(url) { @@ -3594,6 +3596,8 @@ async function handleRequest(req, env) { let path = url.pathname; const method = req.method; + log("info", `request url: ${JSON.stringify(url)}`); + function handleHomepage() { log("log", "Accessed homepage with repository information"); return jsonResponse({