1. 修复token异常问题

This commit is contained in:
ACT丶流星雨 2026-01-30 22:47:51 +08:00
parent c567e7fa87
commit 13fa6e0723

View File

@ -45,7 +45,8 @@ export default async function startServe() {
if (!setting) return res.status(500).send({ message: "服务器未配置,请联系管理员" }); if (!setting) return res.status(500).send({ message: "服务器未配置,请联系管理员" });
const { tokenKey } = setting; const { tokenKey } = setting;
// 从 header 或 query 参数获取 token // 从 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(); if (req.path === "/other/login") return next();