Fiks signin-loop: / tillatt for uautentiserte, viser inline landingsside

hooks.server.ts: / unntatt fra auth-redirect
+page.svelte: viser landingsside for uautentiserte, mottak for innloggede
Ingen separat statisk fil — alt i SvelteKit

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
vegard 2026-03-19 03:17:08 +00:00
parent 27f7848a90
commit 7233488c71
2 changed files with 23 additions and 2 deletions

View file

@ -6,8 +6,8 @@ import { sequence } from '@sveltejs/kit/hooks';
const authorizationHandle: Handle = async ({ event, resolve }) => { const authorizationHandle: Handle = async ({ event, resolve }) => {
const path = event.url.pathname; const path = event.url.pathname;
// Allow auth-related routes through without session check // Allow auth-related routes and landing page through without session check
if (path.startsWith('/auth/') || path === '/signin') { if (path.startsWith('/auth/') || path === '/signin' || path === '/') {
return resolve(event); return resolve(event);
} }

View file

@ -293,6 +293,26 @@
} }
</script> </script>
{#if !$page.data.session?.user}
<!-- Landingsside for uautentiserte -->
<div class="min-h-screen" style="background: #0a0a0b; color: #e8e8ec; font-family: Inter, -apple-system, sans-serif;">
<div style="max-width: 800px; margin: 0 auto; padding: 0 24px;">
<header style="display: flex; justify-content: space-between; align-items: center; padding: 32px 0;">
<div style="font-size: 1.25rem; font-weight: 700;">synops<span style="color: #6366f1;">.</span></div>
<a href="/auth/signin" style="padding: 10px 24px; background: #6366f1; color: white; border-radius: 8px; text-decoration: none; font-size: 0.9rem; font-weight: 500;">Logg inn</a>
</header>
<section style="padding: 80px 0 60px; text-align: center;">
<h1 style="font-size: clamp(2.5rem, 6vw, 4rem); font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; margin-bottom: 24px;">
Stappfull av <em style="font-style: normal; background: linear-gradient(135deg, #6366f1, #a78bfa); -webkit-background-clip: text; -webkit-text-fill-color: transparent;">features</em><br>(hvorav et fåtall virker som forutsatt)
</h1>
<p style="font-family: Literata, Georgia, serif; font-style: italic; font-size: 1.15rem; color: #8a8a96; max-width: 560px; margin: 0 auto 48px;">
En useriøs plattform for kommunikasjon, redaksjonelt arbeid, podcastproduksjon og egentlig alt du vil. Bygget med uvitenhet, overmot og en urimelig mengde AI-assistanse.
</p>
<a href="/auth/signin" style="padding: 14px 32px; background: #6366f1; color: white; border-radius: 10px; font-size: 1rem; font-weight: 600; text-decoration: none; box-shadow: 0 0 40px rgba(99,102,241,0.15);">Kom i gang &rarr;</a>
</section>
</div>
</div>
{:else}
<div class="min-h-screen bg-gray-50"> <div class="min-h-screen bg-gray-50">
<!-- Header --> <!-- Header -->
<header class="border-b border-gray-200 bg-white"> <header class="border-b border-gray-200 bg-white">
@ -536,3 +556,4 @@
/> />
{/if} {/if}
</div> </div>
{/if}