mirror of
				https://github.com/TeamPiped/Piped.git
				synced 2024-08-14 23:57:27 +00:00 
			
		
		
		
	feat: support for 'watch_videos' endpoint
This commit is contained in:
		
							parent
							
								
									e754831786
								
							
						
					
					
						commit
						86773ebcf6
					
				
					 3 changed files with 23 additions and 3 deletions
				
			
		| 
						 | 
					@ -34,7 +34,7 @@
 | 
				
			||||||
                <div class="i-fa6-solid:thumbs-up" />
 | 
					                <div class="i-fa6-solid:thumbs-up" />
 | 
				
			||||||
                <span v-text="numberFormat(comment.likeCount)" />
 | 
					                <span v-text="numberFormat(comment.likeCount)" />
 | 
				
			||||||
                <font-awesome-icon v-if="comment.hearted" icon="heart" />
 | 
					                <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>
 | 
					            </div>
 | 
				
			||||||
            <template v-if="comment.repliesPage && (!loadingReplies || !showingReplies)">
 | 
					            <template v-if="comment.repliesPage && (!loadingReplies || !showingReplies)">
 | 
				
			||||||
                <div class="cursor-pointer" @click="loadReplies">
 | 
					                <div class="cursor-pointer" @click="loadReplies">
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -648,6 +648,12 @@ export default {
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        getVideoId() {
 | 
					        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;
 | 
					            return this.$route.query.v || this.$route.params.v;
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        navigate(time) {
 | 
					        navigate(time) {
 | 
				
			||||||
| 
						 | 
					@ -687,7 +693,15 @@ export default {
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        navigateNext() {
 | 
					        navigateNext() {
 | 
				
			||||||
            const params = this.$route.query;
 | 
					            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();
 | 
					            const searchParams = new URLSearchParams();
 | 
				
			||||||
            for (var param in params)
 | 
					            for (var param in params)
 | 
				
			||||||
                switch (param) {
 | 
					                switch (param) {
 | 
				
			||||||
| 
						 | 
					@ -695,7 +709,8 @@ export default {
 | 
				
			||||||
                    case "t":
 | 
					                    case "t":
 | 
				
			||||||
                        break;
 | 
					                        break;
 | 
				
			||||||
                    case "index":
 | 
					                    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;
 | 
					                        break;
 | 
				
			||||||
                    case "list":
 | 
					                    case "list":
 | 
				
			||||||
                        if (this.index < this.playlist.relatedStreams.length) searchParams.set("list", params.list);
 | 
					                        if (this.index < this.playlist.relatedStreams.length) searchParams.set("list", params.list);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -31,6 +31,11 @@ const routes = [
 | 
				
			||||||
        name: "WatchVideo",
 | 
					        name: "WatchVideo",
 | 
				
			||||||
        component: () => import("../components/WatchVideo.vue"),
 | 
					        component: () => import("../components/WatchVideo.vue"),
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        path: "/watch_videos",
 | 
				
			||||||
 | 
					        name: "WatchVideos",
 | 
				
			||||||
 | 
					        component: () => import("../components/WatchVideo.vue"),
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        path: "/clip/:clipId",
 | 
					        path: "/clip/:clipId",
 | 
				
			||||||
        name: "Clips",
 | 
					        name: "Clips",
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue