Merge remote-tracking branch 'origin/dev-1.8.0' into dev-1.8.0

This commit is contained in:
LukeGus
2025-10-21 22:09:16 -05:00
5 changed files with 143 additions and 105 deletions

View File

@@ -239,12 +239,19 @@ class AuthManager {
createAdminMiddleware() {
return async (req: Request, res: Response, next: NextFunction) => {
const authHeader = req.headers["authorization"];
if (!authHeader?.startsWith("Bearer ")) {
return res.status(401).json({ error: "Missing Authorization header" });
let token = req.cookies?.jwt;
if (!token) {
const authHeader = req.headers["authorization"];
if (authHeader?.startsWith("Bearer ")) {
token = authHeader.split(" ")[1];
}
}
if (!token) {
return res.status(401).json({ error: "Missing authentication token" });
}
const token = authHeader.split(" ")[1];
const payload = await this.verifyJWTToken(token);
if (!payload) {