Spaces:
Runtime error
Squashed commit of the following:
Browse filescommit 41f3fe7485f6ae7e7ea741f1e5bc59fa1df948ec
Merge: d073aa2 7f84c63
Author: alamin655 <[email protected]>
Date: Sat Dec 30 12:27:50 2023 +0530
Merge pull request #462 from neon-mmd/CHORE/461_display-the-user-provided-settings-from-the-config-or-the-ui-in-the-settings-page
:children_crossing: Display the user provided settings from the config or the UI in the settings page
commit 7f84c6346d507cd8bdaaca9390d67021b785c748
Merge: d894370 d073aa2
Author: alamin655 <[email protected]>
Date: Sat Dec 30 12:23:47 2023 +0530
Merge branch 'rolling' into CHORE/461_display-the-user-provided-settings-from-the-config-or-the-ui-in-the-settings-page
commit d073aa247ae391a60a4f7a2257be21bda8b80740
Author: ddotthomas <[email protected]>
Date: Fri Dec 29 11:20:38 2023 -0700
β»οΈ refactor: start tracking page numbers from 0 instead of 1 in the backend (#467)
Co-authored-by: neon_arch <[email protected]>
commit 9f23a1c70b5a387d81448aeb69ef91e31b0dae68
Author: Jann Marc Villablanca <[email protected]>
Date: Sat Dec 30 00:21:06 2023 +0800
β¨ feat(engine): `mojeek` for the search engine (#464)
* π§βπ» fix: add closing curly brace in the nix build step
* β¨ feat: add code to provide search results from `mojeek` engine
---------
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
commit d8943709c7eb19b7987440a22772397ddadeb726
Author: neon_arch <[email protected]>
Date: Thu Dec 28 21:08:11 2023 +0300
π¨ chore: make cargo format checks happy (#461)
commit 93afb6b8c99e39b23674caaacd6f9ba68f7871fd
Merge: 83c3981 9f5213c
Author: neon_arch <[email protected]>
Date: Thu Dec 28 21:04:21 2023 +0300
Merge branch 'rolling' into CHORE/461_display-the-user-provided-settings-from-the-config-or-the-ui-in-the-settings-page
commit 83c398169735ff1d2ce29e34b9d9979f384b0452
Author: neon_arch <[email protected]>
Date: Thu Dec 28 20:22:05 2023 +0300
π chore: bump the app version (#461)
commit 40138572bec2074218596700fbbbecaa7b42c2cf
Author: neon_arch <[email protected]>
Date: Thu Dec 28 20:15:38 2023 +0300
π¨ chore: make clippy checks happy (#461)
commit 7b392b369db96e169ba86aa447e64979bce49423
Author: neon_arch <[email protected]>
Date: Thu Dec 28 20:09:35 2023 +0300
π chore: add style for the new message when a setting is managed by the config cannot be altered/modified (#461)
commit 26aa345f06cebb1fa499cc60a9b09a90fdc712a3
Author: neon_arch <[email protected]>
Date: Thu Dec 28 19:56:11 2023 +0300
πΈ chore: pass the `safe_search_level` & `upstream_search_engines` as a hashmap in the `settings` view function (#461)
commit b7a23f1826eb0bee522008398292231c4188d8ab
Author: neon_arch <[email protected]>
Date: Thu Dec 28 19:54:47 2023 +0300
πΈ chore: add code to display saved settings from the config on the settings page (#461)
commit 34468202f949de4df273012b88dbe4f0d3fcdc5e
Author: neon_arch <[email protected]>
Date: Thu Dec 28 19:54:28 2023 +0300
πΈ chore: add code to display saved user settings from the cookies on the settings page (#461)
commit 9f5213cf42165dd36133a2e6bcdf0e77b81edfb2
Author: maokwen <[email protected]>
Date: Thu Dec 28 12:05:21 2023 +0800
π fix: explicit `content-type` header for the search page response (#458)
commit 43357493d550ffe321fffbd668a7b7a7afe6c7a9
Author: maokwen <[email protected]>
Date: Wed Dec 27 16:24:44 2023 +0800
π fix: explicit Content-Type header for HTTP response (#457)
- Cargo.lock +66 -66
- Cargo.toml +1 -1
- flake.nix +1 -1
- public/static/cookies.js +67 -3
- public/static/themes/simple.css +9 -1
- src/engines/mod.rs +1 -0
- src/engines/mojeek.rs +151 -0
- src/models/engine_models.rs +4 -0
- src/server/router.rs +32 -28
- src/server/routes/search.rs +15 -13
- src/templates/partials/settings_tabs/engines.rs +45 -14
- src/templates/partials/settings_tabs/general.rs +18 -4
- src/templates/partials/settings_tabs/user_interface.rs +28 -10
- src/templates/views/settings.rs +8 -3
- websurfx/config.lua +1 -0
@@ -65,15 +65,15 @@ checksum = "a2e7b88f3804e01bd4191fdb08650430bbfcb43d3d9b2890064df3551ec7d25b"
|
|
65 |
dependencies = [
|
66 |
"actix-http",
|
67 |
"actix-web",
|
68 |
-
"futures 0.3.
|
69 |
"governor",
|
70 |
]
|
71 |
|
72 |
[[package]]
|
73 |
name = "actix-http"
|
74 |
-
version = "3.
|
75 |
source = "registry+https://github.com/rust-lang/crates.io-index"
|
76 |
-
checksum = "
|
77 |
dependencies = [
|
78 |
"actix-codec",
|
79 |
"actix-rt",
|
@@ -111,14 +111,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
111 |
checksum = "e01ed3140b2f8d422c68afa1ed2e85d996ea619c988ac834d255db32138655cb"
|
112 |
dependencies = [
|
113 |
"quote 1.0.33",
|
114 |
-
"syn 2.0.
|
115 |
]
|
116 |
|
117 |
[[package]]
|
118 |
name = "actix-router"
|
119 |
-
version = "0.5.
|
120 |
source = "registry+https://github.com/rust-lang/crates.io-index"
|
121 |
-
checksum = "
|
122 |
dependencies = [
|
123 |
"bytestring",
|
124 |
"http 0.2.11",
|
@@ -177,9 +177,9 @@ dependencies = [
|
|
177 |
|
178 |
[[package]]
|
179 |
name = "actix-web"
|
180 |
-
version = "4.4.
|
181 |
source = "registry+https://github.com/rust-lang/crates.io-index"
|
182 |
-
checksum = "
|
183 |
dependencies = [
|
184 |
"actix-codec",
|
185 |
"actix-http",
|
@@ -224,7 +224,7 @@ dependencies = [
|
|
224 |
"actix-router",
|
225 |
"proc-macro2 1.0.71",
|
226 |
"quote 1.0.33",
|
227 |
-
"syn 2.0.
|
228 |
]
|
229 |
|
230 |
[[package]]
|
@@ -313,9 +313,9 @@ checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87"
|
|
313 |
|
314 |
[[package]]
|
315 |
name = "anyhow"
|
316 |
-
version = "1.0.
|
317 |
source = "registry+https://github.com/rust-lang/crates.io-index"
|
318 |
-
checksum = "
|
319 |
|
320 |
[[package]]
|
321 |
name = "arc-swap"
|
@@ -369,7 +369,7 @@ checksum = "fdf6721fb0140e4f897002dd086c06f6c27775df19cfe1fccb21181a48fd2c98"
|
|
369 |
dependencies = [
|
370 |
"proc-macro2 1.0.71",
|
371 |
"quote 1.0.33",
|
372 |
-
"syn 2.0.
|
373 |
]
|
374 |
|
375 |
[[package]]
|
@@ -552,9 +552,9 @@ dependencies = [
|
|
552 |
|
553 |
[[package]]
|
554 |
name = "cargo-platform"
|
555 |
-
version = "0.1.
|
556 |
source = "registry+https://github.com/rust-lang/crates.io-index"
|
557 |
-
checksum = "
|
558 |
dependencies = [
|
559 |
"serde",
|
560 |
]
|
@@ -824,12 +824,12 @@ dependencies = [
|
|
824 |
|
825 |
[[package]]
|
826 |
name = "crossbeam-channel"
|
827 |
-
version = "0.5.
|
828 |
source = "registry+https://github.com/rust-lang/crates.io-index"
|
829 |
-
checksum = "
|
830 |
dependencies = [
|
831 |
"cfg-if 1.0.0",
|
832 |
-
"crossbeam-utils 0.8.
|
833 |
]
|
834 |
|
835 |
[[package]]
|
@@ -882,9 +882,9 @@ dependencies = [
|
|
882 |
|
883 |
[[package]]
|
884 |
name = "crossbeam-utils"
|
885 |
-
version = "0.8.
|
886 |
source = "registry+https://github.com/rust-lang/crates.io-index"
|
887 |
-
checksum = "
|
888 |
dependencies = [
|
889 |
"cfg-if 1.0.0",
|
890 |
]
|
@@ -941,7 +941,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
941 |
checksum = "13b588ba4ac1a99f7f2964d24b3d896ddc6bf847ee3855dbd4366f058cfcd331"
|
942 |
dependencies = [
|
943 |
"quote 1.0.33",
|
944 |
-
"syn 2.0.
|
945 |
]
|
946 |
|
947 |
[[package]]
|
@@ -1232,9 +1232,9 @@ checksum = "3a471a38ef8ed83cd6e40aa59c1ffe17db6855c18e3604d9c4ed8c08ebc28678"
|
|
1232 |
|
1233 |
[[package]]
|
1234 |
name = "futures"
|
1235 |
-
version = "0.3.
|
1236 |
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1237 |
-
checksum = "
|
1238 |
dependencies = [
|
1239 |
"futures-channel",
|
1240 |
"futures-core",
|
@@ -1247,9 +1247,9 @@ dependencies = [
|
|
1247 |
|
1248 |
[[package]]
|
1249 |
name = "futures-channel"
|
1250 |
-
version = "0.3.
|
1251 |
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1252 |
-
checksum = "
|
1253 |
dependencies = [
|
1254 |
"futures-core",
|
1255 |
"futures-sink",
|
@@ -1257,9 +1257,9 @@ dependencies = [
|
|
1257 |
|
1258 |
[[package]]
|
1259 |
name = "futures-core"
|
1260 |
-
version = "0.3.
|
1261 |
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1262 |
-
checksum = "
|
1263 |
|
1264 |
[[package]]
|
1265 |
name = "futures-cpupool"
|
@@ -1273,9 +1273,9 @@ dependencies = [
|
|
1273 |
|
1274 |
[[package]]
|
1275 |
name = "futures-executor"
|
1276 |
-
version = "0.3.
|
1277 |
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1278 |
-
checksum = "
|
1279 |
dependencies = [
|
1280 |
"futures-core",
|
1281 |
"futures-task",
|
@@ -1284,32 +1284,32 @@ dependencies = [
|
|
1284 |
|
1285 |
[[package]]
|
1286 |
name = "futures-io"
|
1287 |
-
version = "0.3.
|
1288 |
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1289 |
-
checksum = "
|
1290 |
|
1291 |
[[package]]
|
1292 |
name = "futures-macro"
|
1293 |
-
version = "0.3.
|
1294 |
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1295 |
-
checksum = "
|
1296 |
dependencies = [
|
1297 |
"proc-macro2 1.0.71",
|
1298 |
"quote 1.0.33",
|
1299 |
-
"syn 2.0.
|
1300 |
]
|
1301 |
|
1302 |
[[package]]
|
1303 |
name = "futures-sink"
|
1304 |
-
version = "0.3.
|
1305 |
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1306 |
-
checksum = "
|
1307 |
|
1308 |
[[package]]
|
1309 |
name = "futures-task"
|
1310 |
-
version = "0.3.
|
1311 |
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1312 |
-
checksum = "
|
1313 |
|
1314 |
[[package]]
|
1315 |
name = "futures-timer"
|
@@ -1319,9 +1319,9 @@ checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c"
|
|
1319 |
|
1320 |
[[package]]
|
1321 |
name = "futures-util"
|
1322 |
-
version = "0.3.
|
1323 |
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1324 |
-
checksum = "
|
1325 |
dependencies = [
|
1326 |
"futures-channel",
|
1327 |
"futures-core",
|
@@ -1394,7 +1394,7 @@ checksum = "821239e5672ff23e2a7060901fa622950bbd80b649cdaadd78d1c1767ed14eb4"
|
|
1394 |
dependencies = [
|
1395 |
"cfg-if 1.0.0",
|
1396 |
"dashmap",
|
1397 |
-
"futures 0.3.
|
1398 |
"futures-timer",
|
1399 |
"no-std-compat",
|
1400 |
"nonzero_ext",
|
@@ -1725,13 +1725,13 @@ checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3"
|
|
1725 |
|
1726 |
[[package]]
|
1727 |
name = "is-terminal"
|
1728 |
-
version = "0.4.
|
1729 |
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1730 |
-
checksum = "
|
1731 |
dependencies = [
|
1732 |
"hermit-abi",
|
1733 |
"rustix",
|
1734 |
-
"windows-sys 0.
|
1735 |
]
|
1736 |
|
1737 |
[[package]]
|
@@ -2018,7 +2018,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2018 |
checksum = "23e0b72e7c9042467008b10279fc732326bd605459ae03bda88825909dd19b56"
|
2019 |
dependencies = [
|
2020 |
"crossbeam-channel",
|
2021 |
-
"crossbeam-utils 0.8.
|
2022 |
"dashmap",
|
2023 |
"skeptic",
|
2024 |
"smallvec 1.11.2",
|
@@ -2198,9 +2198,9 @@ dependencies = [
|
|
2198 |
|
2199 |
[[package]]
|
2200 |
name = "object"
|
2201 |
-
version = "0.32.
|
2202 |
source = "registry+https://github.com/rust-lang/crates.io-index"
|
2203 |
-
checksum = "
|
2204 |
dependencies = [
|
2205 |
"memchr",
|
2206 |
]
|
@@ -2240,7 +2240,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c"
|
|
2240 |
dependencies = [
|
2241 |
"proc-macro2 1.0.71",
|
2242 |
"quote 1.0.33",
|
2243 |
-
"syn 2.0.
|
2244 |
]
|
2245 |
|
2246 |
[[package]]
|
@@ -2451,7 +2451,7 @@ dependencies = [
|
|
2451 |
"phf_shared 0.11.2",
|
2452 |
"proc-macro2 1.0.71",
|
2453 |
"quote 1.0.33",
|
2454 |
-
"syn 2.0.
|
2455 |
]
|
2456 |
|
2457 |
[[package]]
|
@@ -2498,7 +2498,7 @@ checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405"
|
|
2498 |
dependencies = [
|
2499 |
"proc-macro2 1.0.71",
|
2500 |
"quote 1.0.33",
|
2501 |
-
"syn 2.0.
|
2502 |
]
|
2503 |
|
2504 |
[[package]]
|
@@ -2606,7 +2606,7 @@ version = "0.11.1"
|
|
2606 |
source = "registry+https://github.com/rust-lang/crates.io-index"
|
2607 |
checksum = "a17e662a7a8291a865152364c20c7abc5e60486ab2001e8ec10b24862de0b9ab"
|
2608 |
dependencies = [
|
2609 |
-
"crossbeam-utils 0.8.
|
2610 |
"libc",
|
2611 |
"mach2",
|
2612 |
"once_cell",
|
@@ -2798,7 +2798,7 @@ dependencies = [
|
|
2798 |
"async-trait",
|
2799 |
"bytes 1.5.0",
|
2800 |
"combine",
|
2801 |
-
"futures 0.3.
|
2802 |
"futures-util",
|
2803 |
"itoa 1.0.10",
|
2804 |
"percent-encoding 2.3.1",
|
@@ -3047,11 +3047,11 @@ dependencies = [
|
|
3047 |
|
3048 |
[[package]]
|
3049 |
name = "schannel"
|
3050 |
-
version = "0.1.
|
3051 |
source = "registry+https://github.com/rust-lang/crates.io-index"
|
3052 |
-
checksum = "
|
3053 |
dependencies = [
|
3054 |
-
"windows-sys 0.
|
3055 |
]
|
3056 |
|
3057 |
[[package]]
|
@@ -3178,7 +3178,7 @@ checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3"
|
|
3178 |
dependencies = [
|
3179 |
"proc-macro2 1.0.71",
|
3180 |
"quote 1.0.33",
|
3181 |
-
"syn 2.0.
|
3182 |
]
|
3183 |
|
3184 |
[[package]]
|
@@ -3414,9 +3414,9 @@ dependencies = [
|
|
3414 |
|
3415 |
[[package]]
|
3416 |
name = "syn"
|
3417 |
-
version = "2.0.
|
3418 |
source = "registry+https://github.com/rust-lang/crates.io-index"
|
3419 |
-
checksum = "
|
3420 |
dependencies = [
|
3421 |
"proc-macro2 1.0.71",
|
3422 |
"quote 1.0.33",
|
@@ -3474,15 +3474,15 @@ checksum = "7b2093cf4c8eb1e67749a6762251bc9cd836b6fc171623bd0a9d324d37af2417"
|
|
3474 |
|
3475 |
[[package]]
|
3476 |
name = "tempfile"
|
3477 |
-
version = "3.
|
3478 |
source = "registry+https://github.com/rust-lang/crates.io-index"
|
3479 |
-
checksum = "
|
3480 |
dependencies = [
|
3481 |
"cfg-if 1.0.0",
|
3482 |
"fastrand",
|
3483 |
"redox_syscall 0.4.1",
|
3484 |
"rustix",
|
3485 |
-
"windows-sys 0.
|
3486 |
]
|
3487 |
|
3488 |
[[package]]
|
@@ -3655,7 +3655,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b"
|
|
3655 |
dependencies = [
|
3656 |
"proc-macro2 1.0.71",
|
3657 |
"quote 1.0.33",
|
3658 |
-
"syn 2.0.
|
3659 |
]
|
3660 |
|
3661 |
[[package]]
|
@@ -3993,7 +3993,7 @@ dependencies = [
|
|
3993 |
"once_cell",
|
3994 |
"proc-macro2 1.0.71",
|
3995 |
"quote 1.0.33",
|
3996 |
-
"syn 2.0.
|
3997 |
"wasm-bindgen-shared",
|
3998 |
]
|
3999 |
|
@@ -4027,7 +4027,7 @@ checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283"
|
|
4027 |
dependencies = [
|
4028 |
"proc-macro2 1.0.71",
|
4029 |
"quote 1.0.33",
|
4030 |
-
"syn 2.0.
|
4031 |
"wasm-bindgen-backend",
|
4032 |
"wasm-bindgen-shared",
|
4033 |
]
|
@@ -4056,7 +4056,7 @@ checksum = "1778a42e8b3b90bff8d0f5032bf22250792889a5cdc752aa0020c84abe3aaf10"
|
|
4056 |
|
4057 |
[[package]]
|
4058 |
name = "websurfx"
|
4059 |
-
version = "1.6.
|
4060 |
dependencies = [
|
4061 |
"actix-cors",
|
4062 |
"actix-files",
|
@@ -4070,7 +4070,7 @@ dependencies = [
|
|
4070 |
"env_logger",
|
4071 |
"error-stack",
|
4072 |
"fake-useragent",
|
4073 |
-
"futures 0.3.
|
4074 |
"lightningcss",
|
4075 |
"log",
|
4076 |
"maud",
|
@@ -4324,5 +4324,5 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6"
|
|
4324 |
dependencies = [
|
4325 |
"proc-macro2 1.0.71",
|
4326 |
"quote 1.0.33",
|
4327 |
-
"syn 2.0.
|
4328 |
]
|
|
|
65 |
dependencies = [
|
66 |
"actix-http",
|
67 |
"actix-web",
|
68 |
+
"futures 0.3.30",
|
69 |
"governor",
|
70 |
]
|
71 |
|
72 |
[[package]]
|
73 |
name = "actix-http"
|
74 |
+
version = "3.5.1"
|
75 |
source = "registry+https://github.com/rust-lang/crates.io-index"
|
76 |
+
checksum = "129d4c88e98860e1758c5de288d1632b07970a16d59bdf7b8d66053d582bb71f"
|
77 |
dependencies = [
|
78 |
"actix-codec",
|
79 |
"actix-rt",
|
|
|
111 |
checksum = "e01ed3140b2f8d422c68afa1ed2e85d996ea619c988ac834d255db32138655cb"
|
112 |
dependencies = [
|
113 |
"quote 1.0.33",
|
114 |
+
"syn 2.0.43",
|
115 |
]
|
116 |
|
117 |
[[package]]
|
118 |
name = "actix-router"
|
119 |
+
version = "0.5.2"
|
120 |
source = "registry+https://github.com/rust-lang/crates.io-index"
|
121 |
+
checksum = "d22475596539443685426b6bdadb926ad0ecaefdfc5fb05e5e3441f15463c511"
|
122 |
dependencies = [
|
123 |
"bytestring",
|
124 |
"http 0.2.11",
|
|
|
177 |
|
178 |
[[package]]
|
179 |
name = "actix-web"
|
180 |
+
version = "4.4.1"
|
181 |
source = "registry+https://github.com/rust-lang/crates.io-index"
|
182 |
+
checksum = "e43428f3bf11dee6d166b00ec2df4e3aa8cc1606aaa0b7433c146852e2f4e03b"
|
183 |
dependencies = [
|
184 |
"actix-codec",
|
185 |
"actix-http",
|
|
|
224 |
"actix-router",
|
225 |
"proc-macro2 1.0.71",
|
226 |
"quote 1.0.33",
|
227 |
+
"syn 2.0.43",
|
228 |
]
|
229 |
|
230 |
[[package]]
|
|
|
313 |
|
314 |
[[package]]
|
315 |
name = "anyhow"
|
316 |
+
version = "1.0.77"
|
317 |
source = "registry+https://github.com/rust-lang/crates.io-index"
|
318 |
+
checksum = "c9d19de80eff169429ac1e9f48fffb163916b448a44e8e046186232046d9e1f9"
|
319 |
|
320 |
[[package]]
|
321 |
name = "arc-swap"
|
|
|
369 |
dependencies = [
|
370 |
"proc-macro2 1.0.71",
|
371 |
"quote 1.0.33",
|
372 |
+
"syn 2.0.43",
|
373 |
]
|
374 |
|
375 |
[[package]]
|
|
|
552 |
|
553 |
[[package]]
|
554 |
name = "cargo-platform"
|
555 |
+
version = "0.1.6"
|
556 |
source = "registry+https://github.com/rust-lang/crates.io-index"
|
557 |
+
checksum = "ceed8ef69d8518a5dda55c07425450b58a4e1946f4951eab6d7191ee86c2443d"
|
558 |
dependencies = [
|
559 |
"serde",
|
560 |
]
|
|
|
824 |
|
825 |
[[package]]
|
826 |
name = "crossbeam-channel"
|
827 |
+
version = "0.5.10"
|
828 |
source = "registry+https://github.com/rust-lang/crates.io-index"
|
829 |
+
checksum = "82a9b73a36529d9c47029b9fb3a6f0ea3cc916a261195352ba19e770fc1748b2"
|
830 |
dependencies = [
|
831 |
"cfg-if 1.0.0",
|
832 |
+
"crossbeam-utils 0.8.18",
|
833 |
]
|
834 |
|
835 |
[[package]]
|
|
|
882 |
|
883 |
[[package]]
|
884 |
name = "crossbeam-utils"
|
885 |
+
version = "0.8.18"
|
886 |
source = "registry+https://github.com/rust-lang/crates.io-index"
|
887 |
+
checksum = "c3a430a770ebd84726f584a90ee7f020d28db52c6d02138900f22341f866d39c"
|
888 |
dependencies = [
|
889 |
"cfg-if 1.0.0",
|
890 |
]
|
|
|
941 |
checksum = "13b588ba4ac1a99f7f2964d24b3d896ddc6bf847ee3855dbd4366f058cfcd331"
|
942 |
dependencies = [
|
943 |
"quote 1.0.33",
|
944 |
+
"syn 2.0.43",
|
945 |
]
|
946 |
|
947 |
[[package]]
|
|
|
1232 |
|
1233 |
[[package]]
|
1234 |
name = "futures"
|
1235 |
+
version = "0.3.30"
|
1236 |
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1237 |
+
checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0"
|
1238 |
dependencies = [
|
1239 |
"futures-channel",
|
1240 |
"futures-core",
|
|
|
1247 |
|
1248 |
[[package]]
|
1249 |
name = "futures-channel"
|
1250 |
+
version = "0.3.30"
|
1251 |
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1252 |
+
checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78"
|
1253 |
dependencies = [
|
1254 |
"futures-core",
|
1255 |
"futures-sink",
|
|
|
1257 |
|
1258 |
[[package]]
|
1259 |
name = "futures-core"
|
1260 |
+
version = "0.3.30"
|
1261 |
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1262 |
+
checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d"
|
1263 |
|
1264 |
[[package]]
|
1265 |
name = "futures-cpupool"
|
|
|
1273 |
|
1274 |
[[package]]
|
1275 |
name = "futures-executor"
|
1276 |
+
version = "0.3.30"
|
1277 |
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1278 |
+
checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d"
|
1279 |
dependencies = [
|
1280 |
"futures-core",
|
1281 |
"futures-task",
|
|
|
1284 |
|
1285 |
[[package]]
|
1286 |
name = "futures-io"
|
1287 |
+
version = "0.3.30"
|
1288 |
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1289 |
+
checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1"
|
1290 |
|
1291 |
[[package]]
|
1292 |
name = "futures-macro"
|
1293 |
+
version = "0.3.30"
|
1294 |
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1295 |
+
checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac"
|
1296 |
dependencies = [
|
1297 |
"proc-macro2 1.0.71",
|
1298 |
"quote 1.0.33",
|
1299 |
+
"syn 2.0.43",
|
1300 |
]
|
1301 |
|
1302 |
[[package]]
|
1303 |
name = "futures-sink"
|
1304 |
+
version = "0.3.30"
|
1305 |
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1306 |
+
checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5"
|
1307 |
|
1308 |
[[package]]
|
1309 |
name = "futures-task"
|
1310 |
+
version = "0.3.30"
|
1311 |
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1312 |
+
checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004"
|
1313 |
|
1314 |
[[package]]
|
1315 |
name = "futures-timer"
|
|
|
1319 |
|
1320 |
[[package]]
|
1321 |
name = "futures-util"
|
1322 |
+
version = "0.3.30"
|
1323 |
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1324 |
+
checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48"
|
1325 |
dependencies = [
|
1326 |
"futures-channel",
|
1327 |
"futures-core",
|
|
|
1394 |
dependencies = [
|
1395 |
"cfg-if 1.0.0",
|
1396 |
"dashmap",
|
1397 |
+
"futures 0.3.30",
|
1398 |
"futures-timer",
|
1399 |
"no-std-compat",
|
1400 |
"nonzero_ext",
|
|
|
1725 |
|
1726 |
[[package]]
|
1727 |
name = "is-terminal"
|
1728 |
+
version = "0.4.10"
|
1729 |
source = "registry+https://github.com/rust-lang/crates.io-index"
|
1730 |
+
checksum = "0bad00257d07be169d870ab665980b06cdb366d792ad690bf2e76876dc503455"
|
1731 |
dependencies = [
|
1732 |
"hermit-abi",
|
1733 |
"rustix",
|
1734 |
+
"windows-sys 0.52.0",
|
1735 |
]
|
1736 |
|
1737 |
[[package]]
|
|
|
2018 |
checksum = "23e0b72e7c9042467008b10279fc732326bd605459ae03bda88825909dd19b56"
|
2019 |
dependencies = [
|
2020 |
"crossbeam-channel",
|
2021 |
+
"crossbeam-utils 0.8.18",
|
2022 |
"dashmap",
|
2023 |
"skeptic",
|
2024 |
"smallvec 1.11.2",
|
|
|
2198 |
|
2199 |
[[package]]
|
2200 |
name = "object"
|
2201 |
+
version = "0.32.2"
|
2202 |
source = "registry+https://github.com/rust-lang/crates.io-index"
|
2203 |
+
checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441"
|
2204 |
dependencies = [
|
2205 |
"memchr",
|
2206 |
]
|
|
|
2240 |
dependencies = [
|
2241 |
"proc-macro2 1.0.71",
|
2242 |
"quote 1.0.33",
|
2243 |
+
"syn 2.0.43",
|
2244 |
]
|
2245 |
|
2246 |
[[package]]
|
|
|
2451 |
"phf_shared 0.11.2",
|
2452 |
"proc-macro2 1.0.71",
|
2453 |
"quote 1.0.33",
|
2454 |
+
"syn 2.0.43",
|
2455 |
]
|
2456 |
|
2457 |
[[package]]
|
|
|
2498 |
dependencies = [
|
2499 |
"proc-macro2 1.0.71",
|
2500 |
"quote 1.0.33",
|
2501 |
+
"syn 2.0.43",
|
2502 |
]
|
2503 |
|
2504 |
[[package]]
|
|
|
2606 |
source = "registry+https://github.com/rust-lang/crates.io-index"
|
2607 |
checksum = "a17e662a7a8291a865152364c20c7abc5e60486ab2001e8ec10b24862de0b9ab"
|
2608 |
dependencies = [
|
2609 |
+
"crossbeam-utils 0.8.18",
|
2610 |
"libc",
|
2611 |
"mach2",
|
2612 |
"once_cell",
|
|
|
2798 |
"async-trait",
|
2799 |
"bytes 1.5.0",
|
2800 |
"combine",
|
2801 |
+
"futures 0.3.30",
|
2802 |
"futures-util",
|
2803 |
"itoa 1.0.10",
|
2804 |
"percent-encoding 2.3.1",
|
|
|
3047 |
|
3048 |
[[package]]
|
3049 |
name = "schannel"
|
3050 |
+
version = "0.1.23"
|
3051 |
source = "registry+https://github.com/rust-lang/crates.io-index"
|
3052 |
+
checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534"
|
3053 |
dependencies = [
|
3054 |
+
"windows-sys 0.52.0",
|
3055 |
]
|
3056 |
|
3057 |
[[package]]
|
|
|
3178 |
dependencies = [
|
3179 |
"proc-macro2 1.0.71",
|
3180 |
"quote 1.0.33",
|
3181 |
+
"syn 2.0.43",
|
3182 |
]
|
3183 |
|
3184 |
[[package]]
|
|
|
3414 |
|
3415 |
[[package]]
|
3416 |
name = "syn"
|
3417 |
+
version = "2.0.43"
|
3418 |
source = "registry+https://github.com/rust-lang/crates.io-index"
|
3419 |
+
checksum = "ee659fb5f3d355364e1f3e5bc10fb82068efbf824a1e9d1c9504244a6469ad53"
|
3420 |
dependencies = [
|
3421 |
"proc-macro2 1.0.71",
|
3422 |
"quote 1.0.33",
|
|
|
3474 |
|
3475 |
[[package]]
|
3476 |
name = "tempfile"
|
3477 |
+
version = "3.9.0"
|
3478 |
source = "registry+https://github.com/rust-lang/crates.io-index"
|
3479 |
+
checksum = "01ce4141aa927a6d1bd34a041795abd0db1cccba5d5f24b009f694bdf3a1f3fa"
|
3480 |
dependencies = [
|
3481 |
"cfg-if 1.0.0",
|
3482 |
"fastrand",
|
3483 |
"redox_syscall 0.4.1",
|
3484 |
"rustix",
|
3485 |
+
"windows-sys 0.52.0",
|
3486 |
]
|
3487 |
|
3488 |
[[package]]
|
|
|
3655 |
dependencies = [
|
3656 |
"proc-macro2 1.0.71",
|
3657 |
"quote 1.0.33",
|
3658 |
+
"syn 2.0.43",
|
3659 |
]
|
3660 |
|
3661 |
[[package]]
|
|
|
3993 |
"once_cell",
|
3994 |
"proc-macro2 1.0.71",
|
3995 |
"quote 1.0.33",
|
3996 |
+
"syn 2.0.43",
|
3997 |
"wasm-bindgen-shared",
|
3998 |
]
|
3999 |
|
|
|
4027 |
dependencies = [
|
4028 |
"proc-macro2 1.0.71",
|
4029 |
"quote 1.0.33",
|
4030 |
+
"syn 2.0.43",
|
4031 |
"wasm-bindgen-backend",
|
4032 |
"wasm-bindgen-shared",
|
4033 |
]
|
|
|
4056 |
|
4057 |
[[package]]
|
4058 |
name = "websurfx"
|
4059 |
+
version = "1.6.11"
|
4060 |
dependencies = [
|
4061 |
"actix-cors",
|
4062 |
"actix-files",
|
|
|
4070 |
"env_logger",
|
4071 |
"error-stack",
|
4072 |
"fake-useragent",
|
4073 |
+
"futures 0.3.30",
|
4074 |
"lightningcss",
|
4075 |
"log",
|
4076 |
"maud",
|
|
|
4324 |
dependencies = [
|
4325 |
"proc-macro2 1.0.71",
|
4326 |
"quote 1.0.33",
|
4327 |
+
"syn 2.0.43",
|
4328 |
]
|
@@ -1,6 +1,6 @@
|
|
1 |
[package]
|
2 |
name = "websurfx"
|
3 |
-
version = "1.6.
|
4 |
edition = "2021"
|
5 |
description = "An open-source alternative to Searx that provides clean, ad-free, and organic results with incredible speed while keeping privacy and security in mind."
|
6 |
repository = "https://github.com/neon-mmd/websurfx"
|
|
|
1 |
[package]
|
2 |
name = "websurfx"
|
3 |
+
version = "1.6.11"
|
4 |
edition = "2021"
|
5 |
description = "An open-source alternative to Searx that provides clean, ad-free, and organic results with incredible speed while keeping privacy and security in mind."
|
6 |
repository = "https://github.com/neon-mmd/websurfx"
|
@@ -60,4 +60,4 @@
|
|
60 |
# calls the build function
|
61 |
packages.websurfx = packages.default;
|
62 |
});
|
63 |
-
|
|
|
60 |
# calls the build function
|
61 |
packages.websurfx = packages.default;
|
62 |
});
|
63 |
+
}
|
@@ -1,3 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
/**
|
2 |
* This function is executed when any page on the website finishes loading and
|
3 |
* this function retrieves the cookies if it is present on the user's machine.
|
@@ -16,9 +75,14 @@ document.addEventListener(
|
|
16 |
let cookie = decodeURIComponent(document.cookie)
|
17 |
// Set the value of the input field to the decoded cookie value if it is not empty
|
18 |
// Otherwise, display a message indicating that no cookies have been saved on the user's system
|
19 |
-
|
20 |
-
|
21 |
-
|
|
|
|
|
|
|
|
|
|
|
22 |
} catch (error) {
|
23 |
// If there is an error decoding the cookie, log the error to the console
|
24 |
// and display an error message in the input field
|
|
|
1 |
+
/**
|
2 |
+
* This functions gets the saved cookies if it is present on the user's machine If it
|
3 |
+
* is available then it is parsed and converted to an object which is then used to
|
4 |
+
* retrieve the preferences that the user had selected previously and is then loaded
|
5 |
+
* and used for displaying the user provided settings by setting them as the selected
|
6 |
+
* options in the settings page.
|
7 |
+
*
|
8 |
+
* @function
|
9 |
+
* @param {string} cookie - It takes the client settings cookie as a string.
|
10 |
+
* @returns {void}
|
11 |
+
*/
|
12 |
+
function setClientSettingsOnPage(cookie) {
|
13 |
+
let cookie_value = cookie
|
14 |
+
.split(';')
|
15 |
+
.map((item) => item.split('='))
|
16 |
+
.reduce((acc, [_, v]) => (acc = JSON.parse(v)) && acc, {})
|
17 |
+
|
18 |
+
// Loop through all select tags and add their values to the cookie dictionary
|
19 |
+
document.querySelectorAll('select').forEach((select_tag) => {
|
20 |
+
switch (select_tag.name) {
|
21 |
+
case 'themes':
|
22 |
+
select_tag.value = cookie_value['theme']
|
23 |
+
break
|
24 |
+
case 'colorschemes':
|
25 |
+
select_tag.value = cookie_value['colorscheme']
|
26 |
+
break
|
27 |
+
case 'animations':
|
28 |
+
select_tag.value = cookie_value['animation']
|
29 |
+
break
|
30 |
+
case 'safe_search_levels':
|
31 |
+
select_tag.value = cookie_value['safe_search_level']
|
32 |
+
break
|
33 |
+
}
|
34 |
+
})
|
35 |
+
let engines = document.querySelectorAll('.engine')
|
36 |
+
let engines_cookie = cookie_value['engines']
|
37 |
+
|
38 |
+
if (engines_cookie.length === engines.length) {
|
39 |
+
document.querySelector('.select_all').checked = true
|
40 |
+
engines.forEach((engine_checkbox) => {
|
41 |
+
engine_checkbox.checked = true
|
42 |
+
})
|
43 |
+
} else {
|
44 |
+
engines.forEach((engines_checkbox) => {
|
45 |
+
engines_checkbox.checked = false
|
46 |
+
})
|
47 |
+
engines_cookie.forEach((engine_name) => {
|
48 |
+
engines.forEach((engine_checkbox) => {
|
49 |
+
if (
|
50 |
+
engine_checkbox.parentNode.parentNode.innerText.trim() ===
|
51 |
+
engine_name.trim()
|
52 |
+
) {
|
53 |
+
engine_checkbox.checked = true
|
54 |
+
}
|
55 |
+
})
|
56 |
+
})
|
57 |
+
}
|
58 |
+
}
|
59 |
+
|
60 |
/**
|
61 |
* This function is executed when any page on the website finishes loading and
|
62 |
* this function retrieves the cookies if it is present on the user's machine.
|
|
|
75 |
let cookie = decodeURIComponent(document.cookie)
|
76 |
// Set the value of the input field to the decoded cookie value if it is not empty
|
77 |
// Otherwise, display a message indicating that no cookies have been saved on the user's system
|
78 |
+
if (cookie.length) {
|
79 |
+
document.querySelector('.cookies input').value = cookie
|
80 |
+
// This function displays the user provided settings on the settings page.
|
81 |
+
setClientSettingsOnPage(cookie)
|
82 |
+
} else {
|
83 |
+
document.querySelector('.cookies input').value =
|
84 |
+
'No cookies have been saved on your system'
|
85 |
+
}
|
86 |
} catch (error) {
|
87 |
// If there is an error decoding the cookie, log the error to the console
|
88 |
// and display an error message in the input field
|
@@ -600,12 +600,20 @@ footer div {
|
|
600 |
text-transform: capitalize;
|
601 |
}
|
602 |
|
603 |
-
.settings_container .tab .description
|
|
|
604 |
font-size: 1.5rem;
|
605 |
margin-bottom: 0.5rem;
|
|
|
|
|
|
|
606 |
color: var(--foreground-color);
|
607 |
}
|
608 |
|
|
|
|
|
|
|
|
|
609 |
.settings_container .user_interface select,
|
610 |
.settings_container .general select {
|
611 |
margin: 0.7rem 0;
|
|
|
600 |
text-transform: capitalize;
|
601 |
}
|
602 |
|
603 |
+
.settings_container .tab .description,
|
604 |
+
.settings_container .tab .admin_warning {
|
605 |
font-size: 1.5rem;
|
606 |
margin-bottom: 0.5rem;
|
607 |
+
}
|
608 |
+
|
609 |
+
.settings_container .tab .description {
|
610 |
color: var(--foreground-color);
|
611 |
}
|
612 |
|
613 |
+
.settings_container .tab .admin_warning {
|
614 |
+
color: var(--color-two);
|
615 |
+
}
|
616 |
+
|
617 |
.settings_container .user_interface select,
|
618 |
.settings_container .general select {
|
619 |
margin: 0.7rem 0;
|
@@ -6,6 +6,7 @@
|
|
6 |
pub mod brave;
|
7 |
pub mod duckduckgo;
|
8 |
pub mod librex;
|
|
|
9 |
pub mod search_result_parser;
|
10 |
pub mod searx;
|
11 |
pub mod startpage;
|
|
|
6 |
pub mod brave;
|
7 |
pub mod duckduckgo;
|
8 |
pub mod librex;
|
9 |
+
pub mod mojeek;
|
10 |
pub mod search_result_parser;
|
11 |
pub mod searx;
|
12 |
pub mod startpage;
|
@@ -0,0 +1,151 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
//! The `mojeek` module handles the scraping of results from the mojeek search engine
|
2 |
+
//! by querying the upstream mojeek search engine with user provided query and with a page
|
3 |
+
//! number if provided.
|
4 |
+
|
5 |
+
use std::collections::HashMap;
|
6 |
+
|
7 |
+
use reqwest::header::HeaderMap;
|
8 |
+
use reqwest::Client;
|
9 |
+
use scraper::Html;
|
10 |
+
|
11 |
+
use crate::models::aggregation_models::SearchResult;
|
12 |
+
|
13 |
+
use crate::models::engine_models::{EngineError, SearchEngine};
|
14 |
+
|
15 |
+
use error_stack::{Report, Result, ResultExt};
|
16 |
+
|
17 |
+
use super::search_result_parser::SearchResultParser;
|
18 |
+
|
19 |
+
/// A new Mojeek engine type defined in-order to implement the `SearchEngine` trait which allows to
|
20 |
+
/// reduce code duplication as well as allows to create vector of different search engines easily.
|
21 |
+
pub struct Mojeek {
|
22 |
+
/// The parser, used to interpret the search result.
|
23 |
+
parser: SearchResultParser,
|
24 |
+
}
|
25 |
+
|
26 |
+
impl Mojeek {
|
27 |
+
/// Creates the Mojeek parser.
|
28 |
+
pub fn new() -> Result<Self, EngineError> {
|
29 |
+
Ok(Self {
|
30 |
+
parser: SearchResultParser::new(
|
31 |
+
".result-col",
|
32 |
+
".results-standard li",
|
33 |
+
"a span.url",
|
34 |
+
"h2 a.title",
|
35 |
+
"p.s",
|
36 |
+
)?,
|
37 |
+
})
|
38 |
+
}
|
39 |
+
}
|
40 |
+
|
41 |
+
#[async_trait::async_trait]
|
42 |
+
impl SearchEngine for Mojeek {
|
43 |
+
async fn results(
|
44 |
+
&self,
|
45 |
+
query: &str,
|
46 |
+
page: u32,
|
47 |
+
user_agent: &str,
|
48 |
+
client: &Client,
|
49 |
+
safe_search: u8,
|
50 |
+
) -> Result<HashMap<String, SearchResult>, EngineError> {
|
51 |
+
// Mojeek uses `start results from this number` convention
|
52 |
+
// So, for 10 results per page, page 0 starts at 1, page 1
|
53 |
+
// starts at 11, and so on.
|
54 |
+
let results_per_page = 10;
|
55 |
+
let start_result = results_per_page * page + 1;
|
56 |
+
|
57 |
+
let results_per_page = results_per_page.to_string();
|
58 |
+
let start_result = start_result.to_string();
|
59 |
+
|
60 |
+
let search_engines = vec![
|
61 |
+
"Bing",
|
62 |
+
"Brave",
|
63 |
+
"DuckDuckGo",
|
64 |
+
"Ecosia",
|
65 |
+
"Google",
|
66 |
+
"Lilo",
|
67 |
+
"Metager",
|
68 |
+
"Qwant",
|
69 |
+
"Startpage",
|
70 |
+
"Swisscows",
|
71 |
+
"Yandex",
|
72 |
+
"Yep",
|
73 |
+
"You",
|
74 |
+
];
|
75 |
+
let qss = search_engines.join("%2C");
|
76 |
+
let safe = if safe_search == 0 { "0" } else { "1" };
|
77 |
+
|
78 |
+
// Mojeek detects automated requests, these are preferences that are
|
79 |
+
// able to circumvent the countermeasure. Some of these are
|
80 |
+
// not documented in their Search API
|
81 |
+
let query_params: Vec<(&str, &str)> = vec![
|
82 |
+
("t", results_per_page.as_str()),
|
83 |
+
("theme", "dark"),
|
84 |
+
("arc", "none"),
|
85 |
+
("date", "1"),
|
86 |
+
("cdate", "1"),
|
87 |
+
("tlen", "100"),
|
88 |
+
("ref", "1"),
|
89 |
+
("hp", "minimal"),
|
90 |
+
("lb", "en"),
|
91 |
+
("qss", &qss),
|
92 |
+
("safe", safe),
|
93 |
+
];
|
94 |
+
|
95 |
+
let mut query_params_string = String::new();
|
96 |
+
for (k, v) in &query_params {
|
97 |
+
query_params_string.push_str(&format!("&{k}={v}"));
|
98 |
+
}
|
99 |
+
|
100 |
+
let url: String = match page {
|
101 |
+
0 => {
|
102 |
+
format!("https://www.mojeek.com/search?q={query}{query_params_string}")
|
103 |
+
}
|
104 |
+
_ => {
|
105 |
+
format!(
|
106 |
+
"https://www.mojeek.com/search?q={query}&s={start_result}{query_params_string}"
|
107 |
+
)
|
108 |
+
}
|
109 |
+
};
|
110 |
+
|
111 |
+
let mut cookie_string = String::new();
|
112 |
+
for (k, v) in &query_params {
|
113 |
+
cookie_string.push_str(&format!("{k}={v}; "));
|
114 |
+
}
|
115 |
+
|
116 |
+
let header_map = HeaderMap::try_from(&HashMap::from([
|
117 |
+
("USER_AGENT".to_string(), user_agent.to_string()),
|
118 |
+
("REFERER".to_string(), "https://google.com/".to_string()),
|
119 |
+
(
|
120 |
+
"CONTENT_TYPE".to_string(),
|
121 |
+
"application/x-www-form-urlencoded".to_string(),
|
122 |
+
),
|
123 |
+
("COOKIE".to_string(), cookie_string),
|
124 |
+
]))
|
125 |
+
.change_context(EngineError::UnexpectedError)?;
|
126 |
+
|
127 |
+
let document: Html = Html::parse_document(
|
128 |
+
&Mojeek::fetch_html_from_upstream(self, &url, header_map, client).await?,
|
129 |
+
);
|
130 |
+
|
131 |
+
if let Some(no_result_msg) = self.parser.parse_for_no_results(&document).nth(0) {
|
132 |
+
if no_result_msg
|
133 |
+
.inner_html()
|
134 |
+
.contains("No pages found matching:")
|
135 |
+
{
|
136 |
+
return Err(Report::new(EngineError::EmptyResultSet));
|
137 |
+
}
|
138 |
+
}
|
139 |
+
|
140 |
+
// scrape all the results from the html
|
141 |
+
self.parser
|
142 |
+
.parse_for_results(&document, |title, url, desc| {
|
143 |
+
Some(SearchResult::new(
|
144 |
+
title.inner_html().trim(),
|
145 |
+
url.inner_html().trim(),
|
146 |
+
desc.inner_html().trim(),
|
147 |
+
&["mojeek"],
|
148 |
+
))
|
149 |
+
})
|
150 |
+
}
|
151 |
+
}
|
@@ -162,6 +162,10 @@ impl EngineHandler {
|
|
162 |
let engine = crate::engines::librex::LibreX::new()?;
|
163 |
("librex", Box::new(engine))
|
164 |
}
|
|
|
|
|
|
|
|
|
165 |
_ => {
|
166 |
return Err(Report::from(EngineError::NoSuchEngineFound(
|
167 |
engine_name.to_string(),
|
|
|
162 |
let engine = crate::engines::librex::LibreX::new()?;
|
163 |
("librex", Box::new(engine))
|
164 |
}
|
165 |
+
"mojeek" => {
|
166 |
+
let engine = crate::engines::mojeek::Mojeek::new()?;
|
167 |
+
("mojeek", Box::new(engine))
|
168 |
+
}
|
169 |
_ => {
|
170 |
return Err(Report::from(EngineError::NoSuchEngineFound(
|
171 |
engine_name.to_string(),
|
@@ -12,14 +12,16 @@ use std::fs::read_to_string;
|
|
12 |
/// Handles the route of index page or main page of the `websurfx` meta search engine website.
|
13 |
#[get("/")]
|
14 |
pub async fn index(config: web::Data<Config>) -> Result<HttpResponse, Box<dyn std::error::Error>> {
|
15 |
-
Ok(HttpResponse::Ok()
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
|
|
|
|
23 |
}
|
24 |
|
25 |
/// Handles the route of any other accessed route/page which is not provided by the
|
@@ -52,14 +54,16 @@ pub async fn robots_data(_req: HttpRequest) -> Result<HttpResponse, Box<dyn std:
|
|
52 |
/// Handles the route of about page of the `websurfx` meta search engine website.
|
53 |
#[get("/about")]
|
54 |
pub async fn about(config: web::Data<Config>) -> Result<HttpResponse, Box<dyn std::error::Error>> {
|
55 |
-
Ok(HttpResponse::Ok()
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
|
|
|
|
63 |
}
|
64 |
|
65 |
/// Handles the route of settings page of the `websurfx` meta search engine website.
|
@@ -67,16 +71,16 @@ pub async fn about(config: web::Data<Config>) -> Result<HttpResponse, Box<dyn st
|
|
67 |
pub async fn settings(
|
68 |
config: web::Data<Config>,
|
69 |
) -> Result<HttpResponse, Box<dyn std::error::Error>> {
|
70 |
-
Ok(HttpResponse::Ok()
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
.
|
77 |
-
.
|
78 |
-
.
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
}
|
|
|
12 |
/// Handles the route of index page or main page of the `websurfx` meta search engine website.
|
13 |
#[get("/")]
|
14 |
pub async fn index(config: web::Data<Config>) -> Result<HttpResponse, Box<dyn std::error::Error>> {
|
15 |
+
Ok(HttpResponse::Ok()
|
16 |
+
.content_type("text/html; charset=utf-8")
|
17 |
+
.body(
|
18 |
+
crate::templates::views::index::index(
|
19 |
+
&config.style.colorscheme,
|
20 |
+
&config.style.theme,
|
21 |
+
&config.style.animation,
|
22 |
+
)
|
23 |
+
.0,
|
24 |
+
))
|
25 |
}
|
26 |
|
27 |
/// Handles the route of any other accessed route/page which is not provided by the
|
|
|
54 |
/// Handles the route of about page of the `websurfx` meta search engine website.
|
55 |
#[get("/about")]
|
56 |
pub async fn about(config: web::Data<Config>) -> Result<HttpResponse, Box<dyn std::error::Error>> {
|
57 |
+
Ok(HttpResponse::Ok()
|
58 |
+
.content_type("text/html; charset=utf-8")
|
59 |
+
.body(
|
60 |
+
crate::templates::views::about::about(
|
61 |
+
&config.style.colorscheme,
|
62 |
+
&config.style.theme,
|
63 |
+
&config.style.animation,
|
64 |
+
)
|
65 |
+
.0,
|
66 |
+
))
|
67 |
}
|
68 |
|
69 |
/// Handles the route of settings page of the `websurfx` meta search engine website.
|
|
|
71 |
pub async fn settings(
|
72 |
config: web::Data<Config>,
|
73 |
) -> Result<HttpResponse, Box<dyn std::error::Error>> {
|
74 |
+
Ok(HttpResponse::Ok()
|
75 |
+
.content_type("text/html; charset=utf-8")
|
76 |
+
.body(
|
77 |
+
crate::templates::views::settings::settings(
|
78 |
+
config.safe_search,
|
79 |
+
&config.style.colorscheme,
|
80 |
+
&config.style.theme,
|
81 |
+
&config.style.animation,
|
82 |
+
&config.upstream_search_engines,
|
83 |
+
)?
|
84 |
+
.0,
|
85 |
+
))
|
86 |
}
|
@@ -59,25 +59,27 @@ pub async fn search(
|
|
59 |
)
|
60 |
};
|
61 |
|
62 |
-
// .max(1) makes sure that the page
|
63 |
-
let page = params.page.unwrap_or(1).max(1);
|
64 |
|
65 |
let (_, results, _) = join!(
|
66 |
-
get_results(page
|
67 |
get_results(page),
|
68 |
get_results(page + 1)
|
69 |
);
|
70 |
|
71 |
-
Ok(HttpResponse::Ok()
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
|
|
|
|
81 |
}
|
82 |
None => Ok(HttpResponse::TemporaryRedirect()
|
83 |
.insert_header(("location", "/"))
|
|
|
59 |
)
|
60 |
};
|
61 |
|
62 |
+
// .max(1) makes sure that the page >= 0.
|
63 |
+
let page = params.page.unwrap_or(1).max(1) - 1;
|
64 |
|
65 |
let (_, results, _) = join!(
|
66 |
+
get_results(page.saturating_sub(1)),
|
67 |
get_results(page),
|
68 |
get_results(page + 1)
|
69 |
);
|
70 |
|
71 |
+
Ok(HttpResponse::Ok()
|
72 |
+
.content_type("text/html; charset=utf-8")
|
73 |
+
.body(
|
74 |
+
crate::templates::views::search::search(
|
75 |
+
&config.style.colorscheme,
|
76 |
+
&config.style.theme,
|
77 |
+
&config.style.animation,
|
78 |
+
query,
|
79 |
+
&results?,
|
80 |
+
)
|
81 |
+
.0,
|
82 |
+
))
|
83 |
}
|
84 |
None => Ok(HttpResponse::TemporaryRedirect()
|
85 |
.insert_header(("location", "/"))
|
@@ -1,17 +1,20 @@
|
|
1 |
//! A module that handles the engines tab for setting page view in the `websurfx` frontend.
|
2 |
|
|
|
|
|
3 |
use maud::{html, Markup};
|
4 |
|
5 |
/// A functions that handles the html code for the engines tab for the settings page for the search page.
|
6 |
///
|
7 |
/// # Arguments
|
8 |
///
|
9 |
-
/// * `engine_names` - It takes the list of all available engine names
|
|
|
10 |
///
|
11 |
/// # Returns
|
12 |
///
|
13 |
/// It returns the compiled html markup code for the engines tab.
|
14 |
-
pub fn engines(engine_names: &
|
15 |
html!(
|
16 |
div class="engines tab"{
|
17 |
h1{"Engines"}
|
@@ -20,21 +23,49 @@ pub fn engines(engine_names: &[&String]) -> Markup {
|
|
20 |
"Select the search engines from the list of engines that you want results from"
|
21 |
}
|
22 |
.engine_selection{
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
}
|
30 |
hr;
|
31 |
-
@for engine_name in engine_names{
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
}
|
37 |
-
(format!("{}{}",engine_name[..1].to_uppercase().to_owned(), engine_name[1..].to_owned()))
|
38 |
}
|
39 |
}
|
40 |
}
|
|
|
1 |
//! A module that handles the engines tab for setting page view in the `websurfx` frontend.
|
2 |
|
3 |
+
use std::collections::HashMap;
|
4 |
+
|
5 |
use maud::{html, Markup};
|
6 |
|
7 |
/// A functions that handles the html code for the engines tab for the settings page for the search page.
|
8 |
///
|
9 |
/// # Arguments
|
10 |
///
|
11 |
+
/// * `engine_names` - It takes the key value pair list of all available engine names and there corresponding
|
12 |
+
/// selected (enabled/disabled) value as an argument.
|
13 |
///
|
14 |
/// # Returns
|
15 |
///
|
16 |
/// It returns the compiled html markup code for the engines tab.
|
17 |
+
pub fn engines(engine_names: &HashMap<String, bool>) -> Markup {
|
18 |
html!(
|
19 |
div class="engines tab"{
|
20 |
h1{"Engines"}
|
|
|
23 |
"Select the search engines from the list of engines that you want results from"
|
24 |
}
|
25 |
.engine_selection{
|
26 |
+
// Checks whether all the engines are selected or not if they are then the
|
27 |
+
// checked `select_all` button is rendered otherwise the unchecked version
|
28 |
+
// is rendered.
|
29 |
+
@if engine_names.values().all(|selected| *selected){
|
30 |
+
.toggle_btn{
|
31 |
+
label class="switch"{
|
32 |
+
input type="checkbox" class="select_all" onchange="toggleAllSelection()" checked;
|
33 |
+
span class="slider round"{}
|
34 |
+
}
|
35 |
+
"Select All"
|
36 |
+
}
|
37 |
+
}
|
38 |
+
@else{
|
39 |
+
.toggle_btn {
|
40 |
+
label class="switch"{
|
41 |
+
input type="checkbox" class="select_all" onchange="toggleAllSelection()";
|
42 |
+
span class="slider round"{}
|
43 |
+
}
|
44 |
+
"Select All"
|
45 |
+
}
|
46 |
}
|
47 |
hr;
|
48 |
+
@for (engine_name, selected) in engine_names{
|
49 |
+
// Checks whether the `engine_name` is selected or not if they are then the
|
50 |
+
// checked `engine` button is rendered otherwise the unchecked version is
|
51 |
+
// rendered.
|
52 |
+
@if *selected {
|
53 |
+
.toggle_btn{
|
54 |
+
label class="switch"{
|
55 |
+
input type="checkbox" class="engine" checked;
|
56 |
+
span class="slider round"{}
|
57 |
+
}
|
58 |
+
(format!("{}{}",engine_name[..1].to_uppercase().to_owned(), engine_name[1..].to_owned()))
|
59 |
+
}
|
60 |
+
}
|
61 |
+
@else {
|
62 |
+
.toggle_btn {
|
63 |
+
label class="switch"{
|
64 |
+
input type="checkbox" class="engine";
|
65 |
+
span class="slider round"{}
|
66 |
+
}
|
67 |
+
(format!("{}{}",engine_name[..1].to_uppercase().to_owned(), engine_name[1..].to_owned()))
|
68 |
}
|
|
|
69 |
}
|
70 |
}
|
71 |
}
|
@@ -7,10 +7,14 @@ const SAFE_SEARCH_LEVELS: [(u8, &str); 3] = [(0, "None"), (1, "Low"), (2, "Moder
|
|
7 |
|
8 |
/// A functions that handles the html code for the general tab for the settings page for the search page.
|
9 |
///
|
|
|
|
|
|
|
|
|
10 |
/// # Returns
|
11 |
///
|
12 |
/// It returns the compiled html markup code for the general tab.
|
13 |
-
pub fn general() -> Markup {
|
14 |
html!(
|
15 |
div class="general tab active"{
|
16 |
h1{"General"}
|
@@ -18,9 +22,19 @@ pub fn general() -> Markup {
|
|
18 |
p class="description"{
|
19 |
"Select a safe search level from the menu below to filter content based on the level."
|
20 |
}
|
21 |
-
|
22 |
-
|
23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
}
|
25 |
}
|
26 |
}
|
|
|
7 |
|
8 |
/// A functions that handles the html code for the general tab for the settings page for the search page.
|
9 |
///
|
10 |
+
/// # Arguments
|
11 |
+
///
|
12 |
+
/// * `safe_search_level` - It takes the safe search level as an argument.
|
13 |
+
///
|
14 |
/// # Returns
|
15 |
///
|
16 |
/// It returns the compiled html markup code for the general tab.
|
17 |
+
pub fn general(safe_search_level: u8) -> Markup {
|
18 |
html!(
|
19 |
div class="general tab active"{
|
20 |
h1{"General"}
|
|
|
22 |
p class="description"{
|
23 |
"Select a safe search level from the menu below to filter content based on the level."
|
24 |
}
|
25 |
+
@if safe_search_level < 3 {
|
26 |
+
select name="safe_search_levels" {
|
27 |
+
// Sets the user selected safe_search_level name from the config file as the first option in the selection list.
|
28 |
+
option value=(safe_search_level){(SAFE_SEARCH_LEVELS.iter().find(|level| level.0 == safe_search_level).unwrap().1)}
|
29 |
+
@for (k,v) in SAFE_SEARCH_LEVELS.iter().filter(|level| level.0 != safe_search_level){
|
30 |
+
option value=(k){(v)}
|
31 |
+
}
|
32 |
+
}
|
33 |
+
}
|
34 |
+
@else {
|
35 |
+
p class="admin_warning" {"β οΈ This setting is being managed by the server administrator."}
|
36 |
+
select name="safe_search_levels" disabled {
|
37 |
+
option value=(SAFE_SEARCH_LEVELS[2].0){(SAFE_SEARCH_LEVELS[2].1)}
|
38 |
}
|
39 |
}
|
40 |
}
|
@@ -4,13 +4,16 @@ use crate::handler::{file_path, FileType};
|
|
4 |
use maud::{html, Markup};
|
5 |
use std::fs::read_dir;
|
6 |
|
7 |
-
/// A helper function that helps in building the list of all available colorscheme/theme
|
8 |
-
/// present in the colorschemes and themes folder respectively
|
|
|
9 |
///
|
10 |
/// # Arguments
|
11 |
///
|
12 |
/// * `style_type` - It takes the style type of the values `theme` and `colorscheme` as an
|
13 |
/// argument.
|
|
|
|
|
14 |
///
|
15 |
/// # Error
|
16 |
///
|
@@ -18,7 +21,8 @@ use std::fs::read_dir;
|
|
18 |
/// returns a standard error message.
|
19 |
fn style_option_list(
|
20 |
style_type: &str,
|
21 |
-
|
|
|
22 |
let mut style_option_names: Vec<(String, String)> = Vec::new();
|
23 |
for file in read_dir(format!(
|
24 |
"{}static/{}/",
|
@@ -26,7 +30,13 @@ fn style_option_list(
|
|
26 |
style_type,
|
27 |
))? {
|
28 |
let style_name = file?.file_name().to_str().unwrap().replace(".css", "");
|
29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
}
|
31 |
|
32 |
Ok(style_option_names)
|
@@ -38,7 +48,11 @@ fn style_option_list(
|
|
38 |
///
|
39 |
/// It returns the compiled html markup code for the user interface tab on success otherwise
|
40 |
/// returns a standard error message.
|
41 |
-
pub fn user_interface(
|
|
|
|
|
|
|
|
|
42 |
Ok(html!(
|
43 |
div class="user_interface tab"{
|
44 |
h1{"User Interface"}
|
@@ -47,7 +61,9 @@ pub fn user_interface() -> Result<Markup, Box<dyn std::error::Error>> {
|
|
47 |
"Select the theme from the available themes to be used in user interface"
|
48 |
}
|
49 |
select name="themes"{
|
50 |
-
|
|
|
|
|
51 |
option value=(k){(v)}
|
52 |
}
|
53 |
}
|
@@ -56,7 +72,9 @@ pub fn user_interface() -> Result<Markup, Box<dyn std::error::Error>> {
|
|
56 |
"Select the color scheme for your theme to be used in user interface"
|
57 |
}
|
58 |
select name="colorschemes"{
|
59 |
-
|
|
|
|
|
60 |
option value=(k){(v)}
|
61 |
}
|
62 |
}
|
@@ -65,12 +83,12 @@ pub fn user_interface() -> Result<Markup, Box<dyn std::error::Error>> {
|
|
65 |
"Select the animation for your theme to be used in user interface"
|
66 |
}
|
67 |
select name="animations"{
|
68 |
-
option
|
69 |
-
|
|
|
70 |
option value=(k){(v)}
|
71 |
}
|
72 |
}
|
73 |
-
|
74 |
}
|
75 |
))
|
76 |
}
|
|
|
4 |
use maud::{html, Markup};
|
5 |
use std::fs::read_dir;
|
6 |
|
7 |
+
/// A helper function that helps in building the list of all available colorscheme/theme/animation
|
8 |
+
/// names present in the colorschemes, animations and themes folder respectively by excluding the
|
9 |
+
/// ones that have already been selected via the config file.
|
10 |
///
|
11 |
/// # Arguments
|
12 |
///
|
13 |
/// * `style_type` - It takes the style type of the values `theme` and `colorscheme` as an
|
14 |
/// argument.
|
15 |
+
/// * `selected_style` - It takes the currently selected style value provided via the config file
|
16 |
+
/// as an argument.
|
17 |
///
|
18 |
/// # Error
|
19 |
///
|
|
|
21 |
/// returns a standard error message.
|
22 |
fn style_option_list(
|
23 |
style_type: &str,
|
24 |
+
selected_style: &str,
|
25 |
+
) -> Result<Vec<(String, String)>, Box<dyn std::error::Error>> {
|
26 |
let mut style_option_names: Vec<(String, String)> = Vec::new();
|
27 |
for file in read_dir(format!(
|
28 |
"{}static/{}/",
|
|
|
30 |
style_type,
|
31 |
))? {
|
32 |
let style_name = file?.file_name().to_str().unwrap().replace(".css", "");
|
33 |
+
if selected_style != style_name {
|
34 |
+
style_option_names.push((style_name.clone(), style_name.replace('-', " ")));
|
35 |
+
}
|
36 |
+
}
|
37 |
+
|
38 |
+
if style_type == "animations" {
|
39 |
+
style_option_names.push(("".to_owned(), "none".to_owned()))
|
40 |
}
|
41 |
|
42 |
Ok(style_option_names)
|
|
|
48 |
///
|
49 |
/// It returns the compiled html markup code for the user interface tab on success otherwise
|
50 |
/// returns a standard error message.
|
51 |
+
pub fn user_interface(
|
52 |
+
theme: &str,
|
53 |
+
colorscheme: &str,
|
54 |
+
animation: &Option<String>,
|
55 |
+
) -> Result<Markup, Box<dyn std::error::Error>> {
|
56 |
Ok(html!(
|
57 |
div class="user_interface tab"{
|
58 |
h1{"User Interface"}
|
|
|
61 |
"Select the theme from the available themes to be used in user interface"
|
62 |
}
|
63 |
select name="themes"{
|
64 |
+
// Sets the user selected theme name from the config file as the first option in the selection list.
|
65 |
+
option value=(theme){(theme.replace('-', " "))}
|
66 |
+
@for (k,v) in style_option_list("themes", theme)?{
|
67 |
option value=(k){(v)}
|
68 |
}
|
69 |
}
|
|
|
72 |
"Select the color scheme for your theme to be used in user interface"
|
73 |
}
|
74 |
select name="colorschemes"{
|
75 |
+
// Sets the user selected colorscheme name from the config file as the first option in the selection list.
|
76 |
+
option value=(colorscheme){(colorscheme.replace('-', " "))}
|
77 |
+
@for (k,v) in style_option_list("colorschemes", colorscheme)?{
|
78 |
option value=(k){(v)}
|
79 |
}
|
80 |
}
|
|
|
83 |
"Select the animation for your theme to be used in user interface"
|
84 |
}
|
85 |
select name="animations"{
|
86 |
+
// Sets the user selected animation name from the config file as the first option in the selection list.
|
87 |
+
option value=(animation.as_ref().unwrap_or(&"".to_owned())){(animation.as_ref().unwrap_or(&"".to_owned()).replace('-'," "))}
|
88 |
+
@for (k,v) in style_option_list("animations", animation.as_ref().unwrap_or(&"".to_owned()))?{
|
89 |
option value=(k){(v)}
|
90 |
}
|
91 |
}
|
|
|
92 |
}
|
93 |
))
|
94 |
}
|
@@ -1,5 +1,7 @@
|
|
1 |
//! A module that handles the view for the settings page in the `websurfx` frontend.
|
2 |
|
|
|
|
|
3 |
use maud::{html, Markup};
|
4 |
|
5 |
use crate::templates::partials::{
|
@@ -14,8 +16,10 @@ use crate::templates::partials::{
|
|
14 |
///
|
15 |
/// # Arguments
|
16 |
///
|
|
|
17 |
/// * `colorscheme` - It takes the colorscheme name as an argument.
|
18 |
/// * `theme` - It takes the theme name as an argument.
|
|
|
19 |
/// * `engine_names` - It takes a list of engine names as an argument.
|
20 |
///
|
21 |
/// # Error
|
@@ -23,10 +27,11 @@ use crate::templates::partials::{
|
|
23 |
/// This function returns a compiled html markup code on success otherwise returns a standard error
|
24 |
/// message.
|
25 |
pub fn settings(
|
|
|
26 |
colorscheme: &str,
|
27 |
theme: &str,
|
28 |
animation: &Option<String>,
|
29 |
-
engine_names: &
|
30 |
) -> Result<Markup, Box<dyn std::error::Error>> {
|
31 |
Ok(html!(
|
32 |
(header(colorscheme, theme, animation))
|
@@ -41,8 +46,8 @@ pub fn settings(
|
|
41 |
.btn onclick="setActiveTab(this)"{"cookies"}
|
42 |
}
|
43 |
.main_container{
|
44 |
-
(general())
|
45 |
-
(user_interface()?)
|
46 |
(engines(engine_names))
|
47 |
(cookies())
|
48 |
p class="message"{}
|
|
|
1 |
//! A module that handles the view for the settings page in the `websurfx` frontend.
|
2 |
|
3 |
+
use std::collections::HashMap;
|
4 |
+
|
5 |
use maud::{html, Markup};
|
6 |
|
7 |
use crate::templates::partials::{
|
|
|
16 |
///
|
17 |
/// # Arguments
|
18 |
///
|
19 |
+
/// * `safe_search_level` - It takes the safe search level as an argument.
|
20 |
/// * `colorscheme` - It takes the colorscheme name as an argument.
|
21 |
/// * `theme` - It takes the theme name as an argument.
|
22 |
+
/// * `animation` - It takes the animation name as an argument.
|
23 |
/// * `engine_names` - It takes a list of engine names as an argument.
|
24 |
///
|
25 |
/// # Error
|
|
|
27 |
/// This function returns a compiled html markup code on success otherwise returns a standard error
|
28 |
/// message.
|
29 |
pub fn settings(
|
30 |
+
safe_search_level: u8,
|
31 |
colorscheme: &str,
|
32 |
theme: &str,
|
33 |
animation: &Option<String>,
|
34 |
+
engine_names: &HashMap<String, bool>,
|
35 |
) -> Result<Markup, Box<dyn std::error::Error>> {
|
36 |
Ok(html!(
|
37 |
(header(colorscheme, theme, animation))
|
|
|
46 |
.btn onclick="setActiveTab(this)"{"cookies"}
|
47 |
}
|
48 |
.main_container{
|
49 |
+
(general(safe_search_level))
|
50 |
+
(user_interface(theme, colorscheme, animation)?)
|
51 |
(engines(engine_names))
|
52 |
(cookies())
|
53 |
p class="message"{}
|
@@ -64,4 +64,5 @@ upstream_search_engines = {
|
|
64 |
Brave = false,
|
65 |
Startpage = false,
|
66 |
LibreX = false,
|
|
|
67 |
} -- select the upstream search engines from which the results should be fetched.
|
|
|
64 |
Brave = false,
|
65 |
Startpage = false,
|
66 |
LibreX = false,
|
67 |
+
Mojeek = false,
|
68 |
} -- select the upstream search engines from which the results should be fetched.
|