Skip to content

Commit

Permalink
fix: miru:// redirects
Browse files Browse the repository at this point in the history
  • Loading branch information
ThaUnknown committed Dec 9, 2023
1 parent 0f14a90 commit 0a28202
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
17 changes: 10 additions & 7 deletions functions/anime/[id].js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@
/** @type {PagesFunction} */
export function onRequest ({ params }) {
try {
const id = params.id
const html = /* html */`<!DOCTYPE html><html style=background:#000><head><meta http-equiv=refresh content="5; url=https://miru.watch"><meta property="og:title" content="Watch Together"><meta property="og:description" content="Stream anime torrents, real-time with no waiting for downloads"><meta property="og:site_name" content="Miru"><meta property="og:image" content=https://github.com/ThaUnknown/miru/blob/master/docs/show.gif?raw=true><meta property="og:url" content=miru://anime/${id}><meta data-vmid="twitter:card" name="twitter:card" content="summary_large_image"><meta name="theme-color" content="#23a559"></head><body><iframe src=miru://w2g/${id} style=border:none></iframe>Redirecting...</body></html>`
const id = Number(params.id)
if (Number.isSafeInteger(id)) {
const html = /* html */`<!DOCTYPE html><html style=background:#000><head><meta http-equiv=refresh content="5; url=https://miru.watch"><meta property="og:title" content="Watch Together"><meta property="og:description" content="Stream anime torrents, real-time with no waiting for downloads"><meta property="og:site_name" content="Miru"><meta property="og:image" content=https://github.com/ThaUnknown/miru/blob/master/docs/show.gif?raw=true><meta property="og:url" content=miru://anime/${id}><meta data-vmid="twitter:card" name="twitter:card" content="summary_large_image"><meta name="theme-color" content="#23a559"></head><body><iframe src=miru://w2g/${id} style=border:none></iframe>Redirecting...</body></html>`

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/')
}
17 changes: 7 additions & 10 deletions functions/w2g/[id].js
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,15 @@
/** @type {PagesFunction} */
export function onRequest ({ params }) {
try {
const id = Number(params.id)
if (Number.isSafeInteger(id)) {
const html = /* html */`<!DOCTYPE html><html style=background:#000><head><meta http-equiv=refresh content="5; url=https://miru.watch"><meta property="og:title" content="Watch Together"><meta property="og:description" content="Stream anime torrents, real-time with no waiting for downloads"><meta property="og:site_name" content="Miru"><meta property="og:image" content=https://github.com/ThaUnknown/miru/blob/master/docs/show.gif?raw=true><meta property="og:url" content=miru://w2g/${id}><meta data-vmid="twitter:card" name="twitter:card" content="summary_large_image"><meta name="theme-color" content="#23a559"></head><body><iframe src=miru://w2g/${id} style=border:none></iframe>Redirecting...</body></html>`
const id = params.id
const html = /* html */`<!DOCTYPE html><html style=background:#000><head><meta http-equiv=refresh content="5; url=https://miru.watch"><meta property="og:title" content="Watch Together"><meta property="og:description" content="Stream anime torrents, real-time with no waiting for downloads"><meta property="og:site_name" content="Miru"><meta property="og:image" content=https://github.com/ThaUnknown/miru/blob/master/docs/show.gif?raw=true><meta property="og:url" content=miru://w2g/${id}><meta data-vmid="twitter:card" name="twitter:card" content="summary_large_image"><meta name="theme-color" content="#23a559"></head><body><iframe src=miru://w2g/${id} style=border:none></iframe>Redirecting...</body></html>`

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/')
}

0 comments on commit 0a28202

Please sign in to comment.