aboutsummaryrefslogtreecommitdiff
path: root/src/routes/login.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/routes/login.ts')
-rw-r--r--src/routes/login.ts36
1 files changed, 0 insertions, 36 deletions
diff --git a/src/routes/login.ts b/src/routes/login.ts
deleted file mode 100644
index 1cd9b23..0000000
--- a/src/routes/login.ts
+++ /dev/null
@@ -1,36 +0,0 @@
-import type { RequestHandler } from '@sveltejs/kit'
-import env from '$lib/env'
-
-
-export const get: RequestHandler = async ({ request, platform }) => {
- const host = request.headers.get('host')
-
- const clientId = env(platform).DISCORD_CLIENT_ID
-
- if (!clientId)
- return {
- status: 500,
- headers: {
- 'content-type': 'text/plain',
- },
- body: 'DISCORD_CLIENT_ID is not set as an environment variable. Please contact the owner of the website if this was expected to work.',
- }
-
- if (!host)
- return {
- status: 400,
- headers: {
- 'content-type': 'text/plain',
- },
- body: 'Host header is required.',
- }
-
- const protocol = request.url.startsWith('https') ? 'https' : 'http'
-
- return {
- status: 303,
- headers: {
- location: `https://discord.com/oauth2/authorize?client_id=${clientId}&redirect_uri=${protocol}://${host}%2Floggedin&response_type=code&scope=identify`
- }
- }
-}