This commit is contained in:
2025-12-03 13:44:22 -03:00
parent 1b4cbbce6c
commit 967e275f29
2 changed files with 5 additions and 14 deletions

View File

@@ -12,16 +12,11 @@ export async function loader({ request, context }: Route.LoaderArgs) {
loginUrl.search = url.search
if (!cookies?.SID) {
return new Response(null, {
status: 302,
headers: {
Location: loginUrl.toString()
}
})
throw redirect(loginUrl.toString())
}
if (!url.searchParams.has('client_id')) {
throw redirect('https://scorm.eduseg.workers.dev/')
throw redirect(context.cloudflare.env.APP_URL)
}
const r = await fetch(issuerUrl.toString(), {
@@ -34,7 +29,7 @@ export async function loader({ request, context }: Route.LoaderArgs) {
})
if (r.status === 302) {
return new Response(await r.text(), {
return new Response(null, {
status: r.status,
headers: r.headers
})
@@ -45,10 +40,5 @@ export async function loader({ request, context }: Route.LoaderArgs) {
throw redirect(new URL('/deny', url.origin).toString())
}
return new Response(null, {
status: 302,
headers: {
Location: loginUrl.toString()
}
})
throw redirect(loginUrl.toString())
}