mirror of
				https://github.com/TeamPiped/Piped.git
				synced 2024-08-14 23:57:27 +00:00 
			
		
		
		
	
							parent
							
								
									4ec67a4884
								
							
						
					
					
						commit
						6ee9592218
					
				
					 1 changed files with 19 additions and 9 deletions
				
			
		| 
						 | 
					@ -216,19 +216,29 @@ export default {
 | 
				
			||||||
    mounted() {
 | 
					    mounted() {
 | 
				
			||||||
        this.getVideoData().then(() => {
 | 
					        this.getVideoData().then(() => {
 | 
				
			||||||
            (async () => {
 | 
					            (async () => {
 | 
				
			||||||
 | 
					                const videoId = this.getVideoId();
 | 
				
			||||||
 | 
					                const instance = this;
 | 
				
			||||||
                if (window.db) {
 | 
					                if (window.db) {
 | 
				
			||||||
                    var tx = window.db.transaction("watch_history", "readwrite");
 | 
					                    var tx = window.db.transaction("watch_history", "readwrite");
 | 
				
			||||||
                    var store = tx.objectStore("watch_history");
 | 
					                    var store = tx.objectStore("watch_history");
 | 
				
			||||||
                    var video = {
 | 
					                    var request = store.get(videoId);
 | 
				
			||||||
                        videoId: this.getVideoId(),
 | 
					                    request.onsuccess = function(event) {
 | 
				
			||||||
                        title: this.video.title,
 | 
					                        var video = event.target.result;
 | 
				
			||||||
                        duration: this.video.duration,
 | 
					                        if (video) {
 | 
				
			||||||
                        thumbnail: this.video.thumbnailUrl,
 | 
					                            video.watchedAt = Date.now();
 | 
				
			||||||
                        uploaderUrl: this.video.uploaderUrl,
 | 
					                        } else {
 | 
				
			||||||
                        uploaderName: this.video.uploader,
 | 
					                            video = {
 | 
				
			||||||
                        watchedAt: Date.now(),
 | 
					                                videoId: videoId,
 | 
				
			||||||
 | 
					                                title: instance.video.title,
 | 
				
			||||||
 | 
					                                duration: instance.video.duration,
 | 
				
			||||||
 | 
					                                thumbnail: instance.video.thumbnailUrl,
 | 
				
			||||||
 | 
					                                uploaderUrl: instance.video.uploaderUrl,
 | 
				
			||||||
 | 
					                                uploaderName: instance.video.uploader,
 | 
				
			||||||
 | 
					                                watchedAt: Date.now(),
 | 
				
			||||||
 | 
					                            };
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					                        store.put(video);
 | 
				
			||||||
                    };
 | 
					                    };
 | 
				
			||||||
                    store.add(video);
 | 
					 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            })();
 | 
					            })();
 | 
				
			||||||
            if (this.active) this.$refs.videoPlayer.loadVideo();
 | 
					            if (this.active) this.$refs.videoPlayer.loadVideo();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue