import type { CreateQRCodeOptions } from '$lib/qrcode'; import type { PageServerLoad } from './$types'; export const load: PageServerLoad = (event) => { const options = parseParams(event.url.searchParams); return { options }; }; const defaultUrl = 'https://shared.coastapp.com/r/0771e285-7068-44c6-9f3c-2918d5c47e4c'; function parseParams(params: URLSearchParams): CreateQRCodeOptions { const url = params.get('url'); const width = params.get('width'); const logo = params.get('logo'); const border = params.get('border'); return { url: url || defaultUrl, width: width ? parseInt(width as string, 10) : undefined, showLogo: ['on', 'true', '1'].includes(logo as string), showBorder: ['on', 'true', '1'].includes(border as string), }; }