feat: support for 'watch_videos' endpoint

This commit is contained in:
Bnyro 2023-10-14 13:48:23 +02:00
parent e754831786
commit 86773ebcf6
3 changed files with 23 additions and 3 deletions

View file

@ -34,7 +34,7 @@
<div class="i-fa6-solid:thumbs-up" />
<span v-text="numberFormat(comment.likeCount)" />
<font-awesome-icon v-if="comment.hearted" icon="heart" />
<img v-if="comment.creatorReplied" :src="uploaderAvatarUrl" class="w-5 h-5 rounded-full" />
<img v-if="comment.creatorReplied" :src="uploaderAvatarUrl" class="h-5 w-5 rounded-full" />
</div>
<template v-if="comment.repliesPage && (!loadingReplies || !showingReplies)">
<div class="cursor-pointer" @click="loadReplies">

View file

@ -648,6 +648,12 @@ export default {
}
},
getVideoId() {
if (this.$route.query.video_ids) {
const videos_list = this.$route.query.video_ids.split(",");
this.index = Number(this.$route.query.index ?? 0);
return videos_list[this.index];
}
return this.$route.query.v || this.$route.params.v;
},
navigate(time) {
@ -687,7 +693,15 @@ export default {
},
navigateNext() {
const params = this.$route.query;
let url = this.playlist?.relatedStreams?.[this.index]?.url ?? this.video.relatedStreams[0].url;
const video_ids = this.$route.query.video_ids?.split(",") ?? [];
let url;
if (this.playlist) {
url = this.playlist?.relatedStreams?.[this.index]?.url ?? this.video.relatedStreams[0].url;
} else if (video_ids.length > this.index + 1) {
url = `${this.$route.path}?index=${this.index + 1}`;
} else {
url = this.video.relatedStreams[0].url;
}
const searchParams = new URLSearchParams();
for (var param in params)
switch (param) {
@ -695,7 +709,8 @@ export default {
case "t":
break;
case "index":
if (this.index < this.playlist.relatedStreams.length) searchParams.set("index", this.index + 1);
if (this.playlist && this.index < this.playlist.relatedStreams.length)
searchParams.set("index", this.index + 1);
break;
case "list":
if (this.index < this.playlist.relatedStreams.length) searchParams.set("list", params.list);

View file

@ -31,6 +31,11 @@ const routes = [
name: "WatchVideo",
component: () => import("../components/WatchVideo.vue"),
},
{
path: "/watch_videos",
name: "WatchVideos",
component: () => import("../components/WatchVideo.vue"),
},
{
path: "/clip/:clipId",
name: "Clips",