diff options
-rw-r--r-- | .gitignore | 6 | ||||
-rw-r--r-- | Cargo.lock | 993 | ||||
-rw-r--r-- | Cargo.toml | 15 | ||||
-rw-r--r-- | src/auth.rs | 3 | ||||
-rw-r--r-- | src/config.rs | 0 | ||||
-rw-r--r-- | src/main.rs | 43 | ||||
-rw-r--r-- | src/routes/mod.rs | 1 | ||||
-rw-r--r-- | src/routes/start.rs | 29 |
8 files changed, 1086 insertions, 4 deletions
@@ -3,12 +3,10 @@ | |||
3 | debug/ | 3 | debug/ |
4 | target/ | 4 | target/ |
5 | 5 | ||
6 | # Remove Cargo.lock from gitignore if creating an executable, leave it for libraries | ||
7 | # More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html | ||
8 | Cargo.lock | ||
9 | |||
10 | # These are backup files generated by rustfmt | 6 | # These are backup files generated by rustfmt |
11 | **/*.rs.bk | 7 | **/*.rs.bk |
12 | 8 | ||
13 | # MSVC Windows builds of rustc generate these, which store debugging information | 9 | # MSVC Windows builds of rustc generate these, which store debugging information |
14 | *.pdb | 10 | *.pdb |
11 | |||
12 | .idea \ No newline at end of file | ||
diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..47552e5 --- /dev/null +++ b/Cargo.lock | |||
@@ -0,0 +1,993 @@ | |||
1 | # This file is automatically @generated by Cargo. | ||
2 | # It is not intended for manual editing. | ||
3 | version = 3 | ||
4 | |||
5 | [[package]] | ||
6 | name = "addr2line" | ||
7 | version = "0.21.0" | ||
8 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
9 | checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" | ||
10 | dependencies = [ | ||
11 | "gimli", | ||
12 | ] | ||
13 | |||
14 | [[package]] | ||
15 | name = "adler" | ||
16 | version = "1.0.2" | ||
17 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
18 | checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" | ||
19 | |||
20 | [[package]] | ||
21 | name = "aho-corasick" | ||
22 | version = "1.1.1" | ||
23 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
24 | checksum = "ea5d730647d4fadd988536d06fecce94b7b4f2a7efdae548f1cf4b63205518ab" | ||
25 | dependencies = [ | ||
26 | "memchr", | ||
27 | ] | ||
28 | |||
29 | [[package]] | ||
30 | name = "async-trait" | ||
31 | version = "0.1.73" | ||
32 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
33 | checksum = "bc00ceb34980c03614e35a3a4e218276a0a824e911d07651cd0d858a51e8c0f0" | ||
34 | dependencies = [ | ||
35 | "proc-macro2", | ||
36 | "quote", | ||
37 | "syn", | ||
38 | ] | ||
39 | |||
40 | [[package]] | ||
41 | name = "axum" | ||
42 | version = "0.6.20" | ||
43 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
44 | checksum = "3b829e4e32b91e643de6eafe82b1d90675f5874230191a4ffbc1b336dec4d6bf" | ||
45 | dependencies = [ | ||
46 | "async-trait", | ||
47 | "axum-core", | ||
48 | "bitflags", | ||
49 | "bytes", | ||
50 | "futures-util", | ||
51 | "headers", | ||
52 | "http", | ||
53 | "http-body", | ||
54 | "hyper", | ||
55 | "itoa", | ||
56 | "matchit", | ||
57 | "memchr", | ||
58 | "mime", | ||
59 | "percent-encoding", | ||
60 | "pin-project-lite", | ||
61 | "rustversion", | ||
62 | "serde", | ||
63 | "serde_json", | ||
64 | "serde_path_to_error", | ||
65 | "serde_urlencoded", | ||
66 | "sync_wrapper", | ||
67 | "tokio", | ||
68 | "tower", | ||
69 | "tower-layer", | ||
70 | "tower-service", | ||
71 | "tracing", | ||
72 | ] | ||
73 | |||
74 | [[package]] | ||
75 | name = "axum-core" | ||
76 | version = "0.3.4" | ||
77 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
78 | checksum = "759fa577a247914fd3f7f76d62972792636412fbfd634cd452f6a385a74d2d2c" | ||
79 | dependencies = [ | ||
80 | "async-trait", | ||
81 | "bytes", | ||
82 | "futures-util", | ||
83 | "http", | ||
84 | "http-body", | ||
85 | "mime", | ||
86 | "rustversion", | ||
87 | "tower-layer", | ||
88 | "tower-service", | ||
89 | "tracing", | ||
90 | ] | ||
91 | |||
92 | [[package]] | ||
93 | name = "backtrace" | ||
94 | version = "0.3.69" | ||
95 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
96 | checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" | ||
97 | dependencies = [ | ||
98 | "addr2line", | ||
99 | "cc", | ||
100 | "cfg-if", | ||
101 | "libc", | ||
102 | "miniz_oxide", | ||
103 | "object", | ||
104 | "rustc-demangle", | ||
105 | ] | ||
106 | |||
107 | [[package]] | ||
108 | name = "base64" | ||
109 | version = "0.21.4" | ||
110 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
111 | checksum = "9ba43ea6f343b788c8764558649e08df62f86c6ef251fdaeb1ffd010a9ae50a2" | ||
112 | |||
113 | [[package]] | ||
114 | name = "bitflags" | ||
115 | version = "1.3.2" | ||
116 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
117 | checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" | ||
118 | |||
119 | [[package]] | ||
120 | name = "block-buffer" | ||
121 | version = "0.10.4" | ||
122 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
123 | checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" | ||
124 | dependencies = [ | ||
125 | "generic-array", | ||
126 | ] | ||
127 | |||
128 | [[package]] | ||
129 | name = "bytes" | ||
130 | version = "1.5.0" | ||
131 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
132 | checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" | ||
133 | |||
134 | [[package]] | ||
135 | name = "cc" | ||
136 | version = "1.0.83" | ||
137 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
138 | checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" | ||
139 | dependencies = [ | ||
140 | "libc", | ||
141 | ] | ||
142 | |||
143 | [[package]] | ||
144 | name = "cfg-if" | ||
145 | version = "1.0.0" | ||
146 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
147 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" | ||
148 | |||
149 | [[package]] | ||
150 | name = "cpufeatures" | ||
151 | version = "0.2.9" | ||
152 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
153 | checksum = "a17b76ff3a4162b0b27f354a0c87015ddad39d35f9c0c36607a3bdd175dde1f1" | ||
154 | dependencies = [ | ||
155 | "libc", | ||
156 | ] | ||
157 | |||
158 | [[package]] | ||
159 | name = "crypto-common" | ||
160 | version = "0.1.6" | ||
161 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
162 | checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" | ||
163 | dependencies = [ | ||
164 | "generic-array", | ||
165 | "typenum", | ||
166 | ] | ||
167 | |||
168 | [[package]] | ||
169 | name = "deranged" | ||
170 | version = "0.3.8" | ||
171 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
172 | checksum = "f2696e8a945f658fd14dc3b87242e6b80cd0f36ff04ea560fa39082368847946" | ||
173 | |||
174 | [[package]] | ||
175 | name = "digest" | ||
176 | version = "0.10.7" | ||
177 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
178 | checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" | ||
179 | dependencies = [ | ||
180 | "block-buffer", | ||
181 | "crypto-common", | ||
182 | ] | ||
183 | |||
184 | [[package]] | ||
185 | name = "fnv" | ||
186 | version = "1.0.7" | ||
187 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
188 | checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" | ||
189 | |||
190 | [[package]] | ||
191 | name = "form_urlencoded" | ||
192 | version = "1.2.0" | ||
193 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
194 | checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" | ||
195 | dependencies = [ | ||
196 | "percent-encoding", | ||
197 | ] | ||
198 | |||
199 | [[package]] | ||
200 | name = "futures-channel" | ||
201 | version = "0.3.28" | ||
202 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
203 | checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" | ||
204 | dependencies = [ | ||
205 | "futures-core", | ||
206 | ] | ||
207 | |||
208 | [[package]] | ||
209 | name = "futures-core" | ||
210 | version = "0.3.28" | ||
211 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
212 | checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" | ||
213 | |||
214 | [[package]] | ||
215 | name = "futures-task" | ||
216 | version = "0.3.28" | ||
217 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
218 | checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" | ||
219 | |||
220 | [[package]] | ||
221 | name = "futures-util" | ||
222 | version = "0.3.28" | ||
223 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
224 | checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" | ||
225 | dependencies = [ | ||
226 | "futures-core", | ||
227 | "futures-task", | ||
228 | "pin-project-lite", | ||
229 | "pin-utils", | ||
230 | ] | ||
231 | |||
232 | [[package]] | ||
233 | name = "generic-array" | ||
234 | version = "0.14.7" | ||
235 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
236 | checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" | ||
237 | dependencies = [ | ||
238 | "typenum", | ||
239 | "version_check", | ||
240 | ] | ||
241 | |||
242 | [[package]] | ||
243 | name = "gimli" | ||
244 | version = "0.28.0" | ||
245 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
246 | checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" | ||
247 | |||
248 | [[package]] | ||
249 | name = "headers" | ||
250 | version = "0.3.9" | ||
251 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
252 | checksum = "06683b93020a07e3dbcf5f8c0f6d40080d725bea7936fc01ad345c01b97dc270" | ||
253 | dependencies = [ | ||
254 | "base64", | ||
255 | "bytes", | ||
256 | "headers-core", | ||
257 | "http", | ||
258 | "httpdate", | ||
259 | "mime", | ||
260 | "sha1", | ||
261 | ] | ||
262 | |||
263 | [[package]] | ||
264 | name = "headers-core" | ||
265 | version = "0.2.0" | ||
266 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
267 | checksum = "e7f66481bfee273957b1f20485a4ff3362987f85b2c236580d81b4eb7a326429" | ||
268 | dependencies = [ | ||
269 | "http", | ||
270 | ] | ||
271 | |||
272 | [[package]] | ||
273 | name = "hermit-abi" | ||
274 | version = "0.3.3" | ||
275 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
276 | checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" | ||
277 | |||
278 | [[package]] | ||
279 | name = "http" | ||
280 | version = "0.2.9" | ||
281 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
282 | checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" | ||
283 | dependencies = [ | ||
284 | "bytes", | ||
285 | "fnv", | ||
286 | "itoa", | ||
287 | ] | ||
288 | |||
289 | [[package]] | ||
290 | name = "http-body" | ||
291 | version = "0.4.5" | ||
292 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
293 | checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" | ||
294 | dependencies = [ | ||
295 | "bytes", | ||
296 | "http", | ||
297 | "pin-project-lite", | ||
298 | ] | ||
299 | |||
300 | [[package]] | ||
301 | name = "httparse" | ||
302 | version = "1.8.0" | ||
303 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
304 | checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" | ||
305 | |||
306 | [[package]] | ||
307 | name = "httpdate" | ||
308 | version = "1.0.3" | ||
309 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
310 | checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" | ||
311 | |||
312 | [[package]] | ||
313 | name = "hyper" | ||
314 | version = "0.14.27" | ||
315 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
316 | checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" | ||
317 | dependencies = [ | ||
318 | "bytes", | ||
319 | "futures-channel", | ||
320 | "futures-core", | ||
321 | "futures-util", | ||
322 | "http", | ||
323 | "http-body", | ||
324 | "httparse", | ||
325 | "httpdate", | ||
326 | "itoa", | ||
327 | "pin-project-lite", | ||
328 | "socket2 0.4.9", | ||
329 | "tokio", | ||
330 | "tower-service", | ||
331 | "tracing", | ||
332 | "want", | ||
333 | ] | ||
334 | |||
335 | [[package]] | ||
336 | name = "itoa" | ||
337 | version = "1.0.9" | ||
338 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
339 | checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" | ||
340 | |||
341 | [[package]] | ||
342 | name = "lazy_static" | ||
343 | version = "1.4.0" | ||
344 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
345 | checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" | ||
346 | |||
347 | [[package]] | ||
348 | name = "libc" | ||
349 | version = "0.2.149" | ||
350 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
351 | checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b" | ||
352 | |||
353 | [[package]] | ||
354 | name = "log" | ||
355 | version = "0.4.20" | ||
356 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
357 | checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" | ||
358 | |||
359 | [[package]] | ||
360 | name = "matchers" | ||
361 | version = "0.1.0" | ||
362 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
363 | checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" | ||
364 | dependencies = [ | ||
365 | "regex-automata 0.1.10", | ||
366 | ] | ||
367 | |||
368 | [[package]] | ||
369 | name = "matchit" | ||
370 | version = "0.7.3" | ||
371 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
372 | checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" | ||
373 | |||
374 | [[package]] | ||
375 | name = "memchr" | ||
376 | version = "2.6.4" | ||
377 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
378 | checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" | ||
379 | |||
380 | [[package]] | ||
381 | name = "mime" | ||
382 | version = "0.3.17" | ||
383 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
384 | checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" | ||
385 | |||
386 | [[package]] | ||
387 | name = "miniz_oxide" | ||
388 | version = "0.7.1" | ||
389 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
390 | checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" | ||
391 | dependencies = [ | ||
392 | "adler", | ||
393 | ] | ||
394 | |||
395 | [[package]] | ||
396 | name = "mio" | ||
397 | version = "0.8.8" | ||
398 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
399 | checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" | ||
400 | dependencies = [ | ||
401 | "libc", | ||
402 | "wasi", | ||
403 | "windows-sys", | ||
404 | ] | ||
405 | |||
406 | [[package]] | ||
407 | name = "nu-ansi-term" | ||
408 | version = "0.46.0" | ||
409 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
410 | checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" | ||
411 | dependencies = [ | ||
412 | "overload", | ||
413 | "winapi", | ||
414 | ] | ||
415 | |||
416 | [[package]] | ||
417 | name = "num_cpus" | ||
418 | version = "1.16.0" | ||
419 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
420 | checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" | ||
421 | dependencies = [ | ||
422 | "hermit-abi", | ||
423 | "libc", | ||
424 | ] | ||
425 | |||
426 | [[package]] | ||
427 | name = "num_threads" | ||
428 | version = "0.1.6" | ||
429 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
430 | checksum = "2819ce041d2ee131036f4fc9d6ae7ae125a3a40e97ba64d04fe799ad9dabbb44" | ||
431 | dependencies = [ | ||
432 | "libc", | ||
433 | ] | ||
434 | |||
435 | [[package]] | ||
436 | name = "object" | ||
437 | version = "0.32.1" | ||
438 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
439 | checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" | ||
440 | dependencies = [ | ||
441 | "memchr", | ||
442 | ] | ||
443 | |||
444 | [[package]] | ||
445 | name = "once_cell" | ||
446 | version = "1.18.0" | ||
447 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
448 | checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" | ||
449 | |||
450 | [[package]] | ||
451 | name = "overload" | ||
452 | version = "0.1.1" | ||
453 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
454 | checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" | ||
455 | |||
456 | [[package]] | ||
457 | name = "percent-encoding" | ||
458 | version = "2.3.0" | ||
459 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
460 | checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" | ||
461 | |||
462 | [[package]] | ||
463 | name = "pin-project" | ||
464 | version = "1.1.3" | ||
465 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
466 | checksum = "fda4ed1c6c173e3fc7a83629421152e01d7b1f9b7f65fb301e490e8cfc656422" | ||
467 | dependencies = [ | ||
468 | "pin-project-internal", | ||
469 | ] | ||
470 | |||
471 | [[package]] | ||
472 | name = "pin-project-internal" | ||
473 | version = "1.1.3" | ||
474 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
475 | checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" | ||
476 | dependencies = [ | ||
477 | "proc-macro2", | ||
478 | "quote", | ||
479 | "syn", | ||
480 | ] | ||
481 | |||
482 | [[package]] | ||
483 | name = "pin-project-lite" | ||
484 | version = "0.2.13" | ||
485 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
486 | checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" | ||
487 | |||
488 | [[package]] | ||
489 | name = "pin-utils" | ||
490 | version = "0.1.0" | ||
491 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
492 | checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" | ||
493 | |||
494 | [[package]] | ||
495 | name = "proc-macro2" | ||
496 | version = "1.0.68" | ||
497 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
498 | checksum = "5b1106fec09662ec6dd98ccac0f81cef56984d0b49f75c92d8cbad76e20c005c" | ||
499 | dependencies = [ | ||
500 | "unicode-ident", | ||
501 | ] | ||
502 | |||
503 | [[package]] | ||
504 | name = "quote" | ||
505 | version = "1.0.33" | ||
506 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
507 | checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" | ||
508 | dependencies = [ | ||
509 | "proc-macro2", | ||
510 | ] | ||
511 | |||
512 | [[package]] | ||
513 | name = "regex" | ||
514 | version = "1.9.6" | ||
515 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
516 | checksum = "ebee201405406dbf528b8b672104ae6d6d63e6d118cb10e4d51abbc7b58044ff" | ||
517 | dependencies = [ | ||
518 | "aho-corasick", | ||
519 | "memchr", | ||
520 | "regex-automata 0.3.9", | ||
521 | "regex-syntax 0.7.5", | ||
522 | ] | ||
523 | |||
524 | [[package]] | ||
525 | name = "regex-automata" | ||
526 | version = "0.1.10" | ||
527 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
528 | checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" | ||
529 | dependencies = [ | ||
530 | "regex-syntax 0.6.29", | ||
531 | ] | ||
532 | |||
533 | [[package]] | ||
534 | name = "regex-automata" | ||
535 | version = "0.3.9" | ||
536 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
537 | checksum = "59b23e92ee4318893fa3fe3e6fb365258efbfe6ac6ab30f090cdcbb7aa37efa9" | ||
538 | dependencies = [ | ||
539 | "aho-corasick", | ||
540 | "memchr", | ||
541 | "regex-syntax 0.7.5", | ||
542 | ] | ||
543 | |||
544 | [[package]] | ||
545 | name = "regex-syntax" | ||
546 | version = "0.6.29" | ||
547 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
548 | checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" | ||
549 | |||
550 | [[package]] | ||
551 | name = "regex-syntax" | ||
552 | version = "0.7.5" | ||
553 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
554 | checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" | ||
555 | |||
556 | [[package]] | ||
557 | name = "rustc-demangle" | ||
558 | version = "0.1.23" | ||
559 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
560 | checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" | ||
561 | |||
562 | [[package]] | ||
563 | name = "rustversion" | ||
564 | version = "1.0.14" | ||
565 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
566 | checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" | ||
567 | |||
568 | [[package]] | ||
569 | name = "ryu" | ||
570 | version = "1.0.15" | ||
571 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
572 | checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" | ||
573 | |||
574 | [[package]] | ||
575 | name = "serde" | ||
576 | version = "1.0.188" | ||
577 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
578 | checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e" | ||
579 | dependencies = [ | ||
580 | "serde_derive", | ||
581 | ] | ||
582 | |||
583 | [[package]] | ||
584 | name = "serde_derive" | ||
585 | version = "1.0.188" | ||
586 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
587 | checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" | ||
588 | dependencies = [ | ||
589 | "proc-macro2", | ||
590 | "quote", | ||
591 | "syn", | ||
592 | ] | ||
593 | |||
594 | [[package]] | ||
595 | name = "serde_json" | ||
596 | version = "1.0.107" | ||
597 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
598 | checksum = "6b420ce6e3d8bd882e9b243c6eed35dbc9a6110c9769e74b584e0d68d1f20c65" | ||
599 | dependencies = [ | ||
600 | "itoa", | ||
601 | "ryu", | ||
602 | "serde", | ||
603 | ] | ||
604 | |||
605 | [[package]] | ||
606 | name = "serde_path_to_error" | ||
607 | version = "0.1.14" | ||
608 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
609 | checksum = "4beec8bce849d58d06238cb50db2e1c417cfeafa4c63f692b15c82b7c80f8335" | ||
610 | dependencies = [ | ||
611 | "itoa", | ||
612 | "serde", | ||
613 | ] | ||
614 | |||
615 | [[package]] | ||
616 | name = "serde_urlencoded" | ||
617 | version = "0.7.1" | ||
618 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
619 | checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" | ||
620 | dependencies = [ | ||
621 | "form_urlencoded", | ||
622 | "itoa", | ||
623 | "ryu", | ||
624 | "serde", | ||
625 | ] | ||
626 | |||
627 | [[package]] | ||
628 | name = "sha1" | ||
629 | version = "0.10.5" | ||
630 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
631 | checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3" | ||
632 | dependencies = [ | ||
633 | "cfg-if", | ||
634 | "cpufeatures", | ||
635 | "digest", | ||
636 | ] | ||
637 | |||
638 | [[package]] | ||
639 | name = "sharded-slab" | ||
640 | version = "0.1.7" | ||
641 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
642 | checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" | ||
643 | dependencies = [ | ||
644 | "lazy_static", | ||
645 | ] | ||
646 | |||
647 | [[package]] | ||
648 | name = "smallvec" | ||
649 | version = "1.11.1" | ||
650 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
651 | checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" | ||
652 | |||
653 | [[package]] | ||
654 | name = "socket2" | ||
655 | version = "0.4.9" | ||
656 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
657 | checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" | ||
658 | dependencies = [ | ||
659 | "libc", | ||
660 | "winapi", | ||
661 | ] | ||
662 | |||
663 | [[package]] | ||
664 | name = "socket2" | ||
665 | version = "0.5.4" | ||
666 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
667 | checksum = "4031e820eb552adee9295814c0ced9e5cf38ddf1e8b7d566d6de8e2538ea989e" | ||
668 | dependencies = [ | ||
669 | "libc", | ||
670 | "windows-sys", | ||
671 | ] | ||
672 | |||
673 | [[package]] | ||
674 | name = "syn" | ||
675 | version = "2.0.38" | ||
676 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
677 | checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b" | ||
678 | dependencies = [ | ||
679 | "proc-macro2", | ||
680 | "quote", | ||
681 | "unicode-ident", | ||
682 | ] | ||
683 | |||
684 | [[package]] | ||
685 | name = "sync_wrapper" | ||
686 | version = "0.1.2" | ||
687 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
688 | checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" | ||
689 | |||
690 | [[package]] | ||
691 | name = "thread_local" | ||
692 | version = "1.1.7" | ||
693 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
694 | checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" | ||
695 | dependencies = [ | ||
696 | "cfg-if", | ||
697 | "once_cell", | ||
698 | ] | ||
699 | |||
700 | [[package]] | ||
701 | name = "time" | ||
702 | version = "0.3.29" | ||
703 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
704 | checksum = "426f806f4089c493dcac0d24c29c01e2c38baf8e30f1b716ee37e83d200b18fe" | ||
705 | dependencies = [ | ||
706 | "deranged", | ||
707 | "itoa", | ||
708 | "libc", | ||
709 | "num_threads", | ||
710 | "serde", | ||
711 | "time-core", | ||
712 | "time-macros", | ||
713 | ] | ||
714 | |||
715 | [[package]] | ||
716 | name = "time-core" | ||
717 | version = "0.1.2" | ||
718 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
719 | checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" | ||
720 | |||
721 | [[package]] | ||
722 | name = "time-macros" | ||
723 | version = "0.2.15" | ||
724 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
725 | checksum = "4ad70d68dba9e1f8aceda7aa6711965dfec1cac869f311a51bd08b3a2ccbce20" | ||
726 | dependencies = [ | ||
727 | "time-core", | ||
728 | ] | ||
729 | |||
730 | [[package]] | ||
731 | name = "tokio" | ||
732 | version = "1.32.0" | ||
733 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
734 | checksum = "17ed6077ed6cd6c74735e21f37eb16dc3935f96878b1fe961074089cc80893f9" | ||
735 | dependencies = [ | ||
736 | "backtrace", | ||
737 | "libc", | ||
738 | "mio", | ||
739 | "num_cpus", | ||
740 | "pin-project-lite", | ||
741 | "socket2 0.5.4", | ||
742 | "tokio-macros", | ||
743 | "windows-sys", | ||
744 | ] | ||
745 | |||
746 | [[package]] | ||
747 | name = "tokio-macros" | ||
748 | version = "2.1.0" | ||
749 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
750 | checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" | ||
751 | dependencies = [ | ||
752 | "proc-macro2", | ||
753 | "quote", | ||
754 | "syn", | ||
755 | ] | ||
756 | |||
757 | [[package]] | ||
758 | name = "tower" | ||
759 | version = "0.4.13" | ||
760 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
761 | checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" | ||
762 | dependencies = [ | ||
763 | "futures-core", | ||
764 | "futures-util", | ||
765 | "pin-project", | ||
766 | "pin-project-lite", | ||
767 | "tokio", | ||
768 | "tower-layer", | ||
769 | "tower-service", | ||
770 | "tracing", | ||
771 | ] | ||
772 | |||
773 | [[package]] | ||
774 | name = "tower-layer" | ||
775 | version = "0.3.2" | ||
776 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
777 | checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" | ||
778 | |||
779 | [[package]] | ||
780 | name = "tower-service" | ||
781 | version = "0.3.2" | ||
782 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
783 | checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" | ||
784 | |||
785 | [[package]] | ||
786 | name = "tracing" | ||
787 | version = "0.1.37" | ||
788 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
789 | checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" | ||
790 | dependencies = [ | ||
791 | "cfg-if", | ||
792 | "log", | ||
793 | "pin-project-lite", | ||
794 | "tracing-attributes", | ||
795 | "tracing-core", | ||
796 | ] | ||
797 | |||
798 | [[package]] | ||
799 | name = "tracing-attributes" | ||
800 | version = "0.1.26" | ||
801 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
802 | checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" | ||
803 | dependencies = [ | ||
804 | "proc-macro2", | ||
805 | "quote", | ||
806 | "syn", | ||
807 | ] | ||
808 | |||
809 | [[package]] | ||
810 | name = "tracing-core" | ||
811 | version = "0.1.31" | ||
812 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
813 | checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a" | ||
814 | dependencies = [ | ||
815 | "once_cell", | ||
816 | "valuable", | ||
817 | ] | ||
818 | |||
819 | [[package]] | ||
820 | name = "tracing-log" | ||
821 | version = "0.1.3" | ||
822 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
823 | checksum = "78ddad33d2d10b1ed7eb9d1f518a5674713876e97e5bb9b7345a7984fbb4f922" | ||
824 | dependencies = [ | ||
825 | "lazy_static", | ||
826 | "log", | ||
827 | "tracing-core", | ||
828 | ] | ||
829 | |||
830 | [[package]] | ||
831 | name = "tracing-subscriber" | ||
832 | version = "0.3.17" | ||
833 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
834 | checksum = "30a651bc37f915e81f087d86e62a18eec5f79550c7faff886f7090b4ea757c77" | ||
835 | dependencies = [ | ||
836 | "matchers", | ||
837 | "nu-ansi-term", | ||
838 | "once_cell", | ||
839 | "regex", | ||
840 | "sharded-slab", | ||
841 | "smallvec", | ||
842 | "thread_local", | ||
843 | "time", | ||
844 | "tracing", | ||
845 | "tracing-core", | ||
846 | "tracing-log", | ||
847 | ] | ||
848 | |||
849 | [[package]] | ||
850 | name = "try-lock" | ||
851 | version = "0.2.4" | ||
852 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
853 | checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" | ||
854 | |||
855 | [[package]] | ||
856 | name = "typenum" | ||
857 | version = "1.17.0" | ||
858 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
859 | checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" | ||
860 | |||
861 | [[package]] | ||
862 | name = "unicode-ident" | ||
863 | version = "1.0.12" | ||
864 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
865 | checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" | ||
866 | |||
867 | [[package]] | ||
868 | name = "valuable" | ||
869 | version = "0.1.0" | ||
870 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
871 | checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" | ||
872 | |||
873 | [[package]] | ||
874 | name = "version_check" | ||
875 | version = "0.9.4" | ||
876 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
877 | checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" | ||
878 | |||
879 | [[package]] | ||
880 | name = "want" | ||
881 | version = "0.3.1" | ||
882 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
883 | checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" | ||
884 | dependencies = [ | ||
885 | "try-lock", | ||
886 | ] | ||
887 | |||
888 | [[package]] | ||
889 | name = "wasi" | ||
890 | version = "0.11.0+wasi-snapshot-preview1" | ||
891 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
892 | checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" | ||
893 | |||
894 | [[package]] | ||
895 | name = "webol" | ||
896 | version = "0.1.0" | ||
897 | dependencies = [ | ||
898 | "axum", | ||
899 | "serde", | ||
900 | "serde_json", | ||
901 | "time", | ||
902 | "tokio", | ||
903 | "tracing", | ||
904 | "tracing-subscriber", | ||
905 | ] | ||
906 | |||
907 | [[package]] | ||
908 | name = "winapi" | ||
909 | version = "0.3.9" | ||
910 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
911 | checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" | ||
912 | dependencies = [ | ||
913 | "winapi-i686-pc-windows-gnu", | ||
914 | "winapi-x86_64-pc-windows-gnu", | ||
915 | ] | ||
916 | |||
917 | [[package]] | ||
918 | name = "winapi-i686-pc-windows-gnu" | ||
919 | version = "0.4.0" | ||
920 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
921 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" | ||
922 | |||
923 | [[package]] | ||
924 | name = "winapi-x86_64-pc-windows-gnu" | ||
925 | version = "0.4.0" | ||
926 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
927 | checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" | ||
928 | |||
929 | [[package]] | ||
930 | name = "windows-sys" | ||
931 | version = "0.48.0" | ||
932 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
933 | checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" | ||
934 | dependencies = [ | ||
935 | "windows-targets", | ||
936 | ] | ||
937 | |||
938 | [[package]] | ||
939 | name = "windows-targets" | ||
940 | version = "0.48.5" | ||
941 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
942 | checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" | ||
943 | dependencies = [ | ||
944 | "windows_aarch64_gnullvm", | ||
945 | "windows_aarch64_msvc", | ||
946 | "windows_i686_gnu", | ||
947 | "windows_i686_msvc", | ||
948 | "windows_x86_64_gnu", | ||
949 | "windows_x86_64_gnullvm", | ||
950 | "windows_x86_64_msvc", | ||
951 | ] | ||
952 | |||
953 | [[package]] | ||
954 | name = "windows_aarch64_gnullvm" | ||
955 | version = "0.48.5" | ||
956 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
957 | checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" | ||
958 | |||
959 | [[package]] | ||
960 | name = "windows_aarch64_msvc" | ||
961 | version = "0.48.5" | ||
962 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
963 | checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" | ||
964 | |||
965 | [[package]] | ||
966 | name = "windows_i686_gnu" | ||
967 | version = "0.48.5" | ||
968 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
969 | checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" | ||
970 | |||
971 | [[package]] | ||
972 | name = "windows_i686_msvc" | ||
973 | version = "0.48.5" | ||
974 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
975 | checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" | ||
976 | |||
977 | [[package]] | ||
978 | name = "windows_x86_64_gnu" | ||
979 | version = "0.48.5" | ||
980 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
981 | checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" | ||
982 | |||
983 | [[package]] | ||
984 | name = "windows_x86_64_gnullvm" | ||
985 | version = "0.48.5" | ||
986 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
987 | checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" | ||
988 | |||
989 | [[package]] | ||
990 | name = "windows_x86_64_msvc" | ||
991 | version = "0.48.5" | ||
992 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
993 | checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" | ||
diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..d0ba7b1 --- /dev/null +++ b/Cargo.toml | |||
@@ -0,0 +1,15 @@ | |||
1 | [package] | ||
2 | name = "webol" | ||
3 | version = "0.1.0" | ||
4 | edition = "2021" | ||
5 | |||
6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
7 | |||
8 | [dependencies] | ||
9 | axum = { version = "0.6.20", features = ["tracing", "headers"] } | ||
10 | tokio = { version = "1.32.0", features = ["macros", "rt-multi-thread"] } | ||
11 | tracing = "0.1.37" | ||
12 | tracing-subscriber = { version = "0.3.17", features = ["env-filter", "local-time", "time"] } | ||
13 | time = { version = "0.3.29", features = ["macros"] } | ||
14 | serde = { version = "1.0.188", features = ["derive"] } | ||
15 | serde_json = "1.0.107" | ||
diff --git a/src/auth.rs b/src/auth.rs new file mode 100644 index 0000000..b1ad76d --- /dev/null +++ b/src/auth.rs | |||
@@ -0,0 +1,3 @@ | |||
1 | pub fn auth(secret: &str) -> bool { | ||
2 | secret == "aaa" | ||
3 | } | ||
diff --git a/src/config.rs b/src/config.rs new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/src/config.rs | |||
diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..60f2214 --- /dev/null +++ b/src/main.rs | |||
@@ -0,0 +1,43 @@ | |||
1 | use axum::{Router, routing::post}; | ||
2 | use time::util::local_offset; | ||
3 | use tracing::{info, level_filters::LevelFilter}; | ||
4 | use tracing_subscriber::{EnvFilter, fmt::{self, time::LocalTime}, prelude::*}; | ||
5 | use crate::routes::start::start; | ||
6 | |||
7 | mod auth; | ||
8 | mod routes; | ||
9 | |||
10 | #[tokio::main] | ||
11 | async fn main() { | ||
12 | |||
13 | unsafe { local_offset::set_soundness(local_offset::Soundness::Unsound); } | ||
14 | let time_format = | ||
15 | time::macros::format_description!("[year]-[month]-[day] [hour]:[minute]:[second]"); | ||
16 | let loc = LocalTime::new(time_format); | ||
17 | |||
18 | tracing_subscriber::registry() | ||
19 | .with(fmt::layer() | ||
20 | .with_timer(loc) | ||
21 | ) | ||
22 | .with( | ||
23 | EnvFilter::builder() | ||
24 | .with_default_directive(LevelFilter::INFO.into()) | ||
25 | .from_env_lossy(), | ||
26 | ) | ||
27 | .init(); | ||
28 | |||
29 | let version = env!("CARGO_PKG_VERSION"); | ||
30 | |||
31 | info!("Starting webol v{}", version); | ||
32 | |||
33 | // build our application with a single route | ||
34 | let app = Router::new() | ||
35 | .route("/start", post(start)); | ||
36 | |||
37 | // run it with hyper on localhost:3000 | ||
38 | axum::Server::bind(&"0.0.0.0:3000".parse().unwrap()) | ||
39 | .serve(app.into_make_service()) | ||
40 | .await | ||
41 | .unwrap(); | ||
42 | } | ||
43 | |||
diff --git a/src/routes/mod.rs b/src/routes/mod.rs new file mode 100644 index 0000000..78d4375 --- /dev/null +++ b/src/routes/mod.rs | |||
@@ -0,0 +1 @@ | |||
pub mod start; \ No newline at end of file | |||
diff --git a/src/routes/start.rs b/src/routes/start.rs new file mode 100644 index 0000000..cda6352 --- /dev/null +++ b/src/routes/start.rs | |||
@@ -0,0 +1,29 @@ | |||
1 | use axum::headers::HeaderMap; | ||
2 | use axum::Json; | ||
3 | use serde::{Deserialize, Serialize}; | ||
4 | use serde_json::{json, Value}; | ||
5 | use crate::auth::auth; | ||
6 | |||
7 | pub async fn start(headers: HeaderMap, Json(payload): Json<StartPayload>) -> Json<Value> { | ||
8 | let mut res = StartResponse { id: payload.id, boot: false }; | ||
9 | if let Some(secret) = headers.get("authorization") { | ||
10 | if !auth(secret.to_str().unwrap()) { Json(json!(res)) } else { | ||
11 | res.boot = true; | ||
12 | Json(json!(res)) | ||
13 | } | ||
14 | } else { | ||
15 | Json(json!(res)) | ||
16 | } | ||
17 | } | ||
18 | |||
19 | #[derive(Deserialize)] | ||
20 | pub struct StartPayload { | ||
21 | id: String, | ||
22 | _test: Option<bool>, | ||
23 | } | ||
24 | |||
25 | #[derive(Serialize)] | ||
26 | struct StartResponse { | ||
27 | id: String, | ||
28 | boot: bool, | ||
29 | } | ||