From cfda92d6ea5c96ad00ea89af1aae6dd42e2d3827 Mon Sep 17 00:00:00 2001 From: huangxd- <649924757@qq.com> Date: Fri, 12 Sep 2025 18:39:27 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A6=96=E9=A1=B5=E4=B8=8D=E9=9C=80=E8=A6=81to?= =?UTF-8?q?ken?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- danmu_api/worker.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/danmu_api/worker.js b/danmu_api/worker.js index 4db6b68..6e5d9a5 100644 --- a/danmu_api/worker.js +++ b/danmu_api/worker.js @@ -207,6 +207,16 @@ async function handleRequest(req, env) { let path = url.pathname; const method = req.method; + // GET / + if (path === "/" && method === "GET") { + log("log", "Accessed homepage with repository information"); + return jsonResponse({ + message: "Welcome to the Danmu API server", + repository: "https://github.com/huangxd-/danmu_api.git", + notice: "本项目仅为个人爱好开发,代码开源。如有任何侵权行为,请联系本人删除。" + }); + } + // --- 校验 token --- const parts = path.split("/").filter(Boolean); // 去掉空段 if (parts.length < 2 || parts[0] !== token) { @@ -219,16 +229,6 @@ async function handleRequest(req, env) { // 移除 token 部分,剩下的才是真正的路径 path = "/" + parts.slice(1).join("/"); - // GET / - if (path === "/" && method === "GET") { - log("log", "Accessed homepage with repository information"); - return jsonResponse({ - message: "Welcome to the Danmu API server", - repository: "https://github.com/huangxd-/danmu_api.git", - notice: "本项目仅为个人爱好开发,代码开源。如有任何侵权行为,请联系本人删除。" - }); - } - // GET /api/v2/search/anime if (path === "/api/v2/search/anime" && method === "GET") { return searchAnime(url);