diff --git a/src/invidious.cr b/src/invidious.cr index 6f0bf088..82b8d0ed 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -700,6 +700,9 @@ post "/preferences" do |env| autoplay ||= "off" autoplay = autoplay == "on" + speed = env.params.body["speed"]?.try &.as(String).to_f + speed ||= 1.0 + quality = env.params.body["quality"]?.try &.as(String) quality ||= "hd720" @@ -713,6 +716,7 @@ post "/preferences" do |env| preferences = { "video_loop" => video_loop, "autoplay" => autoplay, + "speed" => speed, "quality" => quality, "volume" => volume, "dark_mode" => dark_mode, diff --git a/src/invidious/helpers.cr b/src/invidious/helpers.cr index ddd4914c..81c025a3 100644 --- a/src/invidious/helpers.cr +++ b/src/invidious/helpers.cr @@ -20,6 +20,7 @@ end DEFAULT_USER_PREFERENCES = Preferences.from_json({ "video_loop" => false, "autoplay" => false, + "speed" => 1.0, "quality" => "hd720", "volume" => 100, "dark_mode" => false, @@ -137,6 +138,7 @@ class Preferences JSON.mapping({ video_loop: Bool, autoplay: Bool, + speed: Float32, quality: String, volume: Int32, dark_mode: Bool, diff --git a/src/invidious/views/preferences.ecr b/src/invidious/views/preferences.ecr index 20eddbab..c38b14d7 100644 --- a/src/invidious/views/preferences.ecr +++ b/src/invidious/views/preferences.ecr @@ -22,12 +22,21 @@ function update_value(element) { checked<% end %>> +