diff --git a/src/invidious.cr b/src/invidious.cr index de247592..30e4e24b 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -1363,6 +1363,10 @@ post "/preferences" do |env| dark_mode ||= "off" dark_mode = dark_mode == "on" + thin_mode = env.params.body["thin_mode"]?.try &.as(String) + thin_mode ||= "off" + thin_mode = thin_mode == "on" + max_results = env.params.body["max_results"]?.try &.as(String).to_i max_results ||= 40 @@ -1380,6 +1384,7 @@ post "/preferences" do |env| "quality" => quality, "volume" => volume, "dark_mode" => dark_mode, + "thin_mode" => thin_mode, "max_results" => max_results, "sort" => sort, "latest_only" => latest_only, diff --git a/src/invidious/helpers.cr b/src/invidious/helpers.cr index 38283b7d..fb7c573b 100644 --- a/src/invidious/helpers.cr +++ b/src/invidious/helpers.cr @@ -24,6 +24,7 @@ DEFAULT_USER_PREFERENCES = Preferences.from_json({ "quality" => "hd720", "volume" => 100, "dark_mode" => false, + "thin_mode " => false, "max_results" => 40, "sort" => "published", "latest_only" => false, @@ -148,14 +149,20 @@ class User }) end +# TODO: Migrate preferences so this will not be nilable class Preferences JSON.mapping({ - video_loop: Bool, - autoplay: Bool, - speed: Float32, - quality: String, - volume: Int32, - dark_mode: Bool, + video_loop: Bool, + autoplay: Bool, + speed: Float32, + quality: String, + volume: Int32, + dark_mode: Bool, + thin_mode: { + type: Bool, + nilable: true, + default: false, + }, max_results: Int32, sort: String, latest_only: Bool, diff --git a/src/invidious/views/components/subscription_video.ecr b/src/invidious/views/components/subscription_video.ecr index 377f51cb..f1ad4bb3 100644 --- a/src/invidious/views/components/subscription_video.ecr +++ b/src/invidious/views/components/subscription_video.ecr @@ -1,7 +1,10 @@
<%= video.title %>
diff --git a/src/invidious/views/components/video.ecr b/src/invidious/views/components/video.ecr index 804080cc..d145270f 100644 --- a/src/invidious/views/components/video.ecr +++ b/src/invidious/views/components/video.ecr @@ -1,7 +1,10 @@
<%= video.title %>
diff --git a/src/invidious/views/preferences.ecr b/src/invidious/views/preferences.ecr index 370dfc0f..50e8b0e9 100644 --- a/src/invidious/views/preferences.ecr +++ b/src/invidious/views/preferences.ecr @@ -53,6 +53,11 @@ function update_value(element) { checked<% end %>>
<%= rv["title"] %>
<%= rv["author"] %>