import { readFileSync, existsSync } from 'fs'; import { resolve } from 'path'; /** @type {import('./$types').PageServerLoad} */ export async function load() { const dataPath = resolve('static/db_export.json'); const raw = readFileSync(dataPath, 'utf-8'); const data = JSON.parse(raw); const configPath = resolve('config.json'); let config = { embyUrl: '', apiKey: '', dbPath: '' }; if (existsSync(configPath)) { try { config = JSON.parse(readFileSync(configPath, 'utf-8')); } catch { /* use defaults */ } } return { users: data.users, genres: data.genres, enums: data.enums, config }; }