1
0
mirror of https://git.sr.ht/~cadence/cloudtube synced 2024-11-14 12:27:28 +00:00
cloudtube/api/redirects.js

13 lines
353 B
JavaScript
Raw Normal View History

2021-02-03 07:49:21 +00:00
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)
2021-02-03 07:49:21 +00:00
}
}
]