From 897f871f99d229f333b82d65206621aa69cf53eb Mon Sep 17 00:00:00 2001 From: Le Jester Date: Wed, 16 Feb 2022 16:16:59 -0600 Subject: [PATCH 1/3] Make the history recording optional. --- locales/en-US.json | 1 + locales/is.json | 1 + src/invidious/config.cr | 1 + src/invidious/routes/preferences.cr | 5 +++++ src/invidious/routes/watch.cr | 2 +- src/invidious/user/preferences.cr | 1 + src/invidious/views/user/preferences.ecr | 5 +++++ 7 files changed, 15 insertions(+), 1 deletion(-) diff --git a/locales/en-US.json b/locales/en-US.json index c924c8aa..61e7840c 100644 --- a/locales/en-US.json +++ b/locales/en-US.json @@ -65,6 +65,7 @@ "preferences_continue_autoplay_label": "Autoplay next video: ", "preferences_listen_label": "Listen by default: ", "preferences_local_label": "Proxy videos: ", + "preferences_watch_history": "Enable watch history: ", "preferences_speed_label": "Default speed: ", "preferences_quality_label": "Preferred video quality: ", "preferences_quality_option_dash": "DASH (adaptative quality)", diff --git a/locales/is.json b/locales/is.json index 9258154e..8d565dae 100644 --- a/locales/is.json +++ b/locales/is.json @@ -55,6 +55,7 @@ "preferences_continue_autoplay_label": "Spila næst sjálfkrafa: ", "preferences_listen_label": "Hlusta sjálfgefið: ", "preferences_local_label": "Proxy myndbönd? ", + "preferences_watch_history": "Virkja áhorfssögu: ", "preferences_speed_label": "Sjálfgefinn hraði: ", "preferences_quality_label": "Æskilegt myndbands gæði: ", "preferences_volume_label": "Spilara hljóðstyrkur: ", diff --git a/src/invidious/config.cr b/src/invidious/config.cr index 72e145da..280de702 100644 --- a/src/invidious/config.cr +++ b/src/invidious/config.cr @@ -23,6 +23,7 @@ struct ConfigPreferences property listen : Bool = false property local : Bool = false property locale : String = "en-US" + property watch_history : Bool = true property max_results : Int32 = 40 property notifications_only : Bool = false property player_style : String = "invidious" diff --git a/src/invidious/routes/preferences.cr b/src/invidious/routes/preferences.cr index 68d61fd1..570cba69 100644 --- a/src/invidious/routes/preferences.cr +++ b/src/invidious/routes/preferences.cr @@ -47,6 +47,10 @@ module Invidious::Routes::PreferencesRoute local ||= "off" local = local == "on" + watch_history = env.params.body["watch_history"]?.try &.as(String) + watch_history ||= "off" + watch_history = watch_history == "on" + speed = env.params.body["speed"]?.try &.as(String).to_f32? speed ||= CONFIG.default_user_preferences.speed @@ -149,6 +153,7 @@ module Invidious::Routes::PreferencesRoute latest_only: latest_only, listen: listen, local: local, + watch_history: watch_history, locale: locale, max_results: max_results, notifications_only: notifications_only, diff --git a/src/invidious/routes/watch.cr b/src/invidious/routes/watch.cr index 42bc4219..f5454bb5 100644 --- a/src/invidious/routes/watch.cr +++ b/src/invidious/routes/watch.cr @@ -75,7 +75,7 @@ module Invidious::Routes::Watch end env.params.query.delete_all("iv_load_policy") - if watched && !watched.includes? id + if watched && preferences.watch_history && !watched.includes? id Invidious::Database::Users.mark_watched(user.as(User), id) end diff --git a/src/invidious/user/preferences.cr b/src/invidious/user/preferences.cr index bf7ea401..8ecbe7a0 100644 --- a/src/invidious/user/preferences.cr +++ b/src/invidious/user/preferences.cr @@ -23,6 +23,7 @@ struct Preferences property latest_only : Bool = CONFIG.default_user_preferences.latest_only property listen : Bool = CONFIG.default_user_preferences.listen property local : Bool = CONFIG.default_user_preferences.local + property watch_history : Bool = CONFIG.default_user_preferences.watch_history property vr_mode : Bool = CONFIG.default_user_preferences.vr_mode property show_nick : Bool = CONFIG.default_user_preferences.show_nick diff --git a/src/invidious/views/user/preferences.ecr b/src/invidious/views/user/preferences.ecr index 3606d140..1e16c5ec 100644 --- a/src/invidious/views/user/preferences.ecr +++ b/src/invidious/views/user/preferences.ecr @@ -22,6 +22,11 @@ checked<% end %>> +
+ + checked<% end %>> +
+
checked<% end %>> From 8da336b7aa201abea73b4b7844318ad323c6cd62 Mon Sep 17 00:00:00 2001 From: Samantaz Fox Date: Wed, 23 Feb 2022 16:42:34 +0100 Subject: [PATCH 2/3] Move the "watch history" checkbox under the "user" section --- src/invidious/views/user/preferences.ecr | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/invidious/views/user/preferences.ecr b/src/invidious/views/user/preferences.ecr index 1e16c5ec..a584cedb 100644 --- a/src/invidious/views/user/preferences.ecr +++ b/src/invidious/views/user/preferences.ecr @@ -22,11 +22,6 @@ checked<% end %>>
-
- - checked<% end %>> -
-
checked<% end %>> @@ -211,6 +206,11 @@ <% if env.get? "user" %> <%= translate(locale, "preferences_category_subscription") %> +
+ + checked<% end %>> +
+
checked<% end %>> From 60828870701fda890357ac6b9e91202ae24229a6 Mon Sep 17 00:00:00 2001 From: Samantaz Fox Date: Wed, 23 Feb 2022 16:43:59 +0100 Subject: [PATCH 3/3] Add missing '_label' suffix to translation identifier --- locales/en-US.json | 2 +- src/invidious/views/user/preferences.ecr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/locales/en-US.json b/locales/en-US.json index 61e7840c..1335d384 100644 --- a/locales/en-US.json +++ b/locales/en-US.json @@ -65,7 +65,7 @@ "preferences_continue_autoplay_label": "Autoplay next video: ", "preferences_listen_label": "Listen by default: ", "preferences_local_label": "Proxy videos: ", - "preferences_watch_history": "Enable watch history: ", + "preferences_watch_history_label": "Enable watch history: ", "preferences_speed_label": "Default speed: ", "preferences_quality_label": "Preferred video quality: ", "preferences_quality_option_dash": "DASH (adaptative quality)", diff --git a/src/invidious/views/user/preferences.ecr b/src/invidious/views/user/preferences.ecr index a584cedb..dbb5e9db 100644 --- a/src/invidious/views/user/preferences.ecr +++ b/src/invidious/views/user/preferences.ecr @@ -207,7 +207,7 @@ <%= translate(locale, "preferences_category_subscription") %>
- + checked<% end %>>