mirror of
https://github.com/TeamPiped/Piped.git
synced 2024-11-25 23:17:22 +00:00
Add support for /watch/, /embed/, /w/, /v/, /shorts/
This commit is contained in:
parent
20ad39b327
commit
5e791a51f5
@ -141,13 +141,13 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
fetchVideo() {
|
fetchVideo() {
|
||||||
return this.fetchJson(Constants.BASE_URL + "/streams/" + this.$route.query.v);
|
return this.fetchJson(Constants.BASE_URL + "/streams/" + this.getVideoId());
|
||||||
},
|
},
|
||||||
async fetchSponsors() {
|
async fetchSponsors() {
|
||||||
return await this.fetchJson(
|
return await this.fetchJson(
|
||||||
Constants.BASE_URL +
|
Constants.BASE_URL +
|
||||||
"/sponsors/" +
|
"/sponsors/" +
|
||||||
this.$route.query.v +
|
this.getVideoId() +
|
||||||
"?category=" +
|
"?category=" +
|
||||||
(localStorage && localStorage.getItem("selectedSkip") !== null
|
(localStorage && localStorage.getItem("selectedSkip") !== null
|
||||||
? encodeURIComponent('["' + localStorage.getItem("selectedSkip").replace(",", '","') + '"]')
|
? encodeURIComponent('["' + localStorage.getItem("selectedSkip").replace(",", '","') + '"]')
|
||||||
@ -155,7 +155,7 @@ export default {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
fetchComments() {
|
fetchComments() {
|
||||||
return this.fetchJson(Constants.BASE_URL + "/comments/" + this.$route.query.v);
|
return this.fetchJson(Constants.BASE_URL + "/comments/" + this.getVideoId());
|
||||||
},
|
},
|
||||||
onChange() {
|
onChange() {
|
||||||
if (localStorage) localStorage.setItem("autoplay", this.selectedAutoPlay);
|
if (localStorage) localStorage.setItem("autoplay", this.selectedAutoPlay);
|
||||||
@ -194,7 +194,7 @@ export default {
|
|||||||
this.fetchJson(
|
this.fetchJson(
|
||||||
Constants.BASE_URL +
|
Constants.BASE_URL +
|
||||||
"/nextpage/comments/" +
|
"/nextpage/comments/" +
|
||||||
this.$route.query.v +
|
this.getVideoId() +
|
||||||
"?url=" +
|
"?url=" +
|
||||||
encodeURIComponent(this.comments.nextpage),
|
encodeURIComponent(this.comments.nextpage),
|
||||||
).then(json => {
|
).then(json => {
|
||||||
@ -204,6 +204,9 @@ export default {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
getVideoId() {
|
||||||
|
return this.$route.query.v || this.$route.params.v;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
Player,
|
Player,
|
||||||
|
@ -3,7 +3,26 @@ import { createRouter, createWebHistory } from "vue-router";
|
|||||||
const routes = [
|
const routes = [
|
||||||
{
|
{
|
||||||
path: "/watch",
|
path: "/watch",
|
||||||
name: "Watch",
|
component: () => import("../components/WatchVideo.vue"),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/watch/:v",
|
||||||
|
component: () => import("../components/WatchVideo.vue"),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/embed/:v",
|
||||||
|
component: () => import("../components/WatchVideo.vue"),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/w/:v",
|
||||||
|
component: () => import("../components/WatchVideo.vue"),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/v/:v",
|
||||||
|
component: () => import("../components/WatchVideo.vue"),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/shorts/:v",
|
||||||
component: () => import("../components/WatchVideo.vue"),
|
component: () => import("../components/WatchVideo.vue"),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user