fix: simplify form styles and handle missing auth config

- Remove excessive form styling, keep minimal
- Wrap getSession in try-catch for dev without env vars
This commit is contained in:
Lewis Wynne 2026-01-23 04:17:25 +00:00
parent 892afc2161
commit 3600897f4b
2 changed files with 8 additions and 34 deletions

View file

@ -6,7 +6,12 @@ import { getPendingEntries, type GuestbookEntry } from '../lib/db';
import { isAdmin } from '../lib/auth';
import '../styles/global.css';
const session = await getSession(Astro.request);
let session;
try {
session = await getSession(Astro.request);
} catch {
return new Response('Auth not configured', { status: 500 });
}
if (!session) {
return Astro.redirect('/api/auth/signin');

View file

@ -48,46 +48,15 @@ details pre {
}
#guestbook-form {
display: flex;
flex-direction: column;
gap: 0.5rem;
padding-left: 1rem;
margin-top: 0.5rem;
}
#guestbook-form input,
#guestbook-form textarea {
font-family: monospace;
font-size: 1rem;
padding: 0.25rem;
border: 1px solid #888;
background: transparent;
color: inherit;
}
#guestbook-form textarea {
min-height: 3rem;
resize: vertical;
}
#guestbook-form textarea,
#guestbook-form button {
font-family: monospace;
font-size: 1rem;
padding: 0.25rem 0.5rem;
cursor: pointer;
background: transparent;
border: 1px solid #888;
color: inherit;
align-self: flex-start;
}
#guestbook-form button:hover {
background: #888;
color: #000;
font: inherit;
}
#guestbook-status {
padding-left: 1rem;
color: #888;
font-family: monospace;
}