File tree Expand file tree Collapse file tree 4 files changed +18
-9
lines changed Expand file tree Collapse file tree 4 files changed +18
-9
lines changed Original file line number Diff line number Diff line change @@ -2,8 +2,8 @@ PUBLIC_SITE_URL=http://thunderstore.temp
22PUBLIC_API_URL = http://thunderstore.temp
33AUTH_ENABLED =
44AUTH_SECRET = development
5- PUBLIC_AUTH_BASE_URL = https://auth.thunderstore.io/auth/login
6- PUBLIC_AUTH_RETURN_URL = ?next= https%3A%2F%2Fbeta .thunderstore.io%2F
5+ PUBLIC_AUTH_BASE_URL = https://auth.thunderstore.io
6+ PUBLIC_AUTH_RETURN_URL = https%3A%2F%2Fnew .thunderstore.io
77PUBLIC_AUTH_DISCORD_URL = $PUBLIC_AUTH_BASE_URL /discord/
88PUBLIC_AUTH_GITHUB_URL = $PUBLIC_AUTH_BASE_URL /github/
99PUBLIC_AUTH_OVERWOLF_URL = $PUBLIC_AUTH_BASE_URL /overwolf/
Original file line number Diff line number Diff line change @@ -86,6 +86,8 @@ export async function loader() {
8686 "PUBLIC_API_URL" ,
8787 "PUBLIC_CLIENT_SENTRY_DSN" ,
8888 "PUBLIC_SITE_URL" ,
89+ "PUBLIC_AUTH_BASE_URL" ,
90+ "PUBLIC_AUTH_RETURN_URL" ,
8991 ] ) ,
9092 } ,
9193 } ;
Original file line number Diff line number Diff line change @@ -8,6 +8,8 @@ type rootLoaderType = {
88 PUBLIC_API_URL ?: string ;
99 PUBLIC_CLIENT_SENTRY_DSN ?: string ;
1010 PUBLIC_SITE_URL ?: string ;
11+ PUBLIC_AUTH_BASE_URL ?: string ;
12+ PUBLIC_AUTH_RETURN_URL ?: string ;
1113 } ;
1214 } ;
1315 } ;
@@ -23,12 +25,18 @@ export const isRootLoaderData = (obj: unknown): obj is rootLoaderType =>
2325 ( typeof obj . root . envStuff . ENV . PUBLIC_CLIENT_SENTRY_DSN === "string" ||
2426 typeof obj . root . envStuff . ENV . PUBLIC_CLIENT_SENTRY_DSN === "undefined" ) &&
2527 ( typeof obj . root . envStuff . ENV . PUBLIC_SITE_URL === "string" ||
26- typeof obj . root . envStuff . ENV . PUBLIC_SITE_URL === "undefined" ) ;
28+ typeof obj . root . envStuff . ENV . PUBLIC_SITE_URL === "undefined" ) &&
29+ ( typeof obj . root . envStuff . ENV . PUBLIC_AUTH_BASE_URL === "string" ||
30+ typeof obj . root . envStuff . ENV . PUBLIC_AUTH_BASE_URL === "undefined" ) &&
31+ ( typeof obj . root . envStuff . ENV . PUBLIC_AUTH_RETURN_URL === "string" ||
32+ typeof obj . root . envStuff . ENV . PUBLIC_AUTH_RETURN_URL === "undefined" ) ;
2733
2834export type publicEnvVariablesKeys =
2935 | "SITE_URL"
3036 | "API_URL"
31- | "CLIENT_SENTRY_DSN" ;
37+ | "CLIENT_SENTRY_DSN"
38+ | "AUTH_BASE_URL"
39+ | "AUTH_RETURN_URL" ;
3240
3341export type PublicPrefix < envVariable extends string > = `PUBLIC_${envVariable } `;
3442
Original file line number Diff line number Diff line change @@ -6,12 +6,11 @@ interface Props {
66}
77
88export function buildAuthLoginUrl ( props : Props ) {
9- const PUBLIC_API_URL = getPublicEnvVariables ( [
10- "PUBLIC_API_URL" ,
11- ] ) . PUBLIC_API_URL ;
12- return `${ PUBLIC_API_URL } /auth/login/${ props . type } /${
9+ const { PUBLIC_AUTH_BASE_URL , PUBLIC_AUTH_RETURN_URL } =
10+ getPublicEnvVariables ( [ "PUBLIC_AUTH_BASE_URL" , "PUBLIC_AUTH_RETURN_URL" ] ) ;
11+ return `${ PUBLIC_AUTH_BASE_URL } /auth/login/${ props . type } /${
1312 props . nextUrl
1413 ? `?next=${ encodeURIComponent ( props . nextUrl ) } `
15- : `?next=${ encodeURIComponent ( `${ PUBLIC_API_URL } /communities/` ) } `
14+ : `?next=${ encodeURIComponent ( `${ PUBLIC_AUTH_RETURN_URL } /communities/` ) } `
1615 } `;
1716}
You can’t perform that action at this time.
0 commit comments