diff --git a/src/config.ts b/src/config.ts index acb71a8..58dfcea 100644 --- a/src/config.ts +++ b/src/config.ts @@ -1,15 +1,6 @@ +import { env } from '$env/dynamic/private'; + export const GH_STATE_COOKIE_NAME = 'gh_state'; export const GH_ACCESS_TOKEN_COOKIE_NAME = 'gh_token'; - -let GH_CLIENT_ID_; -let GH_CLIENT_SECRET_; -if (process.env) { - GH_CLIENT_ID_ = process.env['GH_CLIENT_ID']; - GH_CLIENT_SECRET_ = process.env['GH_CLIENT_SECRET']; -} else { - GH_CLIENT_ID_ = (Deno as any).env.get('GH_CLIENT_ID'); - GH_CLIENT_SECRET_ = (Deno as any).env.get('GH_CLIENT_SECRET'); -} - -export const GH_CLIENT_ID = GH_CLIENT_ID_; -export const GH_CLIENT_SECRET = GH_CLIENT_SECRET_; +export const GH_CLIENT_ID = env['GH_CLIENT_ID']; +export const GH_CLIENT_SECRET = env['GH_CLIENT_SECRET']; diff --git a/src/routes/publish/github/+page.server.ts b/src/routes/publish/github/+page.server.ts new file mode 100644 index 0000000..04b2c5b --- /dev/null +++ b/src/routes/publish/github/+page.server.ts @@ -0,0 +1,8 @@ +export const csr = false; + +import { GH_CLIENT_ID } from '../../../config'; +import type { PageLoad } from './$types'; + +export const load = (({ params, url }) => { + return { GH_CLIENT_ID, state: crypto.randomUUID(), href: url.href }; +}) satisfies PageLoad; diff --git a/src/routes/publish/github/+page.svelte b/src/routes/publish/github/+page.svelte index 7b5aaf0..2fef7b6 100644 --- a/src/routes/publish/github/+page.svelte +++ b/src/routes/publish/github/+page.svelte @@ -1,7 +1,7 @@ -

@@ -23,12 +23,10 @@
Login to GitHub
- -
diff --git a/src/routes/publish/github/auth_callback/+page.svelte b/src/routes/publish/github/auth_callback/+page.svelte new file mode 100644 index 0000000..5a761db --- /dev/null +++ b/src/routes/publish/github/auth_callback/+page.svelte @@ -0,0 +1 @@ +Auth callback