This commit is contained in:
payacom
2026-07-16 20:08:49 +03:30
parent 39b12a0986
commit 58314d0ab5
40 changed files with 986 additions and 535 deletions

View File

@@ -5,6 +5,21 @@ type ProxyOptions = {
stripAuth?: boolean;
};
const PUBLIC_AUTH_PATTERNS = [
/^\/login\/?$/,
/^\/login\/verify$/,
/^\/login\/login_username$/,
/^\/login\/forgot_password$/,
/^\/register\/?$/,
/^\/register\/verify$/,
/^\/auth\/google$/,
];
export function isPublicAuthPath(pathSegments: string[]): boolean {
const path = `/${pathSegments.join("/")}`;
return PUBLIC_AUTH_PATTERNS.some((pattern) => pattern.test(path));
}
export async function proxyToUpstream(
req: Request,
upstreamPath: string,
@@ -43,8 +58,3 @@ export async function proxyToUpstream(
headers: responseHeaders,
});
}
export function isPublicAuthPath(pathSegments: string[]): boolean {
const path = pathSegments.join("/");
return path.startsWith("login") || path.startsWith("register");
}