fix(preferences): unchecked pages_enabled checkboxes now persist correctly

HTML checkboxes send no value when unchecked, so the fallback
"|| \"on\"" always re-enabled popular/trending/search on save.
Changed default to "off" to match the pattern used by captcha_enabled,
login_enabled, and other checkbox toggles in the same handler.
This commit is contained in:
NorkzYT 2026-03-22 21:10:55 +00:00
parent bd6dd9cb55
commit ea36b2ba4b

View File

@ -202,9 +202,9 @@ module Invidious::Routes::PreferencesRoute
CONFIG.default_user_preferences.feed_menu = admin_feed_menu CONFIG.default_user_preferences.feed_menu = admin_feed_menu
CONFIG.pages_enabled = PagesEnabled.new( CONFIG.pages_enabled = PagesEnabled.new(
popular: (env.params.body["popular_enabled"]?.try &.as(String) || "on") == "on", popular: (env.params.body["popular_enabled"]?.try &.as(String) || "off") == "on",
trending: (env.params.body["trending_enabled"]?.try &.as(String) || "on") == "on", trending: (env.params.body["trending_enabled"]?.try &.as(String) || "off") == "on",
search: (env.params.body["search_enabled"]?.try &.as(String) || "on") == "on", search: (env.params.body["search_enabled"]?.try &.as(String) || "off") == "on",
) )
captcha_enabled = env.params.body["captcha_enabled"]?.try &.as(String) captcha_enabled = env.params.body["captcha_enabled"]?.try &.as(String)