fix: protect admin routes and ignore local docs

This commit is contained in:
Simo committed 2026-07-11 21:35:37 +02:00
1 parent 6a08db8dd0
commit 17264dfc06
6 files changed
+37 -413

No files matched your search

+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;
}