diff --git a/functions/anime/[id].js b/functions/anime/[id].js index 6dcefa67..96ccd1c0 100644 --- a/functions/anime/[id].js +++ b/functions/anime/[id].js @@ -3,15 +3,18 @@ /** @type {PagesFunction} */ export function onRequest ({ params }) { try { - const id = params.id - const html = /* html */`
Redirecting...` + const id = Number(params.id) + if (Number.isSafeInteger(id)) { + const html = /* html */`Redirecting...` - return new Response(html, { - headers: { - 'content-type': 'text/html;charset=UTF-8' - } - }) + return new Response(html, { + headers: { + 'content-type': 'text/html;charset=UTF-8' + } + }) + } } catch (e) { return Response.redirect('https://miru.watch/') } + return Response.redirect('https://miru.watch/') } diff --git a/functions/w2g/[id].js b/functions/w2g/[id].js index 165457f8..2782f85b 100644 --- a/functions/w2g/[id].js +++ b/functions/w2g/[id].js @@ -3,18 +3,15 @@ /** @type {PagesFunction} */ export function onRequest ({ params }) { try { - const id = Number(params.id) - if (Number.isSafeInteger(id)) { - const html = /* html */`Redirecting...` + const id = params.id + const html = /* html */`Redirecting...` - return new Response(html, { - headers: { - 'content-type': 'text/html;charset=UTF-8' - } - }) - } + return new Response(html, { + headers: { + 'content-type': 'text/html;charset=UTF-8' + } + }) } catch (e) { return Response.redirect('https://miru.watch/') } - return Response.redirect('https://miru.watch/') }