diff --git a/.gitignore b/.gitignore index ccb5166..ea8c4bf 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1 @@ /target -.vscode \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index 30bba48..4bea405 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,66 +1,18 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -[[package]] -name = "aho-corasick" -version = "0.7.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f" -dependencies = [ - "memchr", -] - -[[package]] -name = "async-stream" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "171374e7e3b2504e0e5236e3b59260560f9fe94bfe9ac39ba5e4e929c5590625" -dependencies = [ - "async-stream-impl", - "futures-core", -] - -[[package]] -name = "async-stream-impl" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "648ed8c8d2ce5409ccd57453d9d1b214b342a0d69376a6feda1fd6cae3299308" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] +version = 3 [[package]] name = "async-trait" -version = "0.1.50" +version = "0.1.51" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b98e84bbb4cbcdd97da190ba0c58a1bb0de2c1fdf67d159e192ed766aeca722" +checksum = "44318e776df68115a881de9a8fd1b9e53368d7a4a5ce4cc48517da3393233a5e" dependencies = [ "proc-macro2", "quote", "syn", ] -[[package]] -name = "atomic" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3410529e8288c463bedb5930f82833bc0c90e5d2fe639a56582a4d09220b281" -dependencies = [ - "autocfg", -] - -[[package]] -name = "atty" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi", - "libc", - "winapi 0.3.9", -] - [[package]] name = "autocfg" version = "1.0.1" @@ -68,55 +20,50 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" [[package]] -name = "base-x" -version = "0.2.8" +name = "base64" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4521f3e3d031370679b3b140beb36dfe4801b09ac77e30c61941f97df3ef28b" +checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" [[package]] -name = "binascii" -version = "0.1.4" +name = "bincode" +version = "1.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "383d29d513d8764dcdc42ea295d979eb99c3c9f00607b3692cf68a431f7dca72" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] [[package]] name = "bitflags" -version = "1.2.1" +version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "block-buffer" -version = "0.7.3" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" +checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" dependencies = [ - "block-padding", - "byte-tools", - "byteorder", "generic-array", ] [[package]] -name = "block-padding" -version = "0.1.5" +name = "buf_redux" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5" +checksum = "b953a6887648bb07a535631f2bc00fbdb2a2216f135552cb3f534ed136b9c07f" dependencies = [ - "byte-tools", + "memchr", + "safemem", ] [[package]] name = "bumpalo" -version = "3.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c59e7af012c713f529e7a3ee57ce9b31ddd858d4b512923602f74608b009631" - -[[package]] -name = "byte-tools" -version = "0.3.1" +version = "3.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" +checksum = "d9df67f7bf9ef8498769f994239c45613ef0c5899415fb58e9add412d2c1a538" [[package]] name = "byteorder" @@ -126,21 +73,15 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "bytes" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b700ce4376041dcd0a327fd0097c41095743c4c8af8887265942faf1100bd040" +checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8" [[package]] name = "cc" -version = "1.0.68" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a72c244c1ff497a746a7e1fb3d14bd08420ecda70c8f25c7112f2781652d787" - -[[package]] -name = "cfg-if" -version = "0.1.10" +version = "1.0.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" +checksum = "d26a6ce4b6a484fa3edb70f7efa6fc430fd2b87285fe8b84304fd0936faa0dc0" [[package]] name = "cfg-if" @@ -149,147 +90,128 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] -name = "const_fn" -version = "0.4.8" +name = "chrono" +version = "0.4.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f92cfa0fd5690b3cf8c1ef2cabbd9b7ef22fa53cf5e1f92b05103f6d5d1cf6e7" +checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73" +dependencies = [ + "libc", + "num-integer", + "num-traits", + "serde", + "time", + "winapi", +] [[package]] -name = "convert_case" +name = "confy" version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" - -[[package]] -name = "cookie" -version = "0.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffdf8865bac3d9a3bde5bde9088ca431b11f5d37c7a578b8086af77248b76627" +source = "git+https://github.com/JosiahBull/confy#d61abb7896e0e56837033de459eecce9b5eb21a4" dependencies = [ - "percent-encoding", - "time", - "version_check", + "directories-next", + "serde", + "toml", ] [[package]] -name = "derive_more" -version = "0.99.14" +name = "core-foundation" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cc7b9cef1e351660e5443924e4f43ab25fbbed3e9a5f052df3677deb4d6b320" +checksum = "0a89e2ae426ea83155dccf10c0fa6b1463ef6d5fcb44cee0b224a408fa640a62" dependencies = [ - "convert_case", - "proc-macro2", - "quote", - "syn", + "core-foundation-sys", + "libc", ] [[package]] -name = "devise" -version = "0.3.0" +name = "core-foundation-sys" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "411cf45ac38f00df3679689616649dc12607b846db171780bb790b514a042832" -dependencies = [ - "devise_codegen", - "devise_core", -] +checksum = "ea221b5284a47e40033bf9b66f35f984ec0ea2931eb03505246cd27a963f981b" [[package]] -name = "devise_codegen" -version = "0.3.0" +name = "cpufeatures" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cf7081f06822f1787e29359354426132cf832cc977d7a8ff747848631462ad1" +checksum = "95059428f66df56b63431fdb4e1947ed2190586af5c5a8a8b71122bdf5a7f469" dependencies = [ - "devise_core", - "quote", + "libc", ] [[package]] -name = "devise_core" -version = "0.3.0" +name = "crypto-mac" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80c23631758736875d7ce08f847f296b4001b72cf90878e85b47df7ac5442147" +checksum = "bff07008ec701e8028e2ceb8f83f0e4274ee62bd2dbdc4fefff2e9a91824081a" dependencies = [ - "bitflags", - "proc-macro2", - "proc-macro2-diagnostics", - "quote", - "syn", + "generic-array", + "subtle", ] [[package]] name = "digest" -version = "0.8.1" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" +checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" dependencies = [ "generic-array", ] [[package]] -name = "discard" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0" - -[[package]] -name = "either" -version = "1.6.1" +name = "directories-next" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" +checksum = "339ee130d97a610ea5a5872d2bbb130fdf68884ff09d3028b81bec8a1ac23bbc" +dependencies = [ + "cfg-if", + "dirs-sys-next", +] [[package]] -name = "encoding_rs" -version = "0.8.28" +name = "dirs" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80df024fbc5ac80f87dfef0d9f5209a252f2a497f7f42944cff24d8253cac065" +checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059" dependencies = [ - "cfg-if 1.0.0", + "dirs-sys", ] [[package]] -name = "env_logger" -version = "0.7.1" +name = "dirs-sys" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" +checksum = "03d86534ed367a67548dc68113a0f5db55432fdfbb6e6f9d77704397d95d5780" dependencies = [ - "atty", - "humantime", - "log", - "regex", - "termcolor", + "libc", + "redox_users", + "winapi", ] [[package]] -name = "fake-simd" +name = "dirs-sys-next" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" +checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" +dependencies = [ + "libc", + "redox_users", + "winapi", +] [[package]] -name = "figment" -version = "0.10.5" +name = "encoding_rs" +version = "0.8.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ca029e813a72b7526d28273d25f3e4a2f365d1b7a1018a6f93ec9053a119763" +checksum = "80df024fbc5ac80f87dfef0d9f5209a252f2a497f7f42944cff24d8253cac065" dependencies = [ - "atomic", - "pear", - "serde", - "toml", - "uncased", - "version_check", + "cfg-if", ] [[package]] -name = "filetime" -version = "0.2.14" +name = "fallible-iterator" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d34cfa13a63ae058bfa601fe9e313bbdb3746427c1459185464ce0fcf62e1e8" -dependencies = [ - "cfg-if 1.0.0", - "libc", - "redox_syscall", - "winapi 0.3.9", -] +checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" [[package]] name = "fnv" @@ -298,45 +220,35 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] -name = "fsevent" -version = "0.4.0" +name = "foreign-types" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ab7d1bd1bd33cc98b0889831b72da23c0aa4df9cec7e0702f46ecea04b35db6" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" dependencies = [ - "bitflags", - "fsevent-sys", + "foreign-types-shared", ] [[package]] -name = "fsevent-sys" -version = "2.0.1" +name = "foreign-types-shared" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f41b048a94555da0f42f1d632e2e19510084fb8e303b0daa2816e733fb3644a0" -dependencies = [ - "libc", -] +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" [[package]] -name = "fuchsia-zircon" -version = "0.3.3" +name = "form_urlencoded" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" +checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191" dependencies = [ - "bitflags", - "fuchsia-zircon-sys", + "matches", + "percent-encoding", ] -[[package]] -name = "fuchsia-zircon-sys" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" - [[package]] name = "futures" -version = "0.3.15" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e7e43a803dae2fa37c1f6a8fe121e1f7bf9548b4dfc0522a42f34145dadfc27" +checksum = "a12aa0eb539080d55c3f2d45a67c3b58b6b0773c1a3ca2dfec66d58c97fd66ca" dependencies = [ "futures-channel", "futures-core", @@ -349,9 +261,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.15" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e682a68b29a882df0545c143dc3646daefe80ba479bcdede94d5a703de2871e2" +checksum = "5da6ba8c3bb3c165d3c7319fc1cc8304facf1fb8db99c5de877183c08a273888" dependencies = [ "futures-core", "futures-sink", @@ -359,15 +271,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.15" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0402f765d8a89a26043b889b26ce3c4679d268fa6bb22cd7c6aad98340e179d1" +checksum = "88d1c26957f23603395cd326b0ffe64124b818f4449552f960d815cfba83a53d" [[package]] name = "futures-executor" -version = "0.3.15" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "badaa6a909fac9e7236d0620a2f57f7664640c56575b71a7552fbd68deafab79" +checksum = "45025be030969d763025784f7f355043dc6bc74093e4ecc5000ca4dc50d8745c" dependencies = [ "futures-core", "futures-task", @@ -376,15 +288,15 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.15" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acc499defb3b348f8d8f3f66415835a9131856ff7714bf10dadfc4ec4bdb29a1" +checksum = "522de2a0fe3e380f1bc577ba0474108faf3f6b18321dbf60b3b9c39a75073377" [[package]] name = "futures-macro" -version = "0.3.15" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4c40298486cdf52cc00cd6d6987892ba502c7656a16a4192a9992b1ccedd121" +checksum = "18e4a4b95cea4b4ccbcf1c5675ca7c4ee4e9e75eb79944d07defde18068f79bb" dependencies = [ "autocfg", "proc-macro-hack", @@ -395,21 +307,27 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.15" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a57bead0ceff0d6dde8f465ecd96c9338121bb7717d3e7b108059531870c4282" +checksum = "36ea153c13024fe480590b3e3d4cad89a0cfacecc24577b68f86c6ced9c2bc11" [[package]] name = "futures-task" -version = "0.3.15" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d3d00f4eddb73e498a54394f228cd55853bdf059259e8e7bc6e69d408892e99" + +[[package]] +name = "futures-timer" +version = "3.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a16bef9fc1a4dddb5bee51c989e3fbba26569cbb0e31f5b303c184e3dd33dae" +checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c" [[package]] name = "futures-util" -version = "0.3.15" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "feb5c238d27e2bf94ffdfd27b2c29e3df4a68c4193bb6427384259e2bf191967" +checksum = "36568465210a3a6ee45e1f165136d68671471a501e632e9a98d96872222b5481" dependencies = [ "autocfg", "futures-channel", @@ -427,25 +345,24 @@ dependencies = [ ] [[package]] -name = "generator" -version = "0.7.0" +name = "generic-array" +version = "0.14.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1d9279ca822891c1a4dae06d185612cf8fc6acfe5dff37781b41297811b12ee" +checksum = "501466ecc8a30d1d3b7fc9229b122b2ce8ed6e9d9223f1138d4babb253e51817" dependencies = [ - "cc", - "libc", - "log", - "rustversion", - "winapi 0.3.9", + "typenum", + "version_check", ] [[package]] -name = "generic-array" -version = "0.12.4" +name = "getrandom" +version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffdf9f34f1447443d37393cc6c2b8313aebddcd96906caf34e54c68d8e57d7bd" +checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" dependencies = [ - "typenum", + "cfg-if", + "libc", + "wasi 0.9.0+wasi-snapshot-preview1", ] [[package]] @@ -454,22 +371,16 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7fcd999463524c52659517fe2cea98493cfe485d10565e7b0fb07dbba7ad2753" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", - "wasi", + "wasi 0.10.2+wasi-snapshot-preview1", ] -[[package]] -name = "glob" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" - [[package]] name = "h2" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "825343c4eef0b63f541f8903f395dc5beb362a979b5799a84062527ef1e37726" +checksum = "d7f3675cfef6a30c8031cf9e6493ebdc3bb3272a3fea3923c4210d1830e6a472" dependencies = [ "bytes", "fnv", @@ -485,34 +396,55 @@ dependencies = [ ] [[package]] -name = "handlebars" -version = "3.5.5" +name = "hashbrown" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" + +[[package]] +name = "headers" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4498fc115fa7d34de968184e473529abb40eeb6be8bc5f7faba3d08c316cb3e3" +checksum = "f0b7591fb62902706ae8e7aaff416b1b0fa2c0fd0878b46dc13baa3712d8a855" dependencies = [ - "log", - "pest", - "pest_derive", - "quick-error 2.0.1", - "serde", - "serde_json", + "base64", + "bitflags", + "bytes", + "headers-core", + "http", + "mime", + "sha-1", + "time", ] [[package]] -name = "hashbrown" -version = "0.9.1" +name = "headers-core" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04" +checksum = "e7f66481bfee273957b1f20485a4ff3362987f85b2c236580d81b4eb7a326429" +dependencies = [ + "http", +] [[package]] name = "hermit-abi" -version = "0.1.18" +version = "0.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" dependencies = [ "libc", ] +[[package]] +name = "hmac" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1441c6b1e930e2817404b5046f1f989899143a12bf92de603b69f4e0aee1e15" +dependencies = [ + "crypto-mac", + "digest", +] + [[package]] name = "http" version = "0.2.4" @@ -526,9 +458,9 @@ dependencies = [ [[package]] name = "http-body" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60daa14be0e0786db0f03a9e57cb404c9d756eed2b6c62b9ea98ec5743ec75a9" +checksum = "399c583b2979440c60be0821a6199eca73bc3c8dcd9d070d75ac726e2c6186e5" dependencies = [ "bytes", "http", @@ -537,9 +469,9 @@ dependencies = [ [[package]] name = "httparse" -version = "1.4.1" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3a87b616e37e93c22fb19bcd386f02f3af5ea98a25670ad0fce773de23c5e68" +checksum = "acd94fdbe1d4ff688b67b04eee2e17bd50995534a61539e45adfefb45e5e5503" [[package]] name = "httpdate" @@ -547,20 +479,11 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6456b8a6c8f33fee7d958fcd1b60d55b11940a79e63ae87013e6d22e26034440" -[[package]] -name = "humantime" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f" -dependencies = [ - "quick-error 1.2.3", -] - [[package]] name = "hyper" -version = "0.14.9" +version = "0.14.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07d6baa1b441335f3ce5098ac421fb6547c46dda735ca1bc6d0153c838f9dd83" +checksum = "13f67199e765030fa08fe0bd581af683f0d5bc04ea09c2b1102012c5fb90e7fd" dependencies = [ "bytes", "futures-channel", @@ -581,74 +504,76 @@ dependencies = [ ] [[package]] -name = "indexmap" -version = "1.6.2" +name = "hyper-tls" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "824845a0bf897a9042383849b02c1bc219c2383772efcd5c6f9766fa4b81aef3" +checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" dependencies = [ - "autocfg", - "hashbrown", - "serde", + "bytes", + "hyper", + "native-tls", + "tokio", + "tokio-native-tls", ] [[package]] -name = "inlinable_string" -version = "0.1.14" +name = "idna" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3094308123a0e9fd59659ce45e22de9f53fc1d2ac6e1feb9fef988e4f76cad77" +checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8" +dependencies = [ + "matches", + "unicode-bidi", + "unicode-normalization", +] [[package]] -name = "inotify" -version = "0.7.1" +name = "indexmap" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4816c66d2c8ae673df83366c18341538f234a26d65a9ecea5c348b453ac1d02f" +checksum = "bc633605454125dec4b66843673f01c7df2b89479b32e0ed634e43a91cff62a5" dependencies = [ - "bitflags", - "inotify-sys", - "libc", + "autocfg", + "hashbrown", ] [[package]] -name = "inotify-sys" -version = "0.1.5" +name = "input_buffer" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e05c02b5e89bff3b946cedeca278abc628fe811e604f027c45a8aa3cf793d0eb" +checksum = "f97967975f448f1a7ddb12b0bc41069d09ed6a1c161a92687e057325db35d413" dependencies = [ - "libc", + "bytes", ] [[package]] name = "instant" -version = "0.1.9" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61124eeebbd69b8190558df225adf7e4caafce0d743919e5d6b19652314ec5ec" +checksum = "bee0328b1209d157ef001c94dd85b4f8f64139adb0eac2659f4b08382b2f474d" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] -name = "iovec" -version = "0.1.4" +name = "ipnet" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e" -dependencies = [ - "libc", -] +checksum = "68f2d64f2edebec4ce84ad108148e67e1064789bee435edc5b60ad398714a3a9" [[package]] name = "itoa" -version = "0.4.7" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" +checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" [[package]] -name = "kernel32-sys" -version = "0.2.2" +name = "js-sys" +version = "0.3.55" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" +checksum = "7cc9ffccd38c451a86bf13657df244e9c3f37493cce8e5e21e940963777acc84" dependencies = [ - "winapi 0.2.8", - "winapi-build", + "wasm-bindgen", ] [[package]] @@ -657,23 +582,17 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" -[[package]] -name = "lazycell" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" - [[package]] name = "libc" -version = "0.2.97" +version = "0.2.102" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12b8adadd720df158f4d70dfe7ccc6adb0472d7c55ca83445f6a5ab3e36f8fb6" +checksum = "a2a5ac8f984bfcf3a823267e5fde638acc3325f6496633a5da6bb6eb2171e103" [[package]] name = "lock_api" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0382880606dff6d15c9476c416d18690b72742aa7b605bb6dd6ec9030fbf07eb" +checksum = "712a4d093c9976e24e7dbca41db895dabcbac38eb5f4045393d17a95bdfb1109" dependencies = [ "scopeguard", ] @@ -684,33 +603,39 @@ version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] -name = "loom" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7aa5348dc45fa5f2419b6dd4ea20345e6b01b1fcc9d176a322eada1ac3f382ba" +name = "macros" +version = "0.1.0" +source = "git+https://github.com/file-share-platform/ws-com-framework?rev=3a9c2fa#3a9c2fafaf936de9db2c4d464795655ca20f2699" dependencies = [ - "cfg-if 1.0.0", - "generator", - "scoped-tls", - "serde", - "serde_json", + "syn", ] [[package]] -name = "maplit" -version = "1.0.2" +name = "matches" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" + +[[package]] +name = "md-5" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d" +checksum = "7b5a279bb9607f9f53c22d496eade00d138d1bdcccd07d74650387cf94942a15" +dependencies = [ + "block-buffer", + "digest", + "opaque-debug", +] [[package]] name = "memchr" -version = "2.4.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b16bd47d9e329435e309c58469fe0791c2d0d1ba96ec0954152a5ae2b04387dc" +checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" [[package]] name = "mime" @@ -719,136 +644,125 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" [[package]] -name = "mio" -version = "0.6.23" +name = "mime_guess" +version = "2.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4afd66f5b91bf2a3bc13fad0e21caedac168ca4c707504e75585648ae80e4cc4" +checksum = "2684d4c2e97d99848d30b324b00c8fcc7e5c897b7cbb5819b09e7c90e8baf212" dependencies = [ - "cfg-if 0.1.10", - "fuchsia-zircon", - "fuchsia-zircon-sys", - "iovec", - "kernel32-sys", - "libc", - "log", - "miow 0.2.2", - "net2", - "slab", - "winapi 0.2.8", + "mime", + "unicase", ] [[package]] name = "mio" -version = "0.7.11" +version = "0.7.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf80d3e903b34e0bd7282b218398aec54e082c840d9baf8339e0080a0c542956" +checksum = "8c2bdb6314ec10835cd3293dd268473a835c02b7b352e788be788b3c6ca6bb16" dependencies = [ "libc", "log", - "miow 0.3.7", + "miow", "ntapi", - "winapi 0.3.9", + "winapi", ] [[package]] -name = "mio-extras" -version = "2.0.6" +name = "miow" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52403fe290012ce777c4626790c8951324a2b9e3316b3143779c72b029742f19" +checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21" dependencies = [ - "lazycell", - "log", - "mio 0.6.23", - "slab", + "winapi", ] [[package]] -name = "miow" -version = "0.2.2" +name = "mobc" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebd808424166322d4a38da87083bfddd3ac4c131334ed55856112eb06d46944d" +checksum = "7f76d2f2e2dcbb00a8d3b2b09f026a74a82693ea52cd071647aa6cfa7f1ff37e" dependencies = [ - "kernel32-sys", - "net2", - "winapi 0.2.8", - "ws2_32-sys", -] - -[[package]] -name = "miow" -version = "0.3.7" + "async-trait", + "futures-channel", + "futures-core", + "futures-timer", + "futures-util", + "log", + "tokio", +] + +[[package]] +name = "mobc-postgres" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21" +checksum = "ac9231ff47df0b551aae34921256002d4cb218b7c5c11cb4a4f1c24deb6283fb" dependencies = [ - "winapi 0.3.9", + "futures", + "mobc", + "tokio-postgres", ] [[package]] -name = "multer" -version = "2.0.0" +name = "multipart" +version = "0.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fdd568fea4758b30d6423f013f7171e193c34aa97828d1bd9f924fb3af30a8c" +checksum = "d050aeedc89243f5347c3e237e3e13dc76fbe4ae3742a57b94dc14f69acf76d4" dependencies = [ - "bytes", - "derive_more", - "encoding_rs", - "futures-util", - "http", + "buf_redux", "httparse", "log", "mime", - "spin", - "tokio", - "tokio-util", + "mime_guess", + "quick-error", + "rand 0.7.3", + "safemem", + "tempfile", "twoway", - "version_check", ] [[package]] -name = "net2" -version = "0.2.37" +name = "native-tls" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "391630d12b68002ae1e25e8f974306474966550ad82dac6886fb8910c19568ae" +checksum = "48ba9f7719b5a0f42f338907614285fb5fd70e53858141f69898a1fb7203b24d" dependencies = [ - "cfg-if 0.1.10", + "lazy_static", "libc", - "winapi 0.3.9", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", ] [[package]] -name = "normpath" -version = "0.3.0" +name = "ntapi" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27e6e8f70e9fbbe3752d330d769e3424f24b9458ce266df93a3b456902fd696a" +checksum = "3f6bb902e437b6d86e03cce10a7e2af662292c5dfef23b65899ea3ac9354ad44" dependencies = [ - "winapi 0.3.9", + "winapi", ] [[package]] -name = "notify" -version = "4.0.17" +name = "num-integer" +version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae03c8c853dba7bfd23e571ff0cff7bc9dceb40a4cd684cd1681824183f45257" +checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" dependencies = [ - "bitflags", - "filetime", - "fsevent", - "fsevent-sys", - "inotify", - "libc", - "mio 0.6.23", - "mio-extras", - "walkdir", - "winapi 0.3.9", + "autocfg", + "num-traits", ] [[package]] -name = "ntapi" -version = "0.3.6" +name = "num-traits" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f6bb902e437b6d86e03cce10a7e2af662292c5dfef23b65899ea3ac9354ad44" +checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" dependencies = [ - "winapi 0.3.9", + "autocfg", ] [[package]] @@ -869,56 +783,66 @@ checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56" [[package]] name = "opaque-debug" -version = "0.2.3" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" +checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] -name = "parking_lot" -version = "0.11.1" +name = "openssl" +version = "0.10.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d7744ac029df22dca6284efe4e898991d28e3085c706c972bcd7da4a27a15eb" +checksum = "8d9facdb76fec0b73c406f125d44d86fdad818d66fef0531eec9233ca425ff4a" dependencies = [ - "instant", - "lock_api", - "parking_lot_core", + "bitflags", + "cfg-if", + "foreign-types", + "libc", + "once_cell", + "openssl-sys", ] [[package]] -name = "parking_lot_core" -version = "0.8.3" +name = "openssl-probe" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28988d872ab76095a6e6ac88d99b54fd267702734fd7ffe610ca27f533ddb95a" + +[[package]] +name = "openssl-sys" +version = "0.9.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa7a782938e745763fe6907fc6ba86946d72f49fe7e21de074e08128a99fb018" +checksum = "1996d2d305e561b70d1ee0c53f1542833f4e1ac6ce9a6708b6ff2738ca67dc82" dependencies = [ - "cfg-if 1.0.0", - "instant", + "autocfg", + "cc", "libc", - "redox_syscall", - "smallvec", - "winapi 0.3.9", + "pkg-config", + "vcpkg", ] [[package]] -name = "pear" -version = "0.2.3" +name = "parking_lot" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15e44241c5e4c868e3eaa78b7c1848cadd6344ed4f54d029832d32b415a58702" +checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" dependencies = [ - "inlinable_string", - "pear_codegen", - "yansi", + "instant", + "lock_api", + "parking_lot_core", ] [[package]] -name = "pear_codegen" -version = "0.2.3" +name = "parking_lot_core" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82a5ca643c2303ecb740d506539deba189e16f2754040a42901cd8105d0282d0" +checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216" dependencies = [ - "proc-macro2", - "proc-macro2-diagnostics", - "quote", - "syn", + "cfg-if", + "instant", + "libc", + "redox_syscall", + "smallvec", + "winapi", ] [[package]] @@ -928,53 +852,48 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" [[package]] -name = "pest" -version = "2.1.3" +name = "phf" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10f4872ae94d7b90ae48754df22fd42ad52ce740b8f370b03da4835417403e53" +checksum = "3dfb61232e34fcb633f43d12c58f83c1df82962dcdfa565a4e866ffc17dafe12" dependencies = [ - "ucd-trie", + "phf_shared", ] [[package]] -name = "pest_derive" -version = "2.1.0" +name = "phf_shared" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "833d1ae558dc601e9a60366421196a8d94bc0ac980476d0b67e1d0988d72b2d0" +checksum = "c00cf8b9eafe68dde5e9eaa2cef8ee84a9336a47d566ec55ca16589633b65af7" dependencies = [ - "pest", - "pest_generator", + "siphasher", ] [[package]] -name = "pest_generator" -version = "2.1.3" +name = "pin-project" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99b8db626e31e5b81787b9783425769681b347011cc59471e33ea46d2ea0cf55" +checksum = "576bc800220cc65dac09e99e97b08b358cfab6e17078de8dc5fee223bd2d0c08" dependencies = [ - "pest", - "pest_meta", - "proc-macro2", - "quote", - "syn", + "pin-project-internal", ] [[package]] -name = "pest_meta" -version = "2.1.3" +name = "pin-project-internal" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54be6e404f5317079812fc8f9f5279de376d8856929e21c184ecf6bbd692a11d" +checksum = "6e8fe8163d14ce7f0cdac2e040116f22eac817edabff0be91e8aff7e9accf389" dependencies = [ - "maplit", - "pest", - "sha-1", + "proc-macro2", + "quote", + "syn", ] [[package]] name = "pin-project-lite" -version = "0.2.6" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc0e1f259c92177c30a4c9d177246edd0a3568b25756a977d0632cf8fa37e905" +checksum = "8d31d11c69a6b52a174b42bdc0c30e5e11670f90788b2c471c31c1d17d449443" [[package]] name = "pin-utils" @@ -983,21 +902,48 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] -name = "ppv-lite86" -version = "0.2.10" +name = "pkg-config" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" +checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" [[package]] -name = "pretty_env_logger" -version = "0.4.0" +name = "postgres-protocol" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "926d36b9553851b8b0005f1275891b392ee4d2d833852c417ed025477350fb9d" +checksum = "ff3e0f70d32e20923cabf2df02913be7c1842d4c772db8065c00fcfdd1d1bff3" dependencies = [ - "env_logger", - "log", + "base64", + "byteorder", + "bytes", + "fallible-iterator", + "hmac", + "md-5", + "memchr", + "rand 0.8.4", + "sha2", + "stringprep", ] +[[package]] +name = "postgres-types" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "430f4131e1b7657b0cd9a2b0c3408d77c9a43a042d300b8c77f981dffcc43a2f" +dependencies = [ + "bytes", + "chrono", + "fallible-iterator", + "postgres-protocol", + "uuid", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" + [[package]] name = "proc-macro-hack" version = "0.5.19" @@ -1012,38 +958,19 @@ checksum = "bc881b2c22681370c6a780e47af9840ef841837bc98118431d4e1868bd0c1086" [[package]] name = "proc-macro2" -version = "1.0.27" +version = "1.0.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0d8caf72986c1a598726adc988bb5984792ef84f5ee5aa50209145ee8077038" +checksum = "b9f5105d4fdaab20335ca9565e106a5d9b82b6219b5ba735731124ac6711d23d" dependencies = [ "unicode-xid", ] -[[package]] -name = "proc-macro2-diagnostics" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bf29726d67464d49fa6224a1d07936a8c08bb3fba727c7493f6cf1616fdaada" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "version_check", - "yansi", -] - [[package]] name = "quick-error" version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" -[[package]] -name = "quick-error" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3" - [[package]] name = "quote" version = "1.0.9" @@ -1055,223 +982,187 @@ dependencies = [ [[package]] name = "rand" -version = "0.8.3" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ef9e7e66b4468674bfcb0c81af8b7fa0bb154fa9f28eb840da5c447baeb8d7e" +checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" dependencies = [ + "getrandom 0.1.16", "libc", - "rand_chacha", - "rand_core", - "rand_hc", -] - -[[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", + "rand_chacha 0.2.2", + "rand_core 0.5.1", + "rand_hc 0.2.0", ] [[package]] -name = "rand_core" -version = "0.6.2" +name = "rand" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34cf66eb183df1c5876e2dcf6b13d57340741e8dc255b48e40a26de954d06ae7" +checksum = "2e7573632e6454cf6b99d7aac4ccca54be06da05aca2ef7423d22d27d4d4bcd8" dependencies = [ - "getrandom", + "libc", + "rand_chacha 0.3.1", + "rand_core 0.6.3", + "rand_hc 0.3.1", ] [[package]] -name = "rand_hc" -version = "0.3.0" +name = "rand_chacha" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3190ef7066a446f2e7f42e239d161e905420ccab01eb967c9eb27d21b2322a73" +checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" dependencies = [ - "rand_core", + "ppv-lite86", + "rand_core 0.5.1", ] [[package]] -name = "redox_syscall" -version = "0.2.8" +name = "rand_chacha" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "742739e41cd49414de871ea5e549afb7e2a3ac77b589bcbebe8c82fab37147fc" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" dependencies = [ - "bitflags", + "ppv-lite86", + "rand_core 0.6.3", ] [[package]] -name = "ref-cast" -version = "1.0.6" +name = "rand_core" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "300f2a835d808734ee295d45007adacb9ebb29dd3ae2424acfa17930cae541da" +checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" dependencies = [ - "ref-cast-impl", + "getrandom 0.1.16", ] [[package]] -name = "ref-cast-impl" -version = "1.0.6" +name = "rand_core" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c38e3aecd2b21cb3959637b883bb3714bc7e43f0268b9a29d3743ee3e55cdd2" +checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" dependencies = [ - "proc-macro2", - "quote", - "syn", + "getrandom 0.2.3", ] [[package]] -name = "regex" -version = "1.5.4" +name = "rand_hc" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461" +checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", + "rand_core 0.5.1", ] [[package]] -name = "regex-syntax" -version = "0.6.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" - -[[package]] -name = "remove_dir_all" -version = "0.5.3" +name = "rand_hc" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" +checksum = "d51e9f596de227fda2ea6c84607f5558e196eeaf43c986b724ba4fb8fdf497e7" dependencies = [ - "winapi 0.3.9", + "rand_core 0.6.3", ] [[package]] -name = "rocket" -version = "0.5.0-rc.1" +name = "redox_syscall" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a71c18c42a0eb15bf3816831caf0dad11e7966f2a41aaf486a701979c4dd1f2" +checksum = "8383f39639269cde97d255a32bdb68c047337295414940c68bdd30c2e13203ff" dependencies = [ - "async-stream", - "async-trait", - "atomic", - "atty", - "binascii", - "bytes", - "either", - "figment", - "futures", - "indexmap", - "log", - "memchr", - "multer", - "num_cpus", - "parking_lot", - "pin-project-lite", - "rand", - "ref-cast", - "rocket_codegen", - "rocket_http", - "serde", - "state", - "tempfile", - "time", - "tokio", - "tokio-stream", - "tokio-util", - "ubyte", - "version_check", - "yansi", + "bitflags", ] [[package]] -name = "rocket_codegen" -version = "0.5.0-rc.1" +name = "redox_users" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66f5fa462f7eb958bba8710c17c5d774bbbd59809fa76fb1957af7e545aea8bb" +checksum = "528532f3d801c87aec9def2add9ca802fe569e44a544afe633765267840abe64" dependencies = [ - "devise", - "glob", - "indexmap", - "proc-macro2", - "quote", - "rocket_http", - "syn", - "unicode-xid", + "getrandom 0.2.3", + "redox_syscall", ] [[package]] -name = "rocket_dyn_templates" -version = "0.1.0-rc.1" +name = "remove_dir_all" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c83f1287ad8fa034410928297a91db37518d5c46d7cc7e1e1b4a77aec0cd8807" +checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" dependencies = [ - "glob", - "handlebars", - "normpath", - "notify", - "rocket", - "serde", - "serde_json", + "winapi", ] [[package]] -name = "rocket_http" -version = "0.5.0-rc.1" +name = "reqwest" +version = "0.11.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23c8b7d512d2fcac2316ebe590cde67573844b99e6cc9ee0f53375fa16e25ebd" +checksum = "246e9f61b9bb77df069a947682be06e31ac43ea37862e244a69f177694ea6d22" dependencies = [ - "cookie", - "either", + "base64", + "bytes", + "encoding_rs", + "futures-core", + "futures-util", "http", + "http-body", "hyper", - "indexmap", + "hyper-tls", + "ipnet", + "js-sys", + "lazy_static", "log", - "memchr", "mime", - "parking_lot", - "pear", + "native-tls", "percent-encoding", "pin-project-lite", - "ref-cast", "serde", - "smallvec", - "stable-pattern", - "state", - "time", + "serde_json", + "serde_urlencoded", "tokio", - "uncased", + "tokio-native-tls", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "winreg", ] [[package]] -name = "rust-sharing-server" -version = "0.1.0" +name = "ring" +version = "0.16.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" dependencies = [ - "log", - "pretty_env_logger", - "rocket", - "rocket_dyn_templates", - "serde", - "serde_json", - "uuid", + "cc", + "libc", + "once_cell", + "spin", + "untrusted", + "web-sys", + "winapi", ] [[package]] -name = "rustc_version" -version = "0.2.3" +name = "rustls" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" +checksum = "35edb675feee39aec9c99fa5ff985081995a06d594114ae14cbe797ad7b7a6d7" dependencies = [ - "semver", + "base64", + "log", + "ring", + "sct", + "webpki", ] [[package]] -name = "rustversion" -version = "1.0.5" +name = "rustls-native-certs" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61b3909d758bb75c79f23d4736fac9433868679d3ad2ea7a61e3c25cfda9a088" +checksum = "5a07b7c1885bd8ed3831c289b7870b13ef46fe0e856d288c30d9cc17d75a2092" +dependencies = [ + "openssl-probe", + "rustls", + "schannel", + "security-framework", +] [[package]] name = "ryu" @@ -1280,12 +1171,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" [[package]] -name = "same-file" -version = "1.0.6" +name = "safemem" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef703b7cb59335eae2eb93ceb664c0eb7ea6bf567079d843e09420219668e072" + +[[package]] +name = "schannel" +version = "0.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +checksum = "8f05ba609c234e60bee0d547fe94a4c7e9da733d1c962cf6e59efa4cd9c8bc75" dependencies = [ - "winapi-util", + "lazy_static", + "winapi", ] [[package]] @@ -1301,34 +1199,52 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] -name = "semver" -version = "0.9.0" +name = "sct" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" +checksum = "b362b83898e0e69f38515b82ee15aa80636befe47c3b6d3d89a911e78fc228ce" dependencies = [ - "semver-parser", + "ring", + "untrusted", ] [[package]] -name = "semver-parser" -version = "0.7.0" +name = "security-framework" +version = "2.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "525bc1abfda2e1998d152c45cf13e696f76d0a4972310b22fac1658b05df7c87" +dependencies = [ + "bitflags", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" +checksum = "a9dd14d83160b528b7bfd66439110573efcfbe281b17fc2ca9f39f550d619c7e" +dependencies = [ + "core-foundation-sys", + "libc", +] [[package]] name = "serde" -version = "1.0.126" +version = "1.0.130" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec7505abeacaec74ae4778d9d9328fe5a5d04253220a85c4ee022239fc996d03" +checksum = "f12d06de37cf59146fbdecab66aa99f9fe4f78722e3607577a5375d66bd0c913" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.126" +version = "1.0.130" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "963a7dbc9895aeac7ac90e74f34a5d5261828f79df35cbed41e10189d3804d43" +checksum = "d7bc1a1ab1961464eae040d96713baa5a724a8152c1222492465b54322ec508b" dependencies = [ "proc-macro2", "quote", @@ -1337,32 +1253,74 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.64" +version = "1.0.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "799e97dc9fdae36a5c8b8f2cae9ce2ee9fdce2058c57a93e6099d919fd982f79" +checksum = "0f690853975602e1bfe1ccbf50504d67174e3bcf340f23b5ea9992e0587a52d8" dependencies = [ "itoa", "ryu", "serde", ] +[[package]] +name = "serde_urlencoded" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edfa57a7f8d9c1d260a549e7224100f6c43d43f9103e06dd8b4095a9b2b43ce9" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + [[package]] name = "sha-1" -version = "0.8.2" +version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7d94d0bede923b3cea61f3f1ff57ff8cdfd77b400fb8f9998949e0cf04163df" +checksum = "99cd6713db3cf16b6c84e06321e049a9b9f699826e16096d23bbcc44d15d51a6" dependencies = [ "block-buffer", + "cfg-if", + "cpufeatures", "digest", - "fake-simd", "opaque-debug", ] [[package]] -name = "sha1" -version = "0.6.0" +name = "sha2" +version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" +checksum = "b69f9a4c9740d74c5baa3fd2e547f9525fa8088a8a958e0ca2409a514e33f5fa" +dependencies = [ + "block-buffer", + "cfg-if", + "cpufeatures", + "digest", + "opaque-debug", +] + +[[package]] +name = "sharing-agent" +version = "0.1.0" +dependencies = [ + "chrono", + "confy", + "dirs", + "futures", + "futures-util", + "mobc", + "mobc-postgres", + "reqwest", + "serde", + "serde_derive", + "tokio", + "tokio-stream", + "tokio-tungstenite 0.15.0", + "tokio-util", + "warp", + "ws-com-framework", +] [[package]] name = "signal-hook-registry" @@ -1373,11 +1331,17 @@ dependencies = [ "libc", ] +[[package]] +name = "siphasher" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "533494a8f9b724d33625ab53c6c4800f7cc445895924a8ef649222dcb76e938b" + [[package]] name = "slab" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f173ac3d1a7e3b28003f40de0b5ce7fe2710f9b9dc3fc38664cebee46b3b6527" +checksum = "c307a32c1c5c437f38c7fd45d753050587732ba8628319fbdf12a7e289ccc590" [[package]] name = "smallvec" @@ -1387,214 +1351,227 @@ checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e" [[package]] name = "socket2" -version = "0.4.0" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e3dfc207c526015c632472a77be09cf1b6e46866581aecae5cc38fb4235dea2" +checksum = "5dc90fe6c7be1a323296982db1836d1ea9e47b6839496dde9a541bc496df3516" dependencies = [ "libc", - "winapi 0.3.9", + "winapi", ] [[package]] name = "spin" -version = "0.9.0" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b87bbf98cb81332a56c1ee8929845836f85e8ddd693157c30d76660196014478" +checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" [[package]] -name = "stable-pattern" -version = "0.1.0" +name = "stringprep" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4564168c00635f88eaed410d5efa8131afa8d8699a612c80c455a0ba05c21045" +checksum = "8ee348cb74b87454fff4b551cbf727025810a004f88aeacae7f85b87f4e9a1c1" dependencies = [ - "memchr", + "unicode-bidi", + "unicode-normalization", ] [[package]] -name = "standback" -version = "0.2.17" +name = "subtle" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e113fb6f3de07a243d434a56ec6f186dfd51cb08448239fe7bcae73f87ff28ff" -dependencies = [ - "version_check", -] +checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" [[package]] -name = "state" -version = "0.5.1" +name = "syn" +version = "1.0.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b54c22963194db84a59ee48e1fa9ed6c1fa9909ad5db92a700aa6fe956d632b" +checksum = "c6f107db402c2c2055242dbf4d2af0e69197202e9faacbef9571bbe47f5a1b84" dependencies = [ - "loom", + "proc-macro2", + "quote", + "unicode-xid", ] [[package]] -name = "stdweb" -version = "0.4.20" +name = "tempfile" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d022496b16281348b52d0e30ae99e01a73d737b2f45d38fed4edf79f9325a1d5" +checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22" dependencies = [ - "discard", - "rustc_version", - "stdweb-derive", - "stdweb-internal-macros", - "stdweb-internal-runtime", - "wasm-bindgen", + "cfg-if", + "libc", + "rand 0.8.4", + "redox_syscall", + "remove_dir_all", + "winapi", ] [[package]] -name = "stdweb-derive" -version = "0.5.3" +name = "thiserror" +version = "1.0.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c87a60a40fccc84bef0652345bbbbbe20a605bf5d0ce81719fc476f5c03b50ef" +checksum = "602eca064b2d83369e2b2f34b09c70b605402801927c65c11071ac911d299b88" dependencies = [ - "proc-macro2", - "quote", - "serde", - "serde_derive", - "syn", + "thiserror-impl", ] [[package]] -name = "stdweb-internal-macros" -version = "0.2.9" +name = "thiserror-impl" +version = "1.0.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58fa5ff6ad0d98d1ffa8cb115892b6e69d67799f6763e162a1c9db421dc22e11" +checksum = "bad553cc2c78e8de258400763a647e80e6d1b31ee237275d756f6836d204494c" dependencies = [ - "base-x", "proc-macro2", "quote", - "serde", - "serde_derive", - "serde_json", - "sha1", "syn", ] [[package]] -name = "stdweb-internal-runtime" -version = "0.1.5" +name = "time" +version = "0.1.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "213701ba3370744dcd1a12960caa4843b3d68b4d1c0a5d575e0d65b2ee9d16c0" +checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438" +dependencies = [ + "libc", + "winapi", +] [[package]] -name = "syn" -version = "1.0.73" +name = "tinyvec" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f71489ff30030d2ae598524f61326b902466f72a0fb1a8564c001cc63425bcc7" +checksum = "5241dd6f21443a3606b432718b166d3cedc962fd4b8bea54a8bc7f514ebda986" dependencies = [ - "proc-macro2", - "quote", - "unicode-xid", + "tinyvec_macros", ] [[package]] -name = "tempfile" -version = "3.2.0" +name = "tinyvec_macros" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22" +checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" + +[[package]] +name = "tokio" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4efe6fc2395938c8155973d7be49fe8d03a843726e285e100a8a383cc0154ce" dependencies = [ - "cfg-if 1.0.0", + "autocfg", + "bytes", "libc", - "rand", - "redox_syscall", - "remove_dir_all", - "winapi 0.3.9", + "memchr", + "mio", + "num_cpus", + "once_cell", + "parking_lot", + "pin-project-lite", + "signal-hook-registry", + "tokio-macros", + "winapi", ] [[package]] -name = "termcolor" -version = "1.1.2" +name = "tokio-macros" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4" +checksum = "54473be61f4ebe4efd09cec9bd5d16fa51d70ea0192213d754d2d500457db110" dependencies = [ - "winapi-util", + "proc-macro2", + "quote", + "syn", ] [[package]] -name = "time" -version = "0.2.27" +name = "tokio-native-tls" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4752a97f8eebd6854ff91f1c1824cd6160626ac4bd44287f7f4ea2035a02a242" +checksum = "f7d995660bd2b7f8c1568414c1126076c13fbb725c40112dc0120b78eb9b717b" dependencies = [ - "const_fn", - "libc", - "standback", - "stdweb", - "time-macros", - "version_check", - "winapi 0.3.9", + "native-tls", + "tokio", ] [[package]] -name = "time-macros" -version = "0.1.1" +name = "tokio-postgres" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "957e9c6e26f12cb6d0dd7fc776bb67a706312e7299aed74c8dd5b17ebb27e2f1" +checksum = "2d2b1383c7e4fb9a09e292c7c6afb7da54418d53b045f1c1fac7a911411a2b8b" dependencies = [ - "proc-macro-hack", - "time-macros-impl", + "async-trait", + "byteorder", + "bytes", + "fallible-iterator", + "futures", + "log", + "parking_lot", + "percent-encoding", + "phf", + "pin-project-lite", + "postgres-protocol", + "postgres-types", + "socket2", + "tokio", + "tokio-util", ] [[package]] -name = "time-macros-impl" -version = "0.1.2" +name = "tokio-rustls" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd3c141a1b43194f3f56a1411225df8646c55781d5f26db825b3d98507eb482f" +checksum = "bc6844de72e57df1980054b38be3a9f4702aba4858be64dd700181a8a6d0e1b6" dependencies = [ - "proc-macro-hack", - "proc-macro2", - "quote", - "standback", - "syn", + "rustls", + "tokio", + "webpki", ] [[package]] -name = "tokio" -version = "1.6.1" +name = "tokio-stream" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a38d31d7831c6ed7aad00aa4c12d9375fd225a6dd77da1d25b707346319a975" +checksum = "7b2f3f698253f03119ac0102beaa64f67a67e08074d03a22d18784104543727f" dependencies = [ - "autocfg", - "bytes", - "libc", - "memchr", - "mio 0.7.11", - "num_cpus", - "once_cell", + "futures-core", "pin-project-lite", - "signal-hook-registry", - "tokio-macros", - "winapi 0.3.9", + "tokio", ] [[package]] -name = "tokio-macros" -version = "1.2.0" +name = "tokio-tungstenite" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c49e3df43841dafb86046472506755d8501c5615673955f6aa17181125d13c37" +checksum = "e1a5f475f1b9d077ea1017ecbc60890fda8e54942d680ca0b1d2b47cfa2d861b" dependencies = [ - "proc-macro2", - "quote", - "syn", + "futures-util", + "log", + "pin-project", + "tokio", + "tungstenite 0.12.0", ] [[package]] -name = "tokio-stream" -version = "0.1.6" +name = "tokio-tungstenite" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8864d706fdb3cc0843a49647ac892720dac98a6eeb818b77190592cf4994066" +checksum = "511de3f85caf1c98983545490c3d09685fa8eb634e57eec22bb4db271f46cbd8" dependencies = [ - "futures-core", - "pin-project-lite", + "futures-util", + "log", + "pin-project", + "rustls", "tokio", + "tokio-rustls", + "tungstenite 0.14.0", + "webpki", + "webpki-roots", ] [[package]] name = "tokio-util" -version = "0.6.7" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1caa0b0c8d94a049db56b5acf8cba99dc0623aab1b26d5b5f5e2d945846b3592" +checksum = "08d3725d3efa29485e87311c5b699de63cde14b00ed4d256b8318aa30ca452cd" dependencies = [ "bytes", "futures-core", @@ -1621,20 +1598,21 @@ checksum = "360dfd1d6d30e05fda32ace2c8c70e9c0a9da713275777f5a4dbb8a1893930c6" [[package]] name = "tracing" -version = "0.1.26" +version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09adeb8c97449311ccd28a427f96fb563e7fd31aabf994189879d9da2394b89d" +checksum = "c2ba9ab62b7d6497a8638dfda5e5c4fb3b2d5a7fca4118f2b96151c8ef1a437e" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", + "log", "pin-project-lite", "tracing-core", ] [[package]] name = "tracing-core" -version = "0.1.18" +version = "0.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9ff14f98b1a4b289c6248a023c1c2fa1491062964e9fed67ab29c4e4da4a052" +checksum = "46125608c26121c81b0c6d693eab5a420e416da7e43c426d2e8f7df8da8a3acf" dependencies = [ "lazy_static", ] @@ -1646,51 +1624,84 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" [[package]] -name = "twoway" -version = "0.2.2" +name = "tungstenite" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c57ffb460d7c24cd6eda43694110189030a3d1dfe418416d9468fd1c1d290b47" +checksum = "8ada8297e8d70872fa9a551d93250a9f407beb9f37ef86494eb20012a2ff7c24" dependencies = [ - "memchr", - "unchecked-index", + "base64", + "byteorder", + "bytes", + "http", + "httparse", + "input_buffer", + "log", + "rand 0.8.4", + "sha-1", + "url", + "utf-8", ] [[package]] -name = "typenum" -version = "1.13.0" +name = "tungstenite" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "879f6906492a7cd215bfa4cf595b600146ccfac0c79bcbd1f3000162af5e8b06" +checksum = "a0b2d8558abd2e276b0a8df5c05a2ec762609344191e5fd23e292c910e9165b5" +dependencies = [ + "base64", + "byteorder", + "bytes", + "http", + "httparse", + "log", + "rand 0.8.4", + "rustls", + "rustls-native-certs", + "sha-1", + "thiserror", + "url", + "utf-8", + "webpki", +] [[package]] -name = "ubyte" -version = "0.10.1" +name = "twoway" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42756bb9e708855de2f8a98195643dff31a97f0485d90d8467b39dc24be9e8fe" +checksum = "59b11b2b5241ba34be09c3cc85a36e56e48f9888862e19cedf23336d35316ed1" dependencies = [ - "serde", + "memchr", ] [[package]] -name = "ucd-trie" -version = "0.1.3" +name = "typenum" +version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c" +checksum = "b63708a265f51345575b27fe43f9500ad611579e764c79edbc2037b1121959ec" [[package]] -name = "uncased" -version = "0.9.6" +name = "unicase" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5baeed7327e25054889b9bd4f975f32e5f4c5d434042d59ab6cd4142c0a76ed0" +checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6" dependencies = [ - "serde", "version_check", ] [[package]] -name = "unchecked-index" -version = "0.2.2" +name = "unicode-bidi" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "246f4c42e67e7a4e3c6106ff716a5d067d4132a642840b242e357e468a2a0085" + +[[package]] +name = "unicode-normalization" +version = "0.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eeba86d422ce181a719445e51872fa30f1f7413b62becb52e95ec91aa262d85c" +checksum = "d54590932941a9e9266f0832deed84ebe1bf2e4c9e4a3554d393d18f5e854bf9" +dependencies = [ + "tinyvec", +] [[package]] name = "unicode-xid" @@ -1698,15 +1709,41 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" +[[package]] +name = "untrusted" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" + +[[package]] +name = "url" +version = "2.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c" +dependencies = [ + "form_urlencoded", + "idna", + "matches", + "percent-encoding", +] + +[[package]] +name = "utf-8" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" + [[package]] name = "uuid" version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" -dependencies = [ - "getrandom", - "serde", -] + +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" [[package]] name = "version_check" @@ -1715,26 +1752,50 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe" [[package]] -name = "walkdir" -version = "2.3.2" +name = "want" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56" +checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" dependencies = [ - "same-file", - "winapi 0.3.9", - "winapi-util", + "log", + "try-lock", ] [[package]] -name = "want" -version = "0.3.0" +name = "warp" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" +checksum = "332d47745e9a0c38636dbd454729b147d16bd1ed08ae67b3ab281c4506771054" dependencies = [ + "bytes", + "futures", + "headers", + "http", + "hyper", "log", - "try-lock", + "mime", + "mime_guess", + "multipart", + "percent-encoding", + "pin-project", + "scoped-tls", + "serde", + "serde_json", + "serde_urlencoded", + "tokio", + "tokio-stream", + "tokio-tungstenite 0.13.0", + "tokio-util", + "tower-service", + "tracing", ] +[[package]] +name = "wasi" +version = "0.9.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" + [[package]] name = "wasi" version = "0.10.2+wasi-snapshot-preview1" @@ -1743,19 +1804,21 @@ checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" [[package]] name = "wasm-bindgen" -version = "0.2.74" +version = "0.2.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d54ee1d4ed486f78874278e63e4069fc1ab9f6a18ca492076ffb90c5eb2997fd" +checksum = "632f73e236b219150ea279196e54e610f5dbafa5d61786303d4da54f84e47fce" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", + "serde", + "serde_json", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.74" +version = "0.2.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b33f6a0694ccfea53d94db8b2ed1c3a8a4c86dd936b13b9f0a15ec4a451b900" +checksum = "a317bf8f9fba2476b4b2c85ef4c4af8ff39c3c7f0cdfeed4f82c34a880aa837b" dependencies = [ "bumpalo", "lazy_static", @@ -1766,11 +1829,23 @@ dependencies = [ "wasm-bindgen-shared", ] +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e8d7523cb1f2a4c96c1317ca690031b714a51cc14e05f712446691f413f5d39" +dependencies = [ + "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", +] + [[package]] name = "wasm-bindgen-macro" -version = "0.2.74" +version = "0.2.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "088169ca61430fe1e58b8096c24975251700e7b1f6fd91cc9d59b04fb9b18bd4" +checksum = "d56146e7c495528bf6587663bea13a8eb588d39b36b679d83972e1a2dbbdacf9" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -1778,9 +1853,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.74" +version = "0.2.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be2241542ff3d9f241f5e2cb6dd09b37efe786df8851c54957683a49f0987a97" +checksum = "7803e0eea25835f8abdc585cd3021b3deb11543c6fe226dcd30b228857c5c5ab" dependencies = [ "proc-macro2", "quote", @@ -1791,15 +1866,38 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.74" +version = "0.2.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7cff876b8f18eed75a66cf49b65e7f967cb354a7aa16003fb55dbfd25b44b4f" +checksum = "0237232789cf037d5480773fe568aac745bfe2afbc11a863e97901780a6b47cc" [[package]] -name = "winapi" -version = "0.2.8" +name = "web-sys" +version = "0.3.55" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" +checksum = "38eb105f1c59d9eaa6b5cdc92b859d85b926e82cb2e0945cd0c9259faa6fe9fb" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "webpki" +version = "0.21.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8e38c0608262c46d4a56202ebabdeb094cef7e560ca7a226c6bf055188aa4ea" +dependencies = [ + "ring", + "untrusted", +] + +[[package]] +name = "webpki-roots" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aabe153544e473b775453675851ecc86863d2a81d786d741f6b76778f2a48940" +dependencies = [ + "webpki", +] [[package]] name = "winapi" @@ -1811,27 +1909,12 @@ dependencies = [ "winapi-x86_64-pc-windows-gnu", ] -[[package]] -name = "winapi-build" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" - [[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 0.3.9", -] - [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" @@ -1839,17 +1922,27 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] -name = "ws2_32-sys" -version = "0.2.1" +name = "winreg" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" +checksum = "0120db82e8a1e0b9fb3345a539c478767c0048d842860994d96113d5b667bd69" dependencies = [ - "winapi 0.2.8", - "winapi-build", + "winapi", ] [[package]] -name = "yansi" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fc79f4a1e39857fc00c3f662cbf2651c771f00e9c15fe2abc341806bd46bd71" +name = "ws-com-framework" +version = "0.1.0" +source = "git+https://github.com/file-share-platform/ws-com-framework?rev=3a9c2fa#3a9c2fafaf936de9db2c4d464795655ca20f2699" +dependencies = [ + "async-trait", + "bincode", + "chrono", + "futures", + "futures-util", + "macros", + "serde", + "serde_derive", + "tokio", + "tokio-tungstenite 0.15.0", +] diff --git a/Cargo.toml b/Cargo.toml index 4c6b816..82441d5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,22 +1,27 @@ [package] -name = "rust-sharing-server" +name = "sharing-agent" version = "0.1.0" -authors = ["Josiah Bull "] -edition = "2018" +edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -rocket = "0.5.0-rc.1" -log = "0.4" -pretty_env_logger = "0.4.0" -serde = { version = "1.0.126", features = ["derive"] } -serde_json = "1.0.64" -derive-getters = "0.2.0" -[dependencies.rocket_dyn_templates] -version = "0.1.0-rc.1" -features = ["handlebars"] -[dependencies.rocket_sync_db_pools] -version = "0.1.0-rc.1" -default-features = false -features = ["sqlite_pool"] \ No newline at end of file +ws-com-framework= { git="https://github.com/file-share-platform/ws-com-framework", default-features = false, features = ["client", "wrapper-tungstenite"], rev="3a9c2fa" } +tokio = { version = "1", features = ["full"] } +tokio-util = { version = "0.6.8", features = ["codec"] } +confy = { git = "https://github.com/JosiahBull/confy", features = ["toml_conf"] } +mobc = "0.7.3" +mobc-postgres = { version = "*", features = ["with-chrono-0_4", "with-uuid-0_8"] } +reqwest = { version = "0.11.4", features = ["stream", "json"] } +serde = {version = "1.0", features = ["derive"] } +serde_derive = "1.0" +dirs = "4.0.0" +chrono = "0.4.19" +tokio-stream = "0.1.7" +tokio-tungstenite = { version = "0.15.0", features = ["rustls-tls"] } +futures-util = "0.3.17" +futures = "0.3.17" + +[dev-dependencies] +warp="0.3.1" +ws-com-framework= { git="https://github.com/file-share-platform/ws-com-framework", default-features = false, features = ["client", "wrapper-tokio"], rev="3a9c2fa" } \ No newline at end of file diff --git a/Rocket.toml b/Rocket.toml deleted file mode 100644 index d581922..0000000 --- a/Rocket.toml +++ /dev/null @@ -1,2 +0,0 @@ -[global.databases] -sqlite_shares = { url = "./database.db" } \ No newline at end of file diff --git a/config/db.sql b/config/db.sql new file mode 100644 index 0000000..cdac745 --- /dev/null +++ b/config/db.sql @@ -0,0 +1,18 @@ +CREATE TABLE IF NOT EXISTS shares +( + id BIGSERIAL PRIMARY KEY NOT NULL, + public_id text NOT NULL, + created_at timestamp with time zone DEFAULT (now() at time zone 'utc'), + expires timestamp with time zone DEFAULT (now() at time zone 'utc'), + usr text NOT NULL, + website BOOLEAN NOT NULL, + wget BOOLEAN NOT NULL, + name text NOT NULL, + size BIGINT NOT NULL, + file_type text NOT NULL +); + + +-- INSERT INTO shares (uuid, usr, website, wget, name, size, file_type) +-- VALUES ('A0EEBC99-9C0B-4EF8-BB6D-6BB9BD380A11', 'josiah', TRUE, TRUE, 'my_file', 5, 'txt') +-- RETURNING *; \ No newline at end of file diff --git a/src/database.rs b/src/database.rs deleted file mode 100644 index 593c5ec..0000000 --- a/src/database.rs +++ /dev/null @@ -1,119 +0,0 @@ -use rocket_sync_db_pools::rusqlite::{self, params}; -use rocket_sync_db_pools::database; -use crate::structs::Share; - -#[database("sqlite_shares")] -pub struct SharesDbConn(rusqlite::Connection); - -#[derive(Debug)] -pub enum DatabaseError { - SqlError(String), - DoesNotExist -} - -impl From for DatabaseError { - fn from(error: rusqlite::Error) -> DatabaseError { - DatabaseError::SqlError(error.to_string()) - } -} - -impl std::convert::From for (rocket::http::Status, std::string::String) { - fn from(err: DatabaseError) -> (rocket::http::Status, std::string::String) { - (rocket::http::Status::new(500), err.to_string()) //TODO - } -} - -///Setup the database. Creates the table(s) required if they do not already exist in the database.db file. -pub async fn setup(conn: &SharesDbConn) -> Result<(), DatabaseError> { - conn.run(|c| { - c.execute("CREATE TABLE IF NOT EXISTS shares ( - id INTEGER PRIMARY KEY, - uuid TEXT NOT NULL, - usr TEXT NOT NULL, - exp BIGINT NOT NULL, - website BOOLEAN NOT NULL, - wget BOOLEAN NOT NULL, - name TEXT NOT NULL, - crt BIGINT INT NOT NULL, - size BIGINT NOT NULL, - file_type TEXT NOT NULL - );", []) - }).await?; - Ok(()) -} - -///Attempts to add a new share to the database. -pub async fn add_to_database(conn: &SharesDbConn, data: Share) -> Result<(), DatabaseError> { - conn.run(move |c| { - c.execute(" - INSERT INTO shares (uuid, exp, crt, usr, wget, website, name, size, file_type) - VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9) - ", params![data.uuid(), data.exp(), data.crt(), data.usr(), data.restrict_wget(), data.restrict_website(), data.name(), data.size(), data.file_type()]) - }).await?; - Ok(()) -} - -///Specifies how to search for items in the database, with two options. -pub enum Search { - #[allow(dead_code)] - Id(i64), - Uuid(String), -} - -impl Search { - ///Based on which variant of the enum you are using, generates the search term required to interface with the sqlite database. - // Note, if adding to this function in the future, ensure to add '' around strings. - fn get_search_term(self) -> String { - match self { - Search::Id(s) => format!("{} = {}", "id", s), - Search::Uuid(s) => format!("{} = '{}'", "uuid", s), - } - } - ///Run a search, returns the first result it finds in the database, or a DatabaseError if something goes wrong. - pub async fn find_share + 'static + Send + Clone>(self, conn: &SharesDbConn) -> Result { - let search_result: Vec = search_database(conn, self).await?; - if search_result.is_empty() { - return Err(DatabaseError::DoesNotExist); - } - Ok(search_result[0].clone()) //Assume first result is correct, user will use search::id() variant if exactness is important. - } -} - -///Implementing this trait means that the struct can be parsed from a database row, or return an error. -pub trait FromDatabase: Sized - where E: Send + std::fmt::Debug + Into -{ - fn from_database(data: &rocket_sync_db_pools::rusqlite::Row<'_> ) -> Result; -} - -///This is a non-public function, utilised by Search.find_share(). It will search a database, matching against criteria. It returns a vec of possible elements which may match the query. -async fn search_database + 'static + Send>(conn: &SharesDbConn, search: Search) -> Result, DatabaseError> { - let result = conn.run(move |c| { - c.prepare(&format!("Select * FROM shares WHERE {};", search.get_search_term())) - .and_then(|mut res: rusqlite::Statement| -> Result, rusqlite::Error> { - res.query_map([], |row| { - T::from_database(row) - }).unwrap().collect() - }) - }).await?; - Ok(result) -} - - -impl From for String { - fn from(err: DatabaseError) -> String { - return match err { - DatabaseError::DoesNotExist => "not found in database".to_string(), - DatabaseError::SqlError(s) => format!("an sql error occured when interfacing with the database: {}", s), - } - } -} - -impl std::fmt::Display for DatabaseError { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { - match self { - DatabaseError::DoesNotExist => f.write_str("not found in database"), - DatabaseError::SqlError(s) => f.write_str(&format!("an sql error occured when interfacing with the database: {}", s)), - } - } -} \ No newline at end of file diff --git a/src/db.rs b/src/db.rs new file mode 100644 index 0000000..9e63afa --- /dev/null +++ b/src/db.rs @@ -0,0 +1,128 @@ +//! Contains all database functionality + +use crate::error::Error; +use chrono::prelude::*; +use mobc::{Connection, Pool}; +use mobc_postgres::{tokio_postgres, PgConnectionManager}; +use std::fs; +use std::str::FromStr; +use std::time::Duration; +use tokio_postgres::{Config, NoTls, Row}; +use ws_com_framework::File; + +/// Maximum number of open db connections +const DB_POOL_MAX_OPEN: u64 = 32; + +/// Maximum number of idle db connections +const DB_POOL_MAX_IDLE: u64 = 8; + +/// How long we will wait for a db connection before timing out. +const DB_POOL_TIMEOUT_SECONDS: u64 = 15; + +/// The location of the initalisation file for the db. +const INIT_SQL: &str = "./config/db.sql"; + +pub type DBCon = Connection>; +pub type DBPool = Pool>; + +/// A value can be pulled from the databse if it has this trait implemented. +pub trait FromDataBase: Sized { + type Error: Send + std::fmt::Debug + Into; + fn from_database(data: &Row) -> Result; +} + +impl FromDataBase for File { + type Error = Error; + fn from_database(data: &Row) -> Result { + let id: String = data.try_get::(1).unwrap(); + let created_at: DateTime = data.try_get::>(2).unwrap(); //Test timestamp + let expires: DateTime = data.try_get::>(3).unwrap(); //Test timestamp + let usr: String = data.try_get::(4).unwrap(); + let website: bool = data.try_get::(5).unwrap(); + let wget: bool = data.try_get::(6).unwrap(); + let file_name: String = data.try_get::(7).unwrap(); + let size: i64 = data.try_get::(8).unwrap(); + let file_type: String = data.try_get::(9).unwrap(); + + let f = File::new( + id, + created_at, + expires, + usr, + website, + wget, + file_name, + size as usize, + file_type, + ); + Ok(f) + } +} + +pub fn create_pool() -> Result> { + let config = Config::from_str("postgres://postgres@127.0.0.1:7877/postgres")?; //TODO load this from config file + + let manager = PgConnectionManager::new(config, NoTls); + Ok(Pool::builder() + .max_open(DB_POOL_MAX_OPEN) + .max_idle(DB_POOL_MAX_IDLE) + .get_timeout(Some(Duration::from_secs(DB_POOL_TIMEOUT_SECONDS))) + .build(manager)) +} + +pub async fn get_db_con(pool: &DBPool) -> Result { + pool.get().await.map_err(Error::DBPool) +} + +pub async fn init_db(pool: &DBPool) -> Result<(), Error> { + let init_file = fs::read_to_string(INIT_SQL)?; + let conn = get_db_con(pool).await?; + conn.batch_execute(&init_file) + .await + .map_err(Error::DBInit)?; + Ok(()) +} + +pub enum Search { + #[allow(dead_code)] + Id(usize), + PublicId(String), +} + +impl Search { + fn get_search_term(self) -> String { + match self { + Search::Id(i) => format!("{} = {}", "id", i), + Search::PublicId(s) => format!("{} = '{}'", "public_id", s), + } + } + + pub async fn find(self, db_pool: &DBPool) -> Result, Error> { + let mut s = search_database(db_pool, self).await?; + if s.is_empty() { + return Ok(None); + } + Ok(Some(s.remove(0))) + } +} + +async fn search_database<'a>(db_pool: &DBPool, search: Search) -> Result, Error> { + let conn = get_db_con(db_pool).await?; + let rows = conn + .query( + format!( + " + SELECT * from shares + WHERE {} + ORDER BY created_at DESC + ", + search.get_search_term() + ) + .as_str(), + &[], + ) + .await + .map_err(Error::DBQuery)?; + + rows.iter().map(|r| File::from_database(r)).collect() +} diff --git a/src/error.rs b/src/error.rs new file mode 100644 index 0000000..33c3e80 --- /dev/null +++ b/src/error.rs @@ -0,0 +1,33 @@ +use mobc_postgres::tokio_postgres; +// use std::fmt::{self, Formatter}; + +#[derive(Debug)] +pub enum Error { + DBPool(mobc::Error), + DBQuery(tokio_postgres::Error), + DBInit(tokio_postgres::Error), + ReadFile(std::io::Error), + Closed(String), + Http(reqwest::Error), + Conversion(String), +} + +impl std::convert::From for Error { + fn from(e: std::io::Error) -> Error { + Error::ReadFile(e) + } +} + +impl std::convert::From for Error { + fn from(e: reqwest::Error) -> Error { + Error::Http(e) + } +} + +impl std::convert::From for Error { + fn from(e: std::num::ParseIntError) -> Error { + Error::Conversion(e.to_string()) + } +} + +//TODO implement to_string diff --git a/src/main.rs b/src/main.rs index 8941696..758f11c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,141 +1,526 @@ -//Author Josiah Bull -//This script is designed to be a counter part to the cli application. -//Represents a simple webserver which takes basic requests to a handful of endpoints. -//Implements some *very* basic encryption to prevent any old application explroing the endpoints. -//TODO: Implement some sort of external service which does a check to see if the port forward is running. -//Endpoints: -// heartbeat: A simple endpoint to check if the server is up and running, if there is a problem returns 500, 200 otherwise. -// share: Creates a share, returns a simple plain http/text response with the url of the created link. -// URL should look like: http://54.150.23.450/share/123d-d212-3dlk-dafe/yourFile/ - -//Global Config - -const SAVE_PATH: &str = "/opt/fileShare"; -const SERVER_IP: &str = "127.0.0.1:8000"; - -#[macro_use] extern crate rocket; -use rocket::response::{content, status}; -use rocket::http::{ContentType, Status}; - -mod structs; -use structs::{Share, FileDownload, UserAgent}; - -mod database; -use database::{SharesDbConn, add_to_database, Search, setup}; - -use rocket::fs::NamedFile; -use rocket_dyn_templates::Template; - -/// Loads the page for downloading a file! Also does a simple check to see if a request is coming from curl or wget. -/// -/// Address: /download/:ID/:FILENAME/ -/// Returns an html webpage, or a handle to the file -/// -/// Request: -/// ```DOS -/// WGET http://:SERVER_URL/download/some-uuid-code-yuup/YourFile/ -/// ``` -/// It's -#[get("/download//?")] -async fn download(uuid: String, file_name: String, user_agent: UserAgent, force: Option, conn: SharesDbConn) -> Result { - - let share: Share = Search::Uuid(uuid).find_share(&conn).await?; - - //Request is coming from wget or curl, and wget is enabled. Lets allow a download! - if user_agent.agent.to_lowercase().contains("wget") || user_agent.agent.to_lowercase().contains("curl") || force.is_some() { - if *share.restrict_wget() && force.is_none() { - return Err((Status::BadRequest, "Bad Request Client".into())); +//! # Server Agent for the file sharing platform +//! This server application aims to handle incoming connections from the server agent. +//! It needs to serve requested files when needed, and provide information back to the server. +//! It has no direct connection to the user - but instead reads off a database that the cli +//! tool also modifies. This largely isolates it, and prevents us from needing to write +//! a communication layer between the the CLI tool and the server agent. +//! # Function +//! 1. Connect to the Central-API on first start, and attempt to request an ID. +//! 2. Recieve our ID, and store that in a config file. +//! 3. Attempt to connect to the websocket endpoint of the Central-API, on failure repeat steps 1 and 2 again. +//! 4. With a succesful websocket connection gracefully handle incoming requests from the Central-API, primarily: +//! - Requests for metadata/file status. +//! - File upload requests. +//! - Health requests. +//! - Closing websocket. +//! 5. In the event that the Central-API is not available for a connection or disconnects us, sleep for 1 minute then +//! re-attempt the connection. + +mod db; +mod error; +mod uploader; + +use db::DBPool; +use error::Error; +use futures::StreamExt; +use serde::{Deserialize, Serialize}; +use tokio::fs; +use ws_com_framework::{message::Upload, File, Message, Receiver, Sender}; + +const CONFIG_PATH: &str = "/opt/file-share/file-share.toml"; +const MIN_RECONNECT_DELAY: usize = 2000; + +/// A copy of println!, which only prints when the global const DEBUG is true. +/// This makes debugging quick and easy to toggle. +macro_rules! debug { + () => { + if cfg!(debug_assertions) { + println!(); + } + }; + ($($arg:tt)*) => { + if cfg!(debug_assertions) { + println!($($arg)*); + } + } +} + +/// When called, if application is in DEBUG mode will panic. Otherwise will merely print the error to the console. +macro_rules! debug_panic { + ($fmt_string:expr) => { + if cfg!(debug_assertions) { + panic!($fmt_string); + } else { + println!($fmt_string); + } + }; + ($fmt_string:expr, $( $arg:expr ),*) => { + if cfg!(debug_assertions) { + panic!($fmt_string, $( $arg ),*); + } else { + println!($fmt_string, $( $arg ),*); + } + } +} + +macro_rules! okie { + ($fmt_string:expr) => { + return Ok(Some($fmt_string.into())) + }; +} + +#[derive(Serialize, Deserialize, Clone)] +struct Config { + server_ip: String, + prefix: String, + max_upload_attempts: usize, + home_dir_location: String, + reconnect_delay: usize, + id: Option, +} + +impl Config { + fn is_valid(&self) -> bool { + //TODO + true + } + fn set_id(&mut self, id: Id) { + self.id = Some(id) + } +} + +impl Default for Config { + fn default() -> Self { + Config { + server_ip: "localhost:3030".to_owned(), + prefix: "http".to_owned(), + max_upload_attempts: 3, + home_dir_location: "/opt/file-share".to_owned(), + reconnect_delay: 60000, + id: None, + } + } +} + +/// Information required to connect to central api +#[derive(Serialize, Deserialize, Clone)] +struct Id { + public_id: String, + private_key: String, +} + +fn file_to_body(f: tokio::fs::File) -> reqwest::Body { + let stream = tokio_util::codec::FramedRead::new(f, tokio_util::codec::BytesCodec::new()); + reqwest::Body::wrap_stream(stream) +} + +/// Self contained function to upload files to the server +async fn upload_file(metadata: File, cfg: Config, url: &str) { + let loc = format!("{}/hard_links/{}", cfg.home_dir_location, metadata.id()); + let mut a = 0; + loop { + let f = fs::File::open(&loc) + .await + .expect("File unexpectedly not available!"); + let res = reqwest::Client::new() + .post(url) + .body(file_to_body(f)) + .send() + .await; + match res { + Ok(_) => break, + Err(e) => { + if a >= cfg.max_upload_attempts { + debug_panic!("Failed to upload file to endpoint, error: {}", e); + break; + } + a += 1; + } } - //Download File - return Ok(FileDownload::Download ( - NamedFile::open(format!("{}/hard_links/{}", SAVE_PATH, share.uuid())).await.unwrap(), - ContentType::new("application", "octet-stream"), - rocket::http::Header::new("content-disposition", format!("attachment; filename=\"{}\"", file_name)), - )); - } - - //Otherwise, return them the page - if *share.restrict_website() { - return Err((Status::BadRequest, "Bad Request Client".into())); } - Ok(FileDownload::Page ( - Template::render("download", share), - ContentType::new("text", "html") - )) + debug!("File {} uploaded to: {}", metadata.name(), url); +} + +async fn handle_message(m: Message, db: DBPool, cfg: Config) -> Result, Error> { + match m { + Message::UploadRequest(u) => { + if let Some(f) = db::Search::PublicId(u.id().to_string()).find(&db).await? { + upload_file(f, cfg, u.url()).await; + Ok(None) + } else { + okie!(Message::Error(ws_com_framework::Error::FileDoesntExist)) + } + } + Message::MetadataRequest(r) => { + if let Some(f) = db::Search::PublicId(r.id().to_string()).find(&db).await? { + okie!(Message::MetadataResponse(Upload::new( + r.url().to_string(), + f, + ))) + } + okie!(ws_com_framework::Error::FileDoesntExist) + } + Message::Close(c) => Err(Error::Closed(c)), + Message::AuthReq => { + okie!(Message::AuthResponse(ws_com_framework::AuthKey { + key: cfg.id.unwrap().private_key.as_bytes().try_into().unwrap() + })) + } + e => { + debug_panic!("Unsupported message, recieved! {:?}", e); + Ok(None) + } + } +} + +async fn handle_ws( + handle: F, + (mut tx_ws, mut rx_ws): (Sender, Receiver), + db: &DBPool, + cfg: Config, +) -> Result<(), ()> +where + F: Fn(Message, DBPool, Config) -> Fut + Send + Sync + 'static + Copy, + R: ws_com_framework::RxStream, + S: ws_com_framework::TxStream + Send + 'static, + Fut: std::future::Future, Error>> + Send, +{ + let (tx_internal, mut rx_internal) = tokio::sync::mpsc::unbounded_channel::(); + tokio::task::spawn(async move { + while let Some(m) = rx_internal.recv().await { + if let Err(e) = tx_ws.send(m).await { + debug_panic!("Error occured! {:?}", e); + return; + }; + } + }); + + //Loop to get messages + while let Some(m) = rx_ws.next().await { + let m: Message = match m { + Ok(f) => f, + Err(e) => { + //TODO add some handling here + debug_panic!("Error occured! {:?}", e); + continue; + } + }; + + debug!( + "Message recieved from Central-API: {:?}\nProcessing now...", + m + ); + + // Ugly, but this is required to pass owned values into the thread + let db_o = db.clone(); + let cfg_o = cfg.clone(); + let tx_o = tx_internal.clone(); + tokio::task::spawn(async move { + let m = handle(m, db_o, cfg_o).await; + if let Err(e) = m { + debug_panic!("Error occured! {:?}", e); + return; + } + + debug!("Sending response to Central-API: {:?}", m); + + if let Some(r) = m.unwrap() { + if let Err(e) = tx_o.send(r) { + debug_panic!( + "Tried to send response through internal websocket, but failed \n{}", + e + ); + }; + }; + }); + } + Ok(()) +} + +/// Connect to a websocket on the server, and return the sender/receiver handles +async fn connect_sever( + ip: &str, +) -> Result< + ( + Receiver< + futures_util::stream::SplitStream< + tokio_tungstenite::WebSocketStream< + tokio_tungstenite::MaybeTlsStream, + >, + >, + >, + Sender< + futures_util::stream::SplitSink< + tokio_tungstenite::WebSocketStream< + tokio_tungstenite::MaybeTlsStream, + >, + tokio_tungstenite::tungstenite::Message, + >, + >, + ), + Error, +> { + debug!("Attempting to connect to {}", ip); + + let (client, _) = tokio_tungstenite::connect_async(ip) + .await + .expect("Failed to connect"); //TODO error handling + + debug!("Client succesfully connected to Central-Api at {}", ip); + + //Split streams into components, and wrapper them with communication framework + let (rx, tx) = client.split(); + + Ok((Receiver::new(tx), Sender::new(rx))) } +/// We call to this in the event that we are not registered yet. +async fn register_server(ip: String) -> Result { + debug!("Attempting to register websocket with At IP {}", ip); -/// Returns a url which can be used to download a file from anywhere! -/// -/// Address: /share -/// Returns 200 or 404. -/// -/// Returns a link which will allow the file to be downloaded from anywhere! -/// -/// Request: -/// ```JSON -/// POST http://:SERVER_URL/share/ -/// { -/// "": "" -/// } -/// ``` -/// -/// Response (JSON): -/// ```JSON -/// { -/// "url": "http://:SERVER_URL/download/some-uuid-code-yuup/YourFile/" -/// } -/// ``` -#[post("/share", data="")] -async fn share(share: Share, conn: SharesDbConn) -> Result { - let response = format!("http://{}/download/{}/{}.{}", SERVER_IP, share.uuid(), share.name(), share.file_type()); - setup(&conn).await?; - //Validate hard link file exists - //TODO - - //Add share to database - add_to_database(&conn, share).await?; - - Ok(response) + let id = reqwest::Client::new() + .post(&ip) + .send() + .await? + .json::() + .await?; + + Ok(id) } -/// Returns the status of the server, is meant to be used to check if the server is alive. -/// -/// Address: /heartbeat -/// Takes no arguments. -/// Returns 200 or 404. -/// -/// -/// Eventually may return some more useful information about the status of the server, but currently either returns if it's alive, or (obviously) won't if the server is dead. -/// -/// Request: -/// ``` -/// GET /heartbeat -/// ``` -/// -/// Response (JSON): -/// ``` -/// { -/// "status": "online" -/// } -/// ``` -/// -#[get("/heartbeat")] -fn heartbeat() -> status::Custom> { - status::Custom(Status::ImATeapot, content::Json("{ \"status\": \"online\" }")) //TODO implement some form of useful feedback (i.e. online, offline, degraded?) +#[tokio::main] +async fn main() { + debug!("Starting..."); + + let mut cfg: Config = confy::load_path(CONFIG_PATH).expect("Failed to load config!"); + + let db_pool = db::create_pool().expect("failed to create db pool"); + db::init_db(&db_pool).await.expect("failed to initalize db"); + + loop { + // Register websocket if not registered + if cfg.clone().id.is_none() { + let ip = format!( + "{}://{}/api/v1/client/ws-register", + cfg.prefix, cfg.server_ip + ); + let id: Id = match register_server(ip).await { + Ok(f) => f, + Err(e) => { + debug_panic!("Failed to register websocket {:?}", e); + continue; + } + }; + cfg.set_id(id); + debug!( + "Registered websocket with id {}", + cfg.clone().id.unwrap().public_id + ); + if let Err(e) = confy::store_path(CONFIG_PATH, cfg.clone()) { + debug_panic!( + "Failed to save config, quitting to prevent unintended errors: {}", + e + ); + continue; + }; + } + + if !cfg.is_valid() { + debug_panic!("Invalid config detected!"); + continue; + } + + let ip = format!( + "ws://{}/api/v1/client/ws/{}", + &cfg.server_ip, + cfg.clone().id.unwrap().public_id + ); + + let (rx, tx) = match connect_sever(&ip).await { + Ok(f) => f, + Err(e) => { + debug_panic!("Failed to connect to webserver {:?}", e); + continue; + } + }; + + //TODO validation here + + handle_ws(handle_message, (tx, rx), &db_pool, cfg.clone()) + .await + .expect("Not Implemented"); //TODO + + tokio::time::sleep(std::time::Duration::from_millis(std::cmp::max( + cfg.reconnect_delay as u64, + MIN_RECONNECT_DELAY as u64, + ))) + .await; + } + + //TODO Implement a ctrl+c catch to close + + // debug!("Connection closed, Server Agent exiting...."); + // std::process::exit(0); } -//TODO -// #[catch(404)] -// fn not_found(req: &Request) -> String { +#[cfg(test)] +mod websocket_tests { + use crate::db; + use crate::db::DBPool; + use crate::{connect_sever, handle_ws, register_server, Config}; + use futures::{FutureExt, SinkExt, StreamExt}; + use std::time::Duration; + use tokio::sync::oneshot; + use tokio::time::timeout; + use warp; + use warp::Filter; + use ws_com_framework::{Message, Sender}; + /// Spool up a simple websocket server, which is useful in tests, set to echo. + fn create_websocket_server(ip: ([u8; 4], u16)) -> Result, ()> { + let echo_ws = warp::any() + .and(warp::path("echo")) + .and(warp::path::end()) + .and(warp::ws()) + .map(|ws: warp::ws::Ws| { + ws.on_upgrade(|websocket| { + // Just echo all messages back... + let (tx, rx) = websocket.split(); + rx.forward(tx).map(|result| { + if let Err(e) = result { + panic!("websocket error: {:?}", e); + } + }) + }) + }); + + let routes = echo_ws; + + let (tx, rx) = oneshot::channel(); + let (_addr, server) = warp::serve(routes).bind_with_graceful_shutdown(ip, async { + rx.await.ok(); + }); + + tokio::task::spawn(server); + + Ok(tx) + } + + /// Create a simple webserver which parses some basic http requests. + fn create_http_server(ip: ([u8; 4], u16)) -> Result, ()> { + let register = warp::post() + .and(warp::path("test-register")) + .and(warp::path::end()) + .map(|| { + format!( + " + {{ + \"public_id\": \"7N58aK\", + \"private_key\": \"oVZBbqJm5vXCmfTP8wQA0n13FeKd5Ego\" + }}" + ) + }); + + let routes = register; + + let (tx, rx) = oneshot::channel(); + let (_, server) = warp::serve(routes).bind_with_graceful_shutdown(ip, async { + rx.await.ok(); + }); -// } + tokio::task::spawn(server); -#[doc(hidden)] -#[launch] -fn rocket() -> _ { - rocket::build() - .mount("/", routes![heartbeat, share, download]) - .attach(SharesDbConn::fairing()) - .attach(Template::fairing()) + Ok(tx) + } + + /// Test that websocket is able to succesfully connect to a provided server, and send a simple message + /// Will timeout and fail anyway after 10 seconds - this usually indicates the test has failed. + #[tokio::test(flavor = "multi_thread")] + async fn websocket_connect() { + timeout(Duration::from_millis(10_000), async { + let close_server_tx = create_websocket_server(([127, 0, 0, 1], 2033)).unwrap(); + + let (mut rx, mut tx) = connect_sever("ws://127.0.0.1:2033/echo").await.unwrap(); + + let msg = Message::Message("Hello, World!".into()); + + tx.send(msg.clone()).await.unwrap(); + + let m = rx.next().await.unwrap().unwrap(); + + assert_eq!(msg, m); + + let _ = close_server_tx.send(()); + }) + .await + .expect("Test failed due to timeout!"); + } + + #[tokio::test] + async fn test_db() { + let db_pool = db::create_pool().expect("failed to create db pool"); + db::init_db(&db_pool).await.expect("failed to initalize db"); + } + + #[tokio::test(flavor = "multi_thread", worker_threads = 5)] + async fn websocket_handle() { + timeout(Duration::from_millis(5000), async { + let cfg = Config::default(); //TODO should write custom config here + let db_pool = db::create_pool().expect("failed to create db pool"); + db::init_db(&db_pool).await.expect("failed to initalize db"); + + let close_server_tx = create_websocket_server(([127, 0, 0, 1], 2031)).unwrap(); + + let (rx, mut tx) = connect_sever("ws://127.0.0.1:2031/echo").await.unwrap(); + + let msg = Message::Message("Hello, World!".into()); + let e_msg = Message::Message("Hello, World!".into()); + + //Send relevant sequences of messages + tx.send(msg.clone()).await.unwrap(); + tx.send(e_msg.clone()).await.unwrap(); + tx.underlying().close().await.unwrap(); + //This function should process the messages we sent (to ensure they're all getting through) + async fn handle( + m: Message, + _: DBPool, + _: Config, + ) -> Result, crate::error::Error> { + match m.clone() { + Message::Message(t) => { + if t != "Hello, World!".to_owned() { + panic!("Unexpected message recieved! {:?}", m); + } + } + _ => panic!("Unexpected message recieved! {:?}", m), + } + Ok(None) + } + + let (tx, _) = tokio::sync::mpsc::unbounded_channel::(); + let s = Sender::new(tx); + + handle_ws(handle, (s, rx), &db_pool, cfg).await.unwrap(); + + let _ = close_server_tx.send(()); + }) + .await + .expect("Test failed due to timeout!"); + } + + #[tokio::test(flavor = "multi_thread")] + async fn test_register() { + let close_server_tx = create_http_server(([127, 0, 0, 1], 2034)).unwrap(); + + let res = register_server("http://127.0.0.1:2034/test-register".into()) + .await + .unwrap(); + + assert_eq!(res.public_id, "7N58aK".to_owned()); + assert_eq!( + res.private_key, + "oVZBbqJm5vXCmfTP8wQA0n13FeKd5Ego".to_owned() + ); + + let _ = close_server_tx.send(()); + } } diff --git a/src/structs.rs b/src/structs.rs deleted file mode 100644 index 8b9e2d7..0000000 --- a/src/structs.rs +++ /dev/null @@ -1,166 +0,0 @@ -use serde::{Serialize, Deserialize}; -use rocket::data::{self, Data, FromData, ToByteUnit}; -use rocket::outcome::Outcome::*; -use rocket::http::{Status, ContentType, Header}; -use rocket::request::{self, Request, FromRequest}; -use rocket::fs::NamedFile; -use std::error::Error; -use std::fmt; -use std::time::{SystemTime, UNIX_EPOCH}; -use rocket_dyn_templates::Template; -use derive_getters::Getters; - -#[derive(Responder)] -#[response(status = 200)] -pub enum FileDownload { - Download(NamedFile, ContentType, Header<'static>), - Page(Template, ContentType) -} - -pub struct UserAgent { - pub agent: String -} - -#[derive(Debug)] -pub enum ShareError { - ParseError(String), - TooLarge, - Io(std::io::Error), - ContentType, - TimeError, -} - -#[derive(Serialize, Deserialize, Getters, Clone)] -pub struct Share { - uuid: String, - usr: String, - exp: u64, - restrict_wget: bool, - restrict_website: bool, - name: String, - #[serde(default)] - crt: u64, - size: u64, - file_type: String, -} - -impl Share { - pub fn validate(&self) -> Result<(), ShareError> { - //Check that the exp is actually after the created time stamp - if self.exp < self.crt { //NB No error checking needed here. - return Err(ShareError::TimeError); - } - - // Validate that restrict_wget and restrict_website aren't both set - if self.restrict_wget && self.restrict_website { - return Err(ShareError::ParseError("Both restrict_wget and restrict_website are set!".into())) - } - - //TODO Implement validating the file type - - Ok(()) - } -} - -#[derive(Debug)] -pub enum UserAgentError { - ParseError -} - -#[rocket::async_trait] -impl<'r> FromRequest<'r> for UserAgent { - type Error = UserAgentError; - async fn from_request(req: &'r Request<'_>) -> request::Outcome { - let agent_name = match req.headers().get_one("User-Agent") { - Some(name) => name, - None => return Failure((Status::BadRequest, UserAgentError::ParseError)), - }; - return Success( - UserAgent { - agent: agent_name.to_owned() - } - ); - } -} - -#[rocket::async_trait] -impl<'r> FromData<'r> for Share { - type Error = ShareError; - - async fn from_data(req: &'r Request<'_>, data: Data<'r>) -> data::Outcome<'r, Self> { - //Ensure correct content type - let share_ct = ContentType::new("text", "plain"); - if req.content_type() != Some(&share_ct) { - return Failure((Status::UnsupportedMediaType, ShareError::ContentType)); - } - - let limit = req.limits().get("share").unwrap_or_else(|| 1024.bytes()); //Set the maximum size we'll unwrap - //Read the data - let string = match data.open(limit).into_string().await { - Ok(string) if string.is_complete() => string.into_inner(), - Ok(_) => return Failure((Status::PayloadTooLarge, ShareError::TooLarge)), - Err(e) => return Failure((Status::InternalServerError, ShareError::Io(e))), - }; - - let string = request::local_cache!(req, string); - - // Attempt to parse the string with serde into our struct - let mut share: Share = match serde_json::from_str(string) { - Ok(share) => share, - Err(e) => return Failure((Status::BadRequest, ShareError::ParseError(format!("Unable to parse string with serde: {}", e.to_string())))), - }; - - //Set the time we received this request on the share. - share.crt = SystemTime::now().duration_since(UNIX_EPOCH).expect("Time went backwards").as_millis() as u64; - - //Validate the share - match share.validate() { - Ok(_) => (), - Err(e) => return Failure((Status::BadRequest, e)), - }; - - Success(share) - } -} - -impl crate::database::FromDatabase for Share { - fn from_database(row: &rocket_sync_db_pools::rusqlite::Row<'_>) -> Result { - //SAFTEY: These should be safe, as the types with unwraps are disallowed from being null in the schema of the db. - Ok(Share { - //NB: Skip first col (0-th index) as that's the id - uuid: row.get(1).unwrap(), - usr: row.get(2).unwrap(), - exp: row.get(3).unwrap(), - restrict_wget: row.get(4).unwrap(), - restrict_website: row.get(5).unwrap(), - name: row.get(6).unwrap(), - crt: row.get(7).unwrap(), - size: row.get(8).unwrap(), - file_type: row.get(9).unwrap(), - }) - } -} - -impl Error for ShareError { - fn description(&self) -> &str { - match &*self { - ShareError::ParseError(err) => &err, - ShareError::TooLarge => "The share was too large", - ShareError::ContentType => "Incorrect content type, expected application/JSON", - ShareError::Io(_) => "Failed to read string", - ShareError::TimeError => "The expiry date is set before the current time!", - } - } -} - -impl fmt::Display for ShareError { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match &*self { - ShareError::ParseError(err) => f.write_str(&err), - ShareError::TooLarge => f.write_str("The share was too large"), - ShareError::ContentType => f.write_str("Incorrect content type, expected application/JSON"), - ShareError::Io(err) => f.write_str(&err.to_string()), - ShareError::TimeError => f.write_str("The expiry date is set before the current time!"), - } - } -} \ No newline at end of file diff --git a/src/uploader.rs b/src/uploader.rs new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/src/uploader.rs @@ -0,0 +1 @@ + diff --git a/templates/download.html.hbs b/templates/download.html.hbs deleted file mode 100644 index 9c76d97..0000000 --- a/templates/download.html.hbs +++ /dev/null @@ -1,266 +0,0 @@ - - - - - - - - Download File - - - - - - - -
- - - {{!-- Logo --}} -
- {{!-- --}} -
- -
- {{!--
--}} -
- - -
-
-
- - - File Transfer Summary:
- Filename: {{name}}
- {{!-- TODO: Implement a basic function to convert the size value here to human-readable (i.e. 1024 -> 1kb) --}} - File Size: {{size}}
- File type: {{file_type}}
- Sent by: {{usr}}
- {{!-- TODO we are receiving values here which are not human-readable, convert them? --}} - Sent on:
- Expires in:
- {{!-- TODO Implement something to change the color based on if status is online, offline, or degraded --}} - Current Status: online -
-
- -
-

