├── .gitignore ├── Cargo.lock ├── Cargo.toml ├── README.md ├── database.json └── src ├── code_template.rs └── main.rs /.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | -------------------------------------------------------------------------------- /Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 3 4 | 5 | [[package]] 6 | name = "actix-codec" 7 | version = "0.5.1" 8 | source = "registry+https://github.com/rust-lang/crates.io-index" 9 | checksum = "617a8268e3537fe1d8c9ead925fca49ef6400927ee7bc26750e90ecee14ce4b8" 10 | dependencies = [ 11 | "bitflags", 12 | "bytes", 13 | "futures-core", 14 | "futures-sink", 15 | "memchr", 16 | "pin-project-lite", 17 | "tokio", 18 | "tokio-util", 19 | "tracing", 20 | ] 21 | 22 | [[package]] 23 | name = "actix-cors" 24 | version = "0.6.4" 25 | source = "registry+https://github.com/rust-lang/crates.io-index" 26 | checksum = "b340e9cfa5b08690aae90fb61beb44e9b06f44fe3d0f93781aaa58cfba86245e" 27 | dependencies = [ 28 | "actix-utils", 29 | "actix-web", 30 | "derive_more", 31 | "futures-util", 32 | "log", 33 | "once_cell", 34 | "smallvec", 35 | ] 36 | 37 | [[package]] 38 | name = "actix-http" 39 | version = "3.3.1" 40 | source = "registry+https://github.com/rust-lang/crates.io-index" 41 | checksum = "c2079246596c18b4a33e274ae10c0e50613f4d32a4198e09c7b93771013fed74" 42 | dependencies = [ 43 | "actix-codec", 44 | "actix-rt", 45 | "actix-service", 46 | "actix-utils", 47 | "ahash 0.8.3", 48 | "base64", 49 | "bitflags", 50 | "brotli", 51 | "bytes", 52 | "bytestring", 53 | "derive_more", 54 | "encoding_rs", 55 | "flate2", 56 | "futures-core", 57 | "h2", 58 | "http", 59 | "httparse", 60 | "httpdate", 61 | "itoa", 62 | "language-tags", 63 | "local-channel", 64 | "mime", 65 | "percent-encoding", 66 | "pin-project-lite", 67 | "rand", 68 | "sha1", 69 | "smallvec", 70 | "tokio", 71 | "tokio-util", 72 | "tracing", 73 | "zstd", 74 | ] 75 | 76 | [[package]] 77 | name = "actix-macros" 78 | version = "0.2.3" 79 | source = "registry+https://github.com/rust-lang/crates.io-index" 80 | checksum = "465a6172cf69b960917811022d8f29bc0b7fa1398bc4f78b3c466673db1213b6" 81 | dependencies = [ 82 | "quote", 83 | "syn 1.0.109", 84 | ] 85 | 86 | [[package]] 87 | name = "actix-router" 88 | version = "0.5.1" 89 | source = "registry+https://github.com/rust-lang/crates.io-index" 90 | checksum = "d66ff4d247d2b160861fa2866457e85706833527840e4133f8f49aa423a38799" 91 | dependencies = [ 92 | "bytestring", 93 | "http", 94 | "regex", 95 | "serde", 96 | "tracing", 97 | ] 98 | 99 | [[package]] 100 | name = "actix-rt" 101 | version = "2.8.0" 102 | source = "registry+https://github.com/rust-lang/crates.io-index" 103 | checksum = "15265b6b8e2347670eb363c47fc8c75208b4a4994b27192f345fcbe707804f3e" 104 | dependencies = [ 105 | "futures-core", 106 | "tokio", 107 | ] 108 | 109 | [[package]] 110 | name = "actix-server" 111 | version = "2.2.0" 112 | source = "registry+https://github.com/rust-lang/crates.io-index" 113 | checksum = "3e8613a75dd50cc45f473cee3c34d59ed677c0f7b44480ce3b8247d7dc519327" 114 | dependencies = [ 115 | "actix-rt", 116 | "actix-service", 117 | "actix-utils", 118 | "futures-core", 119 | "futures-util", 120 | "mio", 121 | "num_cpus", 122 | "socket2", 123 | "tokio", 124 | "tracing", 125 | ] 126 | 127 | [[package]] 128 | name = "actix-service" 129 | version = "2.0.2" 130 | source = "registry+https://github.com/rust-lang/crates.io-index" 131 | checksum = "3b894941f818cfdc7ccc4b9e60fa7e53b5042a2e8567270f9147d5591893373a" 132 | dependencies = [ 133 | "futures-core", 134 | "paste", 135 | "pin-project-lite", 136 | ] 137 | 138 | [[package]] 139 | name = "actix-utils" 140 | version = "3.0.1" 141 | source = "registry+https://github.com/rust-lang/crates.io-index" 142 | checksum = "88a1dcdff1466e3c2488e1cb5c36a71822750ad43839937f85d2f4d9f8b705d8" 143 | dependencies = [ 144 | "local-waker", 145 | "pin-project-lite", 146 | ] 147 | 148 | [[package]] 149 | name = "actix-web" 150 | version = "4.3.1" 151 | source = "registry+https://github.com/rust-lang/crates.io-index" 152 | checksum = "cd3cb42f9566ab176e1ef0b8b3a896529062b4efc6be0123046095914c4c1c96" 153 | dependencies = [ 154 | "actix-codec", 155 | "actix-http", 156 | "actix-macros", 157 | "actix-router", 158 | "actix-rt", 159 | "actix-server", 160 | "actix-service", 161 | "actix-utils", 162 | "actix-web-codegen", 163 | "ahash 0.7.6", 164 | "bytes", 165 | "bytestring", 166 | "cfg-if", 167 | "cookie", 168 | "derive_more", 169 | "encoding_rs", 170 | "futures-core", 171 | "futures-util", 172 | "http", 173 | "itoa", 174 | "language-tags", 175 | "log", 176 | "mime", 177 | "once_cell", 178 | "pin-project-lite", 179 | "regex", 180 | "serde", 181 | "serde_json", 182 | "serde_urlencoded", 183 | "smallvec", 184 | "socket2", 185 | "time", 186 | "url", 187 | ] 188 | 189 | [[package]] 190 | name = "actix-web-codegen" 191 | version = "4.2.0" 192 | source = "registry+https://github.com/rust-lang/crates.io-index" 193 | checksum = "2262160a7ae29e3415554a3f1fc04c764b1540c116aa524683208078b7a75bc9" 194 | dependencies = [ 195 | "actix-router", 196 | "proc-macro2", 197 | "quote", 198 | "syn 1.0.109", 199 | ] 200 | 201 | [[package]] 202 | name = "adler" 203 | version = "1.0.2" 204 | source = "registry+https://github.com/rust-lang/crates.io-index" 205 | checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" 206 | 207 | [[package]] 208 | name = "ahash" 209 | version = "0.7.6" 210 | source = "registry+https://github.com/rust-lang/crates.io-index" 211 | checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" 212 | dependencies = [ 213 | "getrandom", 214 | "once_cell", 215 | "version_check", 216 | ] 217 | 218 | [[package]] 219 | name = "ahash" 220 | version = "0.8.3" 221 | source = "registry+https://github.com/rust-lang/crates.io-index" 222 | checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" 223 | dependencies = [ 224 | "cfg-if", 225 | "getrandom", 226 | "once_cell", 227 | "version_check", 228 | ] 229 | 230 | [[package]] 231 | name = "aho-corasick" 232 | version = "1.0.2" 233 | source = "registry+https://github.com/rust-lang/crates.io-index" 234 | checksum = "43f6cb1bf222025340178f382c426f13757b2960e89779dfcb319c32542a5a41" 235 | dependencies = [ 236 | "memchr", 237 | ] 238 | 239 | [[package]] 240 | name = "alloc-no-stdlib" 241 | version = "2.0.4" 242 | source = "registry+https://github.com/rust-lang/crates.io-index" 243 | checksum = "cc7bb162ec39d46ab1ca8c77bf72e890535becd1751bb45f64c597edb4c8c6b3" 244 | 245 | [[package]] 246 | name = "alloc-stdlib" 247 | version = "0.2.2" 248 | source = "registry+https://github.com/rust-lang/crates.io-index" 249 | checksum = "94fb8275041c72129eb51b7d0322c29b8387a0386127718b096429201a5d6ece" 250 | dependencies = [ 251 | "alloc-no-stdlib", 252 | ] 253 | 254 | [[package]] 255 | name = "async-trait" 256 | version = "0.1.68" 257 | source = "registry+https://github.com/rust-lang/crates.io-index" 258 | checksum = "b9ccdd8f2a161be9bd5c023df56f1b2a0bd1d83872ae53b71a84a12c9bf6e842" 259 | dependencies = [ 260 | "proc-macro2", 261 | "quote", 262 | "syn 2.0.18", 263 | ] 264 | 265 | [[package]] 266 | name = "autocfg" 267 | version = "1.1.0" 268 | source = "registry+https://github.com/rust-lang/crates.io-index" 269 | checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" 270 | 271 | [[package]] 272 | name = "base64" 273 | version = "0.21.2" 274 | source = "registry+https://github.com/rust-lang/crates.io-index" 275 | checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d" 276 | 277 | [[package]] 278 | name = "bitflags" 279 | version = "1.3.2" 280 | source = "registry+https://github.com/rust-lang/crates.io-index" 281 | checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" 282 | 283 | [[package]] 284 | name = "block-buffer" 285 | version = "0.10.4" 286 | source = "registry+https://github.com/rust-lang/crates.io-index" 287 | checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" 288 | dependencies = [ 289 | "generic-array", 290 | ] 291 | 292 | [[package]] 293 | name = "brotli" 294 | version = "3.3.4" 295 | source = "registry+https://github.com/rust-lang/crates.io-index" 296 | checksum = "a1a0b1dbcc8ae29329621f8d4f0d835787c1c38bb1401979b49d13b0b305ff68" 297 | dependencies = [ 298 | "alloc-no-stdlib", 299 | "alloc-stdlib", 300 | "brotli-decompressor", 301 | ] 302 | 303 | [[package]] 304 | name = "brotli-decompressor" 305 | version = "2.3.4" 306 | source = "registry+https://github.com/rust-lang/crates.io-index" 307 | checksum = "4b6561fd3f895a11e8f72af2cb7d22e08366bebc2b6b57f7744c4bda27034744" 308 | dependencies = [ 309 | "alloc-no-stdlib", 310 | "alloc-stdlib", 311 | ] 312 | 313 | [[package]] 314 | name = "bumpalo" 315 | version = "3.13.0" 316 | source = "registry+https://github.com/rust-lang/crates.io-index" 317 | checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" 318 | 319 | [[package]] 320 | name = "bytes" 321 | version = "1.4.0" 322 | source = "registry+https://github.com/rust-lang/crates.io-index" 323 | checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" 324 | 325 | [[package]] 326 | name = "bytestring" 327 | version = "1.3.0" 328 | source = "registry+https://github.com/rust-lang/crates.io-index" 329 | checksum = "238e4886760d98c4f899360c834fa93e62cf7f721ac3c2da375cbdf4b8679aae" 330 | dependencies = [ 331 | "bytes", 332 | ] 333 | 334 | [[package]] 335 | name = "cc" 336 | version = "1.0.79" 337 | source = "registry+https://github.com/rust-lang/crates.io-index" 338 | checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" 339 | dependencies = [ 340 | "jobserver", 341 | ] 342 | 343 | [[package]] 344 | name = "cfg-if" 345 | version = "1.0.0" 346 | source = "registry+https://github.com/rust-lang/crates.io-index" 347 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" 348 | 349 | [[package]] 350 | name = "convert_case" 351 | version = "0.4.0" 352 | source = "registry+https://github.com/rust-lang/crates.io-index" 353 | checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" 354 | 355 | [[package]] 356 | name = "cookie" 357 | version = "0.16.2" 358 | source = "registry+https://github.com/rust-lang/crates.io-index" 359 | checksum = "e859cd57d0710d9e06c381b550c06e76992472a8c6d527aecd2fc673dcc231fb" 360 | dependencies = [ 361 | "percent-encoding", 362 | "time", 363 | "version_check", 364 | ] 365 | 366 | [[package]] 367 | name = "core-foundation" 368 | version = "0.9.3" 369 | source = "registry+https://github.com/rust-lang/crates.io-index" 370 | checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" 371 | dependencies = [ 372 | "core-foundation-sys", 373 | "libc", 374 | ] 375 | 376 | [[package]] 377 | name = "core-foundation-sys" 378 | version = "0.8.4" 379 | source = "registry+https://github.com/rust-lang/crates.io-index" 380 | checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" 381 | 382 | [[package]] 383 | name = "cpufeatures" 384 | version = "0.2.7" 385 | source = "registry+https://github.com/rust-lang/crates.io-index" 386 | checksum = "3e4c1eaa2012c47becbbad2ab175484c2a84d1185b566fb2cc5b8707343dfe58" 387 | dependencies = [ 388 | "libc", 389 | ] 390 | 391 | [[package]] 392 | name = "crc32fast" 393 | version = "1.3.2" 394 | source = "registry+https://github.com/rust-lang/crates.io-index" 395 | checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" 396 | dependencies = [ 397 | "cfg-if", 398 | ] 399 | 400 | [[package]] 401 | name = "crypto-common" 402 | version = "0.1.6" 403 | source = "registry+https://github.com/rust-lang/crates.io-index" 404 | checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" 405 | dependencies = [ 406 | "generic-array", 407 | "typenum", 408 | ] 409 | 410 | [[package]] 411 | name = "derive_more" 412 | version = "0.99.17" 413 | source = "registry+https://github.com/rust-lang/crates.io-index" 414 | checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" 415 | dependencies = [ 416 | "convert_case", 417 | "proc-macro2", 418 | "quote", 419 | "rustc_version", 420 | "syn 1.0.109", 421 | ] 422 | 423 | [[package]] 424 | name = "digest" 425 | version = "0.10.7" 426 | source = "registry+https://github.com/rust-lang/crates.io-index" 427 | checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" 428 | dependencies = [ 429 | "block-buffer", 430 | "crypto-common", 431 | ] 432 | 433 | [[package]] 434 | name = "dotenv" 435 | version = "0.15.0" 436 | source = "registry+https://github.com/rust-lang/crates.io-index" 437 | checksum = "77c90badedccf4105eca100756a0b1289e191f6fcbdadd3cee1d2f614f97da8f" 438 | 439 | [[package]] 440 | name = "encoding_rs" 441 | version = "0.8.32" 442 | source = "registry+https://github.com/rust-lang/crates.io-index" 443 | checksum = "071a31f4ee85403370b58aca746f01041ede6f0da2730960ad001edc2b71b394" 444 | dependencies = [ 445 | "cfg-if", 446 | ] 447 | 448 | [[package]] 449 | name = "errno" 450 | version = "0.3.1" 451 | source = "registry+https://github.com/rust-lang/crates.io-index" 452 | checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" 453 | dependencies = [ 454 | "errno-dragonfly", 455 | "libc", 456 | "windows-sys 0.48.0", 457 | ] 458 | 459 | [[package]] 460 | name = "errno-dragonfly" 461 | version = "0.1.2" 462 | source = "registry+https://github.com/rust-lang/crates.io-index" 463 | checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" 464 | dependencies = [ 465 | "cc", 466 | "libc", 467 | ] 468 | 469 | [[package]] 470 | name = "fastrand" 471 | version = "1.9.0" 472 | source = "registry+https://github.com/rust-lang/crates.io-index" 473 | checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" 474 | dependencies = [ 475 | "instant", 476 | ] 477 | 478 | [[package]] 479 | name = "flate2" 480 | version = "1.0.26" 481 | source = "registry+https://github.com/rust-lang/crates.io-index" 482 | checksum = "3b9429470923de8e8cbd4d2dc513535400b4b3fef0319fb5c4e1f520a7bef743" 483 | dependencies = [ 484 | "crc32fast", 485 | "miniz_oxide", 486 | ] 487 | 488 | [[package]] 489 | name = "fnv" 490 | version = "1.0.7" 491 | source = "registry+https://github.com/rust-lang/crates.io-index" 492 | checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" 493 | 494 | [[package]] 495 | name = "foreign-types" 496 | version = "0.3.2" 497 | source = "registry+https://github.com/rust-lang/crates.io-index" 498 | checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" 499 | dependencies = [ 500 | "foreign-types-shared", 501 | ] 502 | 503 | [[package]] 504 | name = "foreign-types-shared" 505 | version = "0.1.1" 506 | source = "registry+https://github.com/rust-lang/crates.io-index" 507 | checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" 508 | 509 | [[package]] 510 | name = "form_urlencoded" 511 | version = "1.2.0" 512 | source = "registry+https://github.com/rust-lang/crates.io-index" 513 | checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" 514 | dependencies = [ 515 | "percent-encoding", 516 | ] 517 | 518 | [[package]] 519 | name = "futures-channel" 520 | version = "0.3.28" 521 | source = "registry+https://github.com/rust-lang/crates.io-index" 522 | checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" 523 | dependencies = [ 524 | "futures-core", 525 | ] 526 | 527 | [[package]] 528 | name = "futures-core" 529 | version = "0.3.28" 530 | source = "registry+https://github.com/rust-lang/crates.io-index" 531 | checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" 532 | 533 | [[package]] 534 | name = "futures-sink" 535 | version = "0.3.28" 536 | source = "registry+https://github.com/rust-lang/crates.io-index" 537 | checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" 538 | 539 | [[package]] 540 | name = "futures-task" 541 | version = "0.3.28" 542 | source = "registry+https://github.com/rust-lang/crates.io-index" 543 | checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" 544 | 545 | [[package]] 546 | name = "futures-util" 547 | version = "0.3.28" 548 | source = "registry+https://github.com/rust-lang/crates.io-index" 549 | checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" 550 | dependencies = [ 551 | "futures-core", 552 | "futures-task", 553 | "pin-project-lite", 554 | "pin-utils", 555 | ] 556 | 557 | [[package]] 558 | name = "generic-array" 559 | version = "0.14.7" 560 | source = "registry+https://github.com/rust-lang/crates.io-index" 561 | checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" 562 | dependencies = [ 563 | "typenum", 564 | "version_check", 565 | ] 566 | 567 | [[package]] 568 | name = "getrandom" 569 | version = "0.2.10" 570 | source = "registry+https://github.com/rust-lang/crates.io-index" 571 | checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" 572 | dependencies = [ 573 | "cfg-if", 574 | "libc", 575 | "wasi", 576 | ] 577 | 578 | [[package]] 579 | name = "h2" 580 | version = "0.3.19" 581 | source = "registry+https://github.com/rust-lang/crates.io-index" 582 | checksum = "d357c7ae988e7d2182f7d7871d0b963962420b0678b0997ce7de72001aeab782" 583 | dependencies = [ 584 | "bytes", 585 | "fnv", 586 | "futures-core", 587 | "futures-sink", 588 | "futures-util", 589 | "http", 590 | "indexmap", 591 | "slab", 592 | "tokio", 593 | "tokio-util", 594 | "tracing", 595 | ] 596 | 597 | [[package]] 598 | name = "hashbrown" 599 | version = "0.12.3" 600 | source = "registry+https://github.com/rust-lang/crates.io-index" 601 | checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" 602 | 603 | [[package]] 604 | name = "hermit-abi" 605 | version = "0.2.6" 606 | source = "registry+https://github.com/rust-lang/crates.io-index" 607 | checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" 608 | dependencies = [ 609 | "libc", 610 | ] 611 | 612 | [[package]] 613 | name = "hermit-abi" 614 | version = "0.3.1" 615 | source = "registry+https://github.com/rust-lang/crates.io-index" 616 | checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" 617 | 618 | [[package]] 619 | name = "http" 620 | version = "0.2.9" 621 | source = "registry+https://github.com/rust-lang/crates.io-index" 622 | checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" 623 | dependencies = [ 624 | "bytes", 625 | "fnv", 626 | "itoa", 627 | ] 628 | 629 | [[package]] 630 | name = "http-body" 631 | version = "0.4.5" 632 | source = "registry+https://github.com/rust-lang/crates.io-index" 633 | checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" 634 | dependencies = [ 635 | "bytes", 636 | "http", 637 | "pin-project-lite", 638 | ] 639 | 640 | [[package]] 641 | name = "httparse" 642 | version = "1.8.0" 643 | source = "registry+https://github.com/rust-lang/crates.io-index" 644 | checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" 645 | 646 | [[package]] 647 | name = "httpdate" 648 | version = "1.0.2" 649 | source = "registry+https://github.com/rust-lang/crates.io-index" 650 | checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" 651 | 652 | [[package]] 653 | name = "hyper" 654 | version = "0.14.26" 655 | source = "registry+https://github.com/rust-lang/crates.io-index" 656 | checksum = "ab302d72a6f11a3b910431ff93aae7e773078c769f0a3ef15fb9ec692ed147d4" 657 | dependencies = [ 658 | "bytes", 659 | "futures-channel", 660 | "futures-core", 661 | "futures-util", 662 | "h2", 663 | "http", 664 | "http-body", 665 | "httparse", 666 | "httpdate", 667 | "itoa", 668 | "pin-project-lite", 669 | "socket2", 670 | "tokio", 671 | "tower-service", 672 | "tracing", 673 | "want", 674 | ] 675 | 676 | [[package]] 677 | name = "hyper-tls" 678 | version = "0.5.0" 679 | source = "registry+https://github.com/rust-lang/crates.io-index" 680 | checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" 681 | dependencies = [ 682 | "bytes", 683 | "hyper", 684 | "native-tls", 685 | "tokio", 686 | "tokio-native-tls", 687 | ] 688 | 689 | [[package]] 690 | name = "idna" 691 | version = "0.4.0" 692 | source = "registry+https://github.com/rust-lang/crates.io-index" 693 | checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" 694 | dependencies = [ 695 | "unicode-bidi", 696 | "unicode-normalization", 697 | ] 698 | 699 | [[package]] 700 | name = "indexmap" 701 | version = "1.9.3" 702 | source = "registry+https://github.com/rust-lang/crates.io-index" 703 | checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" 704 | dependencies = [ 705 | "autocfg", 706 | "hashbrown", 707 | ] 708 | 709 | [[package]] 710 | name = "instant" 711 | version = "0.1.12" 712 | source = "registry+https://github.com/rust-lang/crates.io-index" 713 | checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" 714 | dependencies = [ 715 | "cfg-if", 716 | ] 717 | 718 | [[package]] 719 | name = "io-lifetimes" 720 | version = "1.0.11" 721 | source = "registry+https://github.com/rust-lang/crates.io-index" 722 | checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" 723 | dependencies = [ 724 | "hermit-abi 0.3.1", 725 | "libc", 726 | "windows-sys 0.48.0", 727 | ] 728 | 729 | [[package]] 730 | name = "ipnet" 731 | version = "2.7.2" 732 | source = "registry+https://github.com/rust-lang/crates.io-index" 733 | checksum = "12b6ee2129af8d4fb011108c73d99a1b83a85977f23b82460c0ae2e25bb4b57f" 734 | 735 | [[package]] 736 | name = "itoa" 737 | version = "1.0.6" 738 | source = "registry+https://github.com/rust-lang/crates.io-index" 739 | checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" 740 | 741 | [[package]] 742 | name = "jobserver" 743 | version = "0.1.26" 744 | source = "registry+https://github.com/rust-lang/crates.io-index" 745 | checksum = "936cfd212a0155903bcbc060e316fb6cc7cbf2e1907329391ebadc1fe0ce77c2" 746 | dependencies = [ 747 | "libc", 748 | ] 749 | 750 | [[package]] 751 | name = "js-sys" 752 | version = "0.3.63" 753 | source = "registry+https://github.com/rust-lang/crates.io-index" 754 | checksum = "2f37a4a5928311ac501dee68b3c7613a1037d0edb30c8e5427bd832d55d1b790" 755 | dependencies = [ 756 | "wasm-bindgen", 757 | ] 758 | 759 | [[package]] 760 | name = "language-tags" 761 | version = "0.3.2" 762 | source = "registry+https://github.com/rust-lang/crates.io-index" 763 | checksum = "d4345964bb142484797b161f473a503a434de77149dd8c7427788c6e13379388" 764 | 765 | [[package]] 766 | name = "lazy_static" 767 | version = "1.4.0" 768 | source = "registry+https://github.com/rust-lang/crates.io-index" 769 | checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" 770 | 771 | [[package]] 772 | name = "libc" 773 | version = "0.2.146" 774 | source = "registry+https://github.com/rust-lang/crates.io-index" 775 | checksum = "f92be4933c13fd498862a9e02a3055f8a8d9c039ce33db97306fd5a6caa7f29b" 776 | 777 | [[package]] 778 | name = "linux-raw-sys" 779 | version = "0.3.8" 780 | source = "registry+https://github.com/rust-lang/crates.io-index" 781 | checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" 782 | 783 | [[package]] 784 | name = "local-channel" 785 | version = "0.1.3" 786 | source = "registry+https://github.com/rust-lang/crates.io-index" 787 | checksum = "7f303ec0e94c6c54447f84f3b0ef7af769858a9c4ef56ef2a986d3dcd4c3fc9c" 788 | dependencies = [ 789 | "futures-core", 790 | "futures-sink", 791 | "futures-util", 792 | "local-waker", 793 | ] 794 | 795 | [[package]] 796 | name = "local-waker" 797 | version = "0.1.3" 798 | source = "registry+https://github.com/rust-lang/crates.io-index" 799 | checksum = "e34f76eb3611940e0e7d53a9aaa4e6a3151f69541a282fd0dad5571420c53ff1" 800 | 801 | [[package]] 802 | name = "lock_api" 803 | version = "0.4.10" 804 | source = "registry+https://github.com/rust-lang/crates.io-index" 805 | checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" 806 | dependencies = [ 807 | "autocfg", 808 | "scopeguard", 809 | ] 810 | 811 | [[package]] 812 | name = "log" 813 | version = "0.4.18" 814 | source = "registry+https://github.com/rust-lang/crates.io-index" 815 | checksum = "518ef76f2f87365916b142844c16d8fefd85039bc5699050210a7778ee1cd1de" 816 | 817 | [[package]] 818 | name = "memchr" 819 | version = "2.5.0" 820 | source = "registry+https://github.com/rust-lang/crates.io-index" 821 | checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" 822 | 823 | [[package]] 824 | name = "mime" 825 | version = "0.3.17" 826 | source = "registry+https://github.com/rust-lang/crates.io-index" 827 | checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" 828 | 829 | [[package]] 830 | name = "miniz_oxide" 831 | version = "0.7.1" 832 | source = "registry+https://github.com/rust-lang/crates.io-index" 833 | checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" 834 | dependencies = [ 835 | "adler", 836 | ] 837 | 838 | [[package]] 839 | name = "mio" 840 | version = "0.8.8" 841 | source = "registry+https://github.com/rust-lang/crates.io-index" 842 | checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" 843 | dependencies = [ 844 | "libc", 845 | "log", 846 | "wasi", 847 | "windows-sys 0.48.0", 848 | ] 849 | 850 | [[package]] 851 | name = "native-tls" 852 | version = "0.2.11" 853 | source = "registry+https://github.com/rust-lang/crates.io-index" 854 | checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" 855 | dependencies = [ 856 | "lazy_static", 857 | "libc", 858 | "log", 859 | "openssl", 860 | "openssl-probe", 861 | "openssl-sys", 862 | "schannel", 863 | "security-framework", 864 | "security-framework-sys", 865 | "tempfile", 866 | ] 867 | 868 | [[package]] 869 | name = "num_cpus" 870 | version = "1.15.0" 871 | source = "registry+https://github.com/rust-lang/crates.io-index" 872 | checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" 873 | dependencies = [ 874 | "hermit-abi 0.2.6", 875 | "libc", 876 | ] 877 | 878 | [[package]] 879 | name = "once_cell" 880 | version = "1.18.0" 881 | source = "registry+https://github.com/rust-lang/crates.io-index" 882 | checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" 883 | 884 | [[package]] 885 | name = "openssl" 886 | version = "0.10.54" 887 | source = "registry+https://github.com/rust-lang/crates.io-index" 888 | checksum = "69b3f656a17a6cbc115b5c7a40c616947d213ba182135b014d6051b73ab6f019" 889 | dependencies = [ 890 | "bitflags", 891 | "cfg-if", 892 | "foreign-types", 893 | "libc", 894 | "once_cell", 895 | "openssl-macros", 896 | "openssl-sys", 897 | ] 898 | 899 | [[package]] 900 | name = "openssl-macros" 901 | version = "0.1.1" 902 | source = "registry+https://github.com/rust-lang/crates.io-index" 903 | checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" 904 | dependencies = [ 905 | "proc-macro2", 906 | "quote", 907 | "syn 2.0.18", 908 | ] 909 | 910 | [[package]] 911 | name = "openssl-probe" 912 | version = "0.1.5" 913 | source = "registry+https://github.com/rust-lang/crates.io-index" 914 | checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" 915 | 916 | [[package]] 917 | name = "openssl-sys" 918 | version = "0.9.88" 919 | source = "registry+https://github.com/rust-lang/crates.io-index" 920 | checksum = "c2ce0f250f34a308dcfdbb351f511359857d4ed2134ba715a4eadd46e1ffd617" 921 | dependencies = [ 922 | "cc", 923 | "libc", 924 | "pkg-config", 925 | "vcpkg", 926 | ] 927 | 928 | [[package]] 929 | name = "parking_lot" 930 | version = "0.12.1" 931 | source = "registry+https://github.com/rust-lang/crates.io-index" 932 | checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" 933 | dependencies = [ 934 | "lock_api", 935 | "parking_lot_core", 936 | ] 937 | 938 | [[package]] 939 | name = "parking_lot_core" 940 | version = "0.9.8" 941 | source = "registry+https://github.com/rust-lang/crates.io-index" 942 | checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" 943 | dependencies = [ 944 | "cfg-if", 945 | "libc", 946 | "redox_syscall", 947 | "smallvec", 948 | "windows-targets", 949 | ] 950 | 951 | [[package]] 952 | name = "paste" 953 | version = "1.0.12" 954 | source = "registry+https://github.com/rust-lang/crates.io-index" 955 | checksum = "9f746c4065a8fa3fe23974dd82f15431cc8d40779821001404d10d2e79ca7d79" 956 | 957 | [[package]] 958 | name = "percent-encoding" 959 | version = "2.3.0" 960 | source = "registry+https://github.com/rust-lang/crates.io-index" 961 | checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" 962 | 963 | [[package]] 964 | name = "pin-project-lite" 965 | version = "0.2.9" 966 | source = "registry+https://github.com/rust-lang/crates.io-index" 967 | checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" 968 | 969 | [[package]] 970 | name = "pin-utils" 971 | version = "0.1.0" 972 | source = "registry+https://github.com/rust-lang/crates.io-index" 973 | checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" 974 | 975 | [[package]] 976 | name = "pkg-config" 977 | version = "0.3.27" 978 | source = "registry+https://github.com/rust-lang/crates.io-index" 979 | checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" 980 | 981 | [[package]] 982 | name = "ppv-lite86" 983 | version = "0.2.17" 984 | source = "registry+https://github.com/rust-lang/crates.io-index" 985 | checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" 986 | 987 | [[package]] 988 | name = "proc-macro2" 989 | version = "1.0.59" 990 | source = "registry+https://github.com/rust-lang/crates.io-index" 991 | checksum = "6aeca18b86b413c660b781aa319e4e2648a3e6f9eadc9b47e9038e6fe9f3451b" 992 | dependencies = [ 993 | "unicode-ident", 994 | ] 995 | 996 | [[package]] 997 | name = "quote" 998 | version = "1.0.28" 999 | source = "registry+https://github.com/rust-lang/crates.io-index" 1000 | checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" 1001 | dependencies = [ 1002 | "proc-macro2", 1003 | ] 1004 | 1005 | [[package]] 1006 | name = "rand" 1007 | version = "0.8.5" 1008 | source = "registry+https://github.com/rust-lang/crates.io-index" 1009 | checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" 1010 | dependencies = [ 1011 | "libc", 1012 | "rand_chacha", 1013 | "rand_core", 1014 | ] 1015 | 1016 | [[package]] 1017 | name = "rand_chacha" 1018 | version = "0.3.1" 1019 | source = "registry+https://github.com/rust-lang/crates.io-index" 1020 | checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" 1021 | dependencies = [ 1022 | "ppv-lite86", 1023 | "rand_core", 1024 | ] 1025 | 1026 | [[package]] 1027 | name = "rand_core" 1028 | version = "0.6.4" 1029 | source = "registry+https://github.com/rust-lang/crates.io-index" 1030 | checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" 1031 | dependencies = [ 1032 | "getrandom", 1033 | ] 1034 | 1035 | [[package]] 1036 | name = "redox_syscall" 1037 | version = "0.3.5" 1038 | source = "registry+https://github.com/rust-lang/crates.io-index" 1039 | checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" 1040 | dependencies = [ 1041 | "bitflags", 1042 | ] 1043 | 1044 | [[package]] 1045 | name = "regex" 1046 | version = "1.8.4" 1047 | source = "registry+https://github.com/rust-lang/crates.io-index" 1048 | checksum = "d0ab3ca65655bb1e41f2a8c8cd662eb4fb035e67c3f78da1d61dffe89d07300f" 1049 | dependencies = [ 1050 | "aho-corasick", 1051 | "memchr", 1052 | "regex-syntax", 1053 | ] 1054 | 1055 | [[package]] 1056 | name = "regex-syntax" 1057 | version = "0.7.2" 1058 | source = "registry+https://github.com/rust-lang/crates.io-index" 1059 | checksum = "436b050e76ed2903236f032a59761c1eb99e1b0aead2c257922771dab1fc8c78" 1060 | 1061 | [[package]] 1062 | name = "reqwest" 1063 | version = "0.11.18" 1064 | source = "registry+https://github.com/rust-lang/crates.io-index" 1065 | checksum = "cde824a14b7c14f85caff81225f411faacc04a2013f41670f41443742b1c1c55" 1066 | dependencies = [ 1067 | "base64", 1068 | "bytes", 1069 | "encoding_rs", 1070 | "futures-core", 1071 | "futures-util", 1072 | "h2", 1073 | "http", 1074 | "http-body", 1075 | "hyper", 1076 | "hyper-tls", 1077 | "ipnet", 1078 | "js-sys", 1079 | "log", 1080 | "mime", 1081 | "native-tls", 1082 | "once_cell", 1083 | "percent-encoding", 1084 | "pin-project-lite", 1085 | "serde", 1086 | "serde_json", 1087 | "serde_urlencoded", 1088 | "tokio", 1089 | "tokio-native-tls", 1090 | "tower-service", 1091 | "url", 1092 | "wasm-bindgen", 1093 | "wasm-bindgen-futures", 1094 | "web-sys", 1095 | "winreg", 1096 | ] 1097 | 1098 | [[package]] 1099 | name = "rustc_version" 1100 | version = "0.4.0" 1101 | source = "registry+https://github.com/rust-lang/crates.io-index" 1102 | checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" 1103 | dependencies = [ 1104 | "semver", 1105 | ] 1106 | 1107 | [[package]] 1108 | name = "rustix" 1109 | version = "0.37.19" 1110 | source = "registry+https://github.com/rust-lang/crates.io-index" 1111 | checksum = "acf8729d8542766f1b2cf77eb034d52f40d375bb8b615d0b147089946e16613d" 1112 | dependencies = [ 1113 | "bitflags", 1114 | "errno", 1115 | "io-lifetimes", 1116 | "libc", 1117 | "linux-raw-sys", 1118 | "windows-sys 0.48.0", 1119 | ] 1120 | 1121 | [[package]] 1122 | name = "ryu" 1123 | version = "1.0.13" 1124 | source = "registry+https://github.com/rust-lang/crates.io-index" 1125 | checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" 1126 | 1127 | [[package]] 1128 | name = "schannel" 1129 | version = "0.1.21" 1130 | source = "registry+https://github.com/rust-lang/crates.io-index" 1131 | checksum = "713cfb06c7059f3588fb8044c0fad1d09e3c01d225e25b9220dbfdcf16dbb1b3" 1132 | dependencies = [ 1133 | "windows-sys 0.42.0", 1134 | ] 1135 | 1136 | [[package]] 1137 | name = "scopeguard" 1138 | version = "1.1.0" 1139 | source = "registry+https://github.com/rust-lang/crates.io-index" 1140 | checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" 1141 | 1142 | [[package]] 1143 | name = "security-framework" 1144 | version = "2.9.1" 1145 | source = "registry+https://github.com/rust-lang/crates.io-index" 1146 | checksum = "1fc758eb7bffce5b308734e9b0c1468893cae9ff70ebf13e7090be8dcbcc83a8" 1147 | dependencies = [ 1148 | "bitflags", 1149 | "core-foundation", 1150 | "core-foundation-sys", 1151 | "libc", 1152 | "security-framework-sys", 1153 | ] 1154 | 1155 | [[package]] 1156 | name = "security-framework-sys" 1157 | version = "2.9.0" 1158 | source = "registry+https://github.com/rust-lang/crates.io-index" 1159 | checksum = "f51d0c0d83bec45f16480d0ce0058397a69e48fcdc52d1dc8855fb68acbd31a7" 1160 | dependencies = [ 1161 | "core-foundation-sys", 1162 | "libc", 1163 | ] 1164 | 1165 | [[package]] 1166 | name = "semver" 1167 | version = "1.0.17" 1168 | source = "registry+https://github.com/rust-lang/crates.io-index" 1169 | checksum = "bebd363326d05ec3e2f532ab7660680f3b02130d780c299bca73469d521bc0ed" 1170 | 1171 | [[package]] 1172 | name = "serde" 1173 | version = "1.0.163" 1174 | source = "registry+https://github.com/rust-lang/crates.io-index" 1175 | checksum = "2113ab51b87a539ae008b5c6c02dc020ffa39afd2d83cffcb3f4eb2722cebec2" 1176 | dependencies = [ 1177 | "serde_derive", 1178 | ] 1179 | 1180 | [[package]] 1181 | name = "serde_derive" 1182 | version = "1.0.163" 1183 | source = "registry+https://github.com/rust-lang/crates.io-index" 1184 | checksum = "8c805777e3930c8883389c602315a24224bcc738b63905ef87cd1420353ea93e" 1185 | dependencies = [ 1186 | "proc-macro2", 1187 | "quote", 1188 | "syn 2.0.18", 1189 | ] 1190 | 1191 | [[package]] 1192 | name = "serde_json" 1193 | version = "1.0.96" 1194 | source = "registry+https://github.com/rust-lang/crates.io-index" 1195 | checksum = "057d394a50403bcac12672b2b18fb387ab6d289d957dab67dd201875391e52f1" 1196 | dependencies = [ 1197 | "itoa", 1198 | "ryu", 1199 | "serde", 1200 | ] 1201 | 1202 | [[package]] 1203 | name = "serde_urlencoded" 1204 | version = "0.7.1" 1205 | source = "registry+https://github.com/rust-lang/crates.io-index" 1206 | checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" 1207 | dependencies = [ 1208 | "form_urlencoded", 1209 | "itoa", 1210 | "ryu", 1211 | "serde", 1212 | ] 1213 | 1214 | [[package]] 1215 | name = "sha1" 1216 | version = "0.10.5" 1217 | source = "registry+https://github.com/rust-lang/crates.io-index" 1218 | checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3" 1219 | dependencies = [ 1220 | "cfg-if", 1221 | "cpufeatures", 1222 | "digest", 1223 | ] 1224 | 1225 | [[package]] 1226 | name = "signal-hook-registry" 1227 | version = "1.4.1" 1228 | source = "registry+https://github.com/rust-lang/crates.io-index" 1229 | checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" 1230 | dependencies = [ 1231 | "libc", 1232 | ] 1233 | 1234 | [[package]] 1235 | name = "slab" 1236 | version = "0.4.8" 1237 | source = "registry+https://github.com/rust-lang/crates.io-index" 1238 | checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d" 1239 | dependencies = [ 1240 | "autocfg", 1241 | ] 1242 | 1243 | [[package]] 1244 | name = "smallvec" 1245 | version = "1.10.0" 1246 | source = "registry+https://github.com/rust-lang/crates.io-index" 1247 | checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" 1248 | 1249 | [[package]] 1250 | name = "socket2" 1251 | version = "0.4.9" 1252 | source = "registry+https://github.com/rust-lang/crates.io-index" 1253 | checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" 1254 | dependencies = [ 1255 | "libc", 1256 | "winapi", 1257 | ] 1258 | 1259 | [[package]] 1260 | name = "syn" 1261 | version = "1.0.109" 1262 | source = "registry+https://github.com/rust-lang/crates.io-index" 1263 | checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" 1264 | dependencies = [ 1265 | "proc-macro2", 1266 | "quote", 1267 | "unicode-ident", 1268 | ] 1269 | 1270 | [[package]] 1271 | name = "syn" 1272 | version = "2.0.18" 1273 | source = "registry+https://github.com/rust-lang/crates.io-index" 1274 | checksum = "32d41677bcbe24c20c52e7c70b0d8db04134c5d1066bf98662e2871ad200ea3e" 1275 | dependencies = [ 1276 | "proc-macro2", 1277 | "quote", 1278 | "unicode-ident", 1279 | ] 1280 | 1281 | [[package]] 1282 | name = "tempfile" 1283 | version = "3.6.0" 1284 | source = "registry+https://github.com/rust-lang/crates.io-index" 1285 | checksum = "31c0432476357e58790aaa47a8efb0c5138f137343f3b5f23bd36a27e3b0a6d6" 1286 | dependencies = [ 1287 | "autocfg", 1288 | "cfg-if", 1289 | "fastrand", 1290 | "redox_syscall", 1291 | "rustix", 1292 | "windows-sys 0.48.0", 1293 | ] 1294 | 1295 | [[package]] 1296 | name = "time" 1297 | version = "0.3.21" 1298 | source = "registry+https://github.com/rust-lang/crates.io-index" 1299 | checksum = "8f3403384eaacbca9923fa06940178ac13e4edb725486d70e8e15881d0c836cc" 1300 | dependencies = [ 1301 | "itoa", 1302 | "serde", 1303 | "time-core", 1304 | "time-macros", 1305 | ] 1306 | 1307 | [[package]] 1308 | name = "time-core" 1309 | version = "0.1.1" 1310 | source = "registry+https://github.com/rust-lang/crates.io-index" 1311 | checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb" 1312 | 1313 | [[package]] 1314 | name = "time-macros" 1315 | version = "0.2.9" 1316 | source = "registry+https://github.com/rust-lang/crates.io-index" 1317 | checksum = "372950940a5f07bf38dbe211d7283c9e6d7327df53794992d293e534c733d09b" 1318 | dependencies = [ 1319 | "time-core", 1320 | ] 1321 | 1322 | [[package]] 1323 | name = "tinyvec" 1324 | version = "1.6.0" 1325 | source = "registry+https://github.com/rust-lang/crates.io-index" 1326 | checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" 1327 | dependencies = [ 1328 | "tinyvec_macros", 1329 | ] 1330 | 1331 | [[package]] 1332 | name = "tinyvec_macros" 1333 | version = "0.1.1" 1334 | source = "registry+https://github.com/rust-lang/crates.io-index" 1335 | checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" 1336 | 1337 | [[package]] 1338 | name = "tokio" 1339 | version = "1.28.2" 1340 | source = "registry+https://github.com/rust-lang/crates.io-index" 1341 | checksum = "94d7b1cfd2aa4011f2de74c2c4c63665e27a71006b0a192dcd2710272e73dfa2" 1342 | dependencies = [ 1343 | "autocfg", 1344 | "bytes", 1345 | "libc", 1346 | "mio", 1347 | "num_cpus", 1348 | "parking_lot", 1349 | "pin-project-lite", 1350 | "signal-hook-registry", 1351 | "socket2", 1352 | "tokio-macros", 1353 | "windows-sys 0.48.0", 1354 | ] 1355 | 1356 | [[package]] 1357 | name = "tokio-macros" 1358 | version = "2.1.0" 1359 | source = "registry+https://github.com/rust-lang/crates.io-index" 1360 | checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" 1361 | dependencies = [ 1362 | "proc-macro2", 1363 | "quote", 1364 | "syn 2.0.18", 1365 | ] 1366 | 1367 | [[package]] 1368 | name = "tokio-native-tls" 1369 | version = "0.3.1" 1370 | source = "registry+https://github.com/rust-lang/crates.io-index" 1371 | checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" 1372 | dependencies = [ 1373 | "native-tls", 1374 | "tokio", 1375 | ] 1376 | 1377 | [[package]] 1378 | name = "tokio-util" 1379 | version = "0.7.8" 1380 | source = "registry+https://github.com/rust-lang/crates.io-index" 1381 | checksum = "806fe8c2c87eccc8b3267cbae29ed3ab2d0bd37fca70ab622e46aaa9375ddb7d" 1382 | dependencies = [ 1383 | "bytes", 1384 | "futures-core", 1385 | "futures-sink", 1386 | "pin-project-lite", 1387 | "tokio", 1388 | "tracing", 1389 | ] 1390 | 1391 | [[package]] 1392 | name = "tower-service" 1393 | version = "0.3.2" 1394 | source = "registry+https://github.com/rust-lang/crates.io-index" 1395 | checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" 1396 | 1397 | [[package]] 1398 | name = "tracing" 1399 | version = "0.1.37" 1400 | source = "registry+https://github.com/rust-lang/crates.io-index" 1401 | checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" 1402 | dependencies = [ 1403 | "cfg-if", 1404 | "log", 1405 | "pin-project-lite", 1406 | "tracing-core", 1407 | ] 1408 | 1409 | [[package]] 1410 | name = "tracing-core" 1411 | version = "0.1.31" 1412 | source = "registry+https://github.com/rust-lang/crates.io-index" 1413 | checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a" 1414 | dependencies = [ 1415 | "once_cell", 1416 | ] 1417 | 1418 | [[package]] 1419 | name = "try-lock" 1420 | version = "0.2.4" 1421 | source = "registry+https://github.com/rust-lang/crates.io-index" 1422 | checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" 1423 | 1424 | [[package]] 1425 | name = "typenum" 1426 | version = "1.16.0" 1427 | source = "registry+https://github.com/rust-lang/crates.io-index" 1428 | checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" 1429 | 1430 | [[package]] 1431 | name = "unicode-bidi" 1432 | version = "0.3.13" 1433 | source = "registry+https://github.com/rust-lang/crates.io-index" 1434 | checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" 1435 | 1436 | [[package]] 1437 | name = "unicode-ident" 1438 | version = "1.0.9" 1439 | source = "registry+https://github.com/rust-lang/crates.io-index" 1440 | checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" 1441 | 1442 | [[package]] 1443 | name = "unicode-normalization" 1444 | version = "0.1.22" 1445 | source = "registry+https://github.com/rust-lang/crates.io-index" 1446 | checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" 1447 | dependencies = [ 1448 | "tinyvec", 1449 | ] 1450 | 1451 | [[package]] 1452 | name = "url" 1453 | version = "2.4.0" 1454 | source = "registry+https://github.com/rust-lang/crates.io-index" 1455 | checksum = "50bff7831e19200a85b17131d085c25d7811bc4e186efdaf54bbd132994a88cb" 1456 | dependencies = [ 1457 | "form_urlencoded", 1458 | "idna", 1459 | "percent-encoding", 1460 | ] 1461 | 1462 | [[package]] 1463 | name = "vcpkg" 1464 | version = "0.2.15" 1465 | source = "registry+https://github.com/rust-lang/crates.io-index" 1466 | checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" 1467 | 1468 | [[package]] 1469 | name = "version_check" 1470 | version = "0.9.4" 1471 | source = "registry+https://github.com/rust-lang/crates.io-index" 1472 | checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" 1473 | 1474 | [[package]] 1475 | name = "want" 1476 | version = "0.3.0" 1477 | source = "registry+https://github.com/rust-lang/crates.io-index" 1478 | checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" 1479 | dependencies = [ 1480 | "log", 1481 | "try-lock", 1482 | ] 1483 | 1484 | [[package]] 1485 | name = "wasi" 1486 | version = "0.11.0+wasi-snapshot-preview1" 1487 | source = "registry+https://github.com/rust-lang/crates.io-index" 1488 | checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" 1489 | 1490 | [[package]] 1491 | name = "wasm-bindgen" 1492 | version = "0.2.86" 1493 | source = "registry+https://github.com/rust-lang/crates.io-index" 1494 | checksum = "5bba0e8cb82ba49ff4e229459ff22a191bbe9a1cb3a341610c9c33efc27ddf73" 1495 | dependencies = [ 1496 | "cfg-if", 1497 | "wasm-bindgen-macro", 1498 | ] 1499 | 1500 | [[package]] 1501 | name = "wasm-bindgen-backend" 1502 | version = "0.2.86" 1503 | source = "registry+https://github.com/rust-lang/crates.io-index" 1504 | checksum = "19b04bc93f9d6bdee709f6bd2118f57dd6679cf1176a1af464fca3ab0d66d8fb" 1505 | dependencies = [ 1506 | "bumpalo", 1507 | "log", 1508 | "once_cell", 1509 | "proc-macro2", 1510 | "quote", 1511 | "syn 2.0.18", 1512 | "wasm-bindgen-shared", 1513 | ] 1514 | 1515 | [[package]] 1516 | name = "wasm-bindgen-futures" 1517 | version = "0.4.36" 1518 | source = "registry+https://github.com/rust-lang/crates.io-index" 1519 | checksum = "2d1985d03709c53167ce907ff394f5316aa22cb4e12761295c5dc57dacb6297e" 1520 | dependencies = [ 1521 | "cfg-if", 1522 | "js-sys", 1523 | "wasm-bindgen", 1524 | "web-sys", 1525 | ] 1526 | 1527 | [[package]] 1528 | name = "wasm-bindgen-macro" 1529 | version = "0.2.86" 1530 | source = "registry+https://github.com/rust-lang/crates.io-index" 1531 | checksum = "14d6b024f1a526bb0234f52840389927257beb670610081360e5a03c5df9c258" 1532 | dependencies = [ 1533 | "quote", 1534 | "wasm-bindgen-macro-support", 1535 | ] 1536 | 1537 | [[package]] 1538 | name = "wasm-bindgen-macro-support" 1539 | version = "0.2.86" 1540 | source = "registry+https://github.com/rust-lang/crates.io-index" 1541 | checksum = "e128beba882dd1eb6200e1dc92ae6c5dbaa4311aa7bb211ca035779e5efc39f8" 1542 | dependencies = [ 1543 | "proc-macro2", 1544 | "quote", 1545 | "syn 2.0.18", 1546 | "wasm-bindgen-backend", 1547 | "wasm-bindgen-shared", 1548 | ] 1549 | 1550 | [[package]] 1551 | name = "wasm-bindgen-shared" 1552 | version = "0.2.86" 1553 | source = "registry+https://github.com/rust-lang/crates.io-index" 1554 | checksum = "ed9d5b4305409d1fc9482fee2d7f9bcbf24b3972bf59817ef757e23982242a93" 1555 | 1556 | [[package]] 1557 | name = "web-sys" 1558 | version = "0.3.63" 1559 | source = "registry+https://github.com/rust-lang/crates.io-index" 1560 | checksum = "3bdd9ef4e984da1187bf8110c5cf5b845fbc87a23602cdf912386a76fcd3a7c2" 1561 | dependencies = [ 1562 | "js-sys", 1563 | "wasm-bindgen", 1564 | ] 1565 | 1566 | [[package]] 1567 | name = "web_template" 1568 | version = "0.1.0" 1569 | dependencies = [ 1570 | "actix-cors", 1571 | "actix-web", 1572 | "async-trait", 1573 | "dotenv", 1574 | "rand", 1575 | "reqwest", 1576 | "serde", 1577 | "serde_json", 1578 | "tokio", 1579 | ] 1580 | 1581 | [[package]] 1582 | name = "winapi" 1583 | version = "0.3.9" 1584 | source = "registry+https://github.com/rust-lang/crates.io-index" 1585 | checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" 1586 | dependencies = [ 1587 | "winapi-i686-pc-windows-gnu", 1588 | "winapi-x86_64-pc-windows-gnu", 1589 | ] 1590 | 1591 | [[package]] 1592 | name = "winapi-i686-pc-windows-gnu" 1593 | version = "0.4.0" 1594 | source = "registry+https://github.com/rust-lang/crates.io-index" 1595 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 1596 | 1597 | [[package]] 1598 | name = "winapi-x86_64-pc-windows-gnu" 1599 | version = "0.4.0" 1600 | source = "registry+https://github.com/rust-lang/crates.io-index" 1601 | checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 1602 | 1603 | [[package]] 1604 | name = "windows-sys" 1605 | version = "0.42.0" 1606 | source = "registry+https://github.com/rust-lang/crates.io-index" 1607 | checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" 1608 | dependencies = [ 1609 | "windows_aarch64_gnullvm 0.42.2", 1610 | "windows_aarch64_msvc 0.42.2", 1611 | "windows_i686_gnu 0.42.2", 1612 | "windows_i686_msvc 0.42.2", 1613 | "windows_x86_64_gnu 0.42.2", 1614 | "windows_x86_64_gnullvm 0.42.2", 1615 | "windows_x86_64_msvc 0.42.2", 1616 | ] 1617 | 1618 | [[package]] 1619 | name = "windows-sys" 1620 | version = "0.48.0" 1621 | source = "registry+https://github.com/rust-lang/crates.io-index" 1622 | checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" 1623 | dependencies = [ 1624 | "windows-targets", 1625 | ] 1626 | 1627 | [[package]] 1628 | name = "windows-targets" 1629 | version = "0.48.0" 1630 | source = "registry+https://github.com/rust-lang/crates.io-index" 1631 | checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5" 1632 | dependencies = [ 1633 | "windows_aarch64_gnullvm 0.48.0", 1634 | "windows_aarch64_msvc 0.48.0", 1635 | "windows_i686_gnu 0.48.0", 1636 | "windows_i686_msvc 0.48.0", 1637 | "windows_x86_64_gnu 0.48.0", 1638 | "windows_x86_64_gnullvm 0.48.0", 1639 | "windows_x86_64_msvc 0.48.0", 1640 | ] 1641 | 1642 | [[package]] 1643 | name = "windows_aarch64_gnullvm" 1644 | version = "0.42.2" 1645 | source = "registry+https://github.com/rust-lang/crates.io-index" 1646 | checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" 1647 | 1648 | [[package]] 1649 | name = "windows_aarch64_gnullvm" 1650 | version = "0.48.0" 1651 | source = "registry+https://github.com/rust-lang/crates.io-index" 1652 | checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" 1653 | 1654 | [[package]] 1655 | name = "windows_aarch64_msvc" 1656 | version = "0.42.2" 1657 | source = "registry+https://github.com/rust-lang/crates.io-index" 1658 | checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" 1659 | 1660 | [[package]] 1661 | name = "windows_aarch64_msvc" 1662 | version = "0.48.0" 1663 | source = "registry+https://github.com/rust-lang/crates.io-index" 1664 | checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" 1665 | 1666 | [[package]] 1667 | name = "windows_i686_gnu" 1668 | version = "0.42.2" 1669 | source = "registry+https://github.com/rust-lang/crates.io-index" 1670 | checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" 1671 | 1672 | [[package]] 1673 | name = "windows_i686_gnu" 1674 | version = "0.48.0" 1675 | source = "registry+https://github.com/rust-lang/crates.io-index" 1676 | checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" 1677 | 1678 | [[package]] 1679 | name = "windows_i686_msvc" 1680 | version = "0.42.2" 1681 | source = "registry+https://github.com/rust-lang/crates.io-index" 1682 | checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" 1683 | 1684 | [[package]] 1685 | name = "windows_i686_msvc" 1686 | version = "0.48.0" 1687 | source = "registry+https://github.com/rust-lang/crates.io-index" 1688 | checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" 1689 | 1690 | [[package]] 1691 | name = "windows_x86_64_gnu" 1692 | version = "0.42.2" 1693 | source = "registry+https://github.com/rust-lang/crates.io-index" 1694 | checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" 1695 | 1696 | [[package]] 1697 | name = "windows_x86_64_gnu" 1698 | version = "0.48.0" 1699 | source = "registry+https://github.com/rust-lang/crates.io-index" 1700 | checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" 1701 | 1702 | [[package]] 1703 | name = "windows_x86_64_gnullvm" 1704 | version = "0.42.2" 1705 | source = "registry+https://github.com/rust-lang/crates.io-index" 1706 | checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" 1707 | 1708 | [[package]] 1709 | name = "windows_x86_64_gnullvm" 1710 | version = "0.48.0" 1711 | source = "registry+https://github.com/rust-lang/crates.io-index" 1712 | checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" 1713 | 1714 | [[package]] 1715 | name = "windows_x86_64_msvc" 1716 | version = "0.42.2" 1717 | source = "registry+https://github.com/rust-lang/crates.io-index" 1718 | checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" 1719 | 1720 | [[package]] 1721 | name = "windows_x86_64_msvc" 1722 | version = "0.48.0" 1723 | source = "registry+https://github.com/rust-lang/crates.io-index" 1724 | checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" 1725 | 1726 | [[package]] 1727 | name = "winreg" 1728 | version = "0.10.1" 1729 | source = "registry+https://github.com/rust-lang/crates.io-index" 1730 | checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d" 1731 | dependencies = [ 1732 | "winapi", 1733 | ] 1734 | 1735 | [[package]] 1736 | name = "zstd" 1737 | version = "0.12.3+zstd.1.5.2" 1738 | source = "registry+https://github.com/rust-lang/crates.io-index" 1739 | checksum = "76eea132fb024e0e13fd9c2f5d5d595d8a967aa72382ac2f9d39fcc95afd0806" 1740 | dependencies = [ 1741 | "zstd-safe", 1742 | ] 1743 | 1744 | [[package]] 1745 | name = "zstd-safe" 1746 | version = "6.0.5+zstd.1.5.4" 1747 | source = "registry+https://github.com/rust-lang/crates.io-index" 1748 | checksum = "d56d9e60b4b1758206c238a10165fbcae3ca37b01744e394c463463f6529d23b" 1749 | dependencies = [ 1750 | "libc", 1751 | "zstd-sys", 1752 | ] 1753 | 1754 | [[package]] 1755 | name = "zstd-sys" 1756 | version = "2.0.8+zstd.1.5.5" 1757 | source = "registry+https://github.com/rust-lang/crates.io-index" 1758 | checksum = "5556e6ee25d32df2586c098bbfa278803692a20d0ab9565e049480d52707ec8c" 1759 | dependencies = [ 1760 | "cc", 1761 | "libc", 1762 | "pkg-config", 1763 | ] 1764 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "web_template" 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 | actix-web = "4.3.1" 10 | dotenv = "0.15.0" 11 | reqwest = { version = "0.11.17", features = ["json"] } 12 | serde = { version = "1.0.160", features = ["derive"] } 13 | serde_json = "1.0.96" 14 | tokio = { version = "1.28.0", features = ["full"] } 15 | async-trait = "0.1.68" 16 | actix-cors = "0.6.4" 17 | rand = "0.8.5" 18 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | From project root directory 2 | 3 | ```shell 4 | cargo build 5 | cargo build --release 6 | cargo run 7 | ``` 8 | 9 | ### File: src/code_template.rs 10 | 11 | This represents the code template given to Auto-Gippity. 12 | 13 | ### File: src/main.rs 14 | 15 | This represents the code the agent wrote during the course at the game testing in the last section. 16 | 17 | This code will change every time you run the separate auto-gippity project. 18 | 19 | ### Saving 20 | 21 | Save this file in the same main project folder as your auto-gippity download from github: 22 | 23 | https://github.com/coderaidershaun/rust-auto-gippity-full-code.git 24 | -------------------------------------------------------------------------------- /database.json: -------------------------------------------------------------------------------- 1 | {"games":{"6407284293011555467":{"id":6407284293011555467,"word":"sky","guessed_letters":["s","h","t","a"],"incorrect_attempts":3,"last_move":"Guessed letter: a"}}} -------------------------------------------------------------------------------- /src/code_template.rs: -------------------------------------------------------------------------------- 1 | use actix_cors::Cors; 2 | 3 | use actix_web::{ http::header, web, App, HttpServer, Responder, HttpResponse }; 4 | 5 | use serde::{ Deserialize, Serialize }; 6 | 7 | use reqwest::Client as HttpClient; 8 | 9 | use async_trait::async_trait; 10 | 11 | use std::sync::Mutex; 12 | use std::collections::HashMap; 13 | use std::fs; 14 | use std::io::Write; 15 | 16 | #[derive(Serialize, Deserialize, Debug, Clone)] 17 | struct Task { 18 | id: u64, 19 | name: String, 20 | completed: bool 21 | } 22 | 23 | #[derive(Serialize, Deserialize, Debug, Clone)] 24 | struct User { 25 | id: u64, 26 | username: String, 27 | password: String 28 | } 29 | 30 | #[derive(Serialize, Deserialize, Debug, Clone)] 31 | struct Database { 32 | tasks: HashMap, 33 | users: HashMap 34 | } 35 | 36 | impl Database { 37 | fn new() -> Self { 38 | Self { 39 | tasks: HashMap::new(), 40 | users: HashMap::new() 41 | } 42 | } 43 | 44 | // CRUD DATA 45 | fn insert(&mut self, task: Task) { 46 | self.tasks.insert(task.id, task); 47 | } 48 | 49 | fn get(&self, id: &u64) -> Option<&Task> { 50 | self.tasks.get(id) 51 | } 52 | 53 | fn get_all(&self) -> Vec<&Task> { 54 | self.tasks.values().collect() 55 | } 56 | 57 | fn delete(&mut self, id: &u64) { 58 | self.tasks.remove(id); 59 | } 60 | 61 | fn update(&mut self, task: Task) { 62 | self.tasks.insert(task.id, task); 63 | } 64 | 65 | // USER DATA RELATED FUNCTIONS 66 | fn insert_user(&mut self, user: User) { 67 | self.users.insert(user.id, user); 68 | } 69 | 70 | fn get_user_by_name(&self, username: &str) -> Option<&User> { 71 | self.users.values().find(|u| u.username == username) 72 | } 73 | 74 | // DATABASE SAVING 75 | fn save_to_file(&self) -> std::io::Result<()> { 76 | let data: String = serde_json::to_string(&self)?; 77 | let mut file: fs::File = fs::File::create("database.json")?; 78 | file.write_all(data.as_bytes())?; 79 | Ok(()) 80 | } 81 | 82 | fn load_from_file() -> std::io::Result { 83 | let file_content: String = fs::read_to_string("database.json")?; 84 | let db: Database = serde_json::from_str(&file_content)?; 85 | Ok(db) 86 | } 87 | } 88 | 89 | struct AppState { 90 | db: Mutex 91 | } 92 | 93 | async fn create_task(app_state: web::Data, task: web::Json) -> impl Responder { 94 | let mut db: std::sync::MutexGuard = app_state.db.lock().unwrap(); 95 | db.insert(task.into_inner()); 96 | let _ = db.save_to_file(); 97 | HttpResponse::Ok().finish() 98 | } 99 | 100 | async fn read_task(app_state: web::Data, id: web::Path) -> impl Responder { 101 | let db: std::sync::MutexGuard = app_state.db.lock().unwrap(); 102 | match db.get(&id.into_inner()) { 103 | Some(task) => HttpResponse::Ok().json(task), 104 | None => HttpResponse::NotFound().finish() 105 | } 106 | } 107 | 108 | async fn read_all_tasks(app_state: web::Data) -> impl Responder { 109 | let db: std::sync::MutexGuard = app_state.db.lock().unwrap(); 110 | let tasks = db.get_all(); 111 | HttpResponse::Ok().json(tasks) 112 | } 113 | 114 | async fn update_task(app_state: web::Data, task: web::Json) -> impl Responder { 115 | let mut db: std::sync::MutexGuard = app_state.db.lock().unwrap(); 116 | db.update(task.into_inner()); 117 | let _ = db.save_to_file(); 118 | HttpResponse::Ok().finish() 119 | } 120 | 121 | async fn delete_task(app_state: web::Data, id: web::Path) -> impl Responder { 122 | let mut db: std::sync::MutexGuard = app_state.db.lock().unwrap(); 123 | db.delete(&id.into_inner()); 124 | let _ = db.save_to_file(); 125 | HttpResponse::Ok().finish() 126 | } 127 | 128 | async fn register(app_state: web::Data, user: web::Json) -> impl Responder { 129 | let mut db: std::sync::MutexGuard = app_state.db.lock().unwrap(); 130 | db.insert_user(user.into_inner()); 131 | let _ = db.save_to_file(); 132 | HttpResponse::Ok().finish() 133 | } 134 | 135 | async fn login(app_state: web::Data, user: web::Json) -> impl Responder { 136 | let db: std::sync::MutexGuard = app_state.db.lock().unwrap(); 137 | match db.get_user_by_name(&user.username) { 138 | Some(stored_user) if stored_user.password == user.password => { 139 | HttpResponse::Ok().body("Logged in!") 140 | }, 141 | _ => HttpResponse::BadRequest().body("Invalid username or password") 142 | } 143 | } 144 | 145 | #[actix_web::main] 146 | async fn main() -> std::io::Result<()> { 147 | 148 | let db: Database = match Database::load_from_file() { 149 | Ok(db) => db, 150 | Err(_) => Database::new() 151 | }; 152 | 153 | let data: web::Data = web::Data::new(AppState { 154 | db: Mutex::new(db) 155 | }); 156 | 157 | HttpServer::new(move || { 158 | App::new() 159 | .wrap( 160 | Cors::permissive() 161 | .allowed_origin_fn(|origin, _req_head| { 162 | origin.as_bytes().starts_with(b"http://localhost") || origin == "null" 163 | }) 164 | .allowed_methods(vec!["GET", "POST", "PUT", "DELETE"]) 165 | .allowed_headers(vec![header::AUTHORIZATION, header::ACCEPT]) 166 | .allowed_header(header::CONTENT_TYPE) 167 | .supports_credentials() 168 | .max_age(3600) 169 | ) 170 | .app_data(data.clone()) 171 | .route("/task", web::post().to(create_task)) 172 | .route("/task", web::get().to(read_all_tasks)) 173 | .route("/task", web::put().to(update_task)) 174 | .route("/task/{id}", web::get().to(read_task)) 175 | .route("/task/{id}", web::delete().to(delete_task)) 176 | .route("/register", web::post().to(register)) 177 | .route("/login", web::post().to(login)) 178 | }) 179 | .bind("127.0.0.1:8080")? 180 | .run() 181 | .await 182 | } 183 | -------------------------------------------------------------------------------- /src/main.rs: -------------------------------------------------------------------------------- 1 | use actix_cors::Cors; 2 | use actix_web::{http::header, web, App, HttpServer, Responder, HttpResponse}; 3 | use serde::{Deserialize, Serialize}; 4 | use std::sync::Mutex; 5 | use std::collections::HashMap; 6 | use std::fs; 7 | use std::io::Write; 8 | 9 | #[derive(Serialize, Deserialize, Debug, Clone)] 10 | struct GameState { 11 | id: u64, 12 | word: String, 13 | guessed_letters: Vec, 14 | incorrect_attempts: u8, 15 | last_move: String, 16 | } 17 | 18 | #[derive(Serialize, Deserialize, Debug, Clone)] 19 | struct Database { 20 | games: HashMap, 21 | } 22 | 23 | impl Database { 24 | fn new() -> Self { 25 | Self { 26 | games: HashMap::new(), 27 | } 28 | } 29 | 30 | fn insert(&mut self, game: GameState) { 31 | self.games.insert(game.id, game); 32 | } 33 | 34 | fn get(&self, id: &u64) -> Option<&GameState> { 35 | self.games.get(id) 36 | } 37 | 38 | fn update(&mut self, game: GameState) { 39 | self.games.insert(game.id, game); 40 | } 41 | 42 | fn save_to_file(&self) -> std::io::Result<()> { 43 | let data: String = serde_json::to_string(&self)?; 44 | let mut file: fs::File = fs::File::create("database.json")?; 45 | file.write_all(data.as_bytes())?; 46 | Ok(()) 47 | } 48 | 49 | fn load_from_file() -> std::io::Result { 50 | let file_content: String = fs::read_to_string("database.json")?; 51 | let db: Database = serde_json::from_str(&file_content)?; 52 | Ok(db) 53 | } 54 | } 55 | 56 | struct AppState { 57 | db: Mutex, 58 | } 59 | 60 | async fn start_game(app_state: web::Data, word: web::Json) -> impl Responder { 61 | let mut db: std::sync::MutexGuard = app_state.db.lock().unwrap(); 62 | let game = GameState { 63 | id: rand::random(), 64 | word: word.into_inner(), 65 | guessed_letters: Vec::new(), 66 | incorrect_attempts: 0, 67 | last_move: String::new(), 68 | }; 69 | db.insert(game.clone()); 70 | let _ = db.save_to_file(); 71 | HttpResponse::Ok().json(game) 72 | } 73 | 74 | async fn make_move(app_state: web::Data, id: web::Path, letter: web::Json) -> impl Responder { 75 | let mut db: std::sync::MutexGuard = app_state.db.lock().unwrap(); 76 | let mut game = match db.get(&id.into_inner()).cloned() { 77 | Some(game) => game, 78 | None => return HttpResponse::NotFound().finish(), 79 | }; 80 | 81 | let letter_inner = letter.into_inner(); 82 | game.last_move = format!("Guessed letter: {}", letter_inner); 83 | game.guessed_letters.push(letter_inner); 84 | 85 | if !game.word.contains(letter_inner) { 86 | game.incorrect_attempts += 1; 87 | } 88 | 89 | db.update(game.clone()); 90 | let _ = db.save_to_file(); 91 | HttpResponse::Ok().json(game) 92 | } 93 | 94 | #[actix_web::main] 95 | async fn main() -> std::io::Result<()> { 96 | let db: Database = match Database::load_from_file() { 97 | Ok(db) => db, 98 | Err(_) => Database::new(), 99 | }; 100 | 101 | let data: web::Data = web::Data::new(AppState { 102 | db: Mutex::new(db), 103 | }); 104 | 105 | HttpServer::new(move || { 106 | App::new() 107 | .wrap( 108 | Cors::permissive() 109 | .allowed_origin_fn(|origin, _req_head| { 110 | origin.as_bytes().starts_with(b"http://localhost") || origin == "null" 111 | }) 112 | .allowed_methods(vec!["GET", "POST", "PUT", "DELETE"]) 113 | .allowed_headers(vec![header::AUTHORIZATION, header::ACCEPT]) 114 | .allowed_header(header::CONTENT_TYPE) 115 | .supports_credentials() 116 | .max_age(3600), 117 | ) 118 | .app_data(data.clone()) 119 | .route("/start", web::post().to(start_game)) 120 | .route("/move/{id}", web::post().to(make_move)) 121 | }) 122 | .bind("127.0.0.1:8080")? 123 | .run() 124 | .await 125 | } --------------------------------------------------------------------------------