mirror of
https://git.sr.ht/~cadence/cloudtube
synced 2024-11-22 15:47:30 +00:00
Support youtu.be redirection
This commit is contained in:
parent
de4438124a
commit
722842b0b4
10
api/redirects.js
Normal file
10
api/redirects.js
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
const constants = require("../utils/constants")
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
@ -28,7 +28,7 @@ let constants = {
|
|||||||
|
|
||||||
regex: {
|
regex: {
|
||||||
ucid: "[A-Za-z0-9-_]+",
|
ucid: "[A-Za-z0-9-_]+",
|
||||||
video_id: "[A-Za-z0-9-_]+"
|
video_id: "[A-Za-z0-9-_]{11,}"
|
||||||
},
|
},
|
||||||
|
|
||||||
symbols: {
|
symbols: {
|
||||||
|
Loading…
Reference in New Issue
Block a user