From 10c7327c39b24b1a3df280518f84f672aa9b4234 Mon Sep 17 00:00:00 2001 From: ayaka Date: Mon, 6 Jan 2025 07:15:24 +1300 Subject: [PATCH] colorway toggle --- .env.example | 2 ++ src/settings.rs | 3 ++- src/utils.rs | 2 ++ templates/base.html | 4 +++- templates/settings.html | 7 ++++++- 5 files changed, 15 insertions(+), 3 deletions(-) diff --git a/.env.example b/.env.example index b63be36..5ba6d05 100644 --- a/.env.example +++ b/.env.example @@ -16,6 +16,8 @@ REDLIB_PUSHSHIFT_FRONTEND=undelete.pullpush.io REDLIB_DEFAULT_THEME=system # Set the default mascot REDLIB_DEFAULT_MASCOT=none +# Enable showing redsublib colorway by default +REDLIB_DEFAULT_REDSUBLIB_COLORWAY=off # Set the default front page (options: default, popular, all) REDLIB_DEFAULT_FRONT_PAGE=default # Set the default layout (options: card, clean, compact) diff --git a/src/settings.rs b/src/settings.rs index c7882a1..84db59f 100644 --- a/src/settings.rs +++ b/src/settings.rs @@ -21,9 +21,10 @@ struct SettingsTemplate { // CONSTANTS -const PREFS: [&str; 20] = [ +const PREFS: [&str; 21] = [ "theme", "mascot", + "redsublib_colorway", "front_page", "layout", "wide", diff --git a/src/utils.rs b/src/utils.rs index 5b72a89..0e019f2 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -607,6 +607,7 @@ pub struct Preferences { pub available_mascots: Vec, pub theme: String, pub mascot: String, + pub redsublib_colorway: String, pub front_page: String, pub layout: String, pub wide: String, @@ -661,6 +662,7 @@ impl Preferences { available_mascots: mascots, theme: setting(req, "theme"), mascot: setting(req, "mascot"), + redsublib_colorway: setting(req, "redsublib_colorway"), front_page: setting(req, "front_page"), layout: setting(req, "layout"), wide: setting(req, "wide"), diff --git a/templates/base.html b/templates/base.html index d71b337..00756d6 100644 --- a/templates/base.html +++ b/templates/base.html @@ -40,7 +40,9 @@