From 6cafa1509bdc4b288103947c7ab228c0b4860733 Mon Sep 17 00:00:00 2001 From: tarant28 Date: Mon, 6 Apr 2026 15:37:58 +0100 Subject: [PATCH] Commit for Feature Request #7907 Added a setting which allows the option to randomize the order of videos in the subscription feed --- .../SubscriptionSettings.vue | 16 ++++++++++++++++ src/renderer/helpers/subscriptions.js | 13 +++++++++---- src/renderer/store/modules/settings.js | 1 + static/locales/en-US.yaml | 1 + 4 files changed, 27 insertions(+), 4 deletions(-) diff --git a/src/renderer/components/SubscriptionSettings/SubscriptionSettings.vue b/src/renderer/components/SubscriptionSettings/SubscriptionSettings.vue index 2e7e6f6935816..12c7adf50b156 100644 --- a/src/renderer/components/SubscriptionSettings/SubscriptionSettings.vue +++ b/src/renderer/components/SubscriptionSettings/SubscriptionSettings.vue @@ -24,6 +24,12 @@ compact @change="updateUnsubscriptionPopupStatus" /> +
} */ +const randomizeSubscriptionOrder = computed(() => store.getters.getRandomizeSubscriptionOrder) + +/** + * @param {boolean} value + */ +function updateRandomizeSubscriptionOrder(value) { + store.dispatch('updateRandomizeSubscriptionOrder', value) +} + /** @type {import('vue').ComputedRef} */ const onlyShowLatestFromChannel = computed(() => store.getters.getOnlyShowLatestFromChannel) diff --git a/src/renderer/helpers/subscriptions.js b/src/renderer/helpers/subscriptions.js index 25d12ac9b9f9f..4b72c4ba8f37c 100644 --- a/src/renderer/helpers/subscriptions.js +++ b/src/renderer/helpers/subscriptions.js @@ -56,10 +56,15 @@ export function updateVideoListAfterProcessing(videos) { }) } - videoList.sort((a, b) => { - return b.published - a.published - }) - + if (store.getters.getRandomizeSubscriptionOrder) { + const shuffled = videoList.map(value => ({ value, sort: Math.random() })) + shuffled.sort((a, b) => a.sort - b.sort) + videoList = shuffled.map(item => item.value) + } else { + videoList.sort((a, b) => { + return b.published - a.published + }) + } return videoList } diff --git a/src/renderer/store/modules/settings.js b/src/renderer/store/modules/settings.js index 99affa66401d0..65cebfdd941d7 100644 --- a/src/renderer/store/modules/settings.js +++ b/src/renderer/store/modules/settings.js @@ -226,6 +226,7 @@ const state = { maxVideoPlaybackRate: 3, onlyShowLatestFromChannel: false, onlyShowLatestFromChannelNumber: 1, + randomizeSubscriptionOrder: false, openDeepLinksInNewWindow: false, playNextVideo: false, proxyHostname: '127.0.0.1', diff --git a/static/locales/en-US.yaml b/static/locales/en-US.yaml index 95aedd31f9d06..5cb1f563f7ff1 100644 --- a/static/locales/en-US.yaml +++ b/static/locales/en-US.yaml @@ -533,6 +533,7 @@ Settings: 'Limit the number of videos displayed for each channel': 'Limit the number of videos displayed for each channel' To: To Confirm Before Unsubscribing: Confirm Before Unsubscribing + Randomize Order: Randomize Order Distraction Free Settings: Distraction Free Settings: Distraction Free Sections: