Add support for youtu.be 11 character redirects.

This commit is contained in:
FireMasterK 2021-07-20 02:55:43 +05:30
parent 3a71f8c1d3
commit bae1cd3ce1
No known key found for this signature in database
GPG Key ID: 49451E4482CC5BCD
2 changed files with 23 additions and 0 deletions

View File

@ -0,0 +1,17 @@
<template>
<div>Loading...</div>
</template>
<script>
export default {
activated() {
const videoId = this.$route.params.videoId;
if (videoId)
this.$router.push({
path: "/watch",
query: { v: videoId },
});
},
};
</script>

View File

@ -23,10 +23,12 @@ const routes = [
}, },
{ {
path: "/:path(v|w|embed|shorts|watch)/:v?", path: "/:path(v|w|embed|shorts|watch)/:v?",
name: "WatchVideo",
component: () => import("../components/WatchVideo.vue"), component: () => import("../components/WatchVideo.vue"),
}, },
{ {
path: "/:path(channel|user|c)/:channelId/:videos?", path: "/:path(channel|user|c)/:channelId/:videos?",
name: "Channel",
component: () => import("../components/Channel.vue"), component: () => import("../components/Channel.vue"),
}, },
{ {
@ -49,6 +51,10 @@ const routes = [
name: "Import", name: "Import",
component: () => import("../components/ImportPage.vue"), component: () => import("../components/ImportPage.vue"),
}, },
{
path: "/:videoId([a-zA-Z0-9_-]{11})",
component: () => import("../components/VideoRedirect.vue"),
},
]; ];
const router = createRouter({ const router = createRouter({