chore: dynamic server config

This commit is contained in:
Yidadaa 2023-05-18 02:15:30 +08:00
parent 85445c4ef2
commit 3fe521421f
1 changed files with 1 additions and 2 deletions

View File

@ -3,8 +3,6 @@ import { getServerSideConfig } from "../config/server";
import md5 from "spark-md5";
import { ACCESS_CODE_PREFIX } from "../constant";
const serverConfig = getServerSideConfig();
function getIP(req: NextRequest) {
let ip = req.ip ?? req.headers.get("x-real-ip");
const forwardedFor = req.headers.get("x-forwarded-for");
@ -34,6 +32,7 @@ export function auth(req: NextRequest) {
const hashedCode = md5.hash(accessCode ?? "").trim();
const serverConfig = getServerSideConfig();
console.log("[Auth] allowed hashed codes: ", [...serverConfig.codes]);
console.log("[Auth] got access code:", accessCode);
console.log("[Auth] hashed access code:", hashedCode);