import { packageContext } from 'kody:runtime' import { page } from './page.generated.ts' /** * The deck is static: Vite builds it into dist/, which Kody serves under * `/_assets/`. This handler only serves the presenter page (any * path, so `?mode=audience` and deep links work), pointing its URLs at the * asset mount. */ export default { async fetch(request: Request): Promise { if (request.method !== 'GET' && request.method !== 'HEAD') { return new Response('Method not allowed', { status: 405 }) } const base = `${packageContext?.appBasePath ?? ''}/_assets/` const html = page.replaceAll('/__KODY_BASE__/', base) return new Response(request.method === 'HEAD' ? null : html, { headers: { 'content-type': 'text/html; charset=utf-8', 'cache-control': 'no-cache', }, }) }, }