11import { base } from '$app/paths' ;
22import { browser , dev } from '$app/environment' ;
3- import { env as publicEnv } from '$env/dynamic/public' ;
43import { z } from 'zod' ;
54
65const SESSION_PREFIX = 'github:oauth:pkce:' ;
@@ -22,7 +21,7 @@ function isGithubPagesHost() {
2221}
2322
2423function getOauthProxyUrl ( ) {
25- const raw = publicEnv . PUBLIC_GITHUB_OAUTH_PROXY_URL ;
24+ const raw = import . meta . env . PUBLIC_GITHUB_OAUTH_PROXY_URL ;
2625 if ( ! raw ) return null ;
2726 try {
2827 return new URL ( raw ) . toString ( ) ;
@@ -45,7 +44,7 @@ function normalizeRedirectUri(value: string) {
4544
4645export function getGithubPkceAvailability ( ) : GithubPkceAvailability {
4746 if ( ! browser ) return { supported : false , reason : 'unsupportedRuntime' } ;
48- const clientId = publicEnv . PUBLIC_GITHUB_CLIENT_ID ;
47+ const clientId = import . meta . env . PUBLIC_GITHUB_CLIENT_ID ;
4948 if ( ! clientId ) return { supported : false , reason : 'missingClientId' } ;
5049 if ( ! globalThis . crypto ?. subtle ) return { supported : false , reason : 'unsupportedRuntime' } ;
5150
@@ -61,7 +60,7 @@ export function getGithubPkceAvailability(): GithubPkceAvailability {
6160
6261export function getGithubManualTokenAllowed ( ) {
6362 // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
64- return Boolean ( dev ) || Boolean ( publicEnv . PUBLIC_GITHUB_ALLOW_MANUAL_TOKEN ) ;
63+ return Boolean ( dev ) || Boolean ( import . meta . env . PUBLIC_GITHUB_ALLOW_MANUAL_TOKEN ) ;
6564}
6665
6766export type GithubPkceStartResult =
0 commit comments