- Moved event and gallery data to JSON files for cleaner content management. - Added session management utilities with CSRF protection. - Integrated OAuth-based login and logout APIs. - Updated dependencies, including Astro and introduced dotenv-cli. - Enhanced package.json with local environment support.
9 lines
309 B
TypeScript
9 lines
309 B
TypeScript
import type { MiddlewareHandler } from 'astro';
|
|
import { getSessionFromRequest } from './lib/session';
|
|
|
|
export const onRequest: MiddlewareHandler = async (context, next) => {
|
|
const session = getSessionFromRequest(context.request);
|
|
(context.locals as any).user = session?.user || null;
|
|
return next();
|
|
};
|