mirror of
https://git.sr.ht/~cadence/cloudtube
synced 2024-11-22 15:47:30 +00:00
Fix redirected youtu.be/ID shortlinks parameters ordering
Previouly, /[ID]?autoplay=1&test1&test2 would redirect to /watch?autoplay=1&test1=&test2=&v=[ID] which is kind of ugly, and not how YouTube redirects youtu.be shortlinks. This is now redirecting to /watch?v=[ID]&autoplay=1&test1=&test2
This commit is contained in:
parent
6f8eb43e24
commit
4332d3043f
@ -4,9 +4,7 @@ const {redirect} = require("pinski/plugins")
|
|||||||
module.exports = [
|
module.exports = [
|
||||||
{
|
{
|
||||||
route: `/(${constants.regex.video_id})`, priority: -1, methods: ["GET"], code: async ({fill, url}) => {
|
route: `/(${constants.regex.video_id})`, priority: -1, methods: ["GET"], code: async ({fill, url}) => {
|
||||||
const target = new URLSearchParams(url.search)
|
return redirect(`/watch?v=${fill[0]}${url.search.replace(/^\?/, "&")}`, 301)
|
||||||
target.set("v", fill[0])
|
|
||||||
return redirect(`/watch?${target}`, 301)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
Loading…
Reference in New Issue
Block a user