Merge pull request #2929 from SamantazFox/add-disable-history-option

Make the history recording optional.
This commit is contained in:
Samantaz Fox 2022-02-23 18:43:15 +01:00 committed by GitHub
commit 5d1a1fef0f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 15 additions and 1 deletions

View file

@ -65,6 +65,7 @@
"preferences_continue_autoplay_label": "Autoplay next video: ", "preferences_continue_autoplay_label": "Autoplay next video: ",
"preferences_listen_label": "Listen by default: ", "preferences_listen_label": "Listen by default: ",
"preferences_local_label": "Proxy videos: ", "preferences_local_label": "Proxy videos: ",
"preferences_watch_history_label": "Enable watch history: ",
"preferences_speed_label": "Default speed: ", "preferences_speed_label": "Default speed: ",
"preferences_quality_label": "Preferred video quality: ", "preferences_quality_label": "Preferred video quality: ",
"preferences_quality_option_dash": "DASH (adaptative quality)", "preferences_quality_option_dash": "DASH (adaptative quality)",

View file

@ -55,6 +55,7 @@
"preferences_continue_autoplay_label": "Spila næst sjálfkrafa: ", "preferences_continue_autoplay_label": "Spila næst sjálfkrafa: ",
"preferences_listen_label": "Hlusta sjálfgefið: ", "preferences_listen_label": "Hlusta sjálfgefið: ",
"preferences_local_label": "Proxy myndbönd? ", "preferences_local_label": "Proxy myndbönd? ",
"preferences_watch_history": "Virkja áhorfssögu: ",
"preferences_speed_label": "Sjálfgefinn hraði: ", "preferences_speed_label": "Sjálfgefinn hraði: ",
"preferences_quality_label": "Æskilegt myndbands gæði: ", "preferences_quality_label": "Æskilegt myndbands gæði: ",
"preferences_volume_label": "Spilara hljóðstyrkur: ", "preferences_volume_label": "Spilara hljóðstyrkur: ",

View file

@ -23,6 +23,7 @@ struct ConfigPreferences
property listen : Bool = false property listen : Bool = false
property local : Bool = false property local : Bool = false
property locale : String = "en-US" property locale : String = "en-US"
property watch_history : Bool = true
property max_results : Int32 = 40 property max_results : Int32 = 40
property notifications_only : Bool = false property notifications_only : Bool = false
property player_style : String = "invidious" property player_style : String = "invidious"

View file

@ -47,6 +47,10 @@ module Invidious::Routes::PreferencesRoute
local ||= "off" local ||= "off"
local = local == "on" 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 = env.params.body["speed"]?.try &.as(String).to_f32?
speed ||= CONFIG.default_user_preferences.speed speed ||= CONFIG.default_user_preferences.speed
@ -149,6 +153,7 @@ module Invidious::Routes::PreferencesRoute
latest_only: latest_only, latest_only: latest_only,
listen: listen, listen: listen,
local: local, local: local,
watch_history: watch_history,
locale: locale, locale: locale,
max_results: max_results, max_results: max_results,
notifications_only: notifications_only, notifications_only: notifications_only,

View file

@ -75,7 +75,7 @@ module Invidious::Routes::Watch
end end
env.params.query.delete_all("iv_load_policy") 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) Invidious::Database::Users.mark_watched(user.as(User), id)
end end

View file

@ -23,6 +23,7 @@ struct Preferences
property latest_only : Bool = CONFIG.default_user_preferences.latest_only property latest_only : Bool = CONFIG.default_user_preferences.latest_only
property listen : Bool = CONFIG.default_user_preferences.listen property listen : Bool = CONFIG.default_user_preferences.listen
property local : Bool = CONFIG.default_user_preferences.local 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 vr_mode : Bool = CONFIG.default_user_preferences.vr_mode
property show_nick : Bool = CONFIG.default_user_preferences.show_nick property show_nick : Bool = CONFIG.default_user_preferences.show_nick

View file

@ -206,6 +206,11 @@
<% if env.get? "user" %> <% if env.get? "user" %>
<legend><%= translate(locale, "preferences_category_subscription") %></legend> <legend><%= translate(locale, "preferences_category_subscription") %></legend>
<div class="pure-control-group">
<label for="watch_history"><%= translate(locale, "preferences_watch_history_label") %></label>
<input name="watch_history" id="watch_history" type="checkbox" <% if preferences.watch_history %>checked<% end %>>
</div>
<div class="pure-control-group"> <div class="pure-control-group">
<label for="annotations_subscribed"><%= translate(locale, "preferences_annotations_subscribed_label") %></label> <label for="annotations_subscribed"><%= translate(locale, "preferences_annotations_subscribed_label") %></label>
<input name="annotations_subscribed" id="annotations_subscribed" type="checkbox" <% if preferences.annotations_subscribed %>checked<% end %>> <input name="annotations_subscribed" id="annotations_subscribed" type="checkbox" <% if preferences.annotations_subscribed %>checked<% end %>>