diff --git a/src/invidious/helpers/helpers.cr b/src/invidious/helpers/helpers.cr index e1d877b7..fa2209db 100644 --- a/src/invidious/helpers/helpers.cr +++ b/src/invidious/helpers/helpers.cr @@ -33,6 +33,7 @@ struct ConfigPreferences property continue : Bool = false property continue_autoplay : Bool = true property dark_mode : String = "" + property feed_cols : Int32 = 4 property latest_only : Bool = false property listen : Bool = false property local : Bool = false diff --git a/src/invidious/routes/preferences.cr b/src/invidious/routes/preferences.cr index 4901d22b..f4020701 100644 --- a/src/invidious/routes/preferences.cr +++ b/src/invidious/routes/preferences.cr @@ -97,6 +97,9 @@ class Invidious::Routes::PreferencesRoute < Invidious::Routes::BaseRoute max_results = env.params.body["max_results"]?.try &.as(String).to_i? max_results ||= CONFIG.default_user_preferences.max_results + feed_cols = env.params.body["feed_cols"]?.try &.as(String).to_i? + feed_cols ||= CONFIG.default_user_preferences.feed_cols + sort = env.params.body["sort"]?.try &.as(String) sort ||= CONFIG.default_user_preferences.sort @@ -122,6 +125,7 @@ class Invidious::Routes::PreferencesRoute < Invidious::Routes::BaseRoute continue: continue, continue_autoplay: continue_autoplay, dark_mode: dark_mode, + feed_cols: feed_cols, latest_only: latest_only, listen: listen, local: local, diff --git a/src/invidious/users.cr b/src/invidious/users.cr index e4ebb4d1..e9682992 100644 --- a/src/invidious/users.cr +++ b/src/invidious/users.cr @@ -50,6 +50,9 @@ struct Preferences @[JSON::Field(converter: Preferences::BoolToString)] @[YAML::Field(converter: Preferences::BoolToString)] property dark_mode : String = CONFIG.default_user_preferences.dark_mode + + @[JSON::Field(converter: Preferences::ClampInt)] + property feed_cols : Int32 = CONFIG.default_user_preferences.feed_cols 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 diff --git a/src/invidious/views/components/item.ecr b/src/invidious/views/components/item.ecr index 9dfa047e..fa278e92 100644 --- a/src/invidious/views/components/item.ecr +++ b/src/invidious/views/components/item.ecr @@ -1,4 +1,5 @@ -
+<% feed_cols = env.get("preferences").as(Preferences).feed_cols %> +
<% case item when %> <% when SearchChannel %> diff --git a/src/invidious/views/history.ecr b/src/invidious/views/history.ecr index fe8c70b9..531f7acc 100644 --- a/src/invidious/views/history.ecr +++ b/src/invidious/views/history.ecr @@ -30,7 +30,8 @@