Spaces:
Runtime error
Runtime error
neon_arch
commited on
Commit
•
ac4e29a
1
Parent(s):
60b2fcc
🧹 chore: make github actions happy (#201)
Browse files- Cargo.lock +25 -65
- src/config/parser.rs +31 -32
Cargo.lock
CHANGED
@@ -288,12 +288,6 @@ version = "1.0.75"
|
|
288 |
source = "registry+https://github.com/rust-lang/crates.io-index"
|
289 |
checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6"
|
290 |
|
291 |
-
[[package]]
|
292 |
-
name = "arc-swap"
|
293 |
-
version = "1.6.0"
|
294 |
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
295 |
-
checksum = "bddcadddf5e9015d310179a59bb28c4d4b9920ad0f11e8e14dbadf654890c9a6"
|
296 |
-
|
297 |
[[package]]
|
298 |
name = "askama_escape"
|
299 |
version = "0.10.3"
|
@@ -571,11 +565,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
571 |
checksum = "35ed6e9d84f0b51a7f52daf1c7d71dd136fd7a3f41a8462b8cdb8c78d920fad4"
|
572 |
dependencies = [
|
573 |
"bytes 1.4.0",
|
574 |
-
"futures-core",
|
575 |
"memchr",
|
576 |
-
"pin-project-lite",
|
577 |
-
"tokio 1.32.0",
|
578 |
-
"tokio-util",
|
579 |
]
|
580 |
|
581 |
[[package]]
|
@@ -1832,20 +1822,6 @@ dependencies = [
|
|
1832 |
"ws2_32-sys",
|
1833 |
]
|
1834 |
|
1835 |
-
[[package]]
|
1836 |
-
name = "mlua"
|
1837 |
-
version = "0.8.10"
|
1838 |
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1839 |
-
checksum = "0bb37b0ba91f017aa7ca2b98ef99496827770cd635b4a932a6047c5b4bbe678e"
|
1840 |
-
dependencies = [
|
1841 |
-
"bstr",
|
1842 |
-
"cc",
|
1843 |
-
"num-traits",
|
1844 |
-
"once_cell",
|
1845 |
-
"pkg-config",
|
1846 |
-
"rustc-hash",
|
1847 |
-
]
|
1848 |
-
|
1849 |
[[package]]
|
1850 |
name = "native-tls"
|
1851 |
version = "0.2.11"
|
@@ -2201,26 +2177,6 @@ dependencies = [
|
|
2201 |
"siphasher 0.3.11",
|
2202 |
]
|
2203 |
|
2204 |
-
[[package]]
|
2205 |
-
name = "pin-project"
|
2206 |
-
version = "1.1.3"
|
2207 |
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
2208 |
-
checksum = "fda4ed1c6c173e3fc7a83629421152e01d7b1f9b7f65fb301e490e8cfc656422"
|
2209 |
-
dependencies = [
|
2210 |
-
"pin-project-internal",
|
2211 |
-
]
|
2212 |
-
|
2213 |
-
[[package]]
|
2214 |
-
name = "pin-project-internal"
|
2215 |
-
version = "1.1.3"
|
2216 |
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
2217 |
-
checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405"
|
2218 |
-
dependencies = [
|
2219 |
-
"proc-macro2 1.0.66",
|
2220 |
-
"quote 1.0.33",
|
2221 |
-
"syn 2.0.29",
|
2222 |
-
]
|
2223 |
-
|
2224 |
[[package]]
|
2225 |
name = "pin-project-lite"
|
2226 |
version = "0.2.13"
|
@@ -2498,21 +2454,12 @@ version = "0.23.3"
|
|
2498 |
source = "registry+https://github.com/rust-lang/crates.io-index"
|
2499 |
checksum = "4f49cdc0bb3f412bf8e7d1bd90fe1d9eb10bc5c399ba90973c14662a27b3f8ba"
|
2500 |
dependencies = [
|
2501 |
-
"arc-swap",
|
2502 |
-
"async-trait",
|
2503 |
-
"bytes 1.4.0",
|
2504 |
"combine",
|
2505 |
-
"futures 0.3.28",
|
2506 |
-
"futures-util",
|
2507 |
"itoa 1.0.9",
|
2508 |
"percent-encoding 2.3.0",
|
2509 |
-
"pin-project-lite",
|
2510 |
"ryu",
|
2511 |
"sha1_smol",
|
2512 |
"socket2 0.4.9",
|
2513 |
-
"tokio 1.32.0",
|
2514 |
-
"tokio-retry",
|
2515 |
-
"tokio-util",
|
2516 |
"url 2.4.1",
|
2517 |
]
|
2518 |
|
@@ -2631,6 +2578,30 @@ dependencies = [
|
|
2631 |
"winreg 0.50.0",
|
2632 |
]
|
2633 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2634 |
[[package]]
|
2635 |
name = "rustc-demangle"
|
2636 |
version = "0.1.23"
|
@@ -3339,17 +3310,6 @@ dependencies = [
|
|
3339 |
"tokio-sync",
|
3340 |
]
|
3341 |
|
3342 |
-
[[package]]
|
3343 |
-
name = "tokio-retry"
|
3344 |
-
version = "0.3.0"
|
3345 |
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
3346 |
-
checksum = "7f57eb36ecbe0fc510036adff84824dd3c24bb781e21bfa67b69d556aa85214f"
|
3347 |
-
dependencies = [
|
3348 |
-
"pin-project",
|
3349 |
-
"rand 0.8.5",
|
3350 |
-
"tokio 1.32.0",
|
3351 |
-
]
|
3352 |
-
|
3353 |
[[package]]
|
3354 |
name = "tokio-sync"
|
3355 |
version = "0.1.8"
|
@@ -3714,12 +3674,12 @@ dependencies = [
|
|
3714 |
"log",
|
3715 |
"md5",
|
3716 |
"mimalloc",
|
3717 |
-
"mlua",
|
3718 |
"once_cell",
|
3719 |
"rand 0.8.5",
|
3720 |
"redis",
|
3721 |
"regex",
|
3722 |
"reqwest 0.11.20",
|
|
|
3723 |
"rusty-hook",
|
3724 |
"scraper",
|
3725 |
"serde",
|
|
|
288 |
source = "registry+https://github.com/rust-lang/crates.io-index"
|
289 |
checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6"
|
290 |
|
|
|
|
|
|
|
|
|
|
|
|
|
291 |
[[package]]
|
292 |
name = "askama_escape"
|
293 |
version = "0.10.3"
|
|
|
565 |
checksum = "35ed6e9d84f0b51a7f52daf1c7d71dd136fd7a3f41a8462b8cdb8c78d920fad4"
|
566 |
dependencies = [
|
567 |
"bytes 1.4.0",
|
|
|
568 |
"memchr",
|
|
|
|
|
|
|
569 |
]
|
570 |
|
571 |
[[package]]
|
|
|
1822 |
"ws2_32-sys",
|
1823 |
]
|
1824 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1825 |
[[package]]
|
1826 |
name = "native-tls"
|
1827 |
version = "0.2.11"
|
|
|
2177 |
"siphasher 0.3.11",
|
2178 |
]
|
2179 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2180 |
[[package]]
|
2181 |
name = "pin-project-lite"
|
2182 |
version = "0.2.13"
|
|
|
2454 |
source = "registry+https://github.com/rust-lang/crates.io-index"
|
2455 |
checksum = "4f49cdc0bb3f412bf8e7d1bd90fe1d9eb10bc5c399ba90973c14662a27b3f8ba"
|
2456 |
dependencies = [
|
|
|
|
|
|
|
2457 |
"combine",
|
|
|
|
|
2458 |
"itoa 1.0.9",
|
2459 |
"percent-encoding 2.3.0",
|
|
|
2460 |
"ryu",
|
2461 |
"sha1_smol",
|
2462 |
"socket2 0.4.9",
|
|
|
|
|
|
|
2463 |
"url 2.4.1",
|
2464 |
]
|
2465 |
|
|
|
2578 |
"winreg 0.50.0",
|
2579 |
]
|
2580 |
|
2581 |
+
[[package]]
|
2582 |
+
name = "rlua"
|
2583 |
+
version = "0.19.7"
|
2584 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
2585 |
+
checksum = "5d33e5ba15c3d43178f283ed5863d4531e292fc0e56fb773f3bea45f18e3a42a"
|
2586 |
+
dependencies = [
|
2587 |
+
"bitflags 1.3.2",
|
2588 |
+
"bstr",
|
2589 |
+
"libc",
|
2590 |
+
"num-traits",
|
2591 |
+
"rlua-lua54-sys",
|
2592 |
+
]
|
2593 |
+
|
2594 |
+
[[package]]
|
2595 |
+
name = "rlua-lua54-sys"
|
2596 |
+
version = "0.1.6"
|
2597 |
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
2598 |
+
checksum = "7aafabafe1895cb4a2be81a56d7ff3d46bf4b5d2f9cfdbea2ed404cdabe96474"
|
2599 |
+
dependencies = [
|
2600 |
+
"cc",
|
2601 |
+
"libc",
|
2602 |
+
"pkg-config",
|
2603 |
+
]
|
2604 |
+
|
2605 |
[[package]]
|
2606 |
name = "rustc-demangle"
|
2607 |
version = "0.1.23"
|
|
|
3310 |
"tokio-sync",
|
3311 |
]
|
3312 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3313 |
[[package]]
|
3314 |
name = "tokio-sync"
|
3315 |
version = "0.1.8"
|
|
|
3674 |
"log",
|
3675 |
"md5",
|
3676 |
"mimalloc",
|
|
|
3677 |
"once_cell",
|
3678 |
"rand 0.8.5",
|
3679 |
"redis",
|
3680 |
"regex",
|
3681 |
"reqwest 0.11.20",
|
3682 |
+
"rlua",
|
3683 |
"rusty-hook",
|
3684 |
"scraper",
|
3685 |
"serde",
|
src/config/parser.rs
CHANGED
@@ -90,39 +90,38 @@ impl Config {
|
|
90 |
parsed_threads
|
91 |
};
|
92 |
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
})
|
126 |
})
|
127 |
}
|
128 |
}
|
|
|
90 |
parsed_threads
|
91 |
};
|
92 |
|
93 |
+
let parsed_safe_search: u8 = globals.get::<_, u8>("safe_search")?;
|
94 |
+
let safe_search: u8 = match parsed_safe_search {
|
95 |
+
0..=4 => parsed_safe_search,
|
96 |
+
_ => {
|
97 |
+
log::error!("Config Error: The value of `safe_search` option should be a non zero positive integer from 0 to 4.");
|
98 |
+
log::error!("Falling back to using the value `1` for the option");
|
99 |
+
1
|
100 |
+
}
|
101 |
+
};
|
102 |
|
103 |
+
Ok(Config {
|
104 |
+
port: globals.get::<_, u16>("port")?,
|
105 |
+
binding_ip: globals.get::<_, String>("binding_ip")?,
|
106 |
+
style: Style::new(
|
107 |
+
globals.get::<_, String>("theme")?,
|
108 |
+
globals.get::<_, String>("colorscheme")?,
|
109 |
+
),
|
110 |
+
redis_url: globals.get::<_, String>("redis_url")?,
|
111 |
+
aggregator: AggregatorConfig {
|
112 |
+
random_delay: globals.get::<_, bool>("production_use")?,
|
113 |
+
},
|
114 |
+
logging,
|
115 |
+
debug,
|
116 |
+
upstream_search_engines: globals
|
117 |
+
.get::<_, HashMap<String, bool>>("upstream_search_engines")?
|
118 |
+
.into_iter()
|
119 |
+
.filter_map(|(key, value)| value.then_some(key))
|
120 |
+
.filter_map(|engine| crate::engines::engine_models::EngineHandler::new(engine))
|
121 |
+
.collect(),
|
122 |
+
request_timeout: globals.get::<_, u8>("request_timeout")?,
|
123 |
+
threads,
|
124 |
+
safe_search,
|
|
|
125 |
})
|
126 |
}
|
127 |
}
|