Download File

-
- {{!-- TODO Remake SVG, Placeholder for now --}} - - - - - - - -
-
- {{!--
--}} - -
Or...
-
- - - {{!-- TODO Remake SVG --}} -
- - - -
-
-
-
-
- -
- -
\ No newline at end of file diff --git a/templates/images_raw_png/Abstract 2.png b/templates/images_raw_png/Abstract 2.png deleted file mode 100644 index e6c0c23..0000000 Binary files a/templates/images_raw_png/Abstract 2.png and /dev/null differ diff --git a/templates/images_raw_png/Abstract.png b/templates/images_raw_png/Abstract.png deleted file mode 100644 index 56dca04..0000000 Binary files a/templates/images_raw_png/Abstract.png and /dev/null differ diff --git a/templates/images_raw_png/Logo.png b/templates/images_raw_png/Logo.png deleted file mode 100644 index c646fb0..0000000 Binary files a/templates/images_raw_png/Logo.png and /dev/null differ diff --git a/templates/images_raw_png/Router.png b/templates/images_raw_png/Router.png deleted file mode 100644 index e004654..0000000 Binary files a/templates/images_raw_png/Router.png and /dev/null differ diff --git a/templates/images_raw_png/World with Arrow.png b/templates/images_raw_png/World with Arrow.png deleted file mode 100644 index c73791f..0000000 Binary files a/templates/images_raw_png/World with Arrow.png and /dev/null differ diff --git a/templates/images_raw_png/book.png b/templates/images_raw_png/book.png deleted file mode 100644 index 3e1764a..0000000 Binary files a/templates/images_raw_png/book.png and /dev/null differ diff --git a/templates/images_raw_png/clock.png b/templates/images_raw_png/clock.png deleted file mode 100644 index 94e88aa..0000000 Binary files a/templates/images_raw_png/clock.png and /dev/null differ diff --git a/templates/images_raw_png/file transfer representation.png b/templates/images_raw_png/file transfer representation.png deleted file mode 100644 index 0ab96ce..0000000 Binary files a/templates/images_raw_png/file transfer representation.png and /dev/null differ diff --git a/templates/images_raw_png/lock (locked).png b/templates/images_raw_png/lock (locked).png deleted file mode 100644 index 4db902e..0000000 Binary files a/templates/images_raw_png/lock (locked).png and /dev/null differ diff --git a/templates/images_raw_png/lock (unlocked).png b/templates/images_raw_png/lock (unlocked).png deleted file mode 100644 index 5bb6bc7..0000000 Binary files a/templates/images_raw_png/lock (unlocked).png and /dev/null differ diff --git a/templates/images_raw_png/mp3 file.png b/templates/images_raw_png/mp3 file.png deleted file mode 100644 index 4d62b6a..0000000 Binary files a/templates/images_raw_png/mp3 file.png and /dev/null differ diff --git a/templates/images_raw_png/pdf file.png b/templates/images_raw_png/pdf file.png deleted file mode 100644 index 43a8f50..0000000 Binary files a/templates/images_raw_png/pdf file.png and /dev/null differ diff --git a/templates/images_raw_png/plane.png b/templates/images_raw_png/plane.png deleted file mode 100644 index 8219eaf..0000000 Binary files a/templates/images_raw_png/plane.png and /dev/null differ diff --git a/templates/images_raw_png/present 1.png b/templates/images_raw_png/present 1.png deleted file mode 100644 index b3cff3f..0000000 Binary files a/templates/images_raw_png/present 1.png and /dev/null differ diff --git a/templates/images_raw_png/present 2.png b/templates/images_raw_png/present 2.png deleted file mode 100644 index f57113e..0000000 Binary files a/templates/images_raw_png/present 2.png and /dev/null differ diff --git a/templates/images_raw_png/present 3.png b/templates/images_raw_png/present 3.png deleted file mode 100644 index d76696c..0000000 Binary files a/templates/images_raw_png/present 3.png and /dev/null differ diff --git a/templates/images_raw_png/ramen.png b/templates/images_raw_png/ramen.png deleted file mode 100644 index e81505d..0000000 Binary files a/templates/images_raw_png/ramen.png and /dev/null differ diff --git a/templates/images_raw_png/stars and moon.png b/templates/images_raw_png/stars and moon.png deleted file mode 100644 index 0191a93..0000000 Binary files a/templates/images_raw_png/stars and moon.png and /dev/null differ diff --git a/templates/images_raw_png/txt file.png b/templates/images_raw_png/txt file.png deleted file mode 100644 index 13b500e..0000000 Binary files a/templates/images_raw_png/txt file.png and /dev/null differ diff --git a/templates/images_svg/Logo.svg b/templates/images_svg/Logo.svg deleted file mode 100644 index 32d8793..0000000 --- a/templates/images_svg/Logo.svg +++ /dev/null @@ -1,69 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - - - - diff --git a/templates/images_svg/Logo_opt.svg b/templates/images_svg/Logo_opt.svg deleted file mode 100644 index b781766..0000000 --- a/templates/images_svg/Logo_opt.svg +++ /dev/null @@ -1 +0,0 @@ - diff --git a/templates/images_svg/Router.svg b/templates/images_svg/Router.svg deleted file mode 100644 index dd03c98..0000000 --- a/templates/images_svg/Router.svg +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - - diff --git a/templates/images_svg/clock.svg b/templates/images_svg/clock.svg deleted file mode 100644 index 9685b51..0000000 --- a/templates/images_svg/clock.svg +++ /dev/null @@ -1,153 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/templates/images_svg/plane.svg b/templates/images_svg/plane.svg deleted file mode 100644 index df74f65..0000000 --- a/templates/images_svg/plane.svg +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - -