diff --git a/src/hooks.server.ts b/src/hooks.server.ts index 623b6a8..118b26b 100644 --- a/src/hooks.server.ts +++ b/src/hooks.server.ts @@ -1,3 +1,4 @@ +import { dev } from '$app/environment'; import { json, type Handle, type HandleServerError } from '@sveltejs/kit'; import { stringify } from 'devalue'; import { randomUUID } from 'node:crypto'; @@ -15,6 +16,15 @@ import { } from '$lib/server/data-moderation'; export const handle: Handle = async ({ event, resolve }) => { + // THROWAWAY PROTOTYPE: fixture-only review must not open the shared database. + if ( + dev && + event.url.pathname === '/database' && + event.url.searchParams.get('prototype') === 'model-status' + ) { + return resolve(event); + } + if ( event.url.pathname === '/admin' || event.url.pathname.startsWith('/admin/') diff --git a/src/routes/+layout.server.ts b/src/routes/+layout.server.ts index d6e7686..a0251b2 100644 --- a/src/routes/+layout.server.ts +++ b/src/routes/+layout.server.ts @@ -1,10 +1,26 @@ +import { dev } from '$app/environment'; import { getSessionUser } from '$lib/server/auth/session'; import { hasPermission } from '$lib/server/auth/authorization'; import type { LayoutServerLoad } from './$types'; import { notificationSummary } from '$lib/server/notifications'; import { getSiteAccessSettings } from '$lib/server/site-access'; -export const load: LayoutServerLoad = async ({ cookies }) => { +export const load: LayoutServerLoad = async ({ cookies, url }) => { + // THROWAWAY PROTOTYPE: fixture-only review must not open the shared database. + if (dev && url.pathname === '/database' && url.searchParams.get('prototype') === 'model-status') { + return { + user: null, + isacAccess: false, + notifications: { unread: 0 }, + siteAccess: { + comingSoonEnabled: false, + accountCreationEnabled: true, + sections: { news: true, database: true, builds: true, guides: true, builder: true }, + updatedAt: 'prototype' + } + }; + } + const user = await getSessionUser(cookies); return { user, diff --git a/src/routes/database/+page.server.ts b/src/routes/database/+page.server.ts index 1f8384a..6dd2af6 100644 --- a/src/routes/database/+page.server.ts +++ b/src/routes/database/+page.server.ts @@ -1,3 +1,4 @@ +import { dev } from '$app/environment'; import { getDatabase } from '$lib/server/database'; import { getRegistrySearch } from '$lib/server/pagination'; import { databaseCategories } from '$lib/database/categories'; @@ -16,6 +17,11 @@ const tables = { } as const; export const load: PageServerLoad = async ({ url }) => { + // THROWAWAY PROTOTYPE: avoid opening the shared database for fixture-only review. + if (dev && url.searchParams.get('prototype') === 'model-status') { + return { registries: [], total: 0, search: '', searchResults: [] }; + } + const database = await getDatabase(); const { search, pattern } = getRegistrySearch(url); const counts = await Promise.all(