1
0
mirror of https://git.sr.ht/~cadence/cloudtube synced 2024-11-14 04:17:29 +00:00
cloudtube/api/redirects.js
2021-02-03 20:58:51 +13:00

13 lines
353 B
JavaScript

const constants = require("../utils/constants")
const {redirect} = require("pinski/plugins")
module.exports = [
{
route: `/(${constants.regex.video_id})`, priority: -1, methods: ["GET"], code: async ({fill, url}) => {
const target = new URLSearchParams(url.search)
target.set("v", fill[0])
return redirect(`/watch?${target}`, 301)
}
}
]