[WIP] book tracker on the atmosphere~
1import type { Handle } from '@sveltejs/kit';
2import { getSessionAgent } from '$lib/server/auth';
3import { startIngester } from '$lib/server/atproto/ingester';
4
5// Start the AT Protocol ingester when the server starts
6startIngester();
7
8const handleAuth: Handle = async ({ event, resolve }) => {
9 // Get the AT Protocol agent for the current session
10 const agent = await getSessionAgent(event);
11
12 // Store the agent in locals for use in routes
13 event.locals.agent = agent;
14 event.locals.user = agent ? { did: agent.assertDid } : null;
15
16 return resolve(event);
17};
18
19export const handle: Handle = handleAuth;