1
0
mirror of https://git.sr.ht/~cadence/cloudtube synced 2024-12-22 13:07:00 +00:00

Preserve other parameters in video redirection

This commit is contained in:
Cadence Ember 2021-02-03 20:58:51 +13:00
parent d3d18bd45f
commit d50e07f053
No known key found for this signature in database
GPG Key ID: BC1C2C61CF521B17

View File

@ -3,8 +3,10 @@ const {redirect} = require("pinski/plugins")
module.exports = [
{
route: `/(${constants.regex.video_id})`, priority: -1, methods: ["GET"], code: async ({fill}) => {
return redirect(`/watch?v=${fill[0]}`, 301)
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)
}
}
]