export function onRequest({ request, next }) { const path = new URL(request.url).pathname; if (/^\/terms(?:\/index\.html)?\/?$/i.test(path)) { return new Response(null, { status: 301, headers: { Location: '/privacy/' } }); } if (['/analytics-consent.gif', '/assets/analytics.js', '/assets/analytics.css'].includes(path)) { return new Response(null, { status: 410, headers: { 'Cache-Control': 'no-store' } }); } if (/^\/(?:download|downloads)(?:\/|$)|^\/appcast(?:-legacy)?\.xml(?:\/|$)/i.test(path)) { return new Response(request.method === 'HEAD' ? null : 'Graphley is no longer publicly distributed.\n', { status: 410, headers: { 'Content-Type': 'text/plain; charset=utf-8', 'Cache-Control': 'no-store' }, }); } return next(); }