fix: protect admin routes and ignore local docs

This commit is contained in:
simoleo89
2026-07-11 21:35:37 +02:00
parent 6a08db8dd0
commit 17264dfc06
6 changed files with 37 additions and 413 deletions
+9
View File
@@ -0,0 +1,9 @@
export interface ProxyToken {
rank?: unknown;
}
export function shouldRedirectAdminRequest(pathname: string, token: ProxyToken | null): boolean {
if (pathname !== "/admin" && !pathname.startsWith("/admin/")) return false;
const rank = typeof token?.rank === "number" ? token.rank : Number(token?.rank);
return !Number.isInteger(rank) || rank < 7;
}