From ece47821fbc7cb1bc000ecb7eec5771c0be53b6f Mon Sep 17 00:00:00 2001 From: Kavin <20838718+FireMasterK@users.noreply.github.com> Date: Fri, 13 Jan 2023 13:40:12 +0000 Subject: [PATCH] Ensure watch history preference actually works. --- src/components/HistoryPage.vue | 2 +- src/components/VideoPlayer.vue | 2 +- src/components/WatchVideo.vue | 2 +- src/main.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/HistoryPage.vue b/src/components/HistoryPage.vue index a0b344d9..0d65910b 100644 --- a/src/components/HistoryPage.vue +++ b/src/components/HistoryPage.vue @@ -36,7 +36,7 @@ export default { }, mounted() { (async () => { - if (window.db) { + if (window.db && this.getPreferenceBoolean("watchHistory", false)) { var tx = window.db.transaction("watch_history", "readonly"); var store = tx.objectStore("watch_history"); const cursorRequest = store.index("watchedAt").openCursor(null, "prev"); diff --git a/src/components/VideoPlayer.vue b/src/components/VideoPlayer.vue index 319bf95a..589ea5ab 100644 --- a/src/components/VideoPlayer.vue +++ b/src/components/VideoPlayer.vue @@ -226,7 +226,7 @@ export default { } videoEl.currentTime = start; this.initialSeekComplete = true; - } else if (window.db) { + } else if (window.db && this.getPreferenceBoolean("watchHistory", false)) { var tx = window.db.transaction("watch_history", "readonly"); var store = tx.objectStore("watch_history"); var request = store.get(this.video.id); diff --git a/src/components/WatchVideo.vue b/src/components/WatchVideo.vue index fc7581d2..54699416 100644 --- a/src/components/WatchVideo.vue +++ b/src/components/WatchVideo.vue @@ -306,7 +306,7 @@ export default { (async () => { const videoId = this.getVideoId(); const instance = this; - if (window.db && !this.video.error) { + if (window.db && this.getPreferenceBoolean("watchHistory", false) && !this.video.error) { var tx = window.db.transaction("watch_history", "readwrite"); var store = tx.objectStore("watch_history"); var request = store.get(videoId); diff --git a/src/main.js b/src/main.js index 4fb415b7..12cf63ef 100644 --- a/src/main.js +++ b/src/main.js @@ -196,7 +196,7 @@ const mixin = { }); }, async updateWatched(videos) { - if (window.db) { + if (window.db && this.getPreferenceBoolean("watchHistory", false)) { var tx = window.db.transaction("watch_history", "readonly"); var store = tx.objectStore("watch_history"); videos.map(async video => {