diff options
author | FxQnLr <[email protected]> | 2024-04-09 22:07:10 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2024-04-09 22:07:10 +0200 |
commit | 907e5cb5bc48899b444f7fedd85af7b5974d9a2e (patch) | |
tree | 7206da6c47e6c9e2da0982344c8f76f1385e0ae2 | |
parent | 8dca7e83519b6c3531653cdedf60b2a14e1035b7 (diff) | |
parent | d91edaf85a1a179a915ac99e7c17b5647d8d9f7d (diff) | |
download | webol-907e5cb5bc48899b444f7fedd85af7b5974d9a2e.tar webol-907e5cb5bc48899b444f7fedd85af7b5974d9a2e.tar.gz webol-907e5cb5bc48899b444f7fedd85af7b5974d9a2e.zip |
Merge pull request #28 from FxQnLr/0.3.4
0.3.4
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | Cargo.lock | 329 | ||||
-rw-r--r-- | Cargo.toml | 6 | ||||
-rw-r--r-- | src/auth.rs | 37 | ||||
-rw-r--r-- | src/config.rs | 10 | ||||
-rw-r--r-- | src/extractors.rs | 24 | ||||
-rw-r--r-- | src/main.rs | 24 | ||||
-rw-r--r-- | src/routes/device.rs | 49 | ||||
-rw-r--r-- | src/routes/start.rs | 106 |
9 files changed, 318 insertions, 268 deletions
@@ -14,6 +14,7 @@ target/ | |||
14 | config.* | 14 | config.* |
15 | 15 | ||
16 | .idea | 16 | .idea |
17 | .lapce | ||
17 | 18 | ||
18 | logs/ | 19 | logs/ |
19 | *.log | 20 | *.log |
@@ -32,9 +32,9 @@ dependencies = [ | |||
32 | 32 | ||
33 | [[package]] | 33 | [[package]] |
34 | name = "aho-corasick" | 34 | name = "aho-corasick" |
35 | version = "1.1.2" | 35 | version = "1.1.3" |
36 | source = "registry+https://github.com/rust-lang/crates.io-index" | 36 | source = "registry+https://github.com/rust-lang/crates.io-index" |
37 | checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" | 37 | checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" |
38 | dependencies = [ | 38 | dependencies = [ |
39 | "memchr", | 39 | "memchr", |
40 | ] | 40 | ] |
@@ -47,13 +47,13 @@ checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" | |||
47 | 47 | ||
48 | [[package]] | 48 | [[package]] |
49 | name = "async-trait" | 49 | name = "async-trait" |
50 | version = "0.1.77" | 50 | version = "0.1.79" |
51 | source = "registry+https://github.com/rust-lang/crates.io-index" | 51 | source = "registry+https://github.com/rust-lang/crates.io-index" |
52 | checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" | 52 | checksum = "a507401cad91ec6a857ed5513a2073c82a9b9048762b885bb98655b306964681" |
53 | dependencies = [ | 53 | dependencies = [ |
54 | "proc-macro2", | 54 | "proc-macro2", |
55 | "quote", | 55 | "quote", |
56 | "syn 2.0.52", | 56 | "syn 2.0.58", |
57 | ] | 57 | ] |
58 | 58 | ||
59 | [[package]] | 59 | [[package]] |
@@ -66,26 +66,16 @@ dependencies = [ | |||
66 | ] | 66 | ] |
67 | 67 | ||
68 | [[package]] | 68 | [[package]] |
69 | name = "atomic-write-file" | ||
70 | version = "0.1.3" | ||
71 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
72 | checksum = "a8204db279bf648d64fe845bd8840f78b39c8132ed4d6a4194c3b10d4b4cfb0b" | ||
73 | dependencies = [ | ||
74 | "nix 0.28.0", | ||
75 | "rand", | ||
76 | ] | ||
77 | |||
78 | [[package]] | ||
79 | name = "autocfg" | 69 | name = "autocfg" |
80 | version = "1.1.0" | 70 | version = "1.2.0" |
81 | source = "registry+https://github.com/rust-lang/crates.io-index" | 71 | source = "registry+https://github.com/rust-lang/crates.io-index" |
82 | checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" | 72 | checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80" |
83 | 73 | ||
84 | [[package]] | 74 | [[package]] |
85 | name = "axum" | 75 | name = "axum" |
86 | version = "0.7.4" | 76 | version = "0.7.5" |
87 | source = "registry+https://github.com/rust-lang/crates.io-index" | 77 | source = "registry+https://github.com/rust-lang/crates.io-index" |
88 | checksum = "1236b4b292f6c4d6dc34604bb5120d85c3fe1d1aa596bd5cc52ca054d13e7b9e" | 78 | checksum = "3a6c9af12842a67734c9a2e355436e5d03b22383ed60cf13cd0c18fbfe3dcbcf" |
89 | dependencies = [ | 79 | dependencies = [ |
90 | "async-trait", | 80 | "async-trait", |
91 | "axum-core", | 81 | "axum-core", |
@@ -109,7 +99,7 @@ dependencies = [ | |||
109 | "serde_path_to_error", | 99 | "serde_path_to_error", |
110 | "serde_urlencoded", | 100 | "serde_urlencoded", |
111 | "sha1", | 101 | "sha1", |
112 | "sync_wrapper", | 102 | "sync_wrapper 1.0.1", |
113 | "tokio", | 103 | "tokio", |
114 | "tokio-tungstenite", | 104 | "tokio-tungstenite", |
115 | "tower", | 105 | "tower", |
@@ -133,7 +123,7 @@ dependencies = [ | |||
133 | "mime", | 123 | "mime", |
134 | "pin-project-lite", | 124 | "pin-project-lite", |
135 | "rustversion", | 125 | "rustversion", |
136 | "sync_wrapper", | 126 | "sync_wrapper 0.1.2", |
137 | "tower-layer", | 127 | "tower-layer", |
138 | "tower-service", | 128 | "tower-service", |
139 | "tracing", | 129 | "tracing", |
@@ -148,14 +138,14 @@ dependencies = [ | |||
148 | "heck", | 138 | "heck", |
149 | "proc-macro2", | 139 | "proc-macro2", |
150 | "quote", | 140 | "quote", |
151 | "syn 2.0.52", | 141 | "syn 2.0.58", |
152 | ] | 142 | ] |
153 | 143 | ||
154 | [[package]] | 144 | [[package]] |
155 | name = "backtrace" | 145 | name = "backtrace" |
156 | version = "0.3.69" | 146 | version = "0.3.71" |
157 | source = "registry+https://github.com/rust-lang/crates.io-index" | 147 | source = "registry+https://github.com/rust-lang/crates.io-index" |
158 | checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" | 148 | checksum = "26b05800d2e817c8b3b4b54abd461726265fa9789ae34330622f2db9ee696f9d" |
159 | dependencies = [ | 149 | dependencies = [ |
160 | "addr2line", | 150 | "addr2line", |
161 | "cc", | 151 | "cc", |
@@ -186,9 +176,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" | |||
186 | 176 | ||
187 | [[package]] | 177 | [[package]] |
188 | name = "bitflags" | 178 | name = "bitflags" |
189 | version = "2.4.2" | 179 | version = "2.5.0" |
190 | source = "registry+https://github.com/rust-lang/crates.io-index" | 180 | source = "registry+https://github.com/rust-lang/crates.io-index" |
191 | checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" | 181 | checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" |
192 | dependencies = [ | 182 | dependencies = [ |
193 | "serde", | 183 | "serde", |
194 | ] | 184 | ] |
@@ -210,15 +200,15 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" | |||
210 | 200 | ||
211 | [[package]] | 201 | [[package]] |
212 | name = "bytes" | 202 | name = "bytes" |
213 | version = "1.5.0" | 203 | version = "1.6.0" |
214 | source = "registry+https://github.com/rust-lang/crates.io-index" | 204 | source = "registry+https://github.com/rust-lang/crates.io-index" |
215 | checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" | 205 | checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" |
216 | 206 | ||
217 | [[package]] | 207 | [[package]] |
218 | name = "cc" | 208 | name = "cc" |
219 | version = "1.0.89" | 209 | version = "1.0.92" |
220 | source = "registry+https://github.com/rust-lang/crates.io-index" | 210 | source = "registry+https://github.com/rust-lang/crates.io-index" |
221 | checksum = "a0ba8f7aaa012f30d5b2861462f6708eccd49c3c39863fe083a308035f63d723" | 211 | checksum = "2678b2e3449475e95b0aa6f9b506a28e61b3dc8996592b983695e8ebb58a8b41" |
222 | 212 | ||
223 | [[package]] | 213 | [[package]] |
224 | name = "cfg-if" | 214 | name = "cfg-if" |
@@ -227,16 +217,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
227 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" | 217 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" |
228 | 218 | ||
229 | [[package]] | 219 | [[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]] | ||
236 | name = "color-eyre" | 220 | name = "color-eyre" |
237 | version = "0.6.2" | 221 | version = "0.6.3" |
238 | source = "registry+https://github.com/rust-lang/crates.io-index" | 222 | source = "registry+https://github.com/rust-lang/crates.io-index" |
239 | checksum = "5a667583cca8c4f8436db8de46ea8233c42a7d9ae424a82d338f2e4675229204" | 223 | checksum = "55146f5e46f237f7423d74111267d4597b59b0dad0ffaf7303bce9945d843ad5" |
240 | dependencies = [ | 224 | dependencies = [ |
241 | "backtrace", | 225 | "backtrace", |
242 | "color-spantrace", | 226 | "color-spantrace", |
@@ -325,9 +309,9 @@ dependencies = [ | |||
325 | 309 | ||
326 | [[package]] | 310 | [[package]] |
327 | name = "crc" | 311 | name = "crc" |
328 | version = "3.0.1" | 312 | version = "3.2.1" |
329 | source = "registry+https://github.com/rust-lang/crates.io-index" | 313 | source = "registry+https://github.com/rust-lang/crates.io-index" |
330 | checksum = "86ec7a15cbe22e59248fc7eadb1907dab5ba09372595da4d73dd805ed4417dfe" | 314 | checksum = "69e6e4d7b33a94f0991c26729976b10ebde1d34c3ee82408fb536164fa10d636" |
331 | dependencies = [ | 315 | dependencies = [ |
332 | "crc-catalog", | 316 | "crc-catalog", |
333 | ] | 317 | ] |
@@ -408,9 +392,9 @@ checksum = "7e962a19be5cfc3f3bf6dd8f61eb50107f356ad6270fbb3ed41476571db78be5" | |||
408 | 392 | ||
409 | [[package]] | 393 | [[package]] |
410 | name = "der" | 394 | name = "der" |
411 | version = "0.7.8" | 395 | version = "0.7.9" |
412 | source = "registry+https://github.com/rust-lang/crates.io-index" | 396 | source = "registry+https://github.com/rust-lang/crates.io-index" |
413 | checksum = "fffa369a668c8af7dbf8b5e56c9f744fbd399949ed171606040001947de40b1c" | 397 | checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" |
414 | dependencies = [ | 398 | dependencies = [ |
415 | "const-oid", | 399 | "const-oid", |
416 | "pem-rfc7468", | 400 | "pem-rfc7468", |
@@ -507,9 +491,9 @@ dependencies = [ | |||
507 | 491 | ||
508 | [[package]] | 492 | [[package]] |
509 | name = "fastrand" | 493 | name = "fastrand" |
510 | version = "2.0.1" | 494 | version = "2.0.2" |
511 | source = "registry+https://github.com/rust-lang/crates.io-index" | 495 | source = "registry+https://github.com/rust-lang/crates.io-index" |
512 | checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" | 496 | checksum = "658bd65b1cf4c852a3cc96f18a8ce7b5640f6b703f905c7d74532294c2a63984" |
513 | 497 | ||
514 | [[package]] | 498 | [[package]] |
515 | name = "finl_unicode" | 499 | name = "finl_unicode" |
@@ -637,9 +621,9 @@ dependencies = [ | |||
637 | 621 | ||
638 | [[package]] | 622 | [[package]] |
639 | name = "getrandom" | 623 | name = "getrandom" |
640 | version = "0.2.12" | 624 | version = "0.2.14" |
641 | source = "registry+https://github.com/rust-lang/crates.io-index" | 625 | source = "registry+https://github.com/rust-lang/crates.io-index" |
642 | checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" | 626 | checksum = "94b22e06ecb0110981051723910cbf0b5f5e09a2062dd7663334ee79a9d1286c" |
643 | dependencies = [ | 627 | dependencies = [ |
644 | "cfg-if", | 628 | "cfg-if", |
645 | "libc", | 629 | "libc", |
@@ -659,25 +643,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
659 | checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" | 643 | checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" |
660 | 644 | ||
661 | [[package]] | 645 | [[package]] |
662 | name = "h2" | ||
663 | version = "0.4.2" | ||
664 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
665 | checksum = "31d030e59af851932b72ceebadf4a2b5986dba4c3b99dd2493f8273a0f151943" | ||
666 | dependencies = [ | ||
667 | "bytes", | ||
668 | "fnv", | ||
669 | "futures-core", | ||
670 | "futures-sink", | ||
671 | "futures-util", | ||
672 | "http", | ||
673 | "indexmap", | ||
674 | "slab", | ||
675 | "tokio", | ||
676 | "tokio-util", | ||
677 | "tracing", | ||
678 | ] | ||
679 | |||
680 | [[package]] | ||
681 | name = "hashbrown" | 646 | name = "hashbrown" |
682 | version = "0.13.2" | 647 | version = "0.13.2" |
683 | source = "registry+https://github.com/rust-lang/crates.io-index" | 648 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -773,12 +738,12 @@ dependencies = [ | |||
773 | 738 | ||
774 | [[package]] | 739 | [[package]] |
775 | name = "http-body-util" | 740 | name = "http-body-util" |
776 | version = "0.1.0" | 741 | version = "0.1.1" |
777 | source = "registry+https://github.com/rust-lang/crates.io-index" | 742 | source = "registry+https://github.com/rust-lang/crates.io-index" |
778 | checksum = "41cb79eb393015dadd30fc252023adb0b2400a0caee0fa2a077e6e21a551e840" | 743 | checksum = "0475f8b2ac86659c21b64320d5d653f9efe42acd2a4e560073ec61a155a34f1d" |
779 | dependencies = [ | 744 | dependencies = [ |
780 | "bytes", | 745 | "bytes", |
781 | "futures-util", | 746 | "futures-core", |
782 | "http", | 747 | "http", |
783 | "http-body", | 748 | "http-body", |
784 | "pin-project-lite", | 749 | "pin-project-lite", |
@@ -805,7 +770,6 @@ dependencies = [ | |||
805 | "bytes", | 770 | "bytes", |
806 | "futures-channel", | 771 | "futures-channel", |
807 | "futures-util", | 772 | "futures-util", |
808 | "h2", | ||
809 | "http", | 773 | "http", |
810 | "http-body", | 774 | "http-body", |
811 | "httparse", | 775 | "httparse", |
@@ -850,9 +814,9 @@ checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683" | |||
850 | 814 | ||
851 | [[package]] | 815 | [[package]] |
852 | name = "indexmap" | 816 | name = "indexmap" |
853 | version = "2.2.5" | 817 | version = "2.2.6" |
854 | source = "registry+https://github.com/rust-lang/crates.io-index" | 818 | source = "registry+https://github.com/rust-lang/crates.io-index" |
855 | checksum = "7b0b929d511467233429c45a44ac1dcaa21ba0f5ba11e4879e6ed28ddb4f9df4" | 819 | checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" |
856 | dependencies = [ | 820 | dependencies = [ |
857 | "equivalent", | 821 | "equivalent", |
858 | "hashbrown 0.14.3", | 822 | "hashbrown 0.14.3", |
@@ -879,9 +843,9 @@ dependencies = [ | |||
879 | 843 | ||
880 | [[package]] | 844 | [[package]] |
881 | name = "itoa" | 845 | name = "itoa" |
882 | version = "1.0.10" | 846 | version = "1.0.11" |
883 | source = "registry+https://github.com/rust-lang/crates.io-index" | 847 | source = "registry+https://github.com/rust-lang/crates.io-index" |
884 | checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" | 848 | checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" |
885 | 849 | ||
886 | [[package]] | 850 | [[package]] |
887 | name = "json5" | 851 | name = "json5" |
@@ -960,7 +924,7 @@ version = "1.1.5" | |||
960 | source = "registry+https://github.com/rust-lang/crates.io-index" | 924 | source = "registry+https://github.com/rust-lang/crates.io-index" |
961 | checksum = "4863ee94f19ed315bf3bc00299338d857d4b5bc856af375cc97d237382ad3856" | 925 | checksum = "4863ee94f19ed315bf3bc00299338d857d4b5bc856af375cc97d237382ad3856" |
962 | dependencies = [ | 926 | dependencies = [ |
963 | "nix 0.23.2", | 927 | "nix", |
964 | "serde", | 928 | "serde", |
965 | "winapi", | 929 | "winapi", |
966 | ] | 930 | ] |
@@ -992,9 +956,9 @@ dependencies = [ | |||
992 | 956 | ||
993 | [[package]] | 957 | [[package]] |
994 | name = "memchr" | 958 | name = "memchr" |
995 | version = "2.7.1" | 959 | version = "2.7.2" |
996 | source = "registry+https://github.com/rust-lang/crates.io-index" | 960 | source = "registry+https://github.com/rust-lang/crates.io-index" |
997 | checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" | 961 | checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" |
998 | 962 | ||
999 | [[package]] | 963 | [[package]] |
1000 | name = "memoffset" | 964 | name = "memoffset" |
@@ -1061,18 +1025,6 @@ dependencies = [ | |||
1061 | ] | 1025 | ] |
1062 | 1026 | ||
1063 | [[package]] | 1027 | [[package]] |
1064 | name = "nix" | ||
1065 | version = "0.28.0" | ||
1066 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
1067 | checksum = "ab2156c4fce2f8df6c499cc1c763e4394b7482525bf2a9701c9d79d215f519e4" | ||
1068 | dependencies = [ | ||
1069 | "bitflags 2.4.2", | ||
1070 | "cfg-if", | ||
1071 | "cfg_aliases", | ||
1072 | "libc", | ||
1073 | ] | ||
1074 | |||
1075 | [[package]] | ||
1076 | name = "no-std-net" | 1028 | name = "no-std-net" |
1077 | version = "0.6.0" | 1029 | version = "0.6.0" |
1078 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1030 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -1259,9 +1211,9 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" | |||
1259 | 1211 | ||
1260 | [[package]] | 1212 | [[package]] |
1261 | name = "pest" | 1213 | name = "pest" |
1262 | version = "2.7.8" | 1214 | version = "2.7.9" |
1263 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1215 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1264 | checksum = "56f8023d0fb78c8e03784ea1c7f3fa36e68a723138990b8d5a47d916b651e7a8" | 1216 | checksum = "311fb059dee1a7b802f036316d790138c613a4e8b180c822e3925a662e9f0c95" |
1265 | dependencies = [ | 1217 | dependencies = [ |
1266 | "memchr", | 1218 | "memchr", |
1267 | "thiserror", | 1219 | "thiserror", |
@@ -1270,9 +1222,9 @@ dependencies = [ | |||
1270 | 1222 | ||
1271 | [[package]] | 1223 | [[package]] |
1272 | name = "pest_derive" | 1224 | name = "pest_derive" |
1273 | version = "2.7.8" | 1225 | version = "2.7.9" |
1274 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1226 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1275 | checksum = "b0d24f72393fd16ab6ac5738bc33cdb6a9aa73f8b902e8fe29cf4e67d7dd1026" | 1227 | checksum = "f73541b156d32197eecda1a4014d7f868fd2bcb3c550d5386087cfba442bf69c" |
1276 | dependencies = [ | 1228 | dependencies = [ |
1277 | "pest", | 1229 | "pest", |
1278 | "pest_generator", | 1230 | "pest_generator", |
@@ -1280,22 +1232,22 @@ dependencies = [ | |||
1280 | 1232 | ||
1281 | [[package]] | 1233 | [[package]] |
1282 | name = "pest_generator" | 1234 | name = "pest_generator" |
1283 | version = "2.7.8" | 1235 | version = "2.7.9" |
1284 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1236 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1285 | checksum = "fdc17e2a6c7d0a492f0158d7a4bd66cc17280308bbaff78d5bef566dca35ab80" | 1237 | checksum = "c35eeed0a3fab112f75165fdc026b3913f4183133f19b49be773ac9ea966e8bd" |
1286 | dependencies = [ | 1238 | dependencies = [ |
1287 | "pest", | 1239 | "pest", |
1288 | "pest_meta", | 1240 | "pest_meta", |
1289 | "proc-macro2", | 1241 | "proc-macro2", |
1290 | "quote", | 1242 | "quote", |
1291 | "syn 2.0.52", | 1243 | "syn 2.0.58", |
1292 | ] | 1244 | ] |
1293 | 1245 | ||
1294 | [[package]] | 1246 | [[package]] |
1295 | name = "pest_meta" | 1247 | name = "pest_meta" |
1296 | version = "2.7.8" | 1248 | version = "2.7.9" |
1297 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1249 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1298 | checksum = "934cd7631c050f4674352a6e835d5f6711ffbfb9345c2fc0107155ac495ae293" | 1250 | checksum = "2adbf29bb9776f28caece835398781ab24435585fe0d4dc1374a61db5accedca" |
1299 | dependencies = [ | 1251 | dependencies = [ |
1300 | "once_cell", | 1252 | "once_cell", |
1301 | "pest", | 1253 | "pest", |
@@ -1304,29 +1256,29 @@ dependencies = [ | |||
1304 | 1256 | ||
1305 | [[package]] | 1257 | [[package]] |
1306 | name = "pin-project" | 1258 | name = "pin-project" |
1307 | version = "1.1.4" | 1259 | version = "1.1.5" |
1308 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1260 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1309 | checksum = "0302c4a0442c456bd56f841aee5c3bfd17967563f6fadc9ceb9f9c23cf3807e0" | 1261 | checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" |
1310 | dependencies = [ | 1262 | dependencies = [ |
1311 | "pin-project-internal", | 1263 | "pin-project-internal", |
1312 | ] | 1264 | ] |
1313 | 1265 | ||
1314 | [[package]] | 1266 | [[package]] |
1315 | name = "pin-project-internal" | 1267 | name = "pin-project-internal" |
1316 | version = "1.1.4" | 1268 | version = "1.1.5" |
1317 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1269 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1318 | checksum = "266c042b60c9c76b8d53061e52b2e0d1116abc57cefc8c5cd671619a56ac3690" | 1270 | checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" |
1319 | dependencies = [ | 1271 | dependencies = [ |
1320 | "proc-macro2", | 1272 | "proc-macro2", |
1321 | "quote", | 1273 | "quote", |
1322 | "syn 2.0.52", | 1274 | "syn 2.0.58", |
1323 | ] | 1275 | ] |
1324 | 1276 | ||
1325 | [[package]] | 1277 | [[package]] |
1326 | name = "pin-project-lite" | 1278 | name = "pin-project-lite" |
1327 | version = "0.2.13" | 1279 | version = "0.2.14" |
1328 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1280 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1329 | checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" | 1281 | checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" |
1330 | 1282 | ||
1331 | [[package]] | 1283 | [[package]] |
1332 | name = "pin-utils" | 1284 | name = "pin-utils" |
@@ -1363,39 +1315,39 @@ checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" | |||
1363 | 1315 | ||
1364 | [[package]] | 1316 | [[package]] |
1365 | name = "pnet_base" | 1317 | name = "pnet_base" |
1366 | version = "0.33.0" | 1318 | version = "0.34.0" |
1367 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1319 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1368 | checksum = "872e46346144ebf35219ccaa64b1dffacd9c6f188cd7d012bd6977a2a838f42e" | 1320 | checksum = "fe4cf6fb3ab38b68d01ab2aea03ed3d1132b4868fa4e06285f29f16da01c5f4c" |
1369 | dependencies = [ | 1321 | dependencies = [ |
1370 | "no-std-net", | 1322 | "no-std-net", |
1371 | ] | 1323 | ] |
1372 | 1324 | ||
1373 | [[package]] | 1325 | [[package]] |
1374 | name = "pnet_macros" | 1326 | name = "pnet_macros" |
1375 | version = "0.33.0" | 1327 | version = "0.34.0" |
1376 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1328 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1377 | checksum = "2a780e80005c2e463ec25a6e9f928630049a10b43945fea83207207d4a7606f4" | 1329 | checksum = "688b17499eee04a0408aca0aa5cba5fc86401d7216de8a63fdf7a4c227871804" |
1378 | dependencies = [ | 1330 | dependencies = [ |
1379 | "proc-macro2", | 1331 | "proc-macro2", |
1380 | "quote", | 1332 | "quote", |
1381 | "regex", | 1333 | "regex", |
1382 | "syn 1.0.109", | 1334 | "syn 2.0.58", |
1383 | ] | 1335 | ] |
1384 | 1336 | ||
1385 | [[package]] | 1337 | [[package]] |
1386 | name = "pnet_macros_support" | 1338 | name = "pnet_macros_support" |
1387 | version = "0.33.0" | 1339 | version = "0.34.0" |
1388 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1340 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1389 | checksum = "e6d932134f32efd7834eb8b16d42418dac87086347d1bc7d142370ef078582bc" | 1341 | checksum = "eea925b72f4bd37f8eab0f221bbe4c78b63498350c983ffa9dd4bcde7e030f56" |
1390 | dependencies = [ | 1342 | dependencies = [ |
1391 | "pnet_base", | 1343 | "pnet_base", |
1392 | ] | 1344 | ] |
1393 | 1345 | ||
1394 | [[package]] | 1346 | [[package]] |
1395 | name = "pnet_packet" | 1347 | name = "pnet_packet" |
1396 | version = "0.33.0" | 1348 | version = "0.34.0" |
1397 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1349 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1398 | checksum = "8bde678bbd85cb1c2d99dc9fc596e57f03aa725f84f3168b0eaf33eeccb41706" | 1350 | checksum = "a9a005825396b7fe7a38a8e288dbc342d5034dac80c15212436424fef8ea90ba" |
1399 | dependencies = [ | 1351 | dependencies = [ |
1400 | "glob", | 1352 | "glob", |
1401 | "pnet_base", | 1353 | "pnet_base", |
@@ -1441,9 +1393,9 @@ dependencies = [ | |||
1441 | 1393 | ||
1442 | [[package]] | 1394 | [[package]] |
1443 | name = "proc-macro2" | 1395 | name = "proc-macro2" |
1444 | version = "1.0.78" | 1396 | version = "1.0.79" |
1445 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1397 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1446 | checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" | 1398 | checksum = "e835ff2298f5721608eb1a980ecaee1aef2c132bf95ecc026a11b7bf3c01c02e" |
1447 | dependencies = [ | 1399 | dependencies = [ |
1448 | "unicode-ident", | 1400 | "unicode-ident", |
1449 | ] | 1401 | ] |
@@ -1498,14 +1450,14 @@ dependencies = [ | |||
1498 | 1450 | ||
1499 | [[package]] | 1451 | [[package]] |
1500 | name = "regex" | 1452 | name = "regex" |
1501 | version = "1.10.3" | 1453 | version = "1.10.4" |
1502 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1454 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1503 | checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" | 1455 | checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c" |
1504 | dependencies = [ | 1456 | dependencies = [ |
1505 | "aho-corasick", | 1457 | "aho-corasick", |
1506 | "memchr", | 1458 | "memchr", |
1507 | "regex-automata 0.4.6", | 1459 | "regex-automata 0.4.6", |
1508 | "regex-syntax 0.8.2", | 1460 | "regex-syntax 0.8.3", |
1509 | ] | 1461 | ] |
1510 | 1462 | ||
1511 | [[package]] | 1463 | [[package]] |
@@ -1525,7 +1477,7 @@ checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" | |||
1525 | dependencies = [ | 1477 | dependencies = [ |
1526 | "aho-corasick", | 1478 | "aho-corasick", |
1527 | "memchr", | 1479 | "memchr", |
1528 | "regex-syntax 0.8.2", | 1480 | "regex-syntax 0.8.3", |
1529 | ] | 1481 | ] |
1530 | 1482 | ||
1531 | [[package]] | 1483 | [[package]] |
@@ -1536,9 +1488,9 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" | |||
1536 | 1488 | ||
1537 | [[package]] | 1489 | [[package]] |
1538 | name = "regex-syntax" | 1490 | name = "regex-syntax" |
1539 | version = "0.8.2" | 1491 | version = "0.8.3" |
1540 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1492 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1541 | checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" | 1493 | checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" |
1542 | 1494 | ||
1543 | [[package]] | 1495 | [[package]] |
1544 | name = "ron" | 1496 | name = "ron" |
@@ -1547,7 +1499,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
1547 | checksum = "b91f7eff05f748767f183df4320a63d6936e9c6107d97c9e6bdd9784f4289c94" | 1499 | checksum = "b91f7eff05f748767f183df4320a63d6936e9c6107d97c9e6bdd9784f4289c94" |
1548 | dependencies = [ | 1500 | dependencies = [ |
1549 | "base64", | 1501 | "base64", |
1550 | "bitflags 2.4.2", | 1502 | "bitflags 2.5.0", |
1551 | "serde", | 1503 | "serde", |
1552 | "serde_derive", | 1504 | "serde_derive", |
1553 | ] | 1505 | ] |
@@ -1592,7 +1544,7 @@ dependencies = [ | |||
1592 | "proc-macro2", | 1544 | "proc-macro2", |
1593 | "quote", | 1545 | "quote", |
1594 | "rust-embed-utils", | 1546 | "rust-embed-utils", |
1595 | "syn 2.0.52", | 1547 | "syn 2.0.58", |
1596 | "walkdir", | 1548 | "walkdir", |
1597 | ] | 1549 | ] |
1598 | 1550 | ||
@@ -1624,11 +1576,11 @@ checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" | |||
1624 | 1576 | ||
1625 | [[package]] | 1577 | [[package]] |
1626 | name = "rustix" | 1578 | name = "rustix" |
1627 | version = "0.38.31" | 1579 | version = "0.38.32" |
1628 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1580 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1629 | checksum = "6ea3e1a662af26cd7a3ba09c0297a31af215563ecf42817c98df621387f4e949" | 1581 | checksum = "65e04861e65f21776e67888bfbea442b3642beaa0138fdb1dd7a84a52dffdb89" |
1630 | dependencies = [ | 1582 | dependencies = [ |
1631 | "bitflags 2.4.2", | 1583 | "bitflags 2.5.0", |
1632 | "errno", | 1584 | "errno", |
1633 | "libc", | 1585 | "libc", |
1634 | "linux-raw-sys", | 1586 | "linux-raw-sys", |
@@ -1637,9 +1589,9 @@ dependencies = [ | |||
1637 | 1589 | ||
1638 | [[package]] | 1590 | [[package]] |
1639 | name = "rustversion" | 1591 | name = "rustversion" |
1640 | version = "1.0.14" | 1592 | version = "1.0.15" |
1641 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1593 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1642 | checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" | 1594 | checksum = "80af6f9131f277a45a3fba6ce8e2258037bb0477a67e610d3c1fe046ab31de47" |
1643 | 1595 | ||
1644 | [[package]] | 1596 | [[package]] |
1645 | name = "ryu" | 1597 | name = "ryu" |
@@ -1679,14 +1631,14 @@ checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" | |||
1679 | dependencies = [ | 1631 | dependencies = [ |
1680 | "proc-macro2", | 1632 | "proc-macro2", |
1681 | "quote", | 1633 | "quote", |
1682 | "syn 2.0.52", | 1634 | "syn 2.0.58", |
1683 | ] | 1635 | ] |
1684 | 1636 | ||
1685 | [[package]] | 1637 | [[package]] |
1686 | name = "serde_json" | 1638 | name = "serde_json" |
1687 | version = "1.0.114" | 1639 | version = "1.0.115" |
1688 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1640 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1689 | checksum = "c5f09b1bd632ef549eaa9f60a1f8de742bdbc698e6cee2095fc84dde5f549ae0" | 1641 | checksum = "12dc5c46daa8e9fdf4f5e71b6cf9a53f2487da0e86e55808e2d35539666497dd" |
1690 | dependencies = [ | 1642 | dependencies = [ |
1691 | "itoa", | 1643 | "itoa", |
1692 | "ryu", | 1644 | "ryu", |
@@ -1695,9 +1647,9 @@ dependencies = [ | |||
1695 | 1647 | ||
1696 | [[package]] | 1648 | [[package]] |
1697 | name = "serde_path_to_error" | 1649 | name = "serde_path_to_error" |
1698 | version = "0.1.15" | 1650 | version = "0.1.16" |
1699 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1651 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1700 | checksum = "ebd154a240de39fdebcf5775d2675c204d7c13cf39a4c697be6493c8e734337c" | 1652 | checksum = "af99884400da37c88f5e9146b7f1fd0fbcae8f6eec4e9da38b67d05486f814a6" |
1701 | dependencies = [ | 1653 | dependencies = [ |
1702 | "itoa", | 1654 | "itoa", |
1703 | "serde", | 1655 | "serde", |
@@ -1776,9 +1728,9 @@ dependencies = [ | |||
1776 | 1728 | ||
1777 | [[package]] | 1729 | [[package]] |
1778 | name = "smallvec" | 1730 | name = "smallvec" |
1779 | version = "1.13.1" | 1731 | version = "1.13.2" |
1780 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1732 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1781 | checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" | 1733 | checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" |
1782 | 1734 | ||
1783 | [[package]] | 1735 | [[package]] |
1784 | name = "socket2" | 1736 | name = "socket2" |
@@ -1828,9 +1780,9 @@ dependencies = [ | |||
1828 | 1780 | ||
1829 | [[package]] | 1781 | [[package]] |
1830 | name = "sqlx" | 1782 | name = "sqlx" |
1831 | version = "0.7.3" | 1783 | version = "0.7.4" |
1832 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1784 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1833 | checksum = "dba03c279da73694ef99763320dea58b51095dfe87d001b1d4b5fe78ba8763cf" | 1785 | checksum = "c9a2ccff1a000a5a59cd33da541d9f2fdcd9e6e8229cc200565942bff36d0aaa" |
1834 | dependencies = [ | 1786 | dependencies = [ |
1835 | "sqlx-core", | 1787 | "sqlx-core", |
1836 | "sqlx-macros", | 1788 | "sqlx-macros", |
@@ -1841,9 +1793,9 @@ dependencies = [ | |||
1841 | 1793 | ||
1842 | [[package]] | 1794 | [[package]] |
1843 | name = "sqlx-core" | 1795 | name = "sqlx-core" |
1844 | version = "0.7.3" | 1796 | version = "0.7.4" |
1845 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1797 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1846 | checksum = "d84b0a3c3739e220d94b3239fd69fb1f74bc36e16643423bd99de3b43c21bfbd" | 1798 | checksum = "24ba59a9342a3d9bab6c56c118be528b27c9b60e490080e9711a04dccac83ef6" |
1847 | dependencies = [ | 1799 | dependencies = [ |
1848 | "ahash", | 1800 | "ahash", |
1849 | "atoi", | 1801 | "atoi", |
@@ -1851,7 +1803,6 @@ dependencies = [ | |||
1851 | "bytes", | 1803 | "bytes", |
1852 | "crc", | 1804 | "crc", |
1853 | "crossbeam-queue", | 1805 | "crossbeam-queue", |
1854 | "dotenvy", | ||
1855 | "either", | 1806 | "either", |
1856 | "event-listener", | 1807 | "event-listener", |
1857 | "futures-channel", | 1808 | "futures-channel", |
@@ -1883,9 +1834,9 @@ dependencies = [ | |||
1883 | 1834 | ||
1884 | [[package]] | 1835 | [[package]] |
1885 | name = "sqlx-macros" | 1836 | name = "sqlx-macros" |
1886 | version = "0.7.3" | 1837 | version = "0.7.4" |
1887 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1838 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1888 | checksum = "89961c00dc4d7dffb7aee214964b065072bff69e36ddb9e2c107541f75e4f2a5" | 1839 | checksum = "4ea40e2345eb2faa9e1e5e326db8c34711317d2b5e08d0d5741619048a803127" |
1889 | dependencies = [ | 1840 | dependencies = [ |
1890 | "proc-macro2", | 1841 | "proc-macro2", |
1891 | "quote", | 1842 | "quote", |
@@ -1896,11 +1847,10 @@ dependencies = [ | |||
1896 | 1847 | ||
1897 | [[package]] | 1848 | [[package]] |
1898 | name = "sqlx-macros-core" | 1849 | name = "sqlx-macros-core" |
1899 | version = "0.7.3" | 1850 | version = "0.7.4" |
1900 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1851 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1901 | checksum = "d0bd4519486723648186a08785143599760f7cc81c52334a55d6a83ea1e20841" | 1852 | checksum = "5833ef53aaa16d860e92123292f1f6a3d53c34ba8b1969f152ef1a7bb803f3c8" |
1902 | dependencies = [ | 1853 | dependencies = [ |
1903 | "atomic-write-file", | ||
1904 | "dotenvy", | 1854 | "dotenvy", |
1905 | "either", | 1855 | "either", |
1906 | "heck", | 1856 | "heck", |
@@ -1923,13 +1873,13 @@ dependencies = [ | |||
1923 | 1873 | ||
1924 | [[package]] | 1874 | [[package]] |
1925 | name = "sqlx-mysql" | 1875 | name = "sqlx-mysql" |
1926 | version = "0.7.3" | 1876 | version = "0.7.4" |
1927 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1877 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1928 | checksum = "e37195395df71fd068f6e2082247891bc11e3289624bbc776a0cdfa1ca7f1ea4" | 1878 | checksum = "1ed31390216d20e538e447a7a9b959e06ed9fc51c37b514b46eb758016ecd418" |
1929 | dependencies = [ | 1879 | dependencies = [ |
1930 | "atoi", | 1880 | "atoi", |
1931 | "base64", | 1881 | "base64", |
1932 | "bitflags 2.4.2", | 1882 | "bitflags 2.5.0", |
1933 | "byteorder", | 1883 | "byteorder", |
1934 | "bytes", | 1884 | "bytes", |
1935 | "crc", | 1885 | "crc", |
@@ -1965,13 +1915,13 @@ dependencies = [ | |||
1965 | 1915 | ||
1966 | [[package]] | 1916 | [[package]] |
1967 | name = "sqlx-postgres" | 1917 | name = "sqlx-postgres" |
1968 | version = "0.7.3" | 1918 | version = "0.7.4" |
1969 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1919 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1970 | checksum = "d6ac0ac3b7ccd10cc96c7ab29791a7dd236bd94021f31eec7ba3d46a74aa1c24" | 1920 | checksum = "7c824eb80b894f926f89a0b9da0c7f435d27cdd35b8c655b114e58223918577e" |
1971 | dependencies = [ | 1921 | dependencies = [ |
1972 | "atoi", | 1922 | "atoi", |
1973 | "base64", | 1923 | "base64", |
1974 | "bitflags 2.4.2", | 1924 | "bitflags 2.5.0", |
1975 | "byteorder", | 1925 | "byteorder", |
1976 | "crc", | 1926 | "crc", |
1977 | "dotenvy", | 1927 | "dotenvy", |
@@ -1994,7 +1944,6 @@ dependencies = [ | |||
1994 | "rand", | 1944 | "rand", |
1995 | "serde", | 1945 | "serde", |
1996 | "serde_json", | 1946 | "serde_json", |
1997 | "sha1", | ||
1998 | "sha2", | 1947 | "sha2", |
1999 | "smallvec", | 1948 | "smallvec", |
2000 | "sqlx-core", | 1949 | "sqlx-core", |
@@ -2006,9 +1955,9 @@ dependencies = [ | |||
2006 | 1955 | ||
2007 | [[package]] | 1956 | [[package]] |
2008 | name = "sqlx-sqlite" | 1957 | name = "sqlx-sqlite" |
2009 | version = "0.7.3" | 1958 | version = "0.7.4" |
2010 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1959 | source = "registry+https://github.com/rust-lang/crates.io-index" |
2011 | checksum = "210976b7d948c7ba9fced8ca835b11cbb2d677c59c79de41ac0d397e14547490" | 1960 | checksum = "b244ef0a8414da0bed4bb1910426e890b19e5e9bccc27ada6b797d05c55ae0aa" |
2012 | dependencies = [ | 1961 | dependencies = [ |
2013 | "atoi", | 1962 | "atoi", |
2014 | "flume", | 1963 | "flume", |
@@ -2046,9 +1995,9 @@ checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" | |||
2046 | 1995 | ||
2047 | [[package]] | 1996 | [[package]] |
2048 | name = "surge-ping" | 1997 | name = "surge-ping" |
2049 | version = "0.8.0" | 1998 | version = "0.8.1" |
2050 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1999 | source = "registry+https://github.com/rust-lang/crates.io-index" |
2051 | checksum = "af341b2be485d647b5dc4cfb2da99efac35b5c95748a08fb7233480fedc5ead3" | 2000 | checksum = "efbf95ce4c7c5b311d2ce3f088af2b93edef0f09727fa50fbe03c7a979afce77" |
2052 | dependencies = [ | 2001 | dependencies = [ |
2053 | "hex", | 2002 | "hex", |
2054 | "parking_lot", | 2003 | "parking_lot", |
@@ -2073,9 +2022,9 @@ dependencies = [ | |||
2073 | 2022 | ||
2074 | [[package]] | 2023 | [[package]] |
2075 | name = "syn" | 2024 | name = "syn" |
2076 | version = "2.0.52" | 2025 | version = "2.0.58" |
2077 | source = "registry+https://github.com/rust-lang/crates.io-index" | 2026 | source = "registry+https://github.com/rust-lang/crates.io-index" |
2078 | checksum = "b699d15b36d1f02c3e7c69f8ffef53de37aefae075d8488d4ba1a7788d574a07" | 2027 | checksum = "44cfb93f38070beee36b3fef7d4f5a16f27751d94b187b666a5cc5e9b0d30687" |
2079 | dependencies = [ | 2028 | dependencies = [ |
2080 | "proc-macro2", | 2029 | "proc-macro2", |
2081 | "quote", | 2030 | "quote", |
@@ -2089,6 +2038,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
2089 | checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" | 2038 | checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" |
2090 | 2039 | ||
2091 | [[package]] | 2040 | [[package]] |
2041 | name = "sync_wrapper" | ||
2042 | version = "1.0.1" | ||
2043 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
2044 | checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" | ||
2045 | |||
2046 | [[package]] | ||
2092 | name = "tempfile" | 2047 | name = "tempfile" |
2093 | version = "3.10.1" | 2048 | version = "3.10.1" |
2094 | source = "registry+https://github.com/rust-lang/crates.io-index" | 2049 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -2102,22 +2057,22 @@ dependencies = [ | |||
2102 | 2057 | ||
2103 | [[package]] | 2058 | [[package]] |
2104 | name = "thiserror" | 2059 | name = "thiserror" |
2105 | version = "1.0.57" | 2060 | version = "1.0.58" |
2106 | source = "registry+https://github.com/rust-lang/crates.io-index" | 2061 | source = "registry+https://github.com/rust-lang/crates.io-index" |
2107 | checksum = "1e45bcbe8ed29775f228095caf2cd67af7a4ccf756ebff23a306bf3e8b47b24b" | 2062 | checksum = "03468839009160513471e86a034bb2c5c0e4baae3b43f79ffc55c4a5427b3297" |
2108 | dependencies = [ | 2063 | dependencies = [ |
2109 | "thiserror-impl", | 2064 | "thiserror-impl", |
2110 | ] | 2065 | ] |
2111 | 2066 | ||
2112 | [[package]] | 2067 | [[package]] |
2113 | name = "thiserror-impl" | 2068 | name = "thiserror-impl" |
2114 | version = "1.0.57" | 2069 | version = "1.0.58" |
2115 | source = "registry+https://github.com/rust-lang/crates.io-index" | 2070 | source = "registry+https://github.com/rust-lang/crates.io-index" |
2116 | checksum = "a953cb265bef375dae3de6663da4d3804eee9682ea80d8e2542529b73c531c81" | 2071 | checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7" |
2117 | dependencies = [ | 2072 | dependencies = [ |
2118 | "proc-macro2", | 2073 | "proc-macro2", |
2119 | "quote", | 2074 | "quote", |
2120 | "syn 2.0.52", | 2075 | "syn 2.0.58", |
2121 | ] | 2076 | ] |
2122 | 2077 | ||
2123 | [[package]] | 2078 | [[package]] |
@@ -2189,9 +2144,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" | |||
2189 | 2144 | ||
2190 | [[package]] | 2145 | [[package]] |
2191 | name = "tokio" | 2146 | name = "tokio" |
2192 | version = "1.36.0" | 2147 | version = "1.37.0" |
2193 | source = "registry+https://github.com/rust-lang/crates.io-index" | 2148 | source = "registry+https://github.com/rust-lang/crates.io-index" |
2194 | checksum = "61285f6515fa018fb2d1e46eb21223fff441ee8db5d0f1435e8ab4f5cdb80931" | 2149 | checksum = "1adbebffeca75fcfd058afa480fb6c0b81e165a0323f9c9d39c9697e37c46787" |
2195 | dependencies = [ | 2150 | dependencies = [ |
2196 | "backtrace", | 2151 | "backtrace", |
2197 | "bytes", | 2152 | "bytes", |
@@ -2212,14 +2167,14 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" | |||
2212 | dependencies = [ | 2167 | dependencies = [ |
2213 | "proc-macro2", | 2168 | "proc-macro2", |
2214 | "quote", | 2169 | "quote", |
2215 | "syn 2.0.52", | 2170 | "syn 2.0.58", |
2216 | ] | 2171 | ] |
2217 | 2172 | ||
2218 | [[package]] | 2173 | [[package]] |
2219 | name = "tokio-stream" | 2174 | name = "tokio-stream" |
2220 | version = "0.1.14" | 2175 | version = "0.1.15" |
2221 | source = "registry+https://github.com/rust-lang/crates.io-index" | 2176 | source = "registry+https://github.com/rust-lang/crates.io-index" |
2222 | checksum = "397c988d37662c7dda6d2208364a706264bf3d6138b11d436cbac0ad38832842" | 2177 | checksum = "267ac89e0bec6e691e5813911606935d77c476ff49024f98abcea3e7b15e37af" |
2223 | dependencies = [ | 2178 | dependencies = [ |
2224 | "futures-core", | 2179 | "futures-core", |
2225 | "pin-project-lite", | 2180 | "pin-project-lite", |
@@ -2239,24 +2194,10 @@ dependencies = [ | |||
2239 | ] | 2194 | ] |
2240 | 2195 | ||
2241 | [[package]] | 2196 | [[package]] |
2242 | name = "tokio-util" | ||
2243 | version = "0.7.10" | ||
2244 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
2245 | checksum = "5419f34732d9eb6ee4c3578b7989078579b7f039cbbb9ca2c4da015749371e15" | ||
2246 | dependencies = [ | ||
2247 | "bytes", | ||
2248 | "futures-core", | ||
2249 | "futures-sink", | ||
2250 | "pin-project-lite", | ||
2251 | "tokio", | ||
2252 | "tracing", | ||
2253 | ] | ||
2254 | |||
2255 | [[package]] | ||
2256 | name = "toml" | 2197 | name = "toml" |
2257 | version = "0.8.10" | 2198 | version = "0.8.12" |
2258 | source = "registry+https://github.com/rust-lang/crates.io-index" | 2199 | source = "registry+https://github.com/rust-lang/crates.io-index" |
2259 | checksum = "9a9aad4a3066010876e8dcf5a8a06e70a558751117a145c6ce2b82c2e2054290" | 2200 | checksum = "e9dd1545e8208b4a5af1aa9bbd0b4cf7e9ea08fabc5d0a5c67fcaafa17433aa3" |
2260 | dependencies = [ | 2201 | dependencies = [ |
2261 | "serde", | 2202 | "serde", |
2262 | "serde_spanned", | 2203 | "serde_spanned", |
@@ -2275,9 +2216,9 @@ dependencies = [ | |||
2275 | 2216 | ||
2276 | [[package]] | 2217 | [[package]] |
2277 | name = "toml_edit" | 2218 | name = "toml_edit" |
2278 | version = "0.22.6" | 2219 | version = "0.22.9" |
2279 | source = "registry+https://github.com/rust-lang/crates.io-index" | 2220 | source = "registry+https://github.com/rust-lang/crates.io-index" |
2280 | checksum = "2c1b5fd4128cc8d3e0cb74d4ed9a9cc7c7284becd4df68f5f940e1ad123606f6" | 2221 | checksum = "8e40bb779c5187258fd7aad0eb68cb8706a0a81fa712fbea808ab43c4b8374c4" |
2281 | dependencies = [ | 2222 | dependencies = [ |
2282 | "indexmap", | 2223 | "indexmap", |
2283 | "serde", | 2224 | "serde", |
@@ -2346,7 +2287,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" | |||
2346 | dependencies = [ | 2287 | dependencies = [ |
2347 | "proc-macro2", | 2288 | "proc-macro2", |
2348 | "quote", | 2289 | "quote", |
2349 | "syn 2.0.52", | 2290 | "syn 2.0.58", |
2350 | ] | 2291 | ] |
2351 | 2292 | ||
2352 | [[package]] | 2293 | [[package]] |
@@ -2517,7 +2458,7 @@ dependencies = [ | |||
2517 | "proc-macro2", | 2458 | "proc-macro2", |
2518 | "quote", | 2459 | "quote", |
2519 | "regex", | 2460 | "regex", |
2520 | "syn 2.0.52", | 2461 | "syn 2.0.58", |
2521 | ] | 2462 | ] |
2522 | 2463 | ||
2523 | [[package]] | 2464 | [[package]] |
@@ -2538,9 +2479,9 @@ dependencies = [ | |||
2538 | 2479 | ||
2539 | [[package]] | 2480 | [[package]] |
2540 | name = "uuid" | 2481 | name = "uuid" |
2541 | version = "1.7.0" | 2482 | version = "1.8.0" |
2542 | source = "registry+https://github.com/rust-lang/crates.io-index" | 2483 | source = "registry+https://github.com/rust-lang/crates.io-index" |
2543 | checksum = "f00cc9702ca12d3c81455259621e676d0f7251cec66a21e98fe2e9a37db93b2a" | 2484 | checksum = "a183cf7feeba97b4dd1c0d46788634f6221d87fa961b305bed08c851829efcc0" |
2544 | dependencies = [ | 2485 | dependencies = [ |
2545 | "getrandom", | 2486 | "getrandom", |
2546 | "rand", | 2487 | "rand", |
@@ -2588,7 +2529,7 @@ checksum = "b8dad83b4f25e74f184f64c43b150b91efe7647395b42289f38e50566d82855b" | |||
2588 | 2529 | ||
2589 | [[package]] | 2530 | [[package]] |
2590 | name = "webol" | 2531 | name = "webol" |
2591 | version = "0.3.3" | 2532 | version = "0.3.4" |
2592 | dependencies = [ | 2533 | dependencies = [ |
2593 | "axum", | 2534 | "axum", |
2594 | "axum-macros", | 2535 | "axum-macros", |
@@ -2614,9 +2555,9 @@ dependencies = [ | |||
2614 | 2555 | ||
2615 | [[package]] | 2556 | [[package]] |
2616 | name = "whoami" | 2557 | name = "whoami" |
2617 | version = "1.5.0" | 2558 | version = "1.5.1" |
2618 | source = "registry+https://github.com/rust-lang/crates.io-index" | 2559 | source = "registry+https://github.com/rust-lang/crates.io-index" |
2619 | checksum = "0fec781d48b41f8163426ed18e8fc2864c12937df9ce54c88ede7bd47270893e" | 2560 | checksum = "a44ab49fad634e88f55bf8f9bb3abd2f27d7204172a112c7c9987e01c1c94ea9" |
2620 | dependencies = [ | 2561 | dependencies = [ |
2621 | "redox_syscall", | 2562 | "redox_syscall", |
2622 | "wasite", | 2563 | "wasite", |
@@ -2820,7 +2761,7 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" | |||
2820 | dependencies = [ | 2761 | dependencies = [ |
2821 | "proc-macro2", | 2762 | "proc-macro2", |
2822 | "quote", | 2763 | "quote", |
2823 | "syn 2.0.52", | 2764 | "syn 2.0.58", |
2824 | ] | 2765 | ] |
2825 | 2766 | ||
2826 | [[package]] | 2767 | [[package]] |
@@ -1,13 +1,13 @@ | |||
1 | [package] | 1 | [package] |
2 | name = "webol" | 2 | name = "webol" |
3 | version = "0.3.3" | 3 | version = "0.3.4" |
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 |
7 | 7 | ||
8 | [dependencies] | 8 | [dependencies] |
9 | axum = { version = "0.7", features = ["ws"] } | 9 | axum = { version = "0.7", features = ["ws"] } |
10 | tokio = { version = "1.34", features = ["macros", "rt-multi-thread"] } | 10 | tokio = { version = "1.37", features = ["macros", "rt-multi-thread"] } |
11 | tracing = "0.1" | 11 | tracing = "0.1" |
12 | tracing-subscriber = { version = "0.3", features = ["env-filter", "local-time", "time"] } | 12 | tracing-subscriber = { version = "0.3", features = ["env-filter", "local-time", "time"] } |
13 | time = { version = "0.3", features = ["macros"] } | 13 | time = { version = "0.3", features = ["macros"] } |
@@ -17,7 +17,7 @@ config = "0.14" | |||
17 | sqlx = { version = "0.7", features = ["postgres", "runtime-tokio", "ipnetwork", "mac_address"]} | 17 | sqlx = { version = "0.7", features = ["postgres", "runtime-tokio", "ipnetwork", "mac_address"]} |
18 | surge-ping = "0.8" | 18 | surge-ping = "0.8" |
19 | axum-macros = "0.4" | 19 | axum-macros = "0.4" |
20 | uuid = { version = "1.6", features = ["v4", "fast-rng"] } | 20 | uuid = { version = "1.8", 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" |
diff --git a/src/auth.rs b/src/auth.rs new file mode 100644 index 0000000..74008b5 --- /dev/null +++ b/src/auth.rs | |||
@@ -0,0 +1,37 @@ | |||
1 | use crate::AppState; | ||
2 | use axum::{ | ||
3 | extract::{Request, State}, | ||
4 | http::{HeaderMap, StatusCode}, | ||
5 | middleware::Next, | ||
6 | response::Response, | ||
7 | }; | ||
8 | use serde::Deserialize; | ||
9 | |||
10 | #[derive(Debug, Clone, Deserialize)] | ||
11 | pub enum Methods { | ||
12 | Key, | ||
13 | None, | ||
14 | } | ||
15 | |||
16 | pub async fn auth( | ||
17 | State(state): State<AppState>, | ||
18 | headers: HeaderMap, | ||
19 | request: Request, | ||
20 | next: Next, | ||
21 | ) -> Result<Response, StatusCode> { | ||
22 | let auth = state.config.auth; | ||
23 | match auth.method { | ||
24 | Methods::Key => { | ||
25 | if let Some(secret) = headers.get("authorization") { | ||
26 | if auth.secret.as_str() != secret { | ||
27 | return Err(StatusCode::UNAUTHORIZED); | ||
28 | }; | ||
29 | let response = next.run(request).await; | ||
30 | Ok(response) | ||
31 | } else { | ||
32 | Err(StatusCode::UNAUTHORIZED) | ||
33 | } | ||
34 | } | ||
35 | Methods::None => Ok(next.run(request).await), | ||
36 | } | ||
37 | } | ||
diff --git a/src/config.rs b/src/config.rs index 9605361..9636af4 100644 --- a/src/config.rs +++ b/src/config.rs | |||
@@ -1,14 +1,22 @@ | |||
1 | use config::File; | 1 | use config::File; |
2 | use serde::Deserialize; | 2 | use serde::Deserialize; |
3 | 3 | ||
4 | use crate::auth; | ||
5 | |||
4 | #[derive(Debug, Clone, Deserialize)] | 6 | #[derive(Debug, Clone, Deserialize)] |
5 | pub struct Config { | 7 | pub struct Config { |
6 | pub database_url: String, | 8 | pub database_url: String, |
7 | pub apikey: String, | ||
8 | pub serveraddr: String, | 9 | pub serveraddr: String, |
9 | pub pingtimeout: i64, | 10 | pub pingtimeout: i64, |
10 | pub pingthreshold: i64, | 11 | pub pingthreshold: i64, |
11 | pub timeoffset: i8, | 12 | pub timeoffset: i8, |
13 | pub auth: Auth, | ||
14 | } | ||
15 | |||
16 | #[derive(Debug, Clone, Deserialize)] | ||
17 | pub struct Auth { | ||
18 | pub method: auth::Methods, | ||
19 | pub secret: String, | ||
12 | } | 20 | } |
13 | 21 | ||
14 | impl Config { | 22 | impl Config { |
diff --git a/src/extractors.rs b/src/extractors.rs deleted file mode 100644 index 4d441e9..0000000 --- a/src/extractors.rs +++ /dev/null | |||
@@ -1,24 +0,0 @@ | |||
1 | use axum::{ | ||
2 | extract::{Request, State}, | ||
3 | http::{HeaderMap, StatusCode}, | ||
4 | middleware::Next, | ||
5 | response::Response, | ||
6 | }; | ||
7 | |||
8 | use crate::AppState; | ||
9 | |||
10 | pub async fn auth( | ||
11 | State(state): State<AppState>, | ||
12 | headers: HeaderMap, | ||
13 | request: Request, | ||
14 | next: Next, | ||
15 | ) -> Result<Response, StatusCode> { | ||
16 | let secret = headers.get("authorization"); | ||
17 | match secret { | ||
18 | Some(token) if token == state.config.apikey.as_str() => { | ||
19 | let response = next.run(request).await; | ||
20 | Ok(response) | ||
21 | } | ||
22 | _ => Err(StatusCode::UNAUTHORIZED), | ||
23 | } | ||
24 | } | ||
diff --git a/src/main.rs b/src/main.rs index 00fc6ce..70c67cf 100644 --- a/src/main.rs +++ b/src/main.rs | |||
@@ -11,8 +11,8 @@ use axum::{ | |||
11 | }; | 11 | }; |
12 | use dashmap::DashMap; | 12 | use dashmap::DashMap; |
13 | use sqlx::PgPool; | 13 | use sqlx::PgPool; |
14 | use time::UtcOffset; | ||
15 | use std::{env, sync::Arc}; | 14 | use std::{env, sync::Arc}; |
15 | use time::UtcOffset; | ||
16 | use tokio::sync::broadcast::{channel, Sender}; | 16 | use tokio::sync::broadcast::{channel, Sender}; |
17 | use tracing::{info, level_filters::LevelFilter}; | 17 | use tracing::{info, level_filters::LevelFilter}; |
18 | use tracing_subscriber::{ | 18 | use tracing_subscriber::{ |
@@ -29,7 +29,7 @@ use utoipa_swagger_ui::SwaggerUi; | |||
29 | mod config; | 29 | mod config; |
30 | mod db; | 30 | mod db; |
31 | mod error; | 31 | mod error; |
32 | mod extractors; | 32 | mod auth; |
33 | mod routes; | 33 | mod routes; |
34 | mod services; | 34 | mod services; |
35 | mod wol; | 35 | mod wol; |
@@ -37,19 +37,21 @@ mod wol; | |||
37 | #[derive(OpenApi)] | 37 | #[derive(OpenApi)] |
38 | #[openapi( | 38 | #[openapi( |
39 | paths( | 39 | paths( |
40 | start::start, | 40 | start::post, |
41 | start::get, | ||
42 | start::start_payload, | ||
41 | device::get, | 43 | device::get, |
42 | device::get_path, | 44 | device::get_payload, |
43 | device::post, | 45 | device::post, |
44 | device::put, | 46 | device::put, |
45 | ), | 47 | ), |
46 | components( | 48 | components( |
47 | schemas( | 49 | schemas( |
50 | start::PayloadOld, | ||
48 | start::Payload, | 51 | start::Payload, |
49 | start::Response, | 52 | start::Response, |
50 | device::PutDevicePayload, | 53 | device::DevicePayload, |
51 | device::GetDevicePayload, | 54 | device::GetDevicePayload, |
52 | device::PostDevicePayload, | ||
53 | db::DeviceSchema, | 55 | db::DeviceSchema, |
54 | ) | 56 | ) |
55 | ), | 57 | ), |
@@ -116,14 +118,16 @@ async fn main() -> color_eyre::eyre::Result<()> { | |||
116 | }; | 118 | }; |
117 | 119 | ||
118 | let app = Router::new() | 120 | let app = Router::new() |
119 | .route("/start", post(start::start)) | 121 | .route("/start", post(start::start_payload)) |
122 | .route("/start/:id", post(start::post).get(start::get)) | ||
120 | .route( | 123 | .route( |
121 | "/device", | 124 | "/device", |
122 | post(device::post).get(device::get).put(device::put), | 125 | post(device::post).get(device::get_payload).put(device::put), |
123 | ) | 126 | ) |
124 | .route("/device/:id", get(device::get_path)) | 127 | .route("/device/:id", get(device::get)) |
125 | .route("/status", get(status::status)) | 128 | .route("/status", get(status::status)) |
126 | .route_layer(from_fn_with_state(shared_state.clone(), extractors::auth)) | 129 | // TODO: Don't load on `None` Auth |
130 | .route_layer(from_fn_with_state(shared_state.clone(), auth::auth)) | ||
127 | .merge(SwaggerUi::new("/swagger-ui").url("/api-docs/openapi.json", ApiDoc::openapi())) | 131 | .merge(SwaggerUi::new("/swagger-ui").url("/api-docs/openapi.json", ApiDoc::openapi())) |
128 | .with_state(Arc::new(shared_state)); | 132 | .with_state(Arc::new(shared_state)); |
129 | 133 | ||
diff --git a/src/routes/device.rs b/src/routes/device.rs index d01d9f0..40b5cd8 100644 --- a/src/routes/device.rs +++ b/src/routes/device.rs | |||
@@ -20,7 +20,7 @@ use utoipa::ToSchema; | |||
20 | security(("api_key" = [])) | 20 | security(("api_key" = [])) |
21 | )] | 21 | )] |
22 | #[deprecated] | 22 | #[deprecated] |
23 | pub async fn get( | 23 | pub async fn get_payload( |
24 | State(state): State<Arc<crate::AppState>>, | 24 | State(state): State<Arc<crate::AppState>>, |
25 | Json(payload): Json<GetDevicePayload>, | 25 | Json(payload): Json<GetDevicePayload>, |
26 | ) -> Result<Json<Value>, Error> { | 26 | ) -> Result<Json<Value>, Error> { |
@@ -49,11 +49,11 @@ pub async fn get( | |||
49 | (status = 200, description = "Get `Device` information", body = [Device]) | 49 | (status = 200, description = "Get `Device` information", body = [Device]) |
50 | ), | 50 | ), |
51 | params( | 51 | params( |
52 | ("id" = String, Path, description = "Device id") | 52 | ("id" = String, Path, description = "device id") |
53 | ), | 53 | ), |
54 | security(("api_key" = [])) | 54 | security((), ("api_key" = [])) |
55 | )] | 55 | )] |
56 | pub async fn get_path( | 56 | pub async fn get( |
57 | State(state): State<Arc<crate::AppState>>, | 57 | State(state): State<Arc<crate::AppState>>, |
58 | Path(path): Path<String>, | 58 | Path(path): Path<String>, |
59 | ) -> Result<Json<Value>, Error> { | 59 | ) -> Result<Json<Value>, Error> { |
@@ -76,22 +76,31 @@ pub async fn get_path( | |||
76 | } | 76 | } |
77 | 77 | ||
78 | #[derive(Deserialize, ToSchema)] | 78 | #[derive(Deserialize, ToSchema)] |
79 | #[deprecated] | ||
79 | pub struct GetDevicePayload { | 80 | pub struct GetDevicePayload { |
80 | id: String, | 81 | id: String, |
81 | } | 82 | } |
82 | 83 | ||
84 | #[derive(Deserialize, ToSchema)] | ||
85 | pub struct DevicePayload { | ||
86 | id: String, | ||
87 | mac: String, | ||
88 | broadcast_addr: String, | ||
89 | ip: String, | ||
90 | } | ||
91 | |||
83 | #[utoipa::path( | 92 | #[utoipa::path( |
84 | put, | 93 | put, |
85 | path = "/device", | 94 | path = "/device", |
86 | request_body = PutDevicePayload, | 95 | request_body = DevicePayload, |
87 | responses( | 96 | responses( |
88 | (status = 200, description = "List matching todos by query", body = [DeviceSchema]) | 97 | (status = 200, description = "add device to storage", body = [DeviceSchema]) |
89 | ), | 98 | ), |
90 | security(("api_key" = [])) | 99 | security((), ("api_key" = [])) |
91 | )] | 100 | )] |
92 | pub async fn put( | 101 | pub async fn put( |
93 | State(state): State<Arc<crate::AppState>>, | 102 | State(state): State<Arc<crate::AppState>>, |
94 | Json(payload): Json<PutDevicePayload>, | 103 | Json(payload): Json<DevicePayload>, |
95 | ) -> Result<Json<Value>, Error> { | 104 | ) -> Result<Json<Value>, Error> { |
96 | info!( | 105 | info!( |
97 | "add device {} ({}, {}, {})", | 106 | "add device {} ({}, {}, {})", |
@@ -118,26 +127,18 @@ pub async fn put( | |||
118 | Ok(Json(json!(device))) | 127 | Ok(Json(json!(device))) |
119 | } | 128 | } |
120 | 129 | ||
121 | #[derive(Deserialize, ToSchema)] | ||
122 | pub struct PutDevicePayload { | ||
123 | id: String, | ||
124 | mac: String, | ||
125 | broadcast_addr: String, | ||
126 | ip: String, | ||
127 | } | ||
128 | |||
129 | #[utoipa::path( | 130 | #[utoipa::path( |
130 | post, | 131 | post, |
131 | path = "/device", | 132 | path = "/device", |
132 | request_body = PostDevicePayload, | 133 | request_body = DevicePayload, |
133 | responses( | 134 | responses( |
134 | (status = 200, description = "List matching todos by query", body = [DeviceSchema]) | 135 | (status = 200, description = "update device in storage", body = [DeviceSchema]) |
135 | ), | 136 | ), |
136 | security(("api_key" = [])) | 137 | security((), ("api_key" = [])) |
137 | )] | 138 | )] |
138 | pub async fn post( | 139 | pub async fn post( |
139 | State(state): State<Arc<crate::AppState>>, | 140 | State(state): State<Arc<crate::AppState>>, |
140 | Json(payload): Json<PostDevicePayload>, | 141 | Json(payload): Json<DevicePayload>, |
141 | ) -> Result<Json<Value>, Error> { | 142 | ) -> Result<Json<Value>, Error> { |
142 | info!( | 143 | info!( |
143 | "edit device {} ({}, {}, {})", | 144 | "edit device {} ({}, {}, {})", |
@@ -162,11 +163,3 @@ pub async fn post( | |||
162 | 163 | ||
163 | Ok(Json(json!(device))) | 164 | Ok(Json(json!(device))) |
164 | } | 165 | } |
165 | |||
166 | #[derive(Deserialize, ToSchema)] | ||
167 | pub struct PostDevicePayload { | ||
168 | id: String, | ||
169 | mac: String, | ||
170 | broadcast_addr: String, | ||
171 | ip: String, | ||
172 | } | ||
diff --git a/src/routes/start.rs b/src/routes/start.rs index ef6e8f2..ff3d1be 100644 --- a/src/routes/start.rs +++ b/src/routes/start.rs | |||
@@ -2,27 +2,28 @@ use crate::db::Device; | |||
2 | use crate::error::Error; | 2 | use crate::error::Error; |
3 | use crate::services::ping::Value as PingValue; | 3 | use crate::services::ping::Value as PingValue; |
4 | use crate::wol::{create_buffer, send_packet}; | 4 | use crate::wol::{create_buffer, send_packet}; |
5 | use axum::extract::State; | 5 | use axum::extract::{Path, 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; | ||
10 | use std::sync::Arc; | 9 | use std::sync::Arc; |
11 | use tracing::{debug, info}; | 10 | use tracing::{debug, info}; |
11 | use utoipa::ToSchema; | ||
12 | use uuid::Uuid; | 12 | use uuid::Uuid; |
13 | 13 | ||
14 | #[utoipa::path( | 14 | #[utoipa::path( |
15 | post, | 15 | post, |
16 | path = "/start", | 16 | path = "/start", |
17 | request_body = Payload, | 17 | request_body = PayloadOld, |
18 | responses( | 18 | responses( |
19 | (status = 200, description = "List matching todos by query", body = [Response]) | 19 | (status = 200, description = "DEP", body = [Response]) |
20 | ), | 20 | ), |
21 | security(("api_key" = [])) | 21 | security((), ("api_key" = [])) |
22 | )] | 22 | )] |
23 | pub async fn start( | 23 | #[deprecated] |
24 | pub async fn start_payload( | ||
24 | State(state): State<Arc<crate::AppState>>, | 25 | State(state): State<Arc<crate::AppState>>, |
25 | Json(payload): Json<Payload>, | 26 | Json(payload): Json<PayloadOld>, |
26 | ) -> Result<Json<Value>, Error> { | 27 | ) -> Result<Json<Value>, Error> { |
27 | info!("POST request"); | 28 | info!("POST request"); |
28 | let device = sqlx::query_as!( | 29 | let device = sqlx::query_as!( |
@@ -59,6 +60,89 @@ pub async fn start( | |||
59 | }))) | 60 | }))) |
60 | } | 61 | } |
61 | 62 | ||
63 | #[utoipa::path( | ||
64 | post, | ||
65 | path = "/start/{id}", | ||
66 | request_body = Option<Payload>, | ||
67 | responses( | ||
68 | (status = 200, description = "start the device with the given id", body = [Response]) | ||
69 | ), | ||
70 | params( | ||
71 | ("id" = String, Path, description = "device id") | ||
72 | ), | ||
73 | security((), ("api_key" = [])) | ||
74 | )] | ||
75 | pub async fn post( | ||
76 | State(state): State<Arc<crate::AppState>>, | ||
77 | Path(id): Path<String>, | ||
78 | payload: Option<Json<Payload>>, | ||
79 | ) -> Result<Json<Value>, Error> { | ||
80 | send_wol(state, &id, payload).await | ||
81 | } | ||
82 | |||
83 | #[utoipa::path( | ||
84 | get, | ||
85 | path = "/start/{id}", | ||
86 | responses( | ||
87 | (status = 200, description = "start the device with the given id", body = [Response]) | ||
88 | ), | ||
89 | params( | ||
90 | ("id" = String, Path, description = "device id") | ||
91 | ), | ||
92 | security((), ("api_key" = [])) | ||
93 | )] | ||
94 | pub async fn get( | ||
95 | State(state): State<Arc<crate::AppState>>, | ||
96 | Path(id): Path<String>, | ||
97 | ) -> Result<Json<Value>, Error> { | ||
98 | send_wol(state, &id, None).await | ||
99 | } | ||
100 | |||
101 | async fn send_wol( | ||
102 | state: Arc<crate::AppState>, | ||
103 | id: &str, | ||
104 | payload: Option<Json<Payload>>, | ||
105 | ) -> Result<Json<Value>, Error> { | ||
106 | info!("Start request for {id}"); | ||
107 | let device = sqlx::query_as!( | ||
108 | Device, | ||
109 | r#" | ||
110 | SELECT id, mac, broadcast_addr, ip, times | ||
111 | FROM devices | ||
112 | WHERE id = $1; | ||
113 | "#, | ||
114 | id | ||
115 | ) | ||
116 | .fetch_one(&state.db) | ||
117 | .await?; | ||
118 | |||
119 | info!("starting {}", device.id); | ||
120 | |||
121 | let bind_addr = "0.0.0.0:0"; | ||
122 | |||
123 | let _ = send_packet( | ||
124 | bind_addr, | ||
125 | &device.broadcast_addr, | ||
126 | &create_buffer(&device.mac.to_string())?, | ||
127 | )?; | ||
128 | let dev_id = device.id.clone(); | ||
129 | let uuid = if let Some(pl) = payload { | ||
130 | if pl.ping.is_some_and(|ping| ping) { | ||
131 | Some(setup_ping(state, device)) | ||
132 | } else { | ||
133 | None | ||
134 | } | ||
135 | } else { | ||
136 | None | ||
137 | }; | ||
138 | |||
139 | Ok(Json(json!(Response { | ||
140 | id: dev_id, | ||
141 | boot: true, | ||
142 | uuid | ||
143 | }))) | ||
144 | } | ||
145 | |||
62 | fn setup_ping(state: Arc<crate::AppState>, device: Device) -> String { | 146 | fn setup_ping(state: Arc<crate::AppState>, device: Device) -> String { |
63 | let mut uuid: Option<String> = None; | 147 | let mut uuid: Option<String> = None; |
64 | for (key, value) in state.ping_map.clone() { | 148 | for (key, value) in state.ping_map.clone() { |
@@ -99,11 +183,17 @@ fn setup_ping(state: Arc<crate::AppState>, device: Device) -> String { | |||
99 | } | 183 | } |
100 | 184 | ||
101 | #[derive(Deserialize, ToSchema)] | 185 | #[derive(Deserialize, ToSchema)] |
102 | pub struct Payload { | 186 | #[deprecated] |
187 | pub struct PayloadOld { | ||
103 | id: String, | 188 | id: String, |
104 | ping: Option<bool>, | 189 | ping: Option<bool>, |
105 | } | 190 | } |
106 | 191 | ||
192 | #[derive(Deserialize, ToSchema)] | ||
193 | pub struct Payload { | ||
194 | ping: Option<bool>, | ||
195 | } | ||
196 | |||
107 | #[derive(Serialize, ToSchema)] | 197 | #[derive(Serialize, ToSchema)] |
108 | pub struct Response { | 198 | pub struct Response { |
109 | id: String, | 199 | id: String, |