managarten/games/worldream/apps/web/src/hooks.server.ts
Till-JS bb0e0cf5cb 🚚 feat(context): integrate context app into monorepo
Restructure the context app (formerly basetext) to follow the monorepo
pattern with proper workspace configuration.

Changes:
- Move app files to apps/context/apps/mobile/
- Rename package to @context/mobile
- Update bundle ID to com.manacore.context
- Create pnpm-workspace.yaml for project workspace
- Add dev scripts to root package.json
- Update CLAUDE.md with project documentation

The app structure is prepared for future web/backend additions.

Note: Existing TypeScript errors in the original codebase are preserved.
These should be fixed in a follow-up PR.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-05 15:09:04 +01:00

41 lines
1.2 KiB
TypeScript

/**
* Server Hooks for SvelteKit
* Auth is handled client-side via Mana Core Auth
* Supabase is still used for database operations
*
* TODO: Migrate API routes to use Mana Core Auth headers instead of session-based auth
*/
import { createClient } from '$lib/supabase/server';
import type { Handle } from '@sveltejs/kit';
export const handle: Handle = async ({ event, resolve }) => {
// Create Supabase client for database operations
event.locals.supabase = createClient(event);
// Provide session helpers for backwards compatibility
// These are stubs while transitioning to Mana Core Auth
event.locals.safeGetSession = async () => {
// In the future, this should validate the Mana Core Auth token
// For now, return a mock session for development
const {
data: { session },
error,
} = await event.locals.supabase.auth.getSession();
if (error || !session) {
return { session: null, user: null };
}
return { session, user: session.user };
};
event.locals.getSession = async () => {
const { session } = await event.locals.safeGetSession();
return session;
};
return resolve(event, {
filterSerializedResponseHeaders(name) {
return name === 'content-range' || name === 'x-supabase-api-version';
},
});
};