diff --git a/Cargo.lock b/Cargo.lock index 989aa5b..5efe8f4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -288,12 +288,6 @@ version = "1.0.75" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" -[[package]] -name = "arc-swap" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bddcadddf5e9015d310179a59bb28c4d4b9920ad0f11e8e14dbadf654890c9a6" - [[package]] name = "askama_escape" version = "0.10.3" @@ -571,11 +565,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "35ed6e9d84f0b51a7f52daf1c7d71dd136fd7a3f41a8462b8cdb8c78d920fad4" dependencies = [ "bytes 1.4.0", - "futures-core", "memchr", - "pin-project-lite", - "tokio 1.32.0", - "tokio-util", ] [[package]] @@ -1832,20 +1822,6 @@ dependencies = [ "ws2_32-sys", ] -[[package]] -name = "mlua" -version = "0.8.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bb37b0ba91f017aa7ca2b98ef99496827770cd635b4a932a6047c5b4bbe678e" -dependencies = [ - "bstr", - "cc", - "num-traits", - "once_cell", - "pkg-config", - "rustc-hash", -] - [[package]] name = "native-tls" version = "0.2.11" @@ -2201,26 +2177,6 @@ dependencies = [ "siphasher 0.3.11", ] -[[package]] -name = "pin-project" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fda4ed1c6c173e3fc7a83629421152e01d7b1f9b7f65fb301e490e8cfc656422" -dependencies = [ - "pin-project-internal", -] - -[[package]] -name = "pin-project-internal" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" -dependencies = [ - "proc-macro2 1.0.66", - "quote 1.0.33", - "syn 2.0.29", -] - [[package]] name = "pin-project-lite" version = "0.2.13" @@ -2498,21 +2454,12 @@ version = "0.23.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4f49cdc0bb3f412bf8e7d1bd90fe1d9eb10bc5c399ba90973c14662a27b3f8ba" dependencies = [ - "arc-swap", - "async-trait", - "bytes 1.4.0", "combine", - "futures 0.3.28", - "futures-util", "itoa 1.0.9", "percent-encoding 2.3.0", - "pin-project-lite", "ryu", "sha1_smol", "socket2 0.4.9", - "tokio 1.32.0", - "tokio-retry", - "tokio-util", "url 2.4.1", ] @@ -2631,6 +2578,30 @@ dependencies = [ "winreg 0.50.0", ] +[[package]] +name = "rlua" +version = "0.19.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d33e5ba15c3d43178f283ed5863d4531e292fc0e56fb773f3bea45f18e3a42a" +dependencies = [ + "bitflags 1.3.2", + "bstr", + "libc", + "num-traits", + "rlua-lua54-sys", +] + +[[package]] +name = "rlua-lua54-sys" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7aafabafe1895cb4a2be81a56d7ff3d46bf4b5d2f9cfdbea2ed404cdabe96474" +dependencies = [ + "cc", + "libc", + "pkg-config", +] + [[package]] name = "rustc-demangle" version = "0.1.23" @@ -3339,17 +3310,6 @@ dependencies = [ "tokio-sync", ] -[[package]] -name = "tokio-retry" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f57eb36ecbe0fc510036adff84824dd3c24bb781e21bfa67b69d556aa85214f" -dependencies = [ - "pin-project", - "rand 0.8.5", - "tokio 1.32.0", -] - [[package]] name = "tokio-sync" version = "0.1.8" @@ -3714,12 +3674,12 @@ dependencies = [ "log", "md5", "mimalloc", - "mlua", "once_cell", "rand 0.8.5", "redis", "regex", "reqwest 0.11.20", + "rlua", "rusty-hook", "scraper", "serde", diff --git a/src/config/parser.rs b/src/config/parser.rs index fa9f78c..ff29bb2 100644 --- a/src/config/parser.rs +++ b/src/config/parser.rs @@ -90,39 +90,38 @@ impl Config { parsed_threads }; - let parsed_safe_search:u8 = globals.get::<_,u8>("safe_search")?; - let safe_search: u8 = match parsed_safe_search { - 0..=4 => parsed_safe_search, - _ => { - log::error!("Config Error: The value of `safe_search` option should be a non zero positive integer from 0 to 4."); - log::error!("Falling back to using the value `1` for the option"); - 1 - } - }; + let parsed_safe_search: u8 = globals.get::<_, u8>("safe_search")?; + let safe_search: u8 = match parsed_safe_search { + 0..=4 => parsed_safe_search, + _ => { + log::error!("Config Error: The value of `safe_search` option should be a non zero positive integer from 0 to 4."); + log::error!("Falling back to using the value `1` for the option"); + 1 + } + }; - Ok(Config { - port: globals.get::<_, u16>("port")?, - binding_ip: globals.get::<_, String>("binding_ip")?, - style: Style::new( - globals.get::<_, String>("theme")?, - globals.get::<_, String>("colorscheme")?, - ), - redis_url: globals.get::<_, String>("redis_url")?, - aggregator: AggregatorConfig { - random_delay: globals.get::<_, bool>("production_use")?, - }, - logging, - debug, - upstream_search_engines: globals - .get::<_, HashMap>("upstream_search_engines")? - .into_iter() - .filter_map(|(key, value)| value.then_some(key)) - .filter_map(|engine| crate::engines::engine_models::EngineHandler::new(&engine)) - .collect(), - request_timeout: globals.get::<_, u8>("request_timeout")?, - threads, - safe_search - }) + Ok(Config { + port: globals.get::<_, u16>("port")?, + binding_ip: globals.get::<_, String>("binding_ip")?, + style: Style::new( + globals.get::<_, String>("theme")?, + globals.get::<_, String>("colorscheme")?, + ), + redis_url: globals.get::<_, String>("redis_url")?, + aggregator: AggregatorConfig { + random_delay: globals.get::<_, bool>("production_use")?, + }, + logging, + debug, + upstream_search_engines: globals + .get::<_, HashMap>("upstream_search_engines")? + .into_iter() + .filter_map(|(key, value)| value.then_some(key)) + .filter_map(|engine| crate::engines::engine_models::EngineHandler::new(engine)) + .collect(), + request_timeout: globals.get::<_, u8>("request_timeout")?, + threads, + safe_search, }) } }