mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-09-15 15:15:29 +02:00
feat: unify GitHub sign-in and connect OAuth for gists
This commit is contained in:
@@ -20,3 +20,18 @@ export function getLoginToken(
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
export function safeAuthReturnTo(value: unknown, fallback = "/dashboard"): string {
|
||||
return typeof value === "string" && /^\/(?:(?:anonymize|pull-request-anonymize|gist-anonymize)(?:\/[\w-]+)?|connections|dashboard)(?:\?[^\\\r\n]*)?$/.test(value) ? value : fallback;
|
||||
}
|
||||
|
||||
export type OAuthContext = { ownerId?: string; githubId?: string; returnTo: string; expires: number; recovery?: boolean };
|
||||
declare module "express-session" {
|
||||
interface SessionData {
|
||||
githubRecovery?: OAuthContext;
|
||||
githubOAuthFlow?: OAuthContext;
|
||||
}
|
||||
}
|
||||
declare module "express-serve-static-core" {
|
||||
interface Request { githubOAuthContext?: OAuthContext; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user