Spaces:
Running
Running
Merge pull request #462 from neon-mmd/CHORE/461_display-the-user-provided-settings-from-the-config-or-the-ui-in-the-settings-page
Browse files- Cargo.lock +66 -66
- Cargo.toml +1 -1
- public/static/cookies.js +67 -3
- public/static/themes/simple.css +9 -1
- src/server/router.rs +2 -4
- 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
Cargo.lock
CHANGED
@@ -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 |
]
|
Cargo.toml
CHANGED
@@ -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"
|
public/static/cookies.js
CHANGED
@@ -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
|
public/static/themes/simple.css
CHANGED
@@ -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;
|
src/server/router.rs
CHANGED
@@ -75,13 +75,11 @@ pub async fn settings(
|
|
75 |
.content_type("text/html; charset=utf-8")
|
76 |
.body(
|
77 |
crate::templates::views::settings::settings(
|
|
|
78 |
&config.style.colorscheme,
|
79 |
&config.style.theme,
|
80 |
&config.style.animation,
|
81 |
-
&config
|
82 |
-
.upstream_search_engines
|
83 |
-
.keys()
|
84 |
-
.collect::<Vec<&String>>(),
|
85 |
)?
|
86 |
.0,
|
87 |
))
|
|
|
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 |
))
|
src/templates/partials/settings_tabs/engines.rs
CHANGED
@@ -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 |
}
|
src/templates/partials/settings_tabs/general.rs
CHANGED
@@ -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 |
}
|
src/templates/partials/settings_tabs/user_interface.rs
CHANGED
@@ -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 |
}
|
src/templates/views/settings.rs
CHANGED
@@ -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"{}
|