From 8c239e23130aaba5ad35ba19661a5adc9ec0c77a Mon Sep 17 00:00:00 2001 From: neon_arch Date: Sun, 17 Sep 2023 12:48:52 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=9B=A0=EF=B8=8F=20fix:=20make=20the=20red?= =?UTF-8?q?is=5Furl=20option=20only=20available=20on=20`redis-cache`=20fea?= =?UTF-8?q?ture=20(#244)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/config/parser.rs | 6 ++++-- src/models/server_models.rs | 11 +++++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/config/parser.rs b/src/config/parser.rs index 6d84374..fb9f8b1 100644 --- a/src/config/parser.rs +++ b/src/config/parser.rs @@ -17,9 +17,10 @@ pub struct Config { pub binding_ip: String, /// It stores the theming options for the website. pub style: Style, + #[cfg(feature = "redis-cache")] /// It stores the redis connection url address on which the redis /// client should connect. - pub redis_url: Option, + pub redis_url: String, /// It stores the option to whether enable or disable production use. pub aggregator: AggregatorConfig, /// It stores the option to whether enable or disable logs. @@ -99,7 +100,8 @@ impl Config { globals.get::<_, String>("theme")?, globals.get::<_, String>("colorscheme")?, ), - redis_url: globals.get::<_, String>("redis_url").ok(), + #[cfg(feature = "redis-cache")] + redis_url: globals.get::<_, String>("redis_url")?, aggregator: AggregatorConfig { random_delay: globals.get::<_, bool>("production_use")?, }, diff --git a/src/models/server_models.rs b/src/models/server_models.rs index 3da6717..c9ed350 100644 --- a/src/models/server_models.rs +++ b/src/models/server_models.rs @@ -11,16 +11,19 @@ pub struct SearchParams { /// It stores the search parameter `page` (or pageno in simple words) /// of the search url. pub page: Option, + /// It stores the search parameter `safesearch` (or safe search level in simple words) of the + /// search url. + pub safesearch: Option, } /// A named struct which is used to deserialize the cookies fetched from the client side. #[allow(dead_code)] #[derive(Deserialize)] -pub struct Cookie { +pub struct Cookie<'a> { /// It stores the theme name used in the website. - pub theme: String, + pub theme: &'a str, /// It stores the colorscheme name used for the website theme. - pub colorscheme: String, + pub colorscheme: &'a str, /// It stores the user selected upstream search engines selected from the UI. - pub engines: Vec, + pub engines: Vec<&'a str>, }