mirror of
https://github.com/TeamPiped/Piped.git
synced 2025-12-22 04:30:12 +00:00
hide watched videos in the feed
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div>
|
||||
<div v-if="showVideo">
|
||||
<router-link
|
||||
:to="{
|
||||
path: '/watch',
|
||||
@@ -141,6 +141,10 @@ export default {
|
||||
return {};
|
||||
},
|
||||
},
|
||||
isFeed: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
height: { type: String, default: "118" },
|
||||
width: { type: String, default: "210" },
|
||||
hideChannel: { type: Boolean, default: false },
|
||||
@@ -151,8 +155,12 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
showModal: false,
|
||||
showVideo: true,
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.shouldShowVideo();
|
||||
},
|
||||
methods: {
|
||||
removeVideo() {
|
||||
if (confirm(this.$t("actions.delete_playlist_video_confirm"))) {
|
||||
@@ -173,6 +181,21 @@ export default {
|
||||
});
|
||||
}
|
||||
},
|
||||
shouldShowVideo() {
|
||||
if (!this.isFeed || !this.getPreferenceBoolean("hideWatched", false)) return;
|
||||
|
||||
const objectStore = window.db.transaction("watch_history", "readonly").objectStore("watch_history");
|
||||
objectStore.openCursor().onsuccess = event => {
|
||||
const cursor = event.target.result;
|
||||
if (cursor) {
|
||||
if (cursor.value.videoId === this.video.url.replace("/watch?v=", "")) {
|
||||
this.showVideo = false;
|
||||
return;
|
||||
}
|
||||
cursor.continue();
|
||||
}
|
||||
};
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
short() {
|
||||
|
||||
Reference in New Issue
Block a user