From 13fa6e07230eaee4dbdce8bc82c782ed8e526a02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?ACT=E4=B8=B6=E6=B5=81=E6=98=9F=E9=9B=A8?= <1340145680@qq.com> Date: Fri, 30 Jan 2026 22:47:51 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E4=BF=AE=E5=A4=8Dtoken=E5=BC=82=E5=B8=B8?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/app.ts b/src/app.ts index 4d1b8c9..5f2e6d5 100644 --- a/src/app.ts +++ b/src/app.ts @@ -45,7 +45,8 @@ export default async function startServe() { if (!setting) return res.status(500).send({ message: "服务器未配置,请联系管理员" }); const { tokenKey } = setting; // 从 header 或 query 参数获取 token - const token = req.headers.authorization?.replace("Bearer ", "") || (req.query.token as string).replace("Bearer ", ""); + const rawToken = req.headers.authorization || (req.query.token as string) || ""; +const token = rawToken.replace("Bearer ", ""); // 白名单路径 if (req.path === "/other/login") return next();