From 06d46e7037a4e97fc6bf45492d1ac8028255a260 Mon Sep 17 00:00:00 2001 From: petaded Date: Sun, 18 Jun 2023 10:45:44 +0100 Subject: [PATCH 1/3] fix for invidious (+6 squashed commits) Squashed commits: [65932b4b4] update playlist and channel filtering [952a7213a] update subscriptions js to use premiereDate over durationText [530dea939] Add back isRSS and viewcount check to fix when in subscriptions page [93ebb7654] Fix hide premiere [de7a8b4ec] ft-list-lazy-wrapper put whitespace back to what it was [8dadb59b1] move showResult from a method to a computed to work with v-if --- .../components/ft-list-lazy-wrapper/ft-list-lazy-wrapper.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/renderer/components/ft-list-lazy-wrapper/ft-list-lazy-wrapper.js b/src/renderer/components/ft-list-lazy-wrapper/ft-list-lazy-wrapper.js index ebc5aabba9ab3..71fce41e4f9b2 100644 --- a/src/renderer/components/ft-list-lazy-wrapper/ft-list-lazy-wrapper.js +++ b/src/renderer/components/ft-list-lazy-wrapper/ft-list-lazy-wrapper.js @@ -79,12 +79,14 @@ export default defineComponent({ return false } } else if (data.type === 'channel') { - if (this.channelsHidden.includes(data.channelID) || this.channelsHidden.includes(data.name)) { + if (this.channelsHidden.includes(data.id) || this.channelsHidden.includes(data.name) || + this.channelsHidden.includes(data.authorId) || this.channelsHidden.includes(data.author)) { // hide channels by author return false } } else if (data.type === 'playlist') { - if (this.channelsHidden.includes(data.authorId) || this.channelsHidden.includes(data.author)) { + if (this.channelsHidden.includes(data.channelId) || this.channelsHidden.includes(data.channelName) || + this.channelsHidden.includes(data.authorId) || this.channelsHidden.includes(data.author)) { // hide playlists by author return false } From 3989a79bbebb54564cb4405af5c9c8e6e928963b Mon Sep 17 00:00:00 2001 From: PikachuEXE Date: Mon, 3 Jul 2023 11:07:46 +0800 Subject: [PATCH 2/3] Fix Hide Premier for Invidous API --- .../ft-list-lazy-wrapper/ft-list-lazy-wrapper.js | 4 ++++ src/renderer/views/Subscriptions/Subscriptions.js | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/renderer/components/ft-list-lazy-wrapper/ft-list-lazy-wrapper.js b/src/renderer/components/ft-list-lazy-wrapper/ft-list-lazy-wrapper.js index 71fce41e4f9b2..a0ec2f9bac996 100644 --- a/src/renderer/components/ft-list-lazy-wrapper/ft-list-lazy-wrapper.js +++ b/src/renderer/components/ft-list-lazy-wrapper/ft-list-lazy-wrapper.js @@ -67,6 +67,10 @@ export default defineComponent({ if (this.hideUpcomingPremieres && // Observed for premieres in Local API Channels. (data.premiereDate != null || + // Invidious API + // `premiereTimestamp` only available on premiered videos + // https://docs.invidious.io/api/common_types/#videoobject + data.premiereTimestamp != null || // viewCount is our only method of detecting premieres in RSS // data without sending an additional request. // If we ever get a better flag, use it here instead. diff --git a/src/renderer/views/Subscriptions/Subscriptions.js b/src/renderer/views/Subscriptions/Subscriptions.js index a728901ebddaa..fa3a9ed6e081d 100644 --- a/src/renderer/views/Subscriptions/Subscriptions.js +++ b/src/renderer/views/Subscriptions/Subscriptions.js @@ -229,7 +229,12 @@ export default defineComponent({ return item.viewCount !== '0' } // Observed for premieres in Local API Subscriptions. - return item.premiereDate == null + return (item.premiereDate == null || + // Invidious API + // `premiereTimestamp` only available on premiered videos + // https://docs.invidious.io/api/common_types/#videoobject + item.premiereTimestamp == null + ) }) } From aa67d05de8cf452418b104ca365a1473210aa3ef Mon Sep 17 00:00:00 2001 From: PikachuEXE Date: Mon, 3 Jul 2023 11:09:20 +0800 Subject: [PATCH 3/3] Refactor code to be more redable with better doc --- .../ft-list-lazy-wrapper.js | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/src/renderer/components/ft-list-lazy-wrapper/ft-list-lazy-wrapper.js b/src/renderer/components/ft-list-lazy-wrapper/ft-list-lazy-wrapper.js index a0ec2f9bac996..392f208b72680 100644 --- a/src/renderer/components/ft-list-lazy-wrapper/ft-list-lazy-wrapper.js +++ b/src/renderer/components/ft-list-lazy-wrapper/ft-list-lazy-wrapper.js @@ -83,14 +83,30 @@ export default defineComponent({ return false } } else if (data.type === 'channel') { - if (this.channelsHidden.includes(data.id) || this.channelsHidden.includes(data.name) || - this.channelsHidden.includes(data.authorId) || this.channelsHidden.includes(data.author)) { + const attrsToCheck = [ + // Local API + data.id, + data.name, + // Invidious API + // https://docs.invidious.io/api/common_types/#channelobject + data.author, + data.authorId, + ] + if (attrsToCheck.some(a => a != null && this.channelsHidden.includes(a))) { // hide channels by author return false } } else if (data.type === 'playlist') { - if (this.channelsHidden.includes(data.channelId) || this.channelsHidden.includes(data.channelName) || - this.channelsHidden.includes(data.authorId) || this.channelsHidden.includes(data.author)) { + const attrsToCheck = [ + // Local API + data.channelId, + data.channelName, + // Invidious API + // https://docs.invidious.io/api/common_types/#playlistobject + data.author, + data.authorId, + ] + if (attrsToCheck.some(a => a != null && this.channelsHidden.includes(a))) { // hide playlists by author return false }