From fce0ebd76b2e4d189d22f85e3604277248d6fa15 Mon Sep 17 00:00:00 2001 From: Dennis Brentjes Date: Fri, 2 May 2025 23:06:38 +0200 Subject: [PATCH] Deleted the old Rust backend based on rocket. --- backend/.gitignore | 4 - backend/App.toml.example | 8 - backend/Cargo.lock | 2466 ----------------- backend/Cargo.toml | 26 - .../2022-03-19-191822_initial/down.sql | 4 - .../2022-03-19-191822_initial/up.sql | 12 - .../2022-04-17-175115_user-system/down.sql | 4 - .../2022-04-17-175115_user-system/up.sql | 26 - .../down.sql | 4 - .../2022-05-14-104118_gamenight_owners/up.sql | 19 - .../down.sql | 3 - .../up.sql | 9 - .../down.sql | 3 - .../up.sql | 9 - .../down.sql | 6 - .../up.sql | 11 - backend/requests/gamenights.sh | 3 - backend/requests/login.sh | 1 - backend/requests/register.sh | 1 - backend/src/api.rs | 573 ---- backend/src/main.rs | 81 - backend/src/schema/admin.rs | 54 - backend/src/schema/gamenight.rs | 215 -- backend/src/schema/mod.rs | 58 - backend/src/schema/users.rs | 191 -- backend/src/site.rs | 42 - backend/templates/flash.html.hbs | 5 - backend/templates/gamenight_add.html.hbs | 16 - backend/templates/gamenights.html.hbs | 14 - backend/templates/register.html.hbs | 19 - 30 files changed, 3887 deletions(-) delete mode 100644 backend/.gitignore delete mode 100644 backend/App.toml.example delete mode 100644 backend/Cargo.lock delete mode 100644 backend/Cargo.toml delete mode 100644 backend/migrations/2022-03-19-191822_initial/down.sql delete mode 100644 backend/migrations/2022-03-19-191822_initial/up.sql delete mode 100644 backend/migrations/2022-04-17-175115_user-system/down.sql delete mode 100644 backend/migrations/2022-04-17-175115_user-system/up.sql delete mode 100644 backend/migrations/2022-05-14-104118_gamenight_owners/down.sql delete mode 100644 backend/migrations/2022-05-14-104118_gamenight_owners/up.sql delete mode 100644 backend/migrations/2022-05-27-183310_gamenight_gamelist/down.sql delete mode 100644 backend/migrations/2022-05-27-183310_gamenight_gamelist/up.sql delete mode 100644 backend/migrations/2022-05-28-142526_gamenight participants/down.sql delete mode 100644 backend/migrations/2022-05-28-142526_gamenight participants/up.sql delete mode 100644 backend/migrations/2022-06-04-141858_registration_tokens/down.sql delete mode 100644 backend/migrations/2022-06-04-141858_registration_tokens/up.sql delete mode 100755 backend/requests/gamenights.sh delete mode 100755 backend/requests/login.sh delete mode 100755 backend/requests/register.sh delete mode 100644 backend/src/api.rs delete mode 100644 backend/src/main.rs delete mode 100644 backend/src/schema/admin.rs delete mode 100644 backend/src/schema/gamenight.rs delete mode 100644 backend/src/schema/mod.rs delete mode 100644 backend/src/schema/users.rs delete mode 100644 backend/src/site.rs delete mode 100644 backend/templates/flash.html.hbs delete mode 100644 backend/templates/gamenight_add.html.hbs delete mode 100644 backend/templates/gamenights.html.hbs delete mode 100644 backend/templates/register.html.hbs diff --git a/backend/.gitignore b/backend/.gitignore deleted file mode 100644 index 40b942a..0000000 --- a/backend/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -/target -.vscode -App.toml -*.sqlite diff --git a/backend/App.toml.example b/backend/App.toml.example deleted file mode 100644 index d8706fb..0000000 --- a/backend/App.toml.example +++ /dev/null @@ -1,8 +0,0 @@ -#Copy this file over to Rocket.toml after changing all relevant values. - -[default] -jwt_secret = "some really good secret" - -[global.databases] -gamenight_database = { url = "gamenight.sqlite" } - diff --git a/backend/Cargo.lock b/backend/Cargo.lock deleted file mode 100644 index 492d642..0000000 --- a/backend/Cargo.lock +++ /dev/null @@ -1,2466 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "aho-corasick" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43f6cb1bf222025340178f382c426f13757b2960e89779dfcb319c32542a5a41" -dependencies = [ - "memchr", -] - -[[package]] -name = "android-tzdata" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" - -[[package]] -name = "android_system_properties" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" -dependencies = [ - "libc", -] - -[[package]] -name = "argon2" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db4ce4441f99dbd377ca8a8f57b698c44d0d6e712d8329b5040da5a64aa1ce73" -dependencies = [ - "base64ct", - "blake2", - "password-hash", -] - -[[package]] -name = "async-stream" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd56dd203fef61ac097dd65721a419ddccb106b2d2b70ba60a6b529f03961a51" -dependencies = [ - "async-stream-impl", - "futures-core", - "pin-project-lite", -] - -[[package]] -name = "async-stream-impl" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.18", -] - -[[package]] -name = "async-trait" -version = "0.1.68" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9ccdd8f2a161be9bd5c023df56f1b2a0bd1d83872ae53b71a84a12c9bf6e842" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.18", -] - -[[package]] -name = "atomic" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c59bdb34bc650a32731b31bd8f0829cc15d24a708ee31559e0bb34f2bc320cba" - -[[package]] -name = "autocfg" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" - -[[package]] -name = "base64" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" - -[[package]] -name = "base64" -version = "0.21.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d" - -[[package]] -name = "base64ct" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" - -[[package]] -name = "binascii" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "383d29d513d8764dcdc42ea295d979eb99c3c9f00607b3692cf68a431f7dca72" - -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "bitflags" -version = "2.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6dbe3c979c178231552ecba20214a8272df4e09f232a87aef4320cf06539aded" - -[[package]] -name = "blake2" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" -dependencies = [ - "digest", -] - -[[package]] -name = "block-buffer" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" -dependencies = [ - "generic-array", -] - -[[package]] -name = "bumpalo" -version = "3.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" - -[[package]] -name = "byteorder" -version = "1.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" - -[[package]] -name = "bytes" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" - -[[package]] -name = "cc" -version = "1.0.79" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "chrono" -version = "0.4.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec837a71355b28f6556dbd569b37b3f363091c0bd4b2e735674521b4c5fd9bc5" -dependencies = [ - "android-tzdata", - "iana-time-zone", - "js-sys", - "num-traits", - "serde", - "time 0.1.45", - "wasm-bindgen", - "winapi", -] - -[[package]] -name = "cookie" -version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7efb37c3e1ccb1ff97164ad95ac1606e8ccd35b3fa0a7d99a304c7f4a428cc24" -dependencies = [ - "percent-encoding", - "time 0.3.22", - "version_check", -] - -[[package]] -name = "core-foundation-sys" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" - -[[package]] -name = "cpufeatures" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03e69e28e9f7f77debdedbaafa2866e1de9ba56df55a8bd7cfc724c25a09987c" -dependencies = [ - "libc", -] - -[[package]] -name = "crossbeam-channel" -version = "0.5.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200" -dependencies = [ - "cfg-if", - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-utils" -version = "0.8.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "crypto-common" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" -dependencies = [ - "generic-array", - "typenum", -] - -[[package]] -name = "devise" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6eacefd3f541c66fc61433d65e54e0e46e0a029a819a7dbbc7a7b489e8a85f8" -dependencies = [ - "devise_codegen", - "devise_core", -] - -[[package]] -name = "devise_codegen" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8cf4b8dd484ede80fd5c547592c46c3745a617c8af278e2b72bea86b2dfed6" -dependencies = [ - "devise_core", - "quote", -] - -[[package]] -name = "devise_core" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35b50dba0afdca80b187392b24f2499a88c336d5a8493e4b4ccfb608708be56a" -dependencies = [ - "bitflags 2.3.2", - "proc-macro2", - "proc-macro2-diagnostics", - "quote", - "syn 2.0.18", -] - -[[package]] -name = "diesel" -version = "1.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b28135ecf6b7d446b43e27e225622a038cc4e2930a1022f51cdb97ada19b8e4d" -dependencies = [ - "bitflags 1.3.2", - "byteorder", - "chrono", - "diesel_derives 1.4.1", - "pq-sys", - "r2d2", - "uuid", -] - -[[package]] -name = "diesel" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7a532c1f99a0f596f6960a60d1e119e91582b24b39e2d83a190e61262c3ef0c" -dependencies = [ - "bitflags 2.3.2", - "byteorder", - "diesel_derives 2.1.0", - "itoa", - "pq-sys", - "r2d2", -] - -[[package]] -name = "diesel-derive-enum" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c8910921b014e2af16298f006de12aa08af894b71f0f49a486ab6d74b17bbed" -dependencies = [ - "heck", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "diesel_derives" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45f5098f628d02a7a0f68ddba586fb61e80edec3bdc1be3b921f4ceec60858d3" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "diesel_derives" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74398b79d81e52e130d991afeed9c86034bb1b7735f46d2f5bf7deb261d80303" -dependencies = [ - "diesel_table_macro_syntax", - "proc-macro2", - "quote", - "syn 2.0.18", -] - -[[package]] -name = "diesel_migrations" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf3cde8413353dc7f5d72fa8ce0b99a560a359d2c5ef1e5817ca731cd9008f4c" -dependencies = [ - "migrations_internals", - "migrations_macros", -] - -[[package]] -name = "diesel_table_macro_syntax" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc5557efc453706fed5e4fa85006fe9817c224c3f480a34c7e5959fd700921c5" -dependencies = [ - "syn 2.0.18", -] - -[[package]] -name = "digest" -version = "0.10.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" -dependencies = [ - "block-buffer", - "crypto-common", - "subtle", -] - -[[package]] -name = "either" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" - -[[package]] -name = "encoding_rs" -version = "0.8.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071a31f4ee85403370b58aca746f01041ede6f0da2730960ad001edc2b71b394" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "errno" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" -dependencies = [ - "errno-dragonfly", - "libc", - "windows-sys 0.48.0", -] - -[[package]] -name = "errno-dragonfly" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" -dependencies = [ - "cc", - "libc", -] - -[[package]] -name = "fastrand" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" -dependencies = [ - "instant", -] - -[[package]] -name = "figment" -version = "0.10.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4547e226f4c9ab860571e070a9034192b3175580ecea38da34fcdb53a018c9a5" -dependencies = [ - "atomic", - "pear", - "serde", - "toml", - "uncased", - "version_check", -] - -[[package]] -name = "filetime" -version = "0.2.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cbc844cecaee9d4443931972e1289c8ff485cb4cc2767cb03ca139ed6885153" -dependencies = [ - "cfg-if", - "libc", - "redox_syscall 0.2.16", - "windows-sys 0.48.0", -] - -[[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - -[[package]] -name = "form_urlencoded" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" -dependencies = [ - "percent-encoding", -] - -[[package]] -name = "fsevent-sys" -version = "4.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76ee7a02da4d231650c7cea31349b889be2f45ddb3ef3032d2ec8185f6313fd2" -dependencies = [ - "libc", -] - -[[package]] -name = "futures" -version = "0.3.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23342abe12aba583913b2e62f22225ff9c950774065e4bfb61a19cd9770fec40" -dependencies = [ - "futures-channel", - "futures-core", - "futures-executor", - "futures-io", - "futures-sink", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-channel" -version = "0.3.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" -dependencies = [ - "futures-core", - "futures-sink", -] - -[[package]] -name = "futures-core" -version = "0.3.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" - -[[package]] -name = "futures-executor" -version = "0.3.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccecee823288125bd88b4d7f565c9e58e41858e47ab72e8ea2d64e93624386e0" -dependencies = [ - "futures-core", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-io" -version = "0.3.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" - -[[package]] -name = "futures-macro" -version = "0.3.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.18", -] - -[[package]] -name = "futures-sink" -version = "0.3.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" - -[[package]] -name = "futures-task" -version = "0.3.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" - -[[package]] -name = "futures-util" -version = "0.3.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" -dependencies = [ - "futures-channel", - "futures-core", - "futures-io", - "futures-macro", - "futures-sink", - "futures-task", - "memchr", - "pin-project-lite", - "pin-utils", - "slab", -] - -[[package]] -name = "gamenight" -version = "0.1.0" -dependencies = [ - "argon2", - "base64 0.13.1", - "chrono", - "diesel 1.4.8", - "diesel-derive-enum", - "diesel_migrations", - "futures", - "jsonwebtoken", - "password-hash", - "rand", - "rand_core", - "rocket", - "rocket_dyn_templates", - "rocket_sync_db_pools", - "serde", - "uuid", - "validator", -] - -[[package]] -name = "generator" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3e123d9ae7c02966b4d892e550bdc32164f05853cd40ab570650ad600596a8a" -dependencies = [ - "cc", - "libc", - "log", - "rustversion", - "windows", -] - -[[package]] -name = "generic-array" -version = "0.14.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" -dependencies = [ - "typenum", - "version_check", -] - -[[package]] -name = "getrandom" -version = "0.2.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" -dependencies = [ - "cfg-if", - "libc", - "wasi 0.11.0+wasi-snapshot-preview1", -] - -[[package]] -name = "glob" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" - -[[package]] -name = "h2" -version = "0.3.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d357c7ae988e7d2182f7d7871d0b963962420b0678b0997ce7de72001aeab782" -dependencies = [ - "bytes", - "fnv", - "futures-core", - "futures-sink", - "futures-util", - "http", - "indexmap", - "slab", - "tokio", - "tokio-util", - "tracing", -] - -[[package]] -name = "handlebars" -version = "4.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83c3372087601b532857d332f5957cbae686da52bb7810bf038c3e3c3cc2fa0d" -dependencies = [ - "log", - "pest", - "pest_derive", - "serde", - "serde_json", - "thiserror", -] - -[[package]] -name = "hashbrown" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" - -[[package]] -name = "heck" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" - -[[package]] -name = "hermit-abi" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" -dependencies = [ - "libc", -] - -[[package]] -name = "hermit-abi" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" - -[[package]] -name = "http" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" -dependencies = [ - "bytes", - "fnv", - "itoa", -] - -[[package]] -name = "http-body" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" -dependencies = [ - "bytes", - "http", - "pin-project-lite", -] - -[[package]] -name = "httparse" -version = "1.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" - -[[package]] -name = "httpdate" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" - -[[package]] -name = "hyper" -version = "0.14.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab302d72a6f11a3b910431ff93aae7e773078c769f0a3ef15fb9ec692ed147d4" -dependencies = [ - "bytes", - "futures-channel", - "futures-core", - "futures-util", - "h2", - "http", - "http-body", - "httparse", - "httpdate", - "itoa", - "pin-project-lite", - "socket2", - "tokio", - "tower-service", - "tracing", - "want", -] - -[[package]] -name = "iana-time-zone" -version = "0.1.57" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fad5b825842d2b38bd206f3e81d6957625fd7f0a361e345c30e01a0ae2dd613" -dependencies = [ - "android_system_properties", - "core-foundation-sys", - "iana-time-zone-haiku", - "js-sys", - "wasm-bindgen", - "windows", -] - -[[package]] -name = "iana-time-zone-haiku" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" -dependencies = [ - "cc", -] - -[[package]] -name = "idna" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8" -dependencies = [ - "matches", - "unicode-bidi", - "unicode-normalization", -] - -[[package]] -name = "idna" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" -dependencies = [ - "unicode-bidi", - "unicode-normalization", -] - -[[package]] -name = "if_chain" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb56e1aa765b4b4f3aadfab769793b7087bb03a4ea4920644a6d238e2df5b9ed" - -[[package]] -name = "indexmap" -version = "1.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" -dependencies = [ - "autocfg", - "hashbrown", - "serde", -] - -[[package]] -name = "inlinable_string" -version = "0.1.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8fae54786f62fb2918dcfae3d568594e50eb9b5c25bf04371af6fe7516452fb" - -[[package]] -name = "inotify" -version = "0.9.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8069d3ec154eb856955c1c0fbffefbf5f3c40a104ec912d4797314c1801abff" -dependencies = [ - "bitflags 1.3.2", - "inotify-sys", - "libc", -] - -[[package]] -name = "inotify-sys" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e05c02b5e89bff3b946cedeca278abc628fe811e604f027c45a8aa3cf793d0eb" -dependencies = [ - "libc", -] - -[[package]] -name = "instant" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "io-lifetimes" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" -dependencies = [ - "hermit-abi 0.3.1", - "libc", - "windows-sys 0.48.0", -] - -[[package]] -name = "is-terminal" -version = "0.4.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f" -dependencies = [ - "hermit-abi 0.3.1", - "io-lifetimes", - "rustix", - "windows-sys 0.48.0", -] - -[[package]] -name = "itoa" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" - -[[package]] -name = "js-sys" -version = "0.3.64" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" -dependencies = [ - "wasm-bindgen", -] - -[[package]] -name = "jsonwebtoken" -version = "8.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6971da4d9c3aa03c3d8f3ff0f4155b534aad021292003895a469716b2a230378" -dependencies = [ - "base64 0.21.2", - "pem", - "ring", - "serde", - "serde_json", - "simple_asn1", -] - -[[package]] -name = "kqueue" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c8fc60ba15bf51257aa9807a48a61013db043fcf3a78cb0d916e8e396dcad98" -dependencies = [ - "kqueue-sys", - "libc", -] - -[[package]] -name = "kqueue-sys" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8367585489f01bc55dd27404dcf56b95e6da061a256a666ab23be9ba96a2e587" -dependencies = [ - "bitflags 1.3.2", - "libc", -] - -[[package]] -name = "lazy_static" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" - -[[package]] -name = "libc" -version = "0.2.146" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f92be4933c13fd498862a9e02a3055f8a8d9c039ce33db97306fd5a6caa7f29b" - -[[package]] -name = "linux-raw-sys" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" - -[[package]] -name = "lock_api" -version = "0.4.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" -dependencies = [ - "autocfg", - "scopeguard", -] - -[[package]] -name = "log" -version = "0.4.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4" - -[[package]] -name = "loom" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff50ecb28bb86013e935fb6683ab1f6d3a20016f123c76fd4c27470076ac30f5" -dependencies = [ - "cfg-if", - "generator", - "scoped-tls", - "serde", - "serde_json", - "tracing", - "tracing-subscriber", -] - -[[package]] -name = "matchers" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" -dependencies = [ - "regex-automata", -] - -[[package]] -name = "matches" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2532096657941c2fea9c289d370a250971c689d4f143798ff67113ec042024a5" - -[[package]] -name = "memchr" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" - -[[package]] -name = "migrations_internals" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b4fc84e4af020b837029e017966f86a1c2d5e83e64b589963d5047525995860" -dependencies = [ - "diesel 1.4.8", -] - -[[package]] -name = "migrations_macros" -version = "1.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9753f12909fd8d923f75ae5c3258cae1ed3c8ec052e1b38c93c21a6d157f789c" -dependencies = [ - "migrations_internals", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "mime" -version = "0.3.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" - -[[package]] -name = "mio" -version = "0.8.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" -dependencies = [ - "libc", - "log", - "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys 0.48.0", -] - -[[package]] -name = "multer" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01acbdc23469fd8fe07ab135923371d5f5a422fbf9c522158677c8eb15bc51c2" -dependencies = [ - "bytes", - "encoding_rs", - "futures-util", - "http", - "httparse", - "log", - "memchr", - "mime", - "spin 0.9.8", - "tokio", - "tokio-util", - "version_check", -] - -[[package]] -name = "normpath" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec60c60a693226186f5d6edf073232bfb6464ed97eb22cf3b01c1e8198fd97f5" -dependencies = [ - "windows-sys 0.48.0", -] - -[[package]] -name = "notify" -version = "5.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "729f63e1ca555a43fe3efa4f3efdf4801c479da85b432242a7b726f353c88486" -dependencies = [ - "bitflags 1.3.2", - "crossbeam-channel", - "filetime", - "fsevent-sys", - "inotify", - "kqueue", - "libc", - "mio", - "walkdir", - "windows-sys 0.45.0", -] - -[[package]] -name = "nu-ansi-term" -version = "0.46.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" -dependencies = [ - "overload", - "winapi", -] - -[[package]] -name = "num-bigint" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f" -dependencies = [ - "autocfg", - "num-integer", - "num-traits", -] - -[[package]] -name = "num-integer" -version = "0.1.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" -dependencies = [ - "autocfg", - "num-traits", -] - -[[package]] -name = "num-traits" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" -dependencies = [ - "autocfg", -] - -[[package]] -name = "num_cpus" -version = "1.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" -dependencies = [ - "hermit-abi 0.2.6", - "libc", -] - -[[package]] -name = "once_cell" -version = "1.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" - -[[package]] -name = "overload" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" - -[[package]] -name = "parking_lot" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" -dependencies = [ - "lock_api", - "parking_lot_core", -] - -[[package]] -name = "parking_lot_core" -version = "0.9.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" -dependencies = [ - "cfg-if", - "libc", - "redox_syscall 0.3.5", - "smallvec", - "windows-targets 0.48.0", -] - -[[package]] -name = "password-hash" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7676374caaee8a325c9e7a2ae557f216c5563a171d6997b0ef8a65af35147700" -dependencies = [ - "base64ct", - "rand_core", - "subtle", -] - -[[package]] -name = "pear" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ec95680a7087503575284e5063e14b694b7a9c0b065e5dceec661e0497127e8" -dependencies = [ - "inlinable_string", - "pear_codegen", - "yansi", -] - -[[package]] -name = "pear_codegen" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9661a3a53f93f09f2ea882018e4d7c88f6ff2956d809a276060476fd8c879d3c" -dependencies = [ - "proc-macro2", - "proc-macro2-diagnostics", - "quote", - "syn 2.0.18", -] - -[[package]] -name = "pem" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8835c273a76a90455d7344889b0964598e3316e2a79ede8e36f16bdcf2228b8" -dependencies = [ - "base64 0.13.1", -] - -[[package]] -name = "percent-encoding" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" - -[[package]] -name = "pest" -version = "2.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f73935e4d55e2abf7f130186537b19e7a4abc886a0252380b59248af473a3fc9" -dependencies = [ - "thiserror", - "ucd-trie", -] - -[[package]] -name = "pest_derive" -version = "2.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aef623c9bbfa0eedf5a0efba11a5ee83209c326653ca31ff019bec3a95bfff2b" -dependencies = [ - "pest", - "pest_generator", -] - -[[package]] -name = "pest_generator" -version = "2.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3e8cba4ec22bada7fc55ffe51e2deb6a0e0db2d0b7ab0b103acc80d2510c190" -dependencies = [ - "pest", - "pest_meta", - "proc-macro2", - "quote", - "syn 2.0.18", -] - -[[package]] -name = "pest_meta" -version = "2.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a01f71cb40bd8bb94232df14b946909e14660e33fc05db3e50ae2a82d7ea0ca0" -dependencies = [ - "once_cell", - "pest", - "sha2", -] - -[[package]] -name = "pin-project-lite" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" - -[[package]] -name = "pin-utils" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" - -[[package]] -name = "ppv-lite86" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" - -[[package]] -name = "pq-sys" -version = "0.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31c0052426df997c0cbd30789eb44ca097e3541717a7b8fa36b1c464ee7edebd" -dependencies = [ - "vcpkg", -] - -[[package]] -name = "proc-macro-error" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" -dependencies = [ - "proc-macro-error-attr", - "proc-macro2", - "quote", - "syn 1.0.109", - "version_check", -] - -[[package]] -name = "proc-macro-error-attr" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" -dependencies = [ - "proc-macro2", - "quote", - "version_check", -] - -[[package]] -name = "proc-macro2" -version = "1.0.60" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "proc-macro2-diagnostics" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "606c4ba35817e2922a308af55ad51bab3645b59eae5c570d4a6cf07e36bd493b" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.18", - "version_check", - "yansi", -] - -[[package]] -name = "quote" -version = "1.0.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "r2d2" -version = "0.8.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51de85fb3fb6524929c8a2eb85e6b6d363de4e8c48f9e2c2eac4944abc181c93" -dependencies = [ - "log", - "parking_lot", - "scheduled-thread-pool", -] - -[[package]] -name = "rand" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" -dependencies = [ - "libc", - "rand_chacha", - "rand_core", -] - -[[package]] -name = "rand_chacha" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" -dependencies = [ - "ppv-lite86", - "rand_core", -] - -[[package]] -name = "rand_core" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" -dependencies = [ - "getrandom", -] - -[[package]] -name = "redox_syscall" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" -dependencies = [ - "bitflags 1.3.2", -] - -[[package]] -name = "redox_syscall" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" -dependencies = [ - "bitflags 1.3.2", -] - -[[package]] -name = "ref-cast" -version = "1.0.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f43faa91b1c8b36841ee70e97188a869d37ae21759da6846d4be66de5bf7b12c" -dependencies = [ - "ref-cast-impl", -] - -[[package]] -name = "ref-cast-impl" -version = "1.0.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d2275aab483050ab2a7364c1a46604865ee7d6906684e08db0f090acf74f9e7" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.18", -] - -[[package]] -name = "regex" -version = "1.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0ab3ca65655bb1e41f2a8c8cd662eb4fb035e67c3f78da1d61dffe89d07300f" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax 0.7.2", -] - -[[package]] -name = "regex-automata" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" -dependencies = [ - "regex-syntax 0.6.29", -] - -[[package]] -name = "regex-syntax" -version = "0.6.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" - -[[package]] -name = "regex-syntax" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "436b050e76ed2903236f032a59761c1eb99e1b0aead2c257922771dab1fc8c78" - -[[package]] -name = "ring" -version = "0.16.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" -dependencies = [ - "cc", - "libc", - "once_cell", - "spin 0.5.2", - "untrusted", - "web-sys", - "winapi", -] - -[[package]] -name = "rocket" -version = "0.5.0-rc.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58734f7401ae5cfd129685b48f61182331745b357b96f2367f01aebaf1cc9cc9" -dependencies = [ - "async-stream", - "async-trait", - "atomic", - "binascii", - "bytes", - "either", - "figment", - "futures", - "indexmap", - "is-terminal", - "log", - "memchr", - "multer", - "num_cpus", - "parking_lot", - "pin-project-lite", - "rand", - "ref-cast", - "rocket_codegen", - "rocket_http", - "serde", - "serde_json", - "state", - "tempfile", - "time 0.3.22", - "tokio", - "tokio-stream", - "tokio-util", - "ubyte", - "version_check", - "yansi", -] - -[[package]] -name = "rocket_codegen" -version = "0.5.0-rc.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7093353f14228c744982e409259fb54878ba9563d08214f2d880d59ff2fc508b" -dependencies = [ - "devise", - "glob", - "indexmap", - "proc-macro2", - "quote", - "rocket_http", - "syn 2.0.18", - "unicode-xid", -] - -[[package]] -name = "rocket_dyn_templates" -version = "0.1.0-rc.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "276cac97fcddca93d741a4a530f58969f45a5bdb587f8c6b04c75cf849ca7f4c" -dependencies = [ - "glob", - "handlebars", - "normpath", - "notify", - "rocket", -] - -[[package]] -name = "rocket_http" -version = "0.5.0-rc.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "936012c99162a03a67f37f9836d5f938f662e26f2717809761a9ac46432090f4" -dependencies = [ - "cookie", - "either", - "futures", - "http", - "hyper", - "indexmap", - "log", - "memchr", - "pear", - "percent-encoding", - "pin-project-lite", - "ref-cast", - "serde", - "smallvec", - "stable-pattern", - "state", - "time 0.3.22", - "tokio", - "uncased", -] - -[[package]] -name = "rocket_sync_db_pools" -version = "0.1.0-rc.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6b6bd8a6b33c305404653c05c02ab8fec86cb9e4739e5fd0d2284116e740d08" -dependencies = [ - "diesel 2.1.0", - "r2d2", - "rocket", - "rocket_sync_db_pools_codegen", - "serde", - "tokio", - "version_check", -] - -[[package]] -name = "rocket_sync_db_pools_codegen" -version = "0.1.0-rc.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd26d72db34a46b182d79defd99dc5e40c2edb58651262e724d78ddcf1eb2474" -dependencies = [ - "devise", - "quote", -] - -[[package]] -name = "rustix" -version = "0.37.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b96e891d04aa506a6d1f318d2771bcb1c7dfda84e126660ace067c9b474bb2c0" -dependencies = [ - "bitflags 1.3.2", - "errno", - "io-lifetimes", - "libc", - "linux-raw-sys", - "windows-sys 0.48.0", -] - -[[package]] -name = "rustversion" -version = "1.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f3208ce4d8448b3f3e7d168a73f5e0c43a61e32930de3bceeccedb388b6bf06" - -[[package]] -name = "ryu" -version = "1.0.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" - -[[package]] -name = "same-file" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "scheduled-thread-pool" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cbc66816425a074528352f5789333ecff06ca41b36b0b0efdfbb29edc391a19" -dependencies = [ - "parking_lot", -] - -[[package]] -name = "scoped-tls" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" - -[[package]] -name = "scopeguard" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" - -[[package]] -name = "serde" -version = "1.0.164" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e8c8cf938e98f769bc164923b06dce91cea1751522f46f8466461af04c9027d" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.164" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9735b638ccc51c28bf6914d90a2e9725b377144fc612c49a611fddd1b631d68" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.18", -] - -[[package]] -name = "serde_json" -version = "1.0.97" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdf3bf93142acad5821c99197022e170842cdbc1c30482b98750c688c640842a" -dependencies = [ - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "serde_spanned" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93107647184f6027e3b7dcb2e11034cf95ffa1e3a682c67951963ac69c1c007d" -dependencies = [ - "serde", -] - -[[package]] -name = "sha2" -version = "0.10.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "479fb9d862239e610720565ca91403019f2f00410f1864c5aa7479b950a76ed8" -dependencies = [ - "cfg-if", - "cpufeatures", - "digest", -] - -[[package]] -name = "sharded-slab" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "900fba806f70c630b0a382d0d825e17a0f19fcd059a2ade1ff237bcddf446b31" -dependencies = [ - "lazy_static", -] - -[[package]] -name = "signal-hook-registry" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" -dependencies = [ - "libc", -] - -[[package]] -name = "simple_asn1" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adc4e5204eb1910f40f9cfa375f6f05b68c3abac4b6fd879c8ff5e7ae8a0a085" -dependencies = [ - "num-bigint", - "num-traits", - "thiserror", - "time 0.3.22", -] - -[[package]] -name = "slab" -version = "0.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d" -dependencies = [ - "autocfg", -] - -[[package]] -name = "smallvec" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" - -[[package]] -name = "socket2" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" -dependencies = [ - "libc", - "winapi", -] - -[[package]] -name = "spin" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" - -[[package]] -name = "spin" -version = "0.9.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" - -[[package]] -name = "stable-pattern" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4564168c00635f88eaed410d5efa8131afa8d8699a612c80c455a0ba05c21045" -dependencies = [ - "memchr", -] - -[[package]] -name = "state" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbe866e1e51e8260c9eed836a042a5e7f6726bb2b411dffeaa712e19c388f23b" -dependencies = [ - "loom", -] - -[[package]] -name = "subtle" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" - -[[package]] -name = "syn" -version = "1.0.109" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "syn" -version = "2.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32d41677bcbe24c20c52e7c70b0d8db04134c5d1066bf98662e2871ad200ea3e" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "tempfile" -version = "3.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31c0432476357e58790aaa47a8efb0c5138f137343f3b5f23bd36a27e3b0a6d6" -dependencies = [ - "autocfg", - "cfg-if", - "fastrand", - "redox_syscall 0.3.5", - "rustix", - "windows-sys 0.48.0", -] - -[[package]] -name = "thiserror" -version = "1.0.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.18", -] - -[[package]] -name = "thread_local" -version = "1.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" -dependencies = [ - "cfg-if", - "once_cell", -] - -[[package]] -name = "time" -version = "0.1.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a" -dependencies = [ - "libc", - "wasi 0.10.0+wasi-snapshot-preview1", - "winapi", -] - -[[package]] -name = "time" -version = "0.3.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea9e1b3cf1243ae005d9e74085d4d542f3125458f3a81af210d901dcd7411efd" -dependencies = [ - "itoa", - "serde", - "time-core", - "time-macros", -] - -[[package]] -name = "time-core" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb" - -[[package]] -name = "time-macros" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "372950940a5f07bf38dbe211d7283c9e6d7327df53794992d293e534c733d09b" -dependencies = [ - "time-core", -] - -[[package]] -name = "tinyvec" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" -dependencies = [ - "tinyvec_macros", -] - -[[package]] -name = "tinyvec_macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" - -[[package]] -name = "tokio" -version = "1.28.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94d7b1cfd2aa4011f2de74c2c4c63665e27a71006b0a192dcd2710272e73dfa2" -dependencies = [ - "autocfg", - "bytes", - "libc", - "mio", - "num_cpus", - "pin-project-lite", - "signal-hook-registry", - "socket2", - "tokio-macros", - "windows-sys 0.48.0", -] - -[[package]] -name = "tokio-macros" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.18", -] - -[[package]] -name = "tokio-stream" -version = "0.1.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "397c988d37662c7dda6d2208364a706264bf3d6138b11d436cbac0ad38832842" -dependencies = [ - "futures-core", - "pin-project-lite", - "tokio", -] - -[[package]] -name = "tokio-util" -version = "0.7.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "806fe8c2c87eccc8b3267cbae29ed3ab2d0bd37fca70ab622e46aaa9375ddb7d" -dependencies = [ - "bytes", - "futures-core", - "futures-sink", - "pin-project-lite", - "tokio", - "tracing", -] - -[[package]] -name = "toml" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6135d499e69981f9ff0ef2167955a5333c35e36f6937d382974566b3d5b94ec" -dependencies = [ - "serde", - "serde_spanned", - "toml_datetime", - "toml_edit", -] - -[[package]] -name = "toml_datetime" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a76a9312f5ba4c2dec6b9161fdf25d87ad8a09256ccea5a556fef03c706a10f" -dependencies = [ - "serde", -] - -[[package]] -name = "toml_edit" -version = "0.19.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2380d56e8670370eee6566b0bfd4265f65b3f432e8c6d85623f728d4fa31f739" -dependencies = [ - "indexmap", - "serde", - "serde_spanned", - "toml_datetime", - "winnow", -] - -[[package]] -name = "tower-service" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" - -[[package]] -name = "tracing" -version = "0.1.37" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" -dependencies = [ - "cfg-if", - "pin-project-lite", - "tracing-attributes", - "tracing-core", -] - -[[package]] -name = "tracing-attributes" -version = "0.1.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.18", -] - -[[package]] -name = "tracing-core" -version = "0.1.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a" -dependencies = [ - "once_cell", - "valuable", -] - -[[package]] -name = "tracing-log" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ddad33d2d10b1ed7eb9d1f518a5674713876e97e5bb9b7345a7984fbb4f922" -dependencies = [ - "lazy_static", - "log", - "tracing-core", -] - -[[package]] -name = "tracing-subscriber" -version = "0.3.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30a651bc37f915e81f087d86e62a18eec5f79550c7faff886f7090b4ea757c77" -dependencies = [ - "matchers", - "nu-ansi-term", - "once_cell", - "regex", - "sharded-slab", - "smallvec", - "thread_local", - "tracing", - "tracing-core", - "tracing-log", -] - -[[package]] -name = "try-lock" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" - -[[package]] -name = "typenum" -version = "1.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" - -[[package]] -name = "ubyte" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c81f0dae7d286ad0d9366d7679a77934cfc3cf3a8d67e82669794412b2368fe6" -dependencies = [ - "serde", -] - -[[package]] -name = "ucd-trie" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e79c4d996edb816c91e4308506774452e55e95c3c9de07b6729e17e15a5ef81" - -[[package]] -name = "uncased" -version = "0.9.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b9bc53168a4be7402ab86c3aad243a84dd7381d09be0eddc81280c1da95ca68" -dependencies = [ - "serde", - "version_check", -] - -[[package]] -name = "unicode-bidi" -version = "0.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" - -[[package]] -name = "unicode-ident" -version = "1.0.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" - -[[package]] -name = "unicode-normalization" -version = "0.1.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" -dependencies = [ - "tinyvec", -] - -[[package]] -name = "unicode-xid" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" - -[[package]] -name = "untrusted" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" - -[[package]] -name = "url" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50bff7831e19200a85b17131d085c25d7811bc4e186efdaf54bbd132994a88cb" -dependencies = [ - "form_urlencoded", - "idna 0.4.0", - "percent-encoding", -] - -[[package]] -name = "uuid" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" -dependencies = [ - "getrandom", - "serde", -] - -[[package]] -name = "validator" -version = "0.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f07b0a1390e01c0fc35ebb26b28ced33c9a3808f7f9fbe94d3cc01e233bfeed5" -dependencies = [ - "idna 0.2.3", - "lazy_static", - "regex", - "serde", - "serde_derive", - "serde_json", - "url", - "validator_derive", -] - -[[package]] -name = "validator_derive" -version = "0.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea7ed5e8cf2b6bdd64a6c4ce851da25388a89327b17b88424ceced6bd5017923" -dependencies = [ - "if_chain", - "lazy_static", - "proc-macro-error", - "proc-macro2", - "quote", - "regex", - "syn 1.0.109", - "validator_types", -] - -[[package]] -name = "validator_types" -version = "0.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2ddf34293296847abfc1493b15c6e2f5d3cd19f57ad7d22673bf4c6278da329" -dependencies = [ - "proc-macro2", - "syn 1.0.109", -] - -[[package]] -name = "valuable" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" - -[[package]] -name = "vcpkg" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" - -[[package]] -name = "version_check" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "walkdir" -version = "2.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36df944cda56c7d8d8b7496af378e6b16de9284591917d307c9b4d313c44e698" -dependencies = [ - "same-file", - "winapi-util", -] - -[[package]] -name = "want" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" -dependencies = [ - "try-lock", -] - -[[package]] -name = "wasi" -version = "0.10.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" - -[[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" - -[[package]] -name = "wasm-bindgen" -version = "0.2.87" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" -dependencies = [ - "cfg-if", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.87" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" -dependencies = [ - "bumpalo", - "log", - "once_cell", - "proc-macro2", - "quote", - "syn 2.0.18", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.87" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.87" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.18", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.87" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" - -[[package]] -name = "web-sys" -version = "0.3.64" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-util" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" -dependencies = [ - "winapi", -] - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "windows" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" -dependencies = [ - "windows-targets 0.48.0", -] - -[[package]] -name = "windows-sys" -version = "0.45.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" -dependencies = [ - "windows-targets 0.42.2", -] - -[[package]] -name = "windows-sys" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" -dependencies = [ - "windows-targets 0.48.0", -] - -[[package]] -name = "windows-targets" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" -dependencies = [ - "windows_aarch64_gnullvm 0.42.2", - "windows_aarch64_msvc 0.42.2", - "windows_i686_gnu 0.42.2", - "windows_i686_msvc 0.42.2", - "windows_x86_64_gnu 0.42.2", - "windows_x86_64_gnullvm 0.42.2", - "windows_x86_64_msvc 0.42.2", -] - -[[package]] -name = "windows-targets" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5" -dependencies = [ - "windows_aarch64_gnullvm 0.48.0", - "windows_aarch64_msvc 0.48.0", - "windows_i686_gnu 0.48.0", - "windows_i686_msvc 0.48.0", - "windows_x86_64_gnu 0.48.0", - "windows_x86_64_gnullvm 0.48.0", - "windows_x86_64_msvc 0.48.0", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" - -[[package]] -name = "windows_i686_gnu" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" - -[[package]] -name = "windows_i686_gnu" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" - -[[package]] -name = "windows_i686_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" - -[[package]] -name = "windows_i686_msvc" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" - -[[package]] -name = "winnow" -version = "0.4.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca0ace3845f0d96209f0375e6d367e3eb87eb65d27d445bdc9f1843a26f39448" -dependencies = [ - "memchr", -] - -[[package]] -name = "yansi" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" diff --git a/backend/Cargo.toml b/backend/Cargo.toml deleted file mode 100644 index 0bf45fe..0000000 --- a/backend/Cargo.toml +++ /dev/null @@ -1,26 +0,0 @@ -[package] -name = "gamenight" -version = "0.1.0" -authors = ["Dennis Brentjes "] -edition = "2018" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] -rocket = { version = "0.5.0-rc.2", features = ["default", "json"] } -rocket_sync_db_pools = { version = "0.1.0-rc.2", features = ["diesel_postgres_pool"] } -rocket_dyn_templates = { version = "0.1.0-rc.2", features = ["handlebars"] } -diesel = {version = "1.4.8", features = ["uuidv07", "r2d2", "postgres", "chrono"]} -diesel_migrations = "1.4.0" -diesel-derive-enum = { version = "1.1", features = ["postgres"] } -chrono = {version = "0.4.19", features = ["serde"] } -serde = "1.0.136" -password-hash = "0.4" -argon2 = "0.4" -rand_core = { version = "0.6", features = ["std"] } -jsonwebtoken = "8.1" -validator = { version = "0.15", features = ["derive"] } -uuid = { version = "0.8.2", features = ["v4", "serde"] } -futures = "0.3.21" -rand = "0.8.5" -base64 = "0.13.0" \ No newline at end of file diff --git a/backend/migrations/2022-03-19-191822_initial/down.sql b/backend/migrations/2022-03-19-191822_initial/down.sql deleted file mode 100644 index be43968..0000000 --- a/backend/migrations/2022-03-19-191822_initial/down.sql +++ /dev/null @@ -1,4 +0,0 @@ --- This file should undo anything in `up.sql` - -drop table gamenight; -drop table known_games; \ No newline at end of file diff --git a/backend/migrations/2022-03-19-191822_initial/up.sql b/backend/migrations/2022-03-19-191822_initial/up.sql deleted file mode 100644 index 3513943..0000000 --- a/backend/migrations/2022-03-19-191822_initial/up.sql +++ /dev/null @@ -1,12 +0,0 @@ --- Your SQL goes here - -CREATE TABLE gamenight ( - id UUID NOT NULL PRIMARY KEY, - name VARCHAR NOT NULL, - datetime VARCHAR NOT NULL -); - -CREATE TABLE known_games ( - id UUID NOT NULL PRIMARY KEY, - name VARCHAR UNIQUE NOT NULL -); \ No newline at end of file diff --git a/backend/migrations/2022-04-17-175115_user-system/down.sql b/backend/migrations/2022-04-17-175115_user-system/down.sql deleted file mode 100644 index bc7f547..0000000 --- a/backend/migrations/2022-04-17-175115_user-system/down.sql +++ /dev/null @@ -1,4 +0,0 @@ --- This file should undo anything in `up.sql` - -drop table pwd; -drop table users; \ No newline at end of file diff --git a/backend/migrations/2022-04-17-175115_user-system/up.sql b/backend/migrations/2022-04-17-175115_user-system/up.sql deleted file mode 100644 index 710f6f7..0000000 --- a/backend/migrations/2022-04-17-175115_user-system/up.sql +++ /dev/null @@ -1,26 +0,0 @@ -CREATE TABLE users ( - id UUID NOT NULL PRIMARY KEY, - username VARCHAR UNIQUE NOT NULL, - email VARCHAR UNIQUE NOT NULL, - role VARCHAR NOT NULL -); - -CREATE TABLE pwd ( - user_id UUID NOT NULL PRIMARY KEY, - password VARCHAR NOT NULL, - CONSTRAINT FK_UserId FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE -); - ---Initialize default admin user, with password "gamenight!" -CREATE EXTENSION IF NOT EXISTS "uuid-ossp"; -DO $$ -DECLARE - admin_uuid uuid = uuid_generate_v4(); -BEGIN - INSERT INTO users (id, username, email, role) - values(admin_uuid, 'admin', '', 'admin'); - - insert INTO pwd (user_id, password) - values(admin_uuid, '$argon2id$v=19$m=4096,t=3,p=1$zEdUjCAnZqd8DziYWzlFHw$YBLQhKvYIZBY43B8zM6hyBvLKuqTeh0EM5pKOfbWQSI'); -END $$; - diff --git a/backend/migrations/2022-05-14-104118_gamenight_owners/down.sql b/backend/migrations/2022-05-14-104118_gamenight_owners/down.sql deleted file mode 100644 index 4ac10b3..0000000 --- a/backend/migrations/2022-05-14-104118_gamenight_owners/down.sql +++ /dev/null @@ -1,4 +0,0 @@ --- This file should undo anything in `up.sql` - -ALTER TABLE gamenight -DROP COLUMN owner_id; \ No newline at end of file diff --git a/backend/migrations/2022-05-14-104118_gamenight_owners/up.sql b/backend/migrations/2022-05-14-104118_gamenight_owners/up.sql deleted file mode 100644 index 76b28ff..0000000 --- a/backend/migrations/2022-05-14-104118_gamenight_owners/up.sql +++ /dev/null @@ -1,19 +0,0 @@ -ALTER TABLE gamenight RENAME TO _gamenight_old; - -CREATE TABLE gamenight ( - id UUID NOT NULL PRIMARY KEY, - name VARCHAR NOT NULL, - datetime VARCHAR NOT NULL, - owner_id UUID NOT NULL, - CONSTRAINT FK_OwnerId FOREIGN KEY (owner_id) REFERENCES users(id) ON DELETE CASCADE -); - -SET session_replication_role = 'replica'; - -INSERT INTO gamenight (id, name, datetime, owner_id) -select id, name, datetime, '00000000-0000-0000-0000-000000000000' -FROM _gamenight_old; - -drop table _gamenight_old; - -SET session_replication_role = 'origin'; \ No newline at end of file diff --git a/backend/migrations/2022-05-27-183310_gamenight_gamelist/down.sql b/backend/migrations/2022-05-27-183310_gamenight_gamelist/down.sql deleted file mode 100644 index fbf6a0e..0000000 --- a/backend/migrations/2022-05-27-183310_gamenight_gamelist/down.sql +++ /dev/null @@ -1,3 +0,0 @@ --- This file should undo anything in `up.sql` - -drop table gamenight_gamelist; \ No newline at end of file diff --git a/backend/migrations/2022-05-27-183310_gamenight_gamelist/up.sql b/backend/migrations/2022-05-27-183310_gamenight_gamelist/up.sql deleted file mode 100644 index 153a8f4..0000000 --- a/backend/migrations/2022-05-27-183310_gamenight_gamelist/up.sql +++ /dev/null @@ -1,9 +0,0 @@ --- Your SQL goes here - -create table gamenight_gamelist ( - gamenight_id UUID NOT NULL, - game_id UUID NOT NULL, - CONSTRAINT FK_gamenight_id FOREIGN KEY (gamenight_id) REFERENCES gamenight(id) ON DELETE CASCADE, - CONSTRAINT FK_game_id FOREIGN KEY (game_id) REFERENCES known_games(id) ON DELETE CASCADE, - PRIMARY KEY(gamenight_id, game_id) -); \ No newline at end of file diff --git a/backend/migrations/2022-05-28-142526_gamenight participants/down.sql b/backend/migrations/2022-05-28-142526_gamenight participants/down.sql deleted file mode 100644 index e32c462..0000000 --- a/backend/migrations/2022-05-28-142526_gamenight participants/down.sql +++ /dev/null @@ -1,3 +0,0 @@ --- This file should undo anything in `up.sql` - -drop table gamenight_participants; \ No newline at end of file diff --git a/backend/migrations/2022-05-28-142526_gamenight participants/up.sql b/backend/migrations/2022-05-28-142526_gamenight participants/up.sql deleted file mode 100644 index 1115fc9..0000000 --- a/backend/migrations/2022-05-28-142526_gamenight participants/up.sql +++ /dev/null @@ -1,9 +0,0 @@ --- Your SQL goes here - -create table gamenight_participants ( - gamenight_id UUID NOT NULL, - user_id UUID NOT NULL, - CONSTRAINT FK_gamenight_id FOREIGN KEY (gamenight_id) REFERENCES gamenight(id) ON DELETE CASCADE, - CONSTRAINT FK_user_id FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE, - PRIMARY KEY(gamenight_id, user_id) -) \ No newline at end of file diff --git a/backend/migrations/2022-06-04-141858_registration_tokens/down.sql b/backend/migrations/2022-06-04-141858_registration_tokens/down.sql deleted file mode 100644 index a238b3b..0000000 --- a/backend/migrations/2022-06-04-141858_registration_tokens/down.sql +++ /dev/null @@ -1,6 +0,0 @@ --- This file should undo anything in `up.sql` - -drop table registration_tokens; - -ALTER TABLE gamenight -ALTER datetime TYPE VARCHAR; \ No newline at end of file diff --git a/backend/migrations/2022-06-04-141858_registration_tokens/up.sql b/backend/migrations/2022-06-04-141858_registration_tokens/up.sql deleted file mode 100644 index 118a1e2..0000000 --- a/backend/migrations/2022-06-04-141858_registration_tokens/up.sql +++ /dev/null @@ -1,11 +0,0 @@ --- Your SQL goes here - -create table registration_tokens ( - id UUID PRIMARY KEY, - token CHARACTER(32) NOT NULL, - single_use BOOLEAN NOT NULL, - expires TIMESTAMPTZ -); - -ALTER TABLE gamenight -ALTER datetime TYPE TIMESTAMPTZ using datetime::timestamp; diff --git a/backend/requests/gamenights.sh b/backend/requests/gamenights.sh deleted file mode 100755 index 67d8213..0000000 --- a/backend/requests/gamenights.sh +++ /dev/null @@ -1,3 +0,0 @@ -echo $JWT - -curl -X GET -H "Authorization: Bearer ${JWT}" localhost:8000/api/gamenights diff --git a/backend/requests/login.sh b/backend/requests/login.sh deleted file mode 100755 index fc37f34..0000000 --- a/backend/requests/login.sh +++ /dev/null @@ -1 +0,0 @@ -curl -X POST -H "Content-Type: application/json" -d '{"username": "a", "password": "c"}' localhost:8000/api/login diff --git a/backend/requests/register.sh b/backend/requests/register.sh deleted file mode 100755 index 689bfbd..0000000 --- a/backend/requests/register.sh +++ /dev/null @@ -1 +0,0 @@ -curl -X POST -H "Content-Type: application/json" -d '{"username": "roflin", "email": "user@example.com", "password": "oreokoekje123", "password_repeat": "oreokoekje123"}' localhost:8000/api/register diff --git a/backend/src/api.rs b/backend/src/api.rs deleted file mode 100644 index 58fa305..0000000 --- a/backend/src/api.rs +++ /dev/null @@ -1,573 +0,0 @@ -use crate::schema; -use crate::schema::admin::RegistrationToken; -use crate::schema::gamenight::*; -use crate::schema::users::*; -use crate::schema::DatabaseError; -use crate::schema::DbConn; -use crate::AppConfig; -use chrono::DateTime; -use chrono::Utc; -use futures::future::join_all; -use jsonwebtoken::{decode, encode, DecodingKey, EncodingKey, Header, Validation}; -use rocket::http::Status; -use rocket::request::{FromRequest, Outcome, Request}; -use rocket::serde::json::{json, Json, Value}; -use rocket::State; -use serde::{Deserialize, Serialize}; -use std::borrow::Cow; -use uuid::Uuid; -use validator::ValidateArgs; - -#[derive(Debug, Responder)] -pub enum ApiResponseVariant { - Status(Status), - Value(Value), -} - -#[derive(Serialize, Deserialize, Debug)] -pub enum ApiData { - #[serde(rename = "user")] - User(UserWithToken), - #[serde(rename = "gamenights")] - Gamenights(Vec), - #[serde(rename = "gamenight")] - Gamenight(GamenightOutput), - #[serde(rename = "games")] - Games(Vec), - #[serde(rename = "registration_tokens")] - RegistrationTokens(Vec), -} - -#[derive(Serialize, Deserialize, Debug)] -struct ApiResponse { - result: Cow<'static, str>, - #[serde(skip_serializing_if = "Option::is_none")] - message: Option>, - #[serde(flatten, skip_serializing_if = "Option::is_none")] - data: Option, -} - -impl ApiResponse { - const SUCCES_RESULT: Cow<'static, str> = Cow::Borrowed("Ok"); - const FAILURE_RESULT: Cow<'static, str> = Cow::Borrowed("Failure"); - - const SUCCES: Self = Self { - result: Self::SUCCES_RESULT, - message: None, - data: None, - }; - - fn error(message: String) -> Self { - Self { - result: Self::FAILURE_RESULT, - message: Some(Cow::Owned(message)), - data: None, - } - } - - fn login_response(user: User, jwt: String) -> Self { - Self { - result: Self::SUCCES_RESULT, - message: None, - data: Some(ApiData::User(UserWithToken { - user: user, - jwt: jwt, - })), - } - } - - fn gamenights_response(gamenights: Vec) -> Self { - Self { - result: Self::SUCCES_RESULT, - message: None, - data: Some(ApiData::Gamenights(gamenights)), - } - } - - fn gamenight_response(gamenight: GamenightOutput) -> Self { - Self { - result: Self::SUCCES_RESULT, - message: None, - data: Some(ApiData::Gamenight(gamenight)), - } - } - - fn games_response(games: Vec) -> Self { - Self { - result: Self::SUCCES_RESULT, - message: None, - data: Some(ApiData::Games(games)), - } - } - - fn registration_tokens_response(tokens: Vec) -> Self { - Self { - result: Self::SUCCES_RESULT, - message: None, - data: Some(ApiData::RegistrationTokens(tokens)), - } - } -} - -#[derive(Debug)] -pub enum ApiError { - RequestError(String), -} - -const AUTH_HEADER: &str = "Authorization"; -const BEARER: &str = "Bearer "; - -#[rocket::async_trait] -impl<'r> FromRequest<'r> for User { - type Error = ApiError; - - async fn from_request(req: &'r Request<'_>) -> Outcome { - let header = match req.headers().get_one(AUTH_HEADER) { - Some(header) => header, - None => return Outcome::Forward(()), - }; - - if !header.starts_with(BEARER) { - return Outcome::Forward(()); - }; - - let app_config = req.guard::<&State>().await.unwrap().inner(); - let jwt = header.trim_start_matches(BEARER).to_owned(); - let token = match decode::( - &jwt, - &DecodingKey::from_secret(app_config.jwt_secret.as_bytes()), - &Validation::default(), - ) { - Ok(token) => token, - Err(_) => return Outcome::Forward(()), - }; - let id = token.claims.uid; - - let conn = req.guard::().await.unwrap(); - return match get_user(conn, id).await { - Ok(o) => Outcome::Success(o), - Err(_) => Outcome::Forward(()), - }; - } -} - -#[derive(Debug, Serialize, Deserialize)] -pub struct GamenightOutput { - #[serde(flatten)] - gamenight: Gamenight, - game_list: Vec, - participants: Vec, -} - -#[derive(Debug, Serialize, Deserialize)] -pub struct GamenightUpdate { - action: String, -} - -#[patch( - "/gamenights/", - format = "application/json", - data = "" -)] -pub async fn patch_gamenight( - conn: DbConn, - user: User, - gamenight_id: String, - patch_json: Json, -) -> ApiResponseVariant { - let uuid = Uuid::parse_str(&gamenight_id).unwrap(); - let patch = patch_json.into_inner(); - match patch.action.as_str() { - "RemoveParticipant" => { - let entry = GamenightParticipantsEntry { - gamenight_id: uuid, - user_id: user.id, - }; - match remove_participant(&conn, entry).await { - Ok(_) => ApiResponseVariant::Value(json!(ApiResponse::SUCCES)), - Err(err) => ApiResponseVariant::Value(json!(ApiResponse::error(err.to_string()))), - } - } - "AddParticipant" => { - let entry = GamenightParticipantsEntry { - gamenight_id: uuid, - user_id: user.id, - }; - match add_participant(&conn, entry).await { - Ok(_) => ApiResponseVariant::Value(json!(ApiResponse::SUCCES)), - Err(err) => ApiResponseVariant::Value(json!(ApiResponse::error(err.to_string()))), - } - } - _ => ApiResponseVariant::Value(json!(ApiResponse::SUCCES)), - } -} - -#[get("/gamenights/")] -pub async fn gamenight(conn: DbConn, _user: User, gamenight_id: String) -> ApiResponseVariant { - let uuid = Uuid::parse_str(&gamenight_id).unwrap(); - let gamenight = match get_gamenight(&conn, uuid).await { - Ok(result) => result, - Err(err) => return ApiResponseVariant::Value(json!(ApiResponse::error(err.to_string()))), - }; - let games = match get_games_of_gamenight(&conn, uuid).await { - Ok(result) => result, - Err(err) => return ApiResponseVariant::Value(json!(ApiResponse::error(err.to_string()))), - }; - let participants = match load_participants(&conn, uuid).await { - Ok(result) => result, - Err(err) => return ApiResponseVariant::Value(json!(ApiResponse::error(err.to_string()))), - }; - let gamenight_output = GamenightOutput { - gamenight: gamenight, - game_list: games, - participants: participants, - }; - return ApiResponseVariant::Value(json!(ApiResponse::gamenight_response(gamenight_output))); -} - -#[get("/gamenights")] -pub async fn gamenights(conn: DbConn, _user: User) -> ApiResponseVariant { - let gamenights = match get_all_gamenights(&conn).await { - Ok(result) => result, - Err(err) => return ApiResponseVariant::Value(json!(ApiResponse::error(err.to_string()))), - }; - - let conn_ref = &conn; - - let game_results: Result, DatabaseError> = - join_all(gamenights.iter().map(|gn| async move { - let games = get_games_of_gamenight(conn_ref, gn.id).await?; - let participants = load_participants(conn_ref, gn.id).await?; - Ok(GamenightOutput { - gamenight: gn.clone(), - game_list: games, - participants: participants, - }) - })) - .await - .into_iter() - .collect(); - - match game_results { - Ok(result) => ApiResponseVariant::Value(json!(ApiResponse::gamenights_response(result))), - Err(err) => ApiResponseVariant::Value(json!(ApiResponse::error(err.to_string()))), - } -} - -#[get("/gamenights", rank = 2)] -pub async fn gamenights_unauthorized() -> ApiResponseVariant { - ApiResponseVariant::Status(Status::Unauthorized) -} - -#[derive(Debug, Serialize, Deserialize, Clone)] -pub struct GamenightInput { - pub name: String, - pub datetime: DateTime, - pub owner_id: Option, - pub game_list: Vec, -} - -impl Into for GamenightInput { - fn into(self) -> Gamenight { - Gamenight { - id: Uuid::new_v4(), - name: self.name, - datetime: self.datetime, - owner_id: self.owner_id.unwrap(), - } - } -} - -#[post("/gamenights", format = "application/json", data = "")] -pub async fn gamenights_post_json( - conn: DbConn, - user: User, - gamenight_json: Json, -) -> ApiResponseVariant { - let mut gamenight = gamenight_json.into_inner(); - gamenight.owner_id = Some(user.id); - - let mut mutable_game_list = gamenight.game_list.clone(); - - match add_unknown_games(&conn, &mut mutable_game_list).await { - Ok(_) => (), - Err(err) => return ApiResponseVariant::Value(json!(ApiResponse::error(err.to_string()))), - }; - - let gamenight_id = match insert_gamenight(&conn, gamenight.clone().into(), mutable_game_list) - .await - { - Ok(id) => id, - Err(err) => return ApiResponseVariant::Value(json!(ApiResponse::error(err.to_string()))), - }; - - let participant = GamenightParticipantsEntry { - gamenight_id: gamenight_id, - user_id: user.id, - }; - match add_participant(&conn, participant).await { - Ok(_) => ApiResponseVariant::Value(json!(ApiResponse::SUCCES)), - Err(err) => ApiResponseVariant::Value(json!(ApiResponse::error(err.to_string()))), - } -} - -#[post("/gamenights", rank = 2)] -pub async fn gamenights_post_json_unauthorized() -> ApiResponseVariant { - ApiResponseVariant::Status(Status::Unauthorized) -} - -#[delete( - "/gamenights", - format = "application/json", - data = "" -)] -pub async fn gamenights_delete_json( - conn: DbConn, - user: User, - delete_gamenight_json: Json, -) -> ApiResponseVariant { - if user.role == Role::Admin { - if let Err(error) = delete_gamenight(&conn, delete_gamenight_json.game_id).await { - return ApiResponseVariant::Value(json!(ApiResponse::error(error.to_string()))); - } - return ApiResponseVariant::Value(json!(ApiResponse::SUCCES)); - } - - match get_gamenight(&conn, delete_gamenight_json.game_id).await { - Ok(gamenight) => { - if user.id == gamenight.owner_id { - if let Err(error) = delete_gamenight(&conn, delete_gamenight_json.game_id).await { - return ApiResponseVariant::Value(json!(ApiResponse::error(error.to_string()))); - } - return ApiResponseVariant::Value(json!(ApiResponse::SUCCES)); - } - } - Err(error) => { - return ApiResponseVariant::Value(json!(ApiResponse::error(error.to_string()))) - } - } - ApiResponseVariant::Status(Status::Unauthorized) -} - -#[delete("/gamenights", rank = 2)] -pub async fn gamenights_delete_json_unauthorized() -> ApiResponseVariant { - ApiResponseVariant::Status(Status::Unauthorized) -} - -#[post("/register", format = "application/json", data = "")] -pub async fn register_post_json(conn: DbConn, register_json: Json) -> ApiResponseVariant { - let register = register_json.into_inner(); - let register_clone = register.clone(); - match conn - .run(move |c| register_clone.validate_args((c, c))) - .await - { - Ok(()) => (), - Err(error) => { - return ApiResponseVariant::Value(json!(ApiResponse::error(error.to_string()))) - } - } - - match insert_user(conn, register).await { - Ok(_) => ApiResponseVariant::Value(json!(ApiResponse::SUCCES)), - Err(err) => ApiResponseVariant::Value(json!(ApiResponse::error(err.to_string()))), - } -} - -#[derive(Debug, Serialize, Deserialize)] -struct Claims { - exp: i64, - uid: Uuid, - role: Role, -} - -#[post("/login", format = "application/json", data = "")] -pub async fn login_post_json( - conn: DbConn, - config: &State, - login_json: Json, -) -> ApiResponseVariant { - match login(conn, login_json.into_inner()).await { - Err(err) => ApiResponseVariant::Value(json!(ApiResponse::error(err.to_string()))), - Ok(login_result) => { - if !login_result.result { - return ApiResponseVariant::Value(json!(ApiResponse::error(String::from( - "username and password didn't match" - )))); - } - - let user = login_result.user.unwrap(); - let my_claims = Claims { - exp: Utc::now().timestamp() + chrono::Duration::days(7).num_seconds(), - uid: user.id, - role: user.role, - }; - - let secret = &config.inner().jwt_secret; - match encode( - &Header::default(), - &my_claims, - &EncodingKey::from_secret(secret.as_bytes()), - ) { - Ok(token) => { - ApiResponseVariant::Value(json!(ApiResponse::login_response(user, token))) - } - Err(error) => { - ApiResponseVariant::Value(json!(ApiResponse::error(error.to_string()))) - } - } - } - } -} - -#[get("/games")] -pub async fn games(conn: DbConn, _user: User) -> ApiResponseVariant { - match get_all_known_games(&conn).await { - Ok(games) => ApiResponseVariant::Value(json!(ApiResponse::games_response(games))), - Err(error) => ApiResponseVariant::Value(json!(ApiResponse::error(error.to_string()))), - } -} - -#[get("/games", rank = 2)] -pub async fn games_unauthorized() -> ApiResponseVariant { - ApiResponseVariant::Status(Status::Unauthorized) -} - -#[get( - "/participants", - format = "application/json", - data = "" -)] -pub async fn get_participants( - conn: DbConn, - _user: User, - gamenight_id_json: Json, -) -> ApiResponseVariant { - match load_participants(&conn, gamenight_id_json.into_inner().gamenight_id).await { - Ok(_) => ApiResponseVariant::Value(json!(ApiResponse::SUCCES)), - Err(error) => ApiResponseVariant::Value(json!(ApiResponse::error(error.to_string()))), - } -} - -#[get("/participants", rank = 2)] -pub async fn get_participants_unauthorized() -> ApiResponseVariant { - ApiResponseVariant::Status(Status::Unauthorized) -} - -#[post("/participants", format = "application/json", data = "")] -pub async fn post_participants( - conn: DbConn, - _user: User, - entry_json: Json, -) -> ApiResponseVariant { - match add_participant(&conn, entry_json.into_inner()).await { - Ok(_) => ApiResponseVariant::Value(json!(ApiResponse::SUCCES)), - Err(error) => ApiResponseVariant::Value(json!(ApiResponse::error(error.to_string()))), - } -} - -#[post("/participants", rank = 2)] -pub async fn post_participants_unauthorized() -> ApiResponseVariant { - ApiResponseVariant::Status(Status::Unauthorized) -} - -#[delete("/participants", format = "application/json", data = "")] -pub async fn delete_participants( - conn: DbConn, - _user: User, - entry_json: Json, -) -> ApiResponseVariant { - match remove_participant(&conn, entry_json.into_inner()).await { - Ok(_) => ApiResponseVariant::Value(json!(ApiResponse::SUCCES)), - Err(error) => ApiResponseVariant::Value(json!(ApiResponse::error(error.to_string()))), - } -} - -#[delete("/participants", rank = 2)] -pub async fn delete_participants_unauthorized() -> ApiResponseVariant { - ApiResponseVariant::Status(Status::Unauthorized) -} - -#[derive(Deserialize)] -pub struct RegistrationTokenData { - single_use: bool, - expires: Option>, -} - -impl Into for RegistrationTokenData { - fn into(self) -> RegistrationToken { - use rand::Rng; - let random_bytes = rand::thread_rng().gen::<[u8; 24]>(); - RegistrationToken { - id: Uuid::new_v4(), - token: base64::encode_config(random_bytes, base64::URL_SAFE), - single_use: self.single_use, - expires: self.expires, - } - } -} - -#[post( - "/admin/registration_tokens", - format = "application/json", - data = "" -)] -pub async fn add_registration_token( - conn: DbConn, - user: User, - token_json: Json, -) -> ApiResponseVariant { - if user.role != Role::Admin { - return ApiResponseVariant::Status(Status::Unauthorized); - } - - match schema::admin::add_registration_token(&conn, token_json.into_inner().into()).await { - Ok(_) => ApiResponseVariant::Value(json!(ApiResponse::SUCCES)), - Err(err) => ApiResponseVariant::Value(json!(ApiResponse::error(err.to_string()))), - } -} - -#[post("/admin/registration_tokens", rank = 2)] -pub async fn add_registration_token_unauthorized() -> ApiResponseVariant { - ApiResponseVariant::Status(Status::Unauthorized) -} - -#[get("/admin/registration_tokens")] -pub async fn get_registration_tokens(conn: DbConn, user: User) -> ApiResponseVariant { - if user.role != Role::Admin { - return ApiResponseVariant::Status(Status::Unauthorized); - } - - match schema::admin::get_all_registration_tokens(&conn).await { - Ok(results) => { - ApiResponseVariant::Value(json!(ApiResponse::registration_tokens_response(results))) - } - Err(err) => ApiResponseVariant::Value(json!(ApiResponse::error(err.to_string()))), - } -} - -#[get("/admin/registration_tokens", rank = 2)] -pub async fn get_registration_tokens_unauthorized() -> ApiResponseVariant { - ApiResponseVariant::Status(Status::Unauthorized) -} - -#[delete("/admin/registration_tokens/")] -pub async fn delete_registration_tokens( - conn: DbConn, - user: User, - gamenight_id: String, -) -> ApiResponseVariant { - if user.role != Role::Admin { - return ApiResponseVariant::Status(Status::Unauthorized); - } - - let uuid = Uuid::parse_str(&gamenight_id).unwrap(); - match schema::admin::delete_registration_token(&conn, uuid).await { - Ok(_) => ApiResponseVariant::Value(json!(ApiResponse::SUCCES)), - Err(err) => ApiResponseVariant::Value(json!(ApiResponse::error(err.to_string()))), - } -} -#[delete("/admin/registration_tokens", rank = 2)] -pub async fn delete_registration_tokens_unauthorized() -> ApiResponseVariant { - ApiResponseVariant::Status(Status::Unauthorized) -} diff --git a/backend/src/main.rs b/backend/src/main.rs deleted file mode 100644 index d0fb8ad..0000000 --- a/backend/src/main.rs +++ /dev/null @@ -1,81 +0,0 @@ -#[macro_use] -extern crate rocket; -#[macro_use] -extern crate diesel_migrations; -#[macro_use] -extern crate diesel; - -use rocket::{ - fairing::AdHoc, - figment::{ - providers::{Env, Format, Serialized, Toml}, - Figment, Profile, - }, -}; -use rocket_dyn_templates::Template; -use serde::{Deserialize, Serialize}; - -mod api; -pub mod schema; -mod site; - -#[derive(Debug, Deserialize, Serialize)] -pub struct AppConfig { - jwt_secret: String, -} - -impl Default for AppConfig { - fn default() -> AppConfig { - AppConfig { - jwt_secret: String::from("secret"), - } - } -} - -#[launch] -async fn rocket() -> _ { - let figment = Figment::from(rocket::Config::default()) - .merge(Serialized::defaults(AppConfig::default())) - .merge(Toml::file("App.toml").nested()) - .merge(Env::prefixed("APP_").global()) - .select(Profile::from_env_or("APP_PROFILE", "default")); - - let rocket = rocket::custom(figment) - .attach(schema::DbConn::fairing()) - .attach(Template::fairing()) - .attach(site::CORS) - .attach(AdHoc::on_ignite("Run Migrations", schema::run_migrations)) - .attach(AdHoc::config::()) - .mount("/", routes![site::index, site::files]) - .mount( - "/api", - routes![ - api::gamenight, - api::patch_gamenight, - api::gamenights, - api::gamenights_unauthorized, - api::gamenights_post_json, - api::gamenights_post_json_unauthorized, - api::register_post_json, - api::login_post_json, - api::gamenights_delete_json, - api::gamenights_delete_json_unauthorized, - api::games, - api::games_unauthorized, - api::get_participants, - api::get_participants_unauthorized, - api::post_participants, - api::post_participants_unauthorized, - api::delete_participants, - api::delete_participants_unauthorized, - api::add_registration_token, - api::add_registration_token_unauthorized, - api::get_registration_tokens, - api::get_registration_tokens_unauthorized, - api::delete_registration_tokens, - api::delete_registration_tokens_unauthorized, - ], - ); - - rocket -} diff --git a/backend/src/schema/admin.rs b/backend/src/schema/admin.rs deleted file mode 100644 index 218a783..0000000 --- a/backend/src/schema/admin.rs +++ /dev/null @@ -1,54 +0,0 @@ -use crate::schema::{DatabaseError, DbConn}; -use chrono::DateTime; -use chrono::Utc; -use diesel::{QueryDsl, RunQueryDsl, ExpressionMethods}; -use serde::{Deserialize, Serialize}; -use uuid::Uuid; - -table! { - registration_tokens (id) { - id -> diesel::sql_types::Uuid, - token -> Char, - single_use -> Bool, - expires -> Nullable, - } -} - -#[derive(Serialize, Deserialize, Debug, Insertable, Queryable)] -#[table_name = "registration_tokens"] -pub struct RegistrationToken { - pub id: Uuid, - pub token: String, - pub single_use: bool, - pub expires: Option>, -} - -pub async fn get_all_registration_tokens( - conn: &DbConn, -) -> Result, DatabaseError> { - Ok(conn - .run(|c| registration_tokens::table.load::(c)) - .await?) -} - -pub async fn add_registration_token( - conn: &DbConn, - token: RegistrationToken, -) -> Result { - Ok(conn - .run(|c| { - diesel::insert_into(registration_tokens::table) - .values(token) - .execute(c) - }) - .await?) -} - -pub async fn delete_registration_token(conn: &DbConn, id: Uuid) -> Result { - Ok(conn - .run(move |c| { - diesel::delete(registration_tokens::table.filter(registration_tokens::id.eq(id))) - .execute(c) - }) - .await?) -} diff --git a/backend/src/schema/gamenight.rs b/backend/src/schema/gamenight.rs deleted file mode 100644 index fc90c69..0000000 --- a/backend/src/schema/gamenight.rs +++ /dev/null @@ -1,215 +0,0 @@ -use crate::schema::users::{users, User}; -use crate::schema::{DatabaseError, DbConn}; -use chrono::{DateTime, Utc}; -use diesel::{Connection, ExpressionMethods, QueryDsl, RunQueryDsl}; -use serde::{Deserialize, Serialize}; -use uuid::Uuid; - -table! { - gamenight (id) { - id -> diesel::sql_types::Uuid, - name -> VarChar, - datetime -> Timestamptz, - owner_id -> Uuid, - } -} - -table! { - known_games (id) { - id -> diesel::sql_types::Uuid, - name -> VarChar, - } -} - -table! { - gamenight_gamelist(gamenight_id, game_id) { - gamenight_id -> diesel::sql_types::Uuid, - game_id -> diesel::sql_types::Uuid, - } -} - -table! { - gamenight_participants(gamenight_id, user_id) { - gamenight_id -> diesel::sql_types::Uuid, - user_id -> diesel::sql_types::Uuid, - } -} - -#[derive(Serialize, Deserialize, Debug, Queryable, Clone, Insertable)] -#[table_name = "known_games"] -pub struct Game { - pub id: Uuid, - pub name: String, -} - -#[derive(Serialize, Deserialize, Debug, Queryable, Insertable, Clone)] -#[table_name = "gamenight"] -pub struct Gamenight { - pub id: Uuid, - pub name: String, - pub datetime: DateTime, - pub owner_id: Uuid, -} - -#[derive(Serialize, Deserialize, Debug, Queryable, Insertable)] -#[table_name = "gamenight_gamelist"] -pub struct GamenightGameListEntry { - pub gamenight_id: Uuid, - pub game_id: Uuid, -} - -#[derive(Serialize, Deserialize, Debug, Queryable, Insertable, Identifiable)] -#[table_name = "gamenight_participants"] -#[primary_key(gamenight_id, user_id)] -pub struct GamenightParticipantsEntry { - pub gamenight_id: Uuid, - pub user_id: Uuid, -} - -#[derive(Serialize, Deserialize, Debug, Queryable)] -pub struct DeleteGamenight { - pub game_id: Uuid, -} - -#[derive(Serialize, Deserialize, Debug, Queryable)] -pub struct GamenightId { - pub gamenight_id: Uuid, -} - -pub async fn get_all_gamenights(conn: &DbConn) -> Result, DatabaseError> { - Ok(conn.run(|c| gamenight::table.load::(c)).await?) -} - -pub async fn insert_gamenight( - conn: &DbConn, - new_gamenight: Gamenight, - game_list: Vec, -) -> Result { - Ok(conn - .run(move |c| { - c.transaction::<_, DatabaseError, _>(|| { - let id: Uuid = diesel::insert_into(gamenight::table) - .values(&new_gamenight) - .returning(gamenight::id) - .get_result(c)?; - - let entries: Vec = game_list - .iter() - .map(|g| GamenightGameListEntry { - gamenight_id: new_gamenight.id.clone(), - game_id: g.id.clone(), - }) - .collect(); - - diesel::insert_into(gamenight_gamelist::table) - .values(entries) - .execute(c)?; - - Ok(id) - }) - }) - .await?) -} - -pub async fn get_gamenight(conn: &DbConn, gamenight_id: Uuid) -> Result { - Ok(conn - .run(move |c| gamenight::table.find(gamenight_id).first(c)) - .await?) -} - -pub async fn delete_gamenight(conn: &DbConn, game_id: Uuid) -> Result { - Ok(conn - .run(move |c| diesel::delete(gamenight::table.filter(gamenight::id.eq(game_id))).execute(c)) - .await?) -} - -pub async fn get_all_known_games(conn: &DbConn) -> Result, DatabaseError> { - Ok(conn.run(|c| known_games::table.load::(c)).await?) -} - -pub async fn get_games_of_gamenight( - conn: &DbConn, - gamenight_id: Uuid, -) -> Result, DatabaseError> { - Ok(conn - .run::<_, Result, _>>(move |c| { - let linked_game_ids: Vec = gamenight_gamelist::table - .filter(gamenight_gamelist::gamenight_id.eq(gamenight_id)) - .load::(c)?; - - linked_game_ids - .iter() - .map(|l| { - known_games::table - .filter(known_games::id.eq(l.game_id)) - .first::(c) - }) - .collect() - }) - .await?) -} - -pub async fn add_game(conn: &DbConn, game: Game) -> Result { - Ok(conn - .run(|c| { - diesel::insert_into(known_games::table) - .values(game) - .execute(c) - }) - .await?) -} - -pub async fn add_unknown_games(conn: &DbConn, games: &mut Vec) -> Result<(), DatabaseError> { - let all_games = get_all_known_games(conn).await?; - for game in games.iter_mut() { - if !all_games.iter().any(|g| g.name == game.name) { - game.id = Uuid::new_v4(); - add_game(conn, game.clone()).await?; - } - } - Ok(()) -} - -pub async fn load_participants( - conn: &DbConn, - gamenight_id: Uuid, -) -> Result, DatabaseError> { - Ok(conn - .run::<_, Result, _>>(move |c| { - let linked_participants = gamenight_participants::table - .filter(gamenight_participants::gamenight_id.eq(gamenight_id)) - .load::(c)?; - linked_participants - .iter() - .map(|l| { - users::table - .filter(users::id.eq(l.user_id)) - .first::(c) - }) - .collect() - }) - .await?) -} - -pub async fn add_participant( - conn: &DbConn, - participant: GamenightParticipantsEntry, -) -> Result { - Ok(conn - .run(move |c| { - diesel::insert_into(gamenight_participants::table) - .values(&participant) - .on_conflict_do_nothing() - .execute(c) - }) - .await?) -} - -pub async fn remove_participant( - conn: &DbConn, - participant: GamenightParticipantsEntry, -) -> Result { - Ok(conn - .run(move |c| diesel::delete(&participant).execute(c)) - .await?) -} diff --git a/backend/src/schema/mod.rs b/backend/src/schema/mod.rs deleted file mode 100644 index e4ae643..0000000 --- a/backend/src/schema/mod.rs +++ /dev/null @@ -1,58 +0,0 @@ -pub mod admin; -pub mod gamenight; -pub mod users; - -use rocket::{Build, Rocket}; -use rocket_sync_db_pools::database; -use std::ops::Deref; - -#[database("gamenight_database")] -pub struct DbConn(diesel::PgConnection); - -impl Deref for DbConn { - type Target = rocket_sync_db_pools::Connection; - - fn deref(&self) -> &Self::Target { - &self.0 - } -} - -pub enum DatabaseError { - Hash(password_hash::Error), - Query(String), -} - -pub async fn run_migrations(rocket: Rocket) -> Rocket { - // This macro from `diesel_migrations` defines an `embedded_migrations` - // module containing a function named `run`. This allows the example to be - // run and tested without any outside setup of the database. - embed_migrations!(); - - let conn = DbConn::get_one(&rocket).await.expect("database connection"); - conn.run(|c| embedded_migrations::run(c)) - .await - .expect("can run migrations"); - - rocket -} - -impl From for DatabaseError { - fn from(error: diesel::result::Error) -> Self { - Self::Query(error.to_string()) - } -} - -impl From for DatabaseError { - fn from(error: password_hash::Error) -> Self { - Self::Hash(error) - } -} - -impl std::fmt::Display for DatabaseError { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> { - match self { - DatabaseError::Hash(err) => write!(f, "{}", err), - DatabaseError::Query(err) => write!(f, "{}", err), - } - } -} diff --git a/backend/src/schema/users.rs b/backend/src/schema/users.rs deleted file mode 100644 index a29ca50..0000000 --- a/backend/src/schema/users.rs +++ /dev/null @@ -1,191 +0,0 @@ -use crate::schema::{DatabaseError, DbConn}; -use argon2::password_hash::SaltString; -use argon2::PasswordHash; -use argon2::PasswordVerifier; -use argon2::{ - password_hash::{rand_core::OsRng, PasswordHasher}, - Argon2, -}; -use diesel::{Connection, ExpressionMethods, QueryDsl, RunQueryDsl}; -use diesel_derive_enum::DbEnum; -use serde::{Deserialize, Serialize}; -use uuid::Uuid; -use validator::{Validate, ValidationError}; - -#[derive(Debug, Serialize, Deserialize, DbEnum, Clone, Copy, PartialEq)] -pub enum Role { - Admin, - User, -} - -table! { - users(id) { - id -> diesel::sql_types::Uuid, - username -> VarChar, - email -> VarChar, - role -> crate::schema::users::RoleMapping, - } -} - -table! { - pwd(user_id) { - user_id -> diesel::sql_types::Uuid, - password -> VarChar, - } -} - -#[derive(Serialize, Deserialize, Debug, Insertable, Queryable)] -#[table_name = "pwd"] -struct Pwd { - user_id: Uuid, - password: String, -} - -#[derive(Serialize, Deserialize, Debug, Insertable, Queryable)] -#[table_name = "users"] -pub struct User { - pub id: Uuid, - pub username: String, - pub email: String, - pub role: Role, -} - -#[derive(Debug, Serialize, Deserialize)] -pub struct UserWithToken { - #[serde(flatten)] - pub user: User, - pub jwt: String, -} - -#[derive(Serialize, Deserialize, Debug)] -pub struct Login { - pub username: String, - pub password: String, -} - -#[derive(Serialize, Deserialize, Debug)] -pub struct LoginResult { - pub result: bool, - pub user: Option, -} - -#[derive(Serialize, Deserialize, Debug, Validate, Clone)] -pub struct Register { - #[validate( - length(min = 1), - custom(function = "unique_username", arg = "&'v_a diesel::PgConnection") - )] - pub username: String, - #[validate( - email, - custom(function = "unique_email", arg = "&'v_a diesel::PgConnection") - )] - pub email: String, - #[validate(length(min = 10), must_match = "password_repeat")] - pub password: String, - pub password_repeat: String, -} - -pub async fn insert_user(conn: DbConn, new_user: Register) -> Result { - let salt = SaltString::generate(&mut OsRng); - - let argon2 = Argon2::default(); - - let password_hash = argon2 - .hash_password(new_user.password.as_bytes(), &salt)? - .to_string(); - - Ok(conn - .run(move |c| { - c.transaction(|| { - let id = Uuid::new_v4(); - - diesel::insert_into(users::table) - .values(User { - id: id.clone(), - username: new_user.username, - email: new_user.email, - role: Role::User, - }) - .execute(c)?; - - diesel::insert_into(pwd::table) - .values(Pwd { - user_id: id, - password: password_hash, - }) - .execute(c) - }) - }) - .await?) -} - -pub async fn login(conn: DbConn, login: Login) -> Result { - conn.run(move |c| -> Result { - let id: Uuid = users::table - .filter(users::username.eq(&login.username)) - .or_filter(users::email.eq(&login.username)) - .select(users::id) - .first(c)?; - - let pwd: String = pwd::table - .filter(pwd::user_id.eq(id)) - .select(pwd::password) - .first(c)?; - - let parsed_hash = PasswordHash::new(&pwd)?; - - if Argon2::default() - .verify_password(&login.password.as_bytes(), &parsed_hash) - .is_ok() - { - let user: User = users::table.find(id).first(c)?; - - Ok(LoginResult { - result: true, - user: Some(user), - }) - } else { - Ok(LoginResult { - result: false, - user: None, - }) - } - }) - .await -} - -pub async fn get_user(conn: DbConn, id: Uuid) -> Result { - Ok(conn - .run(move |c| users::table.filter(users::id.eq(id)).first(c)) - .await?) -} - -pub fn unique_username( - username: &String, - conn: &diesel::PgConnection, -) -> Result<(), ValidationError> { - match users::table - .count() - .filter(users::username.eq(username)) - .get_result(conn) - { - Ok(0) => Ok(()), - Ok(_) => Err(ValidationError::new("User already exists")), - Err(_) => Err(ValidationError::new("Database error while validating user")), - } -} - -pub fn unique_email(email: &String, conn: &diesel::PgConnection) -> Result<(), ValidationError> { - match users::table - .count() - .filter(users::email.eq(email)) - .get_result(conn) - { - Ok(0) => Ok(()), - Ok(_) => Err(ValidationError::new("email already exists")), - Err(_) => Err(ValidationError::new( - "Database error while validating email", - )), - } -} diff --git a/backend/src/site.rs b/backend/src/site.rs deleted file mode 100644 index 9ce5fef..0000000 --- a/backend/src/site.rs +++ /dev/null @@ -1,42 +0,0 @@ -use rocket::fs::NamedFile; -use rocket::{ - fairing::{Fairing, Info, Kind}, - http::Header, - Request, Response, -}; -use std::io; -use std::path::{Path, PathBuf}; - -pub struct CORS; - -#[rocket::async_trait] -impl Fairing for CORS { - fn info(&self) -> Info { - Info { - name: "Attaching CORS headers to responses", - kind: Kind::Response, - } - } - - async fn on_response<'r>(&self, _request: &'r Request<'_>, response: &mut Response<'r>) { - response.set_header(Header::new("Access-Control-Allow-Origin", "*")); - response.set_header(Header::new( - "Access-Control-Allow-Methods", - "POST, GET, PATCH, OPTIONS", - )); - response.set_header(Header::new("Access-Control-Allow-Headers", "*")); - response.set_header(Header::new("Access-Control-Allow-Credentials", "true")); - } -} - -#[get("/", rank = 10)] -pub async fn files(file: PathBuf) -> Option { - NamedFile::open(Path::new("../frontend/build/").join(file)) - .await - .ok() -} - -#[get("/")] -pub async fn index() -> io::Result { - NamedFile::open("../frontend/build/index.html").await -} diff --git a/backend/templates/flash.html.hbs b/backend/templates/flash.html.hbs deleted file mode 100644 index 4841799..0000000 --- a/backend/templates/flash.html.hbs +++ /dev/null @@ -1,5 +0,0 @@ - {{#if has_data}} -
-

{{kind}}: {{message}}

-
- {{/if}} \ No newline at end of file diff --git a/backend/templates/gamenight_add.html.hbs b/backend/templates/gamenight_add.html.hbs deleted file mode 100644 index 861d3f5..0000000 --- a/backend/templates/gamenight_add.html.hbs +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - {{> flash flash }} - -
-
-
-
- - -
- - \ No newline at end of file diff --git a/backend/templates/gamenights.html.hbs b/backend/templates/gamenights.html.hbs deleted file mode 100644 index 7f61d9d..0000000 --- a/backend/templates/gamenights.html.hbs +++ /dev/null @@ -1,14 +0,0 @@ - - - - - {{> flash flash }} - - {{#each gamenights}} -
- game: {{this.game}} - when: {{this.datetime}} -
- {{/each}} - - \ No newline at end of file diff --git a/backend/templates/register.html.hbs b/backend/templates/register.html.hbs deleted file mode 100644 index 53a9bd3..0000000 --- a/backend/templates/register.html.hbs +++ /dev/null @@ -1,19 +0,0 @@ - - - - - {{> flash flash }} - -
-
-
-
-
-
-
-
-
- -
- - \ No newline at end of file