diff options
author | FxQnLr <[email protected]> | 2024-03-04 21:37:55 +0100 |
---|---|---|
committer | FxQnLr <[email protected]> | 2024-03-04 21:37:55 +0100 |
commit | 0a058ba2064d323451462a79c71580dea7d8ec8c (patch) | |
tree | 3e0a5a8c2d48aac8b1ff1720455db47a0c50386a | |
parent | 0920c86de3523785b5f4ac67e2090f0736f9fcb2 (diff) | |
download | webol-0a058ba2064d323451462a79c71580dea7d8ec8c.tar webol-0a058ba2064d323451462a79c71580dea7d8ec8c.tar.gz webol-0a058ba2064d323451462a79c71580dea7d8ec8c.zip |
Closes #19. Added OpenApi through `utoipa`
-rw-r--r-- | .sqlx/query-566c84386614590144dfebce2248cb3a734074014a493a7aad6fa03bb1286dc8.json | 49 | ||||
-rw-r--r-- | Cargo.lock | 341 | ||||
-rw-r--r-- | Cargo.toml | 8 | ||||
-rw-r--r-- | src/db.rs | 11 | ||||
-rw-r--r-- | src/error.rs | 3 | ||||
-rw-r--r-- | src/main.rs | 89 | ||||
-rw-r--r-- | src/routes.rs | 2 | ||||
-rw-r--r-- | src/routes/device.rs | 91 | ||||
-rw-r--r-- | src/routes/start.rs | 16 |
9 files changed, 495 insertions, 115 deletions
diff --git a/.sqlx/query-566c84386614590144dfebce2248cb3a734074014a493a7aad6fa03bb1286dc8.json b/.sqlx/query-566c84386614590144dfebce2248cb3a734074014a493a7aad6fa03bb1286dc8.json new file mode 100644 index 0000000..735c3bb --- /dev/null +++ b/.sqlx/query-566c84386614590144dfebce2248cb3a734074014a493a7aad6fa03bb1286dc8.json | |||
@@ -0,0 +1,49 @@ | |||
1 | { | ||
2 | "db_name": "PostgreSQL", | ||
3 | "query": "\n INSERT INTO devices (id, mac, broadcast_addr, ip)\n VALUES ($1, $2, $3, $4)\n RETURNING id, mac, broadcast_addr, ip, times;\n ", | ||
4 | "describe": { | ||
5 | "columns": [ | ||
6 | { | ||
7 | "ordinal": 0, | ||
8 | "name": "id", | ||
9 | "type_info": "Varchar" | ||
10 | }, | ||
11 | { | ||
12 | "ordinal": 1, | ||
13 | "name": "mac", | ||
14 | "type_info": "Macaddr" | ||
15 | }, | ||
16 | { | ||
17 | "ordinal": 2, | ||
18 | "name": "broadcast_addr", | ||
19 | "type_info": "Varchar" | ||
20 | }, | ||
21 | { | ||
22 | "ordinal": 3, | ||
23 | "name": "ip", | ||
24 | "type_info": "Inet" | ||
25 | }, | ||
26 | { | ||
27 | "ordinal": 4, | ||
28 | "name": "times", | ||
29 | "type_info": "Int8Array" | ||
30 | } | ||
31 | ], | ||
32 | "parameters": { | ||
33 | "Left": [ | ||
34 | "Varchar", | ||
35 | "Macaddr", | ||
36 | "Varchar", | ||
37 | "Inet" | ||
38 | ] | ||
39 | }, | ||
40 | "nullable": [ | ||
41 | false, | ||
42 | false, | ||
43 | false, | ||
44 | false, | ||
45 | true | ||
46 | ] | ||
47 | }, | ||
48 | "hash": "566c84386614590144dfebce2248cb3a734074014a493a7aad6fa03bb1286dc8" | ||
49 | } | ||
@@ -19,9 +19,9 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" | |||
19 | 19 | ||
20 | [[package]] | 20 | [[package]] |
21 | name = "ahash" | 21 | name = "ahash" |
22 | version = "0.8.10" | 22 | version = "0.8.11" |
23 | source = "registry+https://github.com/rust-lang/crates.io-index" | 23 | source = "registry+https://github.com/rust-lang/crates.io-index" |
24 | checksum = "8b79b82693f705137f8fb9b37871d99e4f9a7df12b917eed79c3d3954830a60b" | 24 | checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" |
25 | dependencies = [ | 25 | dependencies = [ |
26 | "cfg-if", | 26 | "cfg-if", |
27 | "getrandom", | 27 | "getrandom", |
@@ -53,7 +53,7 @@ checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" | |||
53 | dependencies = [ | 53 | dependencies = [ |
54 | "proc-macro2", | 54 | "proc-macro2", |
55 | "quote", | 55 | "quote", |
56 | "syn 2.0.51", | 56 | "syn 2.0.52", |
57 | ] | 57 | ] |
58 | 58 | ||
59 | [[package]] | 59 | [[package]] |
@@ -67,11 +67,11 @@ dependencies = [ | |||
67 | 67 | ||
68 | [[package]] | 68 | [[package]] |
69 | name = "atomic-write-file" | 69 | name = "atomic-write-file" |
70 | version = "0.1.2" | 70 | version = "0.1.3" |
71 | source = "registry+https://github.com/rust-lang/crates.io-index" | 71 | source = "registry+https://github.com/rust-lang/crates.io-index" |
72 | checksum = "edcdbedc2236483ab103a53415653d6b4442ea6141baf1ffa85df29635e88436" | 72 | checksum = "a8204db279bf648d64fe845bd8840f78b39c8132ed4d6a4194c3b10d4b4cfb0b" |
73 | dependencies = [ | 73 | dependencies = [ |
74 | "nix 0.27.1", | 74 | "nix 0.28.0", |
75 | "rand", | 75 | "rand", |
76 | ] | 76 | ] |
77 | 77 | ||
@@ -148,7 +148,7 @@ dependencies = [ | |||
148 | "heck", | 148 | "heck", |
149 | "proc-macro2", | 149 | "proc-macro2", |
150 | "quote", | 150 | "quote", |
151 | "syn 2.0.51", | 151 | "syn 2.0.52", |
152 | ] | 152 | ] |
153 | 153 | ||
154 | [[package]] | 154 | [[package]] |
@@ -216,9 +216,9 @@ checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" | |||
216 | 216 | ||
217 | [[package]] | 217 | [[package]] |
218 | name = "cc" | 218 | name = "cc" |
219 | version = "1.0.88" | 219 | version = "1.0.89" |
220 | source = "registry+https://github.com/rust-lang/crates.io-index" | 220 | source = "registry+https://github.com/rust-lang/crates.io-index" |
221 | checksum = "02f341c093d19155a6e41631ce5971aac4e9a868262212153124c15fa22d1cdc" | 221 | checksum = "a0ba8f7aaa012f30d5b2861462f6708eccd49c3c39863fe083a308035f63d723" |
222 | 222 | ||
223 | [[package]] | 223 | [[package]] |
224 | name = "cfg-if" | 224 | name = "cfg-if" |
@@ -227,6 +227,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
227 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" | 227 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" |
228 | 228 | ||
229 | [[package]] | 229 | [[package]] |
230 | name = "cfg_aliases" | ||
231 | version = "0.1.1" | ||
232 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
233 | checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" | ||
234 | |||
235 | [[package]] | ||
230 | name = "color-eyre" | 236 | name = "color-eyre" |
231 | version = "0.6.2" | 237 | version = "0.6.2" |
232 | source = "registry+https://github.com/rust-lang/crates.io-index" | 238 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -281,9 +287,9 @@ checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" | |||
281 | 287 | ||
282 | [[package]] | 288 | [[package]] |
283 | name = "const-random" | 289 | name = "const-random" |
284 | version = "0.1.17" | 290 | version = "0.1.18" |
285 | source = "registry+https://github.com/rust-lang/crates.io-index" | 291 | source = "registry+https://github.com/rust-lang/crates.io-index" |
286 | checksum = "5aaf16c9c2c612020bcfd042e170f6e32de9b9d75adb5277cdbbd2e2c8c8299a" | 292 | checksum = "87e00182fe74b066627d63b85fd550ac2998d4b0bd86bfed477a0ae4c7c71359" |
287 | dependencies = [ | 293 | dependencies = [ |
288 | "const-random-macro", | 294 | "const-random-macro", |
289 | ] | 295 | ] |
@@ -333,6 +339,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
333 | checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5" | 339 | checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5" |
334 | 340 | ||
335 | [[package]] | 341 | [[package]] |
342 | name = "crc32fast" | ||
343 | version = "1.4.0" | ||
344 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
345 | checksum = "b3855a8a784b474f333699ef2bbca9db2c4a1f6d9088a90a2d25b1eb53111eaa" | ||
346 | dependencies = [ | ||
347 | "cfg-if", | ||
348 | ] | ||
349 | |||
350 | [[package]] | ||
336 | name = "crossbeam-channel" | 351 | name = "crossbeam-channel" |
337 | version = "0.5.12" | 352 | version = "0.5.12" |
338 | source = "registry+https://github.com/rust-lang/crates.io-index" | 353 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -503,6 +518,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
503 | checksum = "8fcfdc7a0362c9f4444381a9e697c79d435fe65b52a37466fc2c1184cee9edc6" | 518 | checksum = "8fcfdc7a0362c9f4444381a9e697c79d435fe65b52a37466fc2c1184cee9edc6" |
504 | 519 | ||
505 | [[package]] | 520 | [[package]] |
521 | name = "flate2" | ||
522 | version = "1.0.28" | ||
523 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
524 | checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e" | ||
525 | dependencies = [ | ||
526 | "crc32fast", | ||
527 | "miniz_oxide", | ||
528 | ] | ||
529 | |||
530 | [[package]] | ||
506 | name = "flume" | 531 | name = "flume" |
507 | version = "0.11.0" | 532 | version = "0.11.0" |
508 | source = "registry+https://github.com/rust-lang/crates.io-index" | 533 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -688,9 +713,9 @@ dependencies = [ | |||
688 | 713 | ||
689 | [[package]] | 714 | [[package]] |
690 | name = "hermit-abi" | 715 | name = "hermit-abi" |
691 | version = "0.3.8" | 716 | version = "0.3.9" |
692 | source = "registry+https://github.com/rust-lang/crates.io-index" | 717 | source = "registry+https://github.com/rust-lang/crates.io-index" |
693 | checksum = "379dada1584ad501b383485dd706b8afb7a70fcbc7f4da7d780638a5a6124a60" | 718 | checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" |
694 | 719 | ||
695 | [[package]] | 720 | [[package]] |
696 | name = "hex" | 721 | name = "hex" |
@@ -727,9 +752,9 @@ dependencies = [ | |||
727 | 752 | ||
728 | [[package]] | 753 | [[package]] |
729 | name = "http" | 754 | name = "http" |
730 | version = "1.0.0" | 755 | version = "1.1.0" |
731 | source = "registry+https://github.com/rust-lang/crates.io-index" | 756 | source = "registry+https://github.com/rust-lang/crates.io-index" |
732 | checksum = "b32afd38673a8016f7c9ae69e5af41a58f81b1d31689040f2f1959594ce194ea" | 757 | checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" |
733 | dependencies = [ | 758 | dependencies = [ |
734 | "bytes", | 759 | "bytes", |
735 | "fnv", | 760 | "fnv", |
@@ -825,12 +850,13 @@ checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683" | |||
825 | 850 | ||
826 | [[package]] | 851 | [[package]] |
827 | name = "indexmap" | 852 | name = "indexmap" |
828 | version = "2.2.3" | 853 | version = "2.2.5" |
829 | source = "registry+https://github.com/rust-lang/crates.io-index" | 854 | source = "registry+https://github.com/rust-lang/crates.io-index" |
830 | checksum = "233cf39063f058ea2caae4091bf4a3ef70a653afbc026f5c4a4135d114e3c177" | 855 | checksum = "7b0b929d511467233429c45a44ac1dcaa21ba0f5ba11e4879e6ed28ddb4f9df4" |
831 | dependencies = [ | 856 | dependencies = [ |
832 | "equivalent", | 857 | "equivalent", |
833 | "hashbrown 0.14.3", | 858 | "hashbrown 0.14.3", |
859 | "serde", | ||
834 | ] | 860 | ] |
835 | 861 | ||
836 | [[package]] | 862 | [[package]] |
@@ -924,9 +950,9 @@ dependencies = [ | |||
924 | 950 | ||
925 | [[package]] | 951 | [[package]] |
926 | name = "log" | 952 | name = "log" |
927 | version = "0.4.20" | 953 | version = "0.4.21" |
928 | source = "registry+https://github.com/rust-lang/crates.io-index" | 954 | source = "registry+https://github.com/rust-lang/crates.io-index" |
929 | checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" | 955 | checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" |
930 | 956 | ||
931 | [[package]] | 957 | [[package]] |
932 | name = "mac_address" | 958 | name = "mac_address" |
@@ -986,6 +1012,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
986 | checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" | 1012 | checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" |
987 | 1013 | ||
988 | [[package]] | 1014 | [[package]] |
1015 | name = "mime_guess" | ||
1016 | version = "2.0.4" | ||
1017 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
1018 | checksum = "4192263c238a5f0d0c6bfd21f336a313a4ce1c450542449ca191bb657b4642ef" | ||
1019 | dependencies = [ | ||
1020 | "mime", | ||
1021 | "unicase", | ||
1022 | ] | ||
1023 | |||
1024 | [[package]] | ||
989 | name = "minimal-lexical" | 1025 | name = "minimal-lexical" |
990 | version = "0.2.1" | 1026 | version = "0.2.1" |
991 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1027 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -1002,9 +1038,9 @@ dependencies = [ | |||
1002 | 1038 | ||
1003 | [[package]] | 1039 | [[package]] |
1004 | name = "mio" | 1040 | name = "mio" |
1005 | version = "0.8.10" | 1041 | version = "0.8.11" |
1006 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1042 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1007 | checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09" | 1043 | checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" |
1008 | dependencies = [ | 1044 | dependencies = [ |
1009 | "libc", | 1045 | "libc", |
1010 | "wasi", | 1046 | "wasi", |
@@ -1026,12 +1062,13 @@ dependencies = [ | |||
1026 | 1062 | ||
1027 | [[package]] | 1063 | [[package]] |
1028 | name = "nix" | 1064 | name = "nix" |
1029 | version = "0.27.1" | 1065 | version = "0.28.0" |
1030 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1066 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1031 | checksum = "2eb04e9c688eff1c89d72b407f168cf79bb9e867a9d3323ed6c01519eb9cc053" | 1067 | checksum = "ab2156c4fce2f8df6c499cc1c763e4394b7482525bf2a9701c9d79d215f519e4" |
1032 | dependencies = [ | 1068 | dependencies = [ |
1033 | "bitflags 2.4.2", | 1069 | "bitflags 2.4.2", |
1034 | "cfg-if", | 1070 | "cfg-if", |
1071 | "cfg_aliases", | ||
1035 | "libc", | 1072 | "libc", |
1036 | ] | 1073 | ] |
1037 | 1074 | ||
@@ -1222,9 +1259,9 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" | |||
1222 | 1259 | ||
1223 | [[package]] | 1260 | [[package]] |
1224 | name = "pest" | 1261 | name = "pest" |
1225 | version = "2.7.7" | 1262 | version = "2.7.8" |
1226 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1263 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1227 | checksum = "219c0dcc30b6a27553f9cc242972b67f75b60eb0db71f0b5462f38b058c41546" | 1264 | checksum = "56f8023d0fb78c8e03784ea1c7f3fa36e68a723138990b8d5a47d916b651e7a8" |
1228 | dependencies = [ | 1265 | dependencies = [ |
1229 | "memchr", | 1266 | "memchr", |
1230 | "thiserror", | 1267 | "thiserror", |
@@ -1233,9 +1270,9 @@ dependencies = [ | |||
1233 | 1270 | ||
1234 | [[package]] | 1271 | [[package]] |
1235 | name = "pest_derive" | 1272 | name = "pest_derive" |
1236 | version = "2.7.7" | 1273 | version = "2.7.8" |
1237 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1274 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1238 | checksum = "22e1288dbd7786462961e69bfd4df7848c1e37e8b74303dbdab82c3a9cdd2809" | 1275 | checksum = "b0d24f72393fd16ab6ac5738bc33cdb6a9aa73f8b902e8fe29cf4e67d7dd1026" |
1239 | dependencies = [ | 1276 | dependencies = [ |
1240 | "pest", | 1277 | "pest", |
1241 | "pest_generator", | 1278 | "pest_generator", |
@@ -1243,22 +1280,22 @@ dependencies = [ | |||
1243 | 1280 | ||
1244 | [[package]] | 1281 | [[package]] |
1245 | name = "pest_generator" | 1282 | name = "pest_generator" |
1246 | version = "2.7.7" | 1283 | version = "2.7.8" |
1247 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1284 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1248 | checksum = "1381c29a877c6d34b8c176e734f35d7f7f5b3adaefe940cb4d1bb7af94678e2e" | 1285 | checksum = "fdc17e2a6c7d0a492f0158d7a4bd66cc17280308bbaff78d5bef566dca35ab80" |
1249 | dependencies = [ | 1286 | dependencies = [ |
1250 | "pest", | 1287 | "pest", |
1251 | "pest_meta", | 1288 | "pest_meta", |
1252 | "proc-macro2", | 1289 | "proc-macro2", |
1253 | "quote", | 1290 | "quote", |
1254 | "syn 2.0.51", | 1291 | "syn 2.0.52", |
1255 | ] | 1292 | ] |
1256 | 1293 | ||
1257 | [[package]] | 1294 | [[package]] |
1258 | name = "pest_meta" | 1295 | name = "pest_meta" |
1259 | version = "2.7.7" | 1296 | version = "2.7.8" |
1260 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1297 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1261 | checksum = "d0934d6907f148c22a3acbda520c7eed243ad7487a30f51f6ce52b58b7077a8a" | 1298 | checksum = "934cd7631c050f4674352a6e835d5f6711ffbfb9345c2fc0107155ac495ae293" |
1262 | dependencies = [ | 1299 | dependencies = [ |
1263 | "once_cell", | 1300 | "once_cell", |
1264 | "pest", | 1301 | "pest", |
@@ -1282,7 +1319,7 @@ checksum = "266c042b60c9c76b8d53061e52b2e0d1116abc57cefc8c5cd671619a56ac3690" | |||
1282 | dependencies = [ | 1319 | dependencies = [ |
1283 | "proc-macro2", | 1320 | "proc-macro2", |
1284 | "quote", | 1321 | "quote", |
1285 | "syn 2.0.51", | 1322 | "syn 2.0.52", |
1286 | ] | 1323 | ] |
1287 | 1324 | ||
1288 | [[package]] | 1325 | [[package]] |
@@ -1379,6 +1416,30 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
1379 | checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" | 1416 | checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" |
1380 | 1417 | ||
1381 | [[package]] | 1418 | [[package]] |
1419 | name = "proc-macro-error" | ||
1420 | version = "1.0.4" | ||
1421 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
1422 | checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" | ||
1423 | dependencies = [ | ||
1424 | "proc-macro-error-attr", | ||
1425 | "proc-macro2", | ||
1426 | "quote", | ||
1427 | "syn 1.0.109", | ||
1428 | "version_check", | ||
1429 | ] | ||
1430 | |||
1431 | [[package]] | ||
1432 | name = "proc-macro-error-attr" | ||
1433 | version = "1.0.4" | ||
1434 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
1435 | checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" | ||
1436 | dependencies = [ | ||
1437 | "proc-macro2", | ||
1438 | "quote", | ||
1439 | "version_check", | ||
1440 | ] | ||
1441 | |||
1442 | [[package]] | ||
1382 | name = "proc-macro2" | 1443 | name = "proc-macro2" |
1383 | version = "1.0.78" | 1444 | version = "1.0.78" |
1384 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1445 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -1443,7 +1504,7 @@ checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" | |||
1443 | dependencies = [ | 1504 | dependencies = [ |
1444 | "aho-corasick", | 1505 | "aho-corasick", |
1445 | "memchr", | 1506 | "memchr", |
1446 | "regex-automata 0.4.5", | 1507 | "regex-automata 0.4.6", |
1447 | "regex-syntax 0.8.2", | 1508 | "regex-syntax 0.8.2", |
1448 | ] | 1509 | ] |
1449 | 1510 | ||
@@ -1458,9 +1519,9 @@ dependencies = [ | |||
1458 | 1519 | ||
1459 | [[package]] | 1520 | [[package]] |
1460 | name = "regex-automata" | 1521 | name = "regex-automata" |
1461 | version = "0.4.5" | 1522 | version = "0.4.6" |
1462 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1523 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1463 | checksum = "5bb987efffd3c6d0d8f5f89510bb458559eab11e4f869acb20bf845e016259cd" | 1524 | checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" |
1464 | dependencies = [ | 1525 | dependencies = [ |
1465 | "aho-corasick", | 1526 | "aho-corasick", |
1466 | "memchr", | 1527 | "memchr", |
@@ -1512,6 +1573,40 @@ dependencies = [ | |||
1512 | ] | 1573 | ] |
1513 | 1574 | ||
1514 | [[package]] | 1575 | [[package]] |
1576 | name = "rust-embed" | ||
1577 | version = "8.3.0" | ||
1578 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
1579 | checksum = "fb78f46d0066053d16d4ca7b898e9343bc3530f71c61d5ad84cd404ada068745" | ||
1580 | dependencies = [ | ||
1581 | "rust-embed-impl", | ||
1582 | "rust-embed-utils", | ||
1583 | "walkdir", | ||
1584 | ] | ||
1585 | |||
1586 | [[package]] | ||
1587 | name = "rust-embed-impl" | ||
1588 | version = "8.3.0" | ||
1589 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
1590 | checksum = "b91ac2a3c6c0520a3fb3dd89321177c3c692937c4eb21893378219da10c44fc8" | ||
1591 | dependencies = [ | ||
1592 | "proc-macro2", | ||
1593 | "quote", | ||
1594 | "rust-embed-utils", | ||
1595 | "syn 2.0.52", | ||
1596 | "walkdir", | ||
1597 | ] | ||
1598 | |||
1599 | [[package]] | ||
1600 | name = "rust-embed-utils" | ||
1601 | version = "8.3.0" | ||
1602 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
1603 | checksum = "86f69089032567ffff4eada41c573fc43ff466c7db7c5688b2e7969584345581" | ||
1604 | dependencies = [ | ||
1605 | "sha2", | ||
1606 | "walkdir", | ||
1607 | ] | ||
1608 | |||
1609 | [[package]] | ||
1515 | name = "rust-ini" | 1610 | name = "rust-ini" |
1516 | version = "0.19.0" | 1611 | version = "0.19.0" |
1517 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1612 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -1553,6 +1648,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
1553 | checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" | 1648 | checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" |
1554 | 1649 | ||
1555 | [[package]] | 1650 | [[package]] |
1651 | name = "same-file" | ||
1652 | version = "1.0.6" | ||
1653 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
1654 | checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" | ||
1655 | dependencies = [ | ||
1656 | "winapi-util", | ||
1657 | ] | ||
1658 | |||
1659 | [[package]] | ||
1556 | name = "scopeguard" | 1660 | name = "scopeguard" |
1557 | version = "1.2.0" | 1661 | version = "1.2.0" |
1558 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1662 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -1575,7 +1679,7 @@ checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" | |||
1575 | dependencies = [ | 1679 | dependencies = [ |
1576 | "proc-macro2", | 1680 | "proc-macro2", |
1577 | "quote", | 1681 | "quote", |
1578 | "syn 2.0.51", | 1682 | "syn 2.0.52", |
1579 | ] | 1683 | ] |
1580 | 1684 | ||
1581 | [[package]] | 1685 | [[package]] |
@@ -1969,9 +2073,9 @@ dependencies = [ | |||
1969 | 2073 | ||
1970 | [[package]] | 2074 | [[package]] |
1971 | name = "syn" | 2075 | name = "syn" |
1972 | version = "2.0.51" | 2076 | version = "2.0.52" |
1973 | source = "registry+https://github.com/rust-lang/crates.io-index" | 2077 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1974 | checksum = "6ab617d94515e94ae53b8406c628598680aa0c9587474ecbe58188f7b345d66c" | 2078 | checksum = "b699d15b36d1f02c3e7c69f8ffef53de37aefae075d8488d4ba1a7788d574a07" |
1975 | dependencies = [ | 2079 | dependencies = [ |
1976 | "proc-macro2", | 2080 | "proc-macro2", |
1977 | "quote", | 2081 | "quote", |
@@ -2013,7 +2117,7 @@ checksum = "a953cb265bef375dae3de6663da4d3804eee9682ea80d8e2542529b73c531c81" | |||
2013 | dependencies = [ | 2117 | dependencies = [ |
2014 | "proc-macro2", | 2118 | "proc-macro2", |
2015 | "quote", | 2119 | "quote", |
2016 | "syn 2.0.51", | 2120 | "syn 2.0.52", |
2017 | ] | 2121 | ] |
2018 | 2122 | ||
2019 | [[package]] | 2123 | [[package]] |
@@ -2108,7 +2212,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" | |||
2108 | dependencies = [ | 2212 | dependencies = [ |
2109 | "proc-macro2", | 2213 | "proc-macro2", |
2110 | "quote", | 2214 | "quote", |
2111 | "syn 2.0.51", | 2215 | "syn 2.0.52", |
2112 | ] | 2216 | ] |
2113 | 2217 | ||
2114 | [[package]] | 2218 | [[package]] |
@@ -2242,7 +2346,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" | |||
2242 | dependencies = [ | 2346 | dependencies = [ |
2243 | "proc-macro2", | 2347 | "proc-macro2", |
2244 | "quote", | 2348 | "quote", |
2245 | "syn 2.0.51", | 2349 | "syn 2.0.52", |
2246 | ] | 2350 | ] |
2247 | 2351 | ||
2248 | [[package]] | 2352 | [[package]] |
@@ -2327,6 +2431,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
2327 | checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9" | 2431 | checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9" |
2328 | 2432 | ||
2329 | [[package]] | 2433 | [[package]] |
2434 | name = "unicase" | ||
2435 | version = "2.7.0" | ||
2436 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
2437 | checksum = "f7d2d4dafb69621809a81864c9c1b864479e1235c0dd4e199924b9742439ed89" | ||
2438 | dependencies = [ | ||
2439 | "version_check", | ||
2440 | ] | ||
2441 | |||
2442 | [[package]] | ||
2330 | name = "unicode-bidi" | 2443 | name = "unicode-bidi" |
2331 | version = "0.3.15" | 2444 | version = "0.3.15" |
2332 | source = "registry+https://github.com/rust-lang/crates.io-index" | 2445 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -2383,6 +2496,47 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
2383 | checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" | 2496 | checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" |
2384 | 2497 | ||
2385 | [[package]] | 2498 | [[package]] |
2499 | name = "utoipa" | ||
2500 | version = "4.2.0" | ||
2501 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
2502 | checksum = "272ebdfbc99111033031d2f10e018836056e4d2c8e2acda76450ec7974269fa7" | ||
2503 | dependencies = [ | ||
2504 | "indexmap", | ||
2505 | "serde", | ||
2506 | "serde_json", | ||
2507 | "utoipa-gen", | ||
2508 | ] | ||
2509 | |||
2510 | [[package]] | ||
2511 | name = "utoipa-gen" | ||
2512 | version = "4.2.0" | ||
2513 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
2514 | checksum = "d3c9f4d08338c1bfa70dde39412a040a884c6f318b3d09aaaf3437a1e52027fc" | ||
2515 | dependencies = [ | ||
2516 | "proc-macro-error", | ||
2517 | "proc-macro2", | ||
2518 | "quote", | ||
2519 | "regex", | ||
2520 | "syn 2.0.52", | ||
2521 | ] | ||
2522 | |||
2523 | [[package]] | ||
2524 | name = "utoipa-swagger-ui" | ||
2525 | version = "6.0.0" | ||
2526 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
2527 | checksum = "0b39868d43c011961e04b41623e050aedf2cc93652562ff7935ce0f819aaf2da" | ||
2528 | dependencies = [ | ||
2529 | "axum", | ||
2530 | "mime_guess", | ||
2531 | "regex", | ||
2532 | "rust-embed", | ||
2533 | "serde", | ||
2534 | "serde_json", | ||
2535 | "utoipa", | ||
2536 | "zip", | ||
2537 | ] | ||
2538 | |||
2539 | [[package]] | ||
2386 | name = "uuid" | 2540 | name = "uuid" |
2387 | version = "1.7.0" | 2541 | version = "1.7.0" |
2388 | source = "registry+https://github.com/rust-lang/crates.io-index" | 2542 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -2411,14 +2565,30 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
2411 | checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" | 2565 | checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" |
2412 | 2566 | ||
2413 | [[package]] | 2567 | [[package]] |
2568 | name = "walkdir" | ||
2569 | version = "2.5.0" | ||
2570 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
2571 | checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" | ||
2572 | dependencies = [ | ||
2573 | "same-file", | ||
2574 | "winapi-util", | ||
2575 | ] | ||
2576 | |||
2577 | [[package]] | ||
2414 | name = "wasi" | 2578 | name = "wasi" |
2415 | version = "0.11.0+wasi-snapshot-preview1" | 2579 | version = "0.11.0+wasi-snapshot-preview1" |
2416 | source = "registry+https://github.com/rust-lang/crates.io-index" | 2580 | source = "registry+https://github.com/rust-lang/crates.io-index" |
2417 | checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" | 2581 | checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" |
2418 | 2582 | ||
2419 | [[package]] | 2583 | [[package]] |
2584 | name = "wasite" | ||
2585 | version = "0.1.0" | ||
2586 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
2587 | checksum = "b8dad83b4f25e74f184f64c43b150b91efe7647395b42289f38e50566d82855b" | ||
2588 | |||
2589 | [[package]] | ||
2420 | name = "webol" | 2590 | name = "webol" |
2421 | version = "0.3.2" | 2591 | version = "0.3.3" |
2422 | dependencies = [ | 2592 | dependencies = [ |
2423 | "axum", | 2593 | "axum", |
2424 | "axum-macros", | 2594 | "axum-macros", |
@@ -2437,14 +2607,20 @@ dependencies = [ | |||
2437 | "tracing", | 2607 | "tracing", |
2438 | "tracing-appender", | 2608 | "tracing-appender", |
2439 | "tracing-subscriber", | 2609 | "tracing-subscriber", |
2610 | "utoipa", | ||
2611 | "utoipa-swagger-ui", | ||
2440 | "uuid", | 2612 | "uuid", |
2441 | ] | 2613 | ] |
2442 | 2614 | ||
2443 | [[package]] | 2615 | [[package]] |
2444 | name = "whoami" | 2616 | name = "whoami" |
2445 | version = "1.4.1" | 2617 | version = "1.5.0" |
2446 | source = "registry+https://github.com/rust-lang/crates.io-index" | 2618 | source = "registry+https://github.com/rust-lang/crates.io-index" |
2447 | checksum = "22fc3756b8a9133049b26c7f61ab35416c130e8c09b660f5b3958b446f52cc50" | 2619 | checksum = "0fec781d48b41f8163426ed18e8fc2864c12937df9ce54c88ede7bd47270893e" |
2620 | dependencies = [ | ||
2621 | "redox_syscall", | ||
2622 | "wasite", | ||
2623 | ] | ||
2448 | 2624 | ||
2449 | [[package]] | 2625 | [[package]] |
2450 | name = "winapi" | 2626 | name = "winapi" |
@@ -2463,6 +2639,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
2463 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" | 2639 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" |
2464 | 2640 | ||
2465 | [[package]] | 2641 | [[package]] |
2642 | name = "winapi-util" | ||
2643 | version = "0.1.6" | ||
2644 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
2645 | checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" | ||
2646 | dependencies = [ | ||
2647 | "winapi", | ||
2648 | ] | ||
2649 | |||
2650 | [[package]] | ||
2466 | name = "winapi-x86_64-pc-windows-gnu" | 2651 | name = "winapi-x86_64-pc-windows-gnu" |
2467 | version = "0.4.0" | 2652 | version = "0.4.0" |
2468 | source = "registry+https://github.com/rust-lang/crates.io-index" | 2653 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -2483,7 +2668,7 @@ version = "0.52.0" | |||
2483 | source = "registry+https://github.com/rust-lang/crates.io-index" | 2668 | source = "registry+https://github.com/rust-lang/crates.io-index" |
2484 | checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" | 2669 | checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" |
2485 | dependencies = [ | 2670 | dependencies = [ |
2486 | "windows-targets 0.52.3", | 2671 | "windows-targets 0.52.4", |
2487 | ] | 2672 | ] |
2488 | 2673 | ||
2489 | [[package]] | 2674 | [[package]] |
@@ -2503,17 +2688,17 @@ dependencies = [ | |||
2503 | 2688 | ||
2504 | [[package]] | 2689 | [[package]] |
2505 | name = "windows-targets" | 2690 | name = "windows-targets" |
2506 | version = "0.52.3" | 2691 | version = "0.52.4" |
2507 | source = "registry+https://github.com/rust-lang/crates.io-index" | 2692 | source = "registry+https://github.com/rust-lang/crates.io-index" |
2508 | checksum = "d380ba1dc7187569a8a9e91ed34b8ccfc33123bbacb8c0aed2d1ad7f3ef2dc5f" | 2693 | checksum = "7dd37b7e5ab9018759f893a1952c9420d060016fc19a472b4bb20d1bdd694d1b" |
2509 | dependencies = [ | 2694 | dependencies = [ |
2510 | "windows_aarch64_gnullvm 0.52.3", | 2695 | "windows_aarch64_gnullvm 0.52.4", |
2511 | "windows_aarch64_msvc 0.52.3", | 2696 | "windows_aarch64_msvc 0.52.4", |
2512 | "windows_i686_gnu 0.52.3", | 2697 | "windows_i686_gnu 0.52.4", |
2513 | "windows_i686_msvc 0.52.3", | 2698 | "windows_i686_msvc 0.52.4", |
2514 | "windows_x86_64_gnu 0.52.3", | 2699 | "windows_x86_64_gnu 0.52.4", |
2515 | "windows_x86_64_gnullvm 0.52.3", | 2700 | "windows_x86_64_gnullvm 0.52.4", |
2516 | "windows_x86_64_msvc 0.52.3", | 2701 | "windows_x86_64_msvc 0.52.4", |
2517 | ] | 2702 | ] |
2518 | 2703 | ||
2519 | [[package]] | 2704 | [[package]] |
@@ -2524,9 +2709,9 @@ checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" | |||
2524 | 2709 | ||
2525 | [[package]] | 2710 | [[package]] |
2526 | name = "windows_aarch64_gnullvm" | 2711 | name = "windows_aarch64_gnullvm" |
2527 | version = "0.52.3" | 2712 | version = "0.52.4" |
2528 | source = "registry+https://github.com/rust-lang/crates.io-index" | 2713 | source = "registry+https://github.com/rust-lang/crates.io-index" |
2529 | checksum = "68e5dcfb9413f53afd9c8f86e56a7b4d86d9a2fa26090ea2dc9e40fba56c6ec6" | 2714 | checksum = "bcf46cf4c365c6f2d1cc93ce535f2c8b244591df96ceee75d8e83deb70a9cac9" |
2530 | 2715 | ||
2531 | [[package]] | 2716 | [[package]] |
2532 | name = "windows_aarch64_msvc" | 2717 | name = "windows_aarch64_msvc" |
@@ -2536,9 +2721,9 @@ checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" | |||
2536 | 2721 | ||
2537 | [[package]] | 2722 | [[package]] |
2538 | name = "windows_aarch64_msvc" | 2723 | name = "windows_aarch64_msvc" |
2539 | version = "0.52.3" | 2724 | version = "0.52.4" |
2540 | source = "registry+https://github.com/rust-lang/crates.io-index" | 2725 | source = "registry+https://github.com/rust-lang/crates.io-index" |
2541 | checksum = "8dab469ebbc45798319e69eebf92308e541ce46760b49b18c6b3fe5e8965b30f" | 2726 | checksum = "da9f259dd3bcf6990b55bffd094c4f7235817ba4ceebde8e6d11cd0c5633b675" |
2542 | 2727 | ||
2543 | [[package]] | 2728 | [[package]] |
2544 | name = "windows_i686_gnu" | 2729 | name = "windows_i686_gnu" |
@@ -2548,9 +2733,9 @@ checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" | |||
2548 | 2733 | ||
2549 | [[package]] | 2734 | [[package]] |
2550 | name = "windows_i686_gnu" | 2735 | name = "windows_i686_gnu" |
2551 | version = "0.52.3" | 2736 | version = "0.52.4" |
2552 | source = "registry+https://github.com/rust-lang/crates.io-index" | 2737 | source = "registry+https://github.com/rust-lang/crates.io-index" |
2553 | checksum = "2a4e9b6a7cac734a8b4138a4e1044eac3404d8326b6c0f939276560687a033fb" | 2738 | checksum = "b474d8268f99e0995f25b9f095bc7434632601028cf86590aea5c8a5cb7801d3" |
2554 | 2739 | ||
2555 | [[package]] | 2740 | [[package]] |
2556 | name = "windows_i686_msvc" | 2741 | name = "windows_i686_msvc" |
@@ -2560,9 +2745,9 @@ checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" | |||
2560 | 2745 | ||
2561 | [[package]] | 2746 | [[package]] |
2562 | name = "windows_i686_msvc" | 2747 | name = "windows_i686_msvc" |
2563 | version = "0.52.3" | 2748 | version = "0.52.4" |
2564 | source = "registry+https://github.com/rust-lang/crates.io-index" | 2749 | source = "registry+https://github.com/rust-lang/crates.io-index" |
2565 | checksum = "28b0ec9c422ca95ff34a78755cfa6ad4a51371da2a5ace67500cf7ca5f232c58" | 2750 | checksum = "1515e9a29e5bed743cb4415a9ecf5dfca648ce85ee42e15873c3cd8610ff8e02" |
2566 | 2751 | ||
2567 | [[package]] | 2752 | [[package]] |
2568 | name = "windows_x86_64_gnu" | 2753 | name = "windows_x86_64_gnu" |
@@ -2572,9 +2757,9 @@ checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" | |||
2572 | 2757 | ||
2573 | [[package]] | 2758 | [[package]] |
2574 | name = "windows_x86_64_gnu" | 2759 | name = "windows_x86_64_gnu" |
2575 | version = "0.52.3" | 2760 | version = "0.52.4" |
2576 | source = "registry+https://github.com/rust-lang/crates.io-index" | 2761 | source = "registry+https://github.com/rust-lang/crates.io-index" |
2577 | checksum = "704131571ba93e89d7cd43482277d6632589b18ecf4468f591fbae0a8b101614" | 2762 | checksum = "5eee091590e89cc02ad514ffe3ead9eb6b660aedca2183455434b93546371a03" |
2578 | 2763 | ||
2579 | [[package]] | 2764 | [[package]] |
2580 | name = "windows_x86_64_gnullvm" | 2765 | name = "windows_x86_64_gnullvm" |
@@ -2584,9 +2769,9 @@ checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" | |||
2584 | 2769 | ||
2585 | [[package]] | 2770 | [[package]] |
2586 | name = "windows_x86_64_gnullvm" | 2771 | name = "windows_x86_64_gnullvm" |
2587 | version = "0.52.3" | 2772 | version = "0.52.4" |
2588 | source = "registry+https://github.com/rust-lang/crates.io-index" | 2773 | source = "registry+https://github.com/rust-lang/crates.io-index" |
2589 | checksum = "42079295511643151e98d61c38c0acc444e52dd42ab456f7ccfd5152e8ecf21c" | 2774 | checksum = "77ca79f2451b49fa9e2af39f0747fe999fcda4f5e241b2898624dca97a1f2177" |
2590 | 2775 | ||
2591 | [[package]] | 2776 | [[package]] |
2592 | name = "windows_x86_64_msvc" | 2777 | name = "windows_x86_64_msvc" |
@@ -2596,15 +2781,15 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" | |||
2596 | 2781 | ||
2597 | [[package]] | 2782 | [[package]] |
2598 | name = "windows_x86_64_msvc" | 2783 | name = "windows_x86_64_msvc" |
2599 | version = "0.52.3" | 2784 | version = "0.52.4" |
2600 | source = "registry+https://github.com/rust-lang/crates.io-index" | 2785 | source = "registry+https://github.com/rust-lang/crates.io-index" |
2601 | checksum = "0770833d60a970638e989b3fa9fd2bb1aaadcf88963d1659fd7d9990196ed2d6" | 2786 | checksum = "32b752e52a2da0ddfbdbcc6fceadfeede4c939ed16d13e648833a61dfb611ed8" |
2602 | 2787 | ||
2603 | [[package]] | 2788 | [[package]] |
2604 | name = "winnow" | 2789 | name = "winnow" |
2605 | version = "0.6.3" | 2790 | version = "0.6.5" |
2606 | source = "registry+https://github.com/rust-lang/crates.io-index" | 2791 | source = "registry+https://github.com/rust-lang/crates.io-index" |
2607 | checksum = "44e19b97e00a4d3db3cdb9b53c8c5f87151b5689b82cc86c2848cbdcccb2689b" | 2792 | checksum = "dffa400e67ed5a4dd237983829e66475f0a4a26938c4b04c21baede6262215b8" |
2608 | dependencies = [ | 2793 | dependencies = [ |
2609 | "memchr", | 2794 | "memchr", |
2610 | ] | 2795 | ] |
@@ -2635,7 +2820,7 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" | |||
2635 | dependencies = [ | 2820 | dependencies = [ |
2636 | "proc-macro2", | 2821 | "proc-macro2", |
2637 | "quote", | 2822 | "quote", |
2638 | "syn 2.0.51", | 2823 | "syn 2.0.52", |
2639 | ] | 2824 | ] |
2640 | 2825 | ||
2641 | [[package]] | 2826 | [[package]] |
@@ -2643,3 +2828,15 @@ name = "zeroize" | |||
2643 | version = "1.7.0" | 2828 | version = "1.7.0" |
2644 | source = "registry+https://github.com/rust-lang/crates.io-index" | 2829 | source = "registry+https://github.com/rust-lang/crates.io-index" |
2645 | checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" | 2830 | checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" |
2831 | |||
2832 | [[package]] | ||
2833 | name = "zip" | ||
2834 | version = "0.6.6" | ||
2835 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
2836 | checksum = "760394e246e4c28189f19d488c058bf16f564016aefac5d32bb1f3b51d5e9261" | ||
2837 | dependencies = [ | ||
2838 | "byteorder", | ||
2839 | "crc32fast", | ||
2840 | "crossbeam-utils", | ||
2841 | "flate2", | ||
2842 | ] | ||
@@ -1,6 +1,6 @@ | |||
1 | [package] | 1 | [package] |
2 | name = "webol" | 2 | name = "webol" |
3 | version = "0.3.2" | 3 | version = "0.3.3" |
4 | edition = "2021" | 4 | edition = "2021" |
5 | 5 | ||
6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html |
@@ -21,6 +21,8 @@ uuid = { version = "1.6", features = ["v4", "fast-rng"] } | |||
21 | dashmap = "5.5" | 21 | dashmap = "5.5" |
22 | color-eyre = "0.6" | 22 | color-eyre = "0.6" |
23 | thiserror = "1.0" | 23 | thiserror = "1.0" |
24 | ipnetwork = "0.20.0" | 24 | ipnetwork = "0.20" |
25 | mac_address = { version = "1.1.5", features = ["serde"] } | 25 | mac_address = { version = "1.1", features = ["serde"] } |
26 | tracing-appender = "0.2.3" | 26 | tracing-appender = "0.2.3" |
27 | utoipa = { version = "4.2", features = ["axum_extras"] } | ||
28 | utoipa-swagger-ui = { version = "6.0", features = ["axum"] } | ||
@@ -1,6 +1,7 @@ | |||
1 | use serde::Serialize; | 1 | use serde::Serialize; |
2 | use sqlx::{PgPool, postgres::PgPoolOptions, types::{ipnetwork::IpNetwork, mac_address::MacAddress}}; | 2 | use sqlx::{PgPool, postgres::PgPoolOptions, types::{ipnetwork::IpNetwork, mac_address::MacAddress}}; |
3 | use tracing::{debug, info}; | 3 | use tracing::{debug, info}; |
4 | use utoipa::ToSchema; | ||
4 | 5 | ||
5 | #[derive(Serialize, Debug)] | 6 | #[derive(Serialize, Debug)] |
6 | pub struct Device { | 7 | pub struct Device { |
@@ -11,6 +12,16 @@ pub struct Device { | |||
11 | pub times: Option<Vec<i64>> | 12 | pub times: Option<Vec<i64>> |
12 | } | 13 | } |
13 | 14 | ||
15 | #[derive(ToSchema)] | ||
16 | #[schema(as = Device)] | ||
17 | pub struct DeviceSchema { | ||
18 | pub id: String, | ||
19 | pub mac: String, | ||
20 | pub broadcast_addr: String, | ||
21 | pub ip: String, | ||
22 | pub times: Option<Vec<i64>> | ||
23 | } | ||
24 | |||
14 | pub async fn init_db_pool(db_url: &str) -> PgPool { | 25 | pub async fn init_db_pool(db_url: &str) -> PgPool { |
15 | debug!("attempt to connect dbPool to '{}'", db_url); | 26 | debug!("attempt to connect dbPool to '{}'", db_url); |
16 | 27 | ||
diff --git a/src/error.rs b/src/error.rs index 513b51b..006fcdb 100644 --- a/src/error.rs +++ b/src/error.rs | |||
@@ -5,10 +5,11 @@ use axum::response::{IntoResponse, Response}; | |||
5 | use axum::Json; | 5 | use axum::Json; |
6 | use mac_address::MacParseError; | 6 | use mac_address::MacParseError; |
7 | use serde_json::json; | 7 | use serde_json::json; |
8 | use utoipa::ToSchema; | ||
8 | use std::io; | 9 | use std::io; |
9 | use tracing::error; | 10 | use tracing::error; |
10 | 11 | ||
11 | #[derive(Debug, thiserror::Error)] | 12 | #[derive(Debug, thiserror::Error, ToSchema)] |
12 | pub enum Error { | 13 | pub enum Error { |
13 | #[error("db: {source}")] | 14 | #[error("db: {source}")] |
14 | Db { | 15 | Db { |
diff --git a/src/main.rs b/src/main.rs index d17984f..8978e58 100644 --- a/src/main.rs +++ b/src/main.rs | |||
@@ -1,21 +1,29 @@ | |||
1 | use crate::config::Config; | 1 | use crate::{ |
2 | use crate::db::init_db_pool; | 2 | config::Config, |
3 | use crate::routes::device; | 3 | db::init_db_pool, |
4 | use crate::routes::start::start; | 4 | routes::{device, start, status}, |
5 | use crate::routes::status::status; | 5 | services::ping::{BroadcastCommand, StatusMap}, |
6 | use crate::services::ping::StatusMap; | 6 | }; |
7 | use axum::middleware::from_fn_with_state; | 7 | use axum::{ |
8 | use axum::routing::{get, put}; | 8 | middleware::from_fn_with_state, |
9 | use axum::{routing::post, Router}; | 9 | routing::{get, post}, |
10 | Router, | ||
11 | }; | ||
10 | use dashmap::DashMap; | 12 | use dashmap::DashMap; |
11 | use services::ping::BroadcastCommand; | ||
12 | use sqlx::PgPool; | 13 | use sqlx::PgPool; |
13 | use std::env; | 14 | use std::{env, sync::Arc}; |
14 | use std::sync::Arc; | ||
15 | use tokio::sync::broadcast::{channel, Sender}; | 15 | use tokio::sync::broadcast::{channel, Sender}; |
16 | use tracing::{info, level_filters::LevelFilter}; | 16 | use tracing::{info, level_filters::LevelFilter}; |
17 | use tracing_subscriber::fmt::time::UtcTime; | 17 | use tracing_subscriber::{ |
18 | use tracing_subscriber::{fmt, prelude::*, EnvFilter}; | 18 | fmt::{self, time::UtcTime}, |
19 | prelude::*, | ||
20 | EnvFilter, | ||
21 | }; | ||
22 | use utoipa::{ | ||
23 | openapi::security::{ApiKey, ApiKeyValue, SecurityScheme}, | ||
24 | Modify, OpenApi, | ||
25 | }; | ||
26 | use utoipa_swagger_ui::SwaggerUi; | ||
19 | 27 | ||
20 | mod config; | 28 | mod config; |
21 | mod db; | 29 | mod db; |
@@ -25,7 +33,47 @@ mod routes; | |||
25 | mod services; | 33 | mod services; |
26 | mod wol; | 34 | mod wol; |
27 | 35 | ||
36 | #[derive(OpenApi)] | ||
37 | #[openapi( | ||
38 | paths( | ||
39 | start::start, | ||
40 | device::get, | ||
41 | device::get_path, | ||
42 | device::post, | ||
43 | device::put, | ||
44 | ), | ||
45 | components( | ||
46 | schemas( | ||
47 | start::Payload, | ||
48 | start::Response, | ||
49 | device::PutDevicePayload, | ||
50 | device::GetDevicePayload, | ||
51 | device::PostDevicePayload, | ||
52 | db::DeviceSchema, | ||
53 | ) | ||
54 | ), | ||
55 | modifiers(&SecurityAddon), | ||
56 | tags( | ||
57 | (name = "Webol", description = "Webol API") | ||
58 | ) | ||
59 | )] | ||
60 | struct ApiDoc; | ||
61 | |||
62 | struct SecurityAddon; | ||
63 | |||
64 | impl Modify for SecurityAddon { | ||
65 | fn modify(&self, openapi: &mut utoipa::openapi::OpenApi) { | ||
66 | if let Some(components) = openapi.components.as_mut() { | ||
67 | components.add_security_scheme( | ||
68 | "api_key", | ||
69 | SecurityScheme::ApiKey(ApiKey::Header(ApiKeyValue::new("Authorization"))), | ||
70 | ); | ||
71 | } | ||
72 | } | ||
73 | } | ||
74 | |||
28 | #[tokio::main] | 75 | #[tokio::main] |
76 | #[allow(deprecated)] | ||
29 | async fn main() -> color_eyre::eyre::Result<()> { | 77 | async fn main() -> color_eyre::eyre::Result<()> { |
30 | color_eyre::install()?; | 78 | color_eyre::install()?; |
31 | 79 | ||
@@ -67,12 +115,15 @@ async fn main() -> color_eyre::eyre::Result<()> { | |||
67 | }; | 115 | }; |
68 | 116 | ||
69 | let app = Router::new() | 117 | let app = Router::new() |
70 | .route("/start", post(start)) | 118 | .route("/start", post(start::start)) |
71 | .route("/device", get(device::get)) | 119 | .route( |
72 | .route("/device", put(device::put)) | 120 | "/device", |
73 | .route("/device", post(device::post)) | 121 | post(device::post).get(device::get).put(device::put), |
74 | .route("/status", get(status)) | 122 | ) |
123 | .route("/device/:id", get(device::get_path)) | ||
124 | .route("/status", get(status::status)) | ||
75 | .route_layer(from_fn_with_state(shared_state.clone(), extractors::auth)) | 125 | .route_layer(from_fn_with_state(shared_state.clone(), extractors::auth)) |
126 | .merge(SwaggerUi::new("/swagger-ui").url("/api-docs/openapi.json", ApiDoc::openapi())) | ||
76 | .with_state(Arc::new(shared_state)); | 127 | .with_state(Arc::new(shared_state)); |
77 | 128 | ||
78 | let addr = config.serveraddr; | 129 | let addr = config.serveraddr; |
diff --git a/src/routes.rs b/src/routes.rs index d5ab0d6..a72f27b 100644 --- a/src/routes.rs +++ b/src/routes.rs | |||
@@ -1,3 +1,3 @@ | |||
1 | pub mod start; | 1 | pub mod start; |
2 | pub mod device; | 2 | pub mod device; |
3 | pub mod status; \ No newline at end of file | 3 | pub mod status; |
diff --git a/src/routes/device.rs b/src/routes/device.rs index d39d98e..d01d9f0 100644 --- a/src/routes/device.rs +++ b/src/routes/device.rs | |||
@@ -1,14 +1,25 @@ | |||
1 | use crate::db::Device; | 1 | use crate::db::Device; |
2 | use crate::error::Error; | 2 | use crate::error::Error; |
3 | use axum::extract::State; | 3 | use axum::extract::{Path, State}; |
4 | use axum::Json; | 4 | use axum::Json; |
5 | use mac_address::MacAddress; | 5 | use mac_address::MacAddress; |
6 | use serde::{Deserialize, Serialize}; | 6 | use serde::Deserialize; |
7 | use serde_json::{json, Value}; | 7 | use serde_json::{json, Value}; |
8 | use sqlx::types::ipnetwork::IpNetwork; | 8 | use sqlx::types::ipnetwork::IpNetwork; |
9 | use std::{sync::Arc, str::FromStr}; | 9 | use std::{str::FromStr, sync::Arc}; |
10 | use tracing::{debug, info}; | 10 | use tracing::{debug, info}; |
11 | use utoipa::ToSchema; | ||
11 | 12 | ||
13 | #[utoipa::path( | ||
14 | get, | ||
15 | path = "/device", | ||
16 | request_body = GetDevicePayload, | ||
17 | responses( | ||
18 | (status = 200, description = "Get `Device` information", body = [Device]) | ||
19 | ), | ||
20 | security(("api_key" = [])) | ||
21 | )] | ||
22 | #[deprecated] | ||
12 | pub async fn get( | 23 | pub async fn get( |
13 | State(state): State<Arc<crate::AppState>>, | 24 | State(state): State<Arc<crate::AppState>>, |
14 | Json(payload): Json<GetDevicePayload>, | 25 | Json(payload): Json<GetDevicePayload>, |
@@ -31,11 +42,53 @@ pub async fn get( | |||
31 | Ok(Json(json!(device))) | 42 | Ok(Json(json!(device))) |
32 | } | 43 | } |
33 | 44 | ||
34 | #[derive(Deserialize)] | 45 | #[utoipa::path( |
46 | get, | ||
47 | path = "/device/{id}", | ||
48 | responses( | ||
49 | (status = 200, description = "Get `Device` information", body = [Device]) | ||
50 | ), | ||
51 | params( | ||
52 | ("id" = String, Path, description = "Device id") | ||
53 | ), | ||
54 | security(("api_key" = [])) | ||
55 | )] | ||
56 | pub async fn get_path( | ||
57 | State(state): State<Arc<crate::AppState>>, | ||
58 | Path(path): Path<String>, | ||
59 | ) -> Result<Json<Value>, Error> { | ||
60 | info!("get device from path {}", path); | ||
61 | let device = sqlx::query_as!( | ||
62 | Device, | ||
63 | r#" | ||
64 | SELECT id, mac, broadcast_addr, ip, times | ||
65 | FROM devices | ||
66 | WHERE id = $1; | ||
67 | "#, | ||
68 | path | ||
69 | ) | ||
70 | .fetch_one(&state.db) | ||
71 | .await?; | ||
72 | |||
73 | debug!("got device {:?}", device); | ||
74 | |||
75 | Ok(Json(json!(device))) | ||
76 | } | ||
77 | |||
78 | #[derive(Deserialize, ToSchema)] | ||
35 | pub struct GetDevicePayload { | 79 | pub struct GetDevicePayload { |
36 | id: String, | 80 | id: String, |
37 | } | 81 | } |
38 | 82 | ||
83 | #[utoipa::path( | ||
84 | put, | ||
85 | path = "/device", | ||
86 | request_body = PutDevicePayload, | ||
87 | responses( | ||
88 | (status = 200, description = "List matching todos by query", body = [DeviceSchema]) | ||
89 | ), | ||
90 | security(("api_key" = [])) | ||
91 | )] | ||
39 | pub async fn put( | 92 | pub async fn put( |
40 | State(state): State<Arc<crate::AppState>>, | 93 | State(state): State<Arc<crate::AppState>>, |
41 | Json(payload): Json<PutDevicePayload>, | 94 | Json(payload): Json<PutDevicePayload>, |
@@ -44,26 +97,28 @@ pub async fn put( | |||
44 | "add device {} ({}, {}, {})", | 97 | "add device {} ({}, {}, {})", |
45 | payload.id, payload.mac, payload.broadcast_addr, payload.ip | 98 | payload.id, payload.mac, payload.broadcast_addr, payload.ip |
46 | ); | 99 | ); |
47 | 100 | ||
48 | let ip = IpNetwork::from_str(&payload.ip)?; | 101 | let ip = IpNetwork::from_str(&payload.ip)?; |
49 | let mac = MacAddress::from_str(&payload.mac)?; | 102 | let mac = MacAddress::from_str(&payload.mac)?; |
50 | sqlx::query!( | 103 | let device = sqlx::query_as!( |
104 | Device, | ||
51 | r#" | 105 | r#" |
52 | INSERT INTO devices (id, mac, broadcast_addr, ip) | 106 | INSERT INTO devices (id, mac, broadcast_addr, ip) |
53 | VALUES ($1, $2, $3, $4); | 107 | VALUES ($1, $2, $3, $4) |
108 | RETURNING id, mac, broadcast_addr, ip, times; | ||
54 | "#, | 109 | "#, |
55 | payload.id, | 110 | payload.id, |
56 | mac, | 111 | mac, |
57 | payload.broadcast_addr, | 112 | payload.broadcast_addr, |
58 | ip | 113 | ip |
59 | ) | 114 | ) |
60 | .execute(&state.db) | 115 | .fetch_one(&state.db) |
61 | .await?; | 116 | .await?; |
62 | 117 | ||
63 | Ok(Json(json!(PutDeviceResponse { success: true }))) | 118 | Ok(Json(json!(device))) |
64 | } | 119 | } |
65 | 120 | ||
66 | #[derive(Deserialize)] | 121 | #[derive(Deserialize, ToSchema)] |
67 | pub struct PutDevicePayload { | 122 | pub struct PutDevicePayload { |
68 | id: String, | 123 | id: String, |
69 | mac: String, | 124 | mac: String, |
@@ -71,11 +126,15 @@ pub struct PutDevicePayload { | |||
71 | ip: String, | 126 | ip: String, |
72 | } | 127 | } |
73 | 128 | ||
74 | #[derive(Serialize)] | 129 | #[utoipa::path( |
75 | pub struct PutDeviceResponse { | 130 | post, |
76 | success: bool, | 131 | path = "/device", |
77 | } | 132 | request_body = PostDevicePayload, |
78 | 133 | responses( | |
134 | (status = 200, description = "List matching todos by query", body = [DeviceSchema]) | ||
135 | ), | ||
136 | security(("api_key" = [])) | ||
137 | )] | ||
79 | pub async fn post( | 138 | pub async fn post( |
80 | State(state): State<Arc<crate::AppState>>, | 139 | State(state): State<Arc<crate::AppState>>, |
81 | Json(payload): Json<PostDevicePayload>, | 140 | Json(payload): Json<PostDevicePayload>, |
@@ -104,7 +163,7 @@ pub async fn post( | |||
104 | Ok(Json(json!(device))) | 163 | Ok(Json(json!(device))) |
105 | } | 164 | } |
106 | 165 | ||
107 | #[derive(Deserialize)] | 166 | #[derive(Deserialize, ToSchema)] |
108 | pub struct PostDevicePayload { | 167 | pub struct PostDevicePayload { |
109 | id: String, | 168 | id: String, |
110 | mac: String, | 169 | mac: String, |
diff --git a/src/routes/start.rs b/src/routes/start.rs index d4c0802..ef6e8f2 100644 --- a/src/routes/start.rs +++ b/src/routes/start.rs | |||
@@ -6,10 +6,20 @@ use axum::extract::State; | |||
6 | use axum::Json; | 6 | use axum::Json; |
7 | use serde::{Deserialize, Serialize}; | 7 | use serde::{Deserialize, Serialize}; |
8 | use serde_json::{json, Value}; | 8 | use serde_json::{json, Value}; |
9 | use utoipa::ToSchema; | ||
9 | use std::sync::Arc; | 10 | use std::sync::Arc; |
10 | use tracing::{debug, info}; | 11 | use tracing::{debug, info}; |
11 | use uuid::Uuid; | 12 | use uuid::Uuid; |
12 | 13 | ||
14 | #[utoipa::path( | ||
15 | post, | ||
16 | path = "/start", | ||
17 | request_body = Payload, | ||
18 | responses( | ||
19 | (status = 200, description = "List matching todos by query", body = [Response]) | ||
20 | ), | ||
21 | security(("api_key" = [])) | ||
22 | )] | ||
13 | pub async fn start( | 23 | pub async fn start( |
14 | State(state): State<Arc<crate::AppState>>, | 24 | State(state): State<Arc<crate::AppState>>, |
15 | Json(payload): Json<Payload>, | 25 | Json(payload): Json<Payload>, |
@@ -88,14 +98,14 @@ fn setup_ping(state: Arc<crate::AppState>, device: Device) -> String { | |||
88 | uuid_ret | 98 | uuid_ret |
89 | } | 99 | } |
90 | 100 | ||
91 | #[derive(Deserialize)] | 101 | #[derive(Deserialize, ToSchema)] |
92 | pub struct Payload { | 102 | pub struct Payload { |
93 | id: String, | 103 | id: String, |
94 | ping: Option<bool>, | 104 | ping: Option<bool>, |
95 | } | 105 | } |
96 | 106 | ||
97 | #[derive(Serialize)] | 107 | #[derive(Serialize, ToSchema)] |
98 | struct Response { | 108 | pub struct Response { |
99 | id: String, | 109 | id: String, |
100 | boot: bool, | 110 | boot: bool, |
101 | uuid: Option<String>, | 111 | uuid: Option<String>, |