mirror of
https://git.sr.ht/~cadence/cloudtube
synced 2025-12-13 15:46:30 +00:00
Preserve other parameters in video redirection
This commit is contained in:
parent
d3d18bd45f
commit
d50e07f053
1 changed files with 4 additions and 2 deletions
|
|
@ -3,8 +3,10 @@ const {redirect} = require("pinski/plugins")
|
||||||
|
|
||||||
module.exports = [
|
module.exports = [
|
||||||
{
|
{
|
||||||
route: `/(${constants.regex.video_id})`, priority: -1, methods: ["GET"], code: async ({fill}) => {
|
route: `/(${constants.regex.video_id})`, priority: -1, methods: ["GET"], code: async ({fill, url}) => {
|
||||||
return redirect(`/watch?v=${fill[0]}`, 301)
|
const target = new URLSearchParams(url.search)
|
||||||
|
target.set("v", fill[0])
|
||||||
|
return redirect(`/watch?${target}`, 301)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue