1
0
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:
Cadence Ember 2021-02-03 20:49:21 +13:00
parent de4438124a
commit 722842b0b4
No known key found for this signature in database
GPG Key ID: BC1C2C61CF521B17
2 changed files with 11 additions and 1 deletions

10
api/redirects.js Normal file
View 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)
}
}
]

View File

@ -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: {