import { checkRateLimit } from '$lib/rateLimit.js'; export const GET = async (event) => { const limit = await checkRateLimit(event); const { url } = event; if (limit) return limit; try { return Response.json( await ( await fetch( `https://api.mangadex.org/chapter?manga=${url.searchParams.get( 'id' )}&chapter=${url.searchParams.get( 'chapter' )}&contentRating[]=safe&contentRating[]=suggestive&contentRating[]=erotica&contentRating[]=pornographic&limit=1` ) ).json(), { headers: { 'Cache-Control': 'max-age=300' } } ); } catch { return new Response('rate-limited'); } };