88e00e5d41
Introduce server-rendered guestbook and moderation portal. Persist data in SQLite (better-sqlite3); add WebAuthn YubiKey admin auth, rate-limiting, spam heuristics, and sanitization. Switch Docker image to run Node/standalone Astro (remove nginx), update docker-compose, Dockerfile, astro.config, and package.json. Add .env.example, docs/guestbook.md, gitignore updates, layouts, API routes, and supporting lib/components/pages for the feature.
15 lines
444 B
TypeScript
15 lines
444 B
TypeScript
import type { APIRoute } from 'astro';
|
|
import { deleteSession, SESSION_COOKIE } from '../../../lib/auth';
|
|
|
|
export const prerender = false;
|
|
|
|
export const POST: APIRoute = async ({ cookies }) => {
|
|
const sessionId = cookies.get(SESSION_COOKIE)?.value;
|
|
if (sessionId) {
|
|
deleteSession(sessionId);
|
|
cookies.delete(SESSION_COOKIE, { path: '/' });
|
|
}
|
|
|
|
return new Response(null, { status: 303, headers: { Location: '/admin/login' } });
|
|
};
|