From b51bc09ade9e4c1f755e616fb18f4cb465437066 Mon Sep 17 00:00:00 2001
From: ChunkyProgrammer <78101139+ChunkyProgrammer@users.noreply.github.com>
Date: Thu, 23 Feb 2023 00:46:29 -0500
Subject: [PATCH 1/3] Add RYD and RYD Proxy support
Co-Authored-By: petaded <74797538+petaded@users.noreply.github.com>
---
.../components/ryd-settings/ryd-settings.js | 45 +++++++++++++++++++
.../components/ryd-settings/ryd-settings.vue | 29 ++++++++++++
.../watch-video-info/watch-video-info.js | 4 ++
.../watch-video-info/watch-video-info.vue | 25 ++++-------
src/renderer/helpers/returnyoutubedislike.js | 25 +++++++++++
src/renderer/main.js | 2 +
src/renderer/store/modules/settings.js | 2 +
src/renderer/views/Settings/Settings.js | 2 +
src/renderer/views/Settings/Settings.vue | 2 +
src/renderer/views/Watch/Watch.js | 15 +++++++
static/locales/en-US.yaml | 4 ++
11 files changed, 139 insertions(+), 16 deletions(-)
create mode 100644 src/renderer/components/ryd-settings/ryd-settings.js
create mode 100644 src/renderer/components/ryd-settings/ryd-settings.vue
create mode 100644 src/renderer/helpers/returnyoutubedislike.js
diff --git a/src/renderer/components/ryd-settings/ryd-settings.js b/src/renderer/components/ryd-settings/ryd-settings.js
new file mode 100644
index 000000000000..d409c28fe6a7
--- /dev/null
+++ b/src/renderer/components/ryd-settings/ryd-settings.js
@@ -0,0 +1,45 @@
+import { defineComponent } from 'vue'
+import { mapActions } from 'vuex'
+import FtSettingsSection from '../ft-settings-section/ft-settings-section.vue'
+import FtToggleSwitch from '../ft-toggle-switch/ft-toggle-switch.vue'
+import FtInput from '../ft-input/ft-input.vue'
+import FtFlexBox from '../ft-flex-box/ft-flex-box.vue'
+
+import { getRYDInstances } from '../../helpers/returnyoutubedislike'
+
+export default defineComponent({
+ name: 'RydSettings',
+ components: {
+ 'ft-settings-section': FtSettingsSection,
+ 'ft-toggle-switch': FtToggleSwitch,
+ 'ft-input': FtInput,
+ 'ft-flex-box': FtFlexBox,
+ },
+ computed: {
+ useReturnYoutubeDislikes: function () {
+ return this.$store.getters.getUseReturnYouTubeDislikes
+ },
+ returnYoutubeDislikesUrl: function () {
+ return this.$store.getters.getReturnYouTubeDislikesUrl
+ },
+ returnYoutubeDislikesInstances: function() {
+ return getRYDInstances()
+ }
+ },
+ methods: {
+ handleUpdateUseReturnYoutubeDislike: function (value) {
+ this.updateUseReturnYouTubeDislikes(value)
+ },
+
+ handleUpdateReturnYouTubeDislikesUrl: function (value) {
+ const RYDUrlWithoutTrailingSlash = value.replace(/\/$/, '')
+ const RYDUrlWithoutVotesSuffix = RYDUrlWithoutTrailingSlash.replace(/\/votes$/, '')
+ this.updateReturnYouTubeDislikesUrl(RYDUrlWithoutVotesSuffix)
+ },
+
+ ...mapActions([
+ 'updateUseReturnYouTubeDislikes',
+ 'updateReturnYouTubeDislikesUrl',
+ ])
+ }
+})
diff --git a/src/renderer/components/ryd-settings/ryd-settings.vue b/src/renderer/components/ryd-settings/ryd-settings.vue
new file mode 100644
index 000000000000..487bf1cfd4a9
--- /dev/null
+++ b/src/renderer/components/ryd-settings/ryd-settings.vue
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/renderer/components/watch-video-info/watch-video-info.js b/src/renderer/components/watch-video-info/watch-video-info.js
index 03ca3496f450..358c6d9db7e5 100644
--- a/src/renderer/components/watch-video-info/watch-video-info.js
+++ b/src/renderer/components/watch-video-info/watch-video-info.js
@@ -279,6 +279,10 @@ export default defineComponent({
defaultPlayback: function () {
return this.$store.getters.getDefaultPlayback
+ },
+
+ useReturnYoutubeDislikes: function () {
+ return this.$store.getters.getUseReturnYouTubeDislikes
}
},
mounted: function () {
diff --git a/src/renderer/components/watch-video-info/watch-video-info.vue b/src/renderer/components/watch-video-info/watch-video-info.vue
index 5e554af42e79..6b8ae5e24420 100644
--- a/src/renderer/components/watch-video-info/watch-video-info.vue
+++ b/src/renderer/components/watch-video-info/watch-video-info.vue
@@ -49,20 +49,6 @@
{{ parsedViewCount }}
-
-
-
- {{ parsedLikeCount }}
-
-
-
-
res.json())
+
+ return response.dislikes
+}
+
+export function getRYDInstances() {
+ // hopefully we get an official instance list at some point instead of hard coding...
+ return [
+ 'https://returnyoutubedislikeapi.com',
+ 'https://ryd-proxy.kavin.rocks',
+ 'https://ryd-proxy.privacydev.net'
+ ]
+}
diff --git a/src/renderer/main.js b/src/renderer/main.js
index dd153e5fd2c2..fdb7e99e5a9d 100644
--- a/src/renderer/main.js
+++ b/src/renderer/main.js
@@ -49,6 +49,7 @@ import {
faStepBackward,
faStepForward,
faSync,
+ faThumbsDown,
faThumbsUp,
faThumbtack,
faTimes,
@@ -112,6 +113,7 @@ library.add(
faStepBackward,
faStepForward,
faSync,
+ faThumbsDown,
faThumbsUp,
faThumbtack,
faTimes,
diff --git a/src/renderer/store/modules/settings.js b/src/renderer/store/modules/settings.js
index 0476e182ef2e..e0a4af999291 100644
--- a/src/renderer/store/modules/settings.js
+++ b/src/renderer/store/modules/settings.js
@@ -281,6 +281,8 @@ const state = {
fetchSubscriptionsAutomatically: true,
settingsPassword: '',
allowDashAv1Formats: false,
+ returnYouTubeDislikesUrl: 'https://ryd-proxy.kavin.rocks',
+ useReturnYouTubeDislikes: false,
}
const stateWithSideEffects = {
diff --git a/src/renderer/views/Settings/Settings.js b/src/renderer/views/Settings/Settings.js
index df06cdb04ce3..2284720f5379 100644
--- a/src/renderer/views/Settings/Settings.js
+++ b/src/renderer/views/Settings/Settings.js
@@ -14,6 +14,7 @@ import ParentControlSettings from '../../components/parental-control-settings/pa
import ExperimentalSettings from '../../components/experimental-settings/experimental-settings.vue'
import PasswordSettings from '../../components/password-settings/password-settings.vue'
import PasswordDialog from '../../components/password-dialog/password-dialog.vue'
+import RydSettings from '../../components/ryd-settings/ryd-settings.vue'
export default defineComponent({
name: 'Settings',
@@ -33,6 +34,7 @@ export default defineComponent({
'experimental-settings': ExperimentalSettings,
'password-settings': PasswordSettings,
'password-dialog': PasswordDialog,
+ 'ryd-settings': RydSettings,
},
data: function () {
return {
diff --git a/src/renderer/views/Settings/Settings.vue b/src/renderer/views/Settings/Settings.vue
index 0109b54cdd09..202f33cccc50 100644
--- a/src/renderer/views/Settings/Settings.vue
+++ b/src/renderer/views/Settings/Settings.vue
@@ -27,6 +27,8 @@
+
+
{
+ this.videoDislikeCount = isNaN(dislikes) ? 0 : dislikes
+ })
+ }
}
this.isLive = !!result.basic_info.is_live
@@ -669,6 +679,11 @@ export default defineComponent({
} else {
this.videoLikeCount = result.likeCount
this.videoDislikeCount = result.dislikeCount
+ if (this.useReturnYouTubeDislikes) {
+ getVideoDislikes(this.videoId).then((dislikes) => {
+ this.videoDislikeCount = isNaN(dislikes) ? 0 : dislikes
+ })
+ }
}
if (this.hideChannelSubscriptions) {
this.channelSubscriptionCountText = ''
diff --git a/static/locales/en-US.yaml b/static/locales/en-US.yaml
index 7b5980bbc5d7..b99fd754aa2a 100644
--- a/static/locales/en-US.yaml
+++ b/static/locales/en-US.yaml
@@ -406,6 +406,10 @@ Settings:
Prompt To Skip: Prompt To Skip
Do Nothing: Do Nothing
Category Color: Category Color
+ Return YouTube Dislikes Settings:
+ Return YouTube Dislikes Settings: Return YouTube Dislikes Settings
+ Enable Return YouTube Dislikes: Enable Return YouTube Dislikes
+ Return YouTube Dislikes Url: Return YouTube dislikes API Url (Default is https://ryd-proxy.kavin.rocks/)
Parental Control Settings:
Parental Control Settings: Parental Control Settings
Hide Unsubscribe Button: Hide Unsubscribe Button
From c51031922d771e3bad221b6ec669b2c28a0985e0 Mon Sep 17 00:00:00 2001
From: ChunkyProgrammer <78101139+ChunkyProgrammer@users.noreply.github.com>
Date: Thu, 23 Feb 2023 18:20:23 -0500
Subject: [PATCH 2/3] Make regex case insensitive
Co-authored-by: absidue <48293849+absidue@users.noreply.github.com>
---
src/renderer/components/ryd-settings/ryd-settings.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/renderer/components/ryd-settings/ryd-settings.js b/src/renderer/components/ryd-settings/ryd-settings.js
index d409c28fe6a7..1db25b8d1231 100644
--- a/src/renderer/components/ryd-settings/ryd-settings.js
+++ b/src/renderer/components/ryd-settings/ryd-settings.js
@@ -33,7 +33,7 @@ export default defineComponent({
handleUpdateReturnYouTubeDislikesUrl: function (value) {
const RYDUrlWithoutTrailingSlash = value.replace(/\/$/, '')
- const RYDUrlWithoutVotesSuffix = RYDUrlWithoutTrailingSlash.replace(/\/votes$/, '')
+ const RYDUrlWithoutVotesSuffix = RYDUrlWithoutTrailingSlash.replace(/\/votes$/i, '')
this.updateReturnYouTubeDislikesUrl(RYDUrlWithoutVotesSuffix)
},
From 8b59c9cad527cdf263d625de268186250a2ed12f Mon Sep 17 00:00:00 2001
From: ChunkyProgrammer <78101139+ChunkyProgrammer@users.noreply.github.com>
Date: Sat, 25 Feb 2023 13:20:09 -0500
Subject: [PATCH 3/3] Move ryd section below sponsorblock
Co-authored-by: absidue <48293849+absidue@users.noreply.github.com>
---
src/renderer/views/Settings/Settings.vue | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/renderer/views/Settings/Settings.vue b/src/renderer/views/Settings/Settings.vue
index 202f33cccc50..6cc3a4737378 100644
--- a/src/renderer/views/Settings/Settings.vue
+++ b/src/renderer/views/Settings/Settings.vue
@@ -24,10 +24,10 @@
-
-
+
+