Refactor content structure and add basic authentication utilities
- 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.
This commit is contained in:
8
src/middleware.ts
Normal file
8
src/middleware.ts
Normal file
@ -0,0 +1,8 @@
|
||||
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();
|
||||
};
|
||||
Reference in New Issue
Block a user