summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLe Jester <lejester@crates.im>2022-02-16 16:16:59 -0600
committerSamantaz Fox <coding@samantaz.fr>2022-02-23 13:03:21 +0100
commit897f871f99d229f333b82d65206621aa69cf53eb (patch)
treec85587b745a0dc33e690d09bb5d55d949ed6e57d /src
parent997d936e9c8d2b9ab87935fcbdd5b34a54d726b5 (diff)
downloadinvidious-897f871f99d229f333b82d65206621aa69cf53eb.tar.gz
invidious-897f871f99d229f333b82d65206621aa69cf53eb.tar.bz2
invidious-897f871f99d229f333b82d65206621aa69cf53eb.zip
Make the history recording optional.
Diffstat (limited to 'src')
-rw-r--r--src/invidious/config.cr1
-rw-r--r--src/invidious/routes/preferences.cr5
-rw-r--r--src/invidious/routes/watch.cr2
-rw-r--r--src/invidious/user/preferences.cr1
-rw-r--r--src/invidious/views/user/preferences.ecr5
5 files changed, 13 insertions, 1 deletions
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
@@ -23,6 +23,11 @@
</div>
<div class="pure-control-group">
+ <label for="watch_history"><%= translate(locale, "preferences_watch_history") %></label>
+ <input name="watch_history" id="watch_history" type="checkbox" <% if preferences.watch_history %>checked<% end %>>
+ </div>
+
+ <div class="pure-control-group">
<label for="continue_autoplay"><%= translate(locale, "preferences_continue_autoplay_label") %></label>
<input name="continue_autoplay" id="continue_autoplay" type="checkbox" <% if preferences.continue_autoplay %>checked<% end %>>
</div>