diff --git a/Cargo.lock b/Cargo.lock index 97827b6..1e68c22 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -36,95 +36,30 @@ dependencies = [ "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" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" -[[package]] -name = "base-x" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b20b618342cf9891c292c4f5ac2cde7287cc5c87e87e9c769d617793607dec1" - [[package]] name = "base64" version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" -[[package]] -name = "binascii" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "383d29d513d8764dcdc42ea295d979eb99c3c9f00607b3692cf68a431f7dca72" - [[package]] name = "bitflags" version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" -[[package]] -name = "block-buffer" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" -dependencies = [ - "block-padding", - "byte-tools", - "byteorder", - "generic-array", -] - -[[package]] -name = "block-padding" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5" -dependencies = [ - "byte-tools", -] - [[package]] name = "bumpalo" version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2e8c087f005730276d1096a652e92a8bacee2e2472bcc9715a74d2bec38b5820" -[[package]] -name = "byte-tools" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" - -[[package]] -name = "byteorder" -version = "1.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" - [[package]] name = "bytes" version = "0.5.6" @@ -143,31 +78,6 @@ version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" -[[package]] -name = "cloudabi" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4344512281c643ae7638bbabc3af17a11307803ec8f0fcad9fae512a8bf36467" -dependencies = [ - "bitflags", -] - -[[package]] -name = "const_fn" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce90df4c658c62f12d78f7508cf92f9173e5184a539c10bfe54a3107b3ffd0f2" - -[[package]] -name = "cookie" -version = "0.15.0-dev" -source = "git+https://github.com/SergioBenitez/cookie-rs.git?rev=9675944#96759448004cc9bdb76a58cfacee815da5617f8b" -dependencies = [ - "percent-encoding", - "time", - "version_check", -] - [[package]] name = "core-foundation" version = "0.7.0" @@ -193,51 +103,6 @@ dependencies = [ "cfg-if", ] -[[package]] -name = "devise" -version = "0.3.0" -source = "git+https://github.com/SergioBenitez/Devise.git?rev=3648468#3648468a9ede9ca896cd35bc1eb818c7a9fb3047" -dependencies = [ - "devise_codegen", - "devise_core", -] - -[[package]] -name = "devise_codegen" -version = "0.3.0" -source = "git+https://github.com/SergioBenitez/Devise.git?rev=3648468#3648468a9ede9ca896cd35bc1eb818c7a9fb3047" -dependencies = [ - "devise_core", - "quote", -] - -[[package]] -name = "devise_core" -version = "0.3.0" -source = "git+https://github.com/SergioBenitez/Devise.git?rev=3648468#3648468a9ede9ca896cd35bc1eb818c7a9fb3047" -dependencies = [ - "bitflags", - "proc-macro2", - "proc-macro2-diagnostics 0.9.0", - "quote", - "syn", -] - -[[package]] -name = "digest" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" -dependencies = [ - "generic-array", -] - -[[package]] -name = "discard" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0" - [[package]] name = "dotenv" version = "0.15.0" @@ -250,12 +115,6 @@ version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "134951f4028bdadb9b84baf4232681efbf277da25144b9b0ad65df75946c422b" -[[package]] -name = "either" -version = "1.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" - [[package]] name = "encoding_rs" version = "0.8.24" @@ -265,24 +124,6 @@ dependencies = [ "cfg-if", ] -[[package]] -name = "fake-simd" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" - -[[package]] -name = "filetime" -version = "0.2.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ed85775dcc68644b5c950ac06a2b23768d3bc9390464151aaf27136998dcf9e" -dependencies = [ - "cfg-if", - "libc", - "redox_syscall", - "winapi 0.3.9", -] - [[package]] name = "flate2" version = "1.0.18" @@ -316,25 +157,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" -[[package]] -name = "fsevent" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ab7d1bd1bd33cc98b0889831b72da23c0aa4df9cec7e0702f46ecea04b35db6" -dependencies = [ - "bitflags", - "fsevent-sys", -] - -[[package]] -name = "fsevent-sys" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f41b048a94555da0f42f1d632e2e19510084fb8e303b0daa2816e733fb3644a0" -dependencies = [ - "libc", -] - [[package]] name = "fuchsia-zircon" version = "0.3.3" @@ -351,21 +173,6 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" -[[package]] -name = "futures" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d8e3078b7b2a8a671cb7a3d17b4760e4181ea243227776ba83fd043b4ca034e" -dependencies = [ - "futures-channel", - "futures-core", - "futures-executor", - "futures-io", - "futures-sink", - "futures-task", - "futures-util", -] - [[package]] name = "futures-channel" version = "0.3.6" @@ -373,7 +180,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7a4d35f7401e948629c9c3d6638fb9bf94e0b2121e96c3b428cc4e631f3eb74" dependencies = [ "futures-core", - "futures-sink", ] [[package]] @@ -382,23 +188,6 @@ version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d674eaa0056896d5ada519900dbf97ead2e46a7b6621e8160d79e2f2e1e2784b" -[[package]] -name = "futures-executor" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc709ca1da6f66143b8c9bec8e6260181869893714e9b5a490b169b0414144ab" -dependencies = [ - "futures-core", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-io" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fc94b64bb39543b4e432f1790b6bf18e3ee3b74653c5449f63310e9a74b123c" - [[package]] name = "futures-macro" version = "0.3.6" @@ -432,13 +221,9 @@ version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a894a0acddba51a2d49a6f4263b1e64b8c579ece8af50fa86503d52cd1eea34" dependencies = [ - "futures-channel", "futures-core", - "futures-io", "futures-macro", - "futures-sink", "futures-task", - "memchr", "pin-project", "pin-utils", "proc-macro-hack", @@ -446,15 +231,6 @@ dependencies = [ "slab", ] -[[package]] -name = "generic-array" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c68f0274ae0e023facc3c97b2e00f076be70e254bc851d972503b328db79b2ec" -dependencies = [ - "typenum", -] - [[package]] name = "getrandom" version = "0.1.15" @@ -466,12 +242,6 @@ dependencies = [ "wasi", ] -[[package]] -name = "glob" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" - [[package]] name = "h2" version = "0.2.6" @@ -491,20 +261,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "handlebars" -version = "3.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcd1b5399b9884f9ae18b5d4105d180720c8f602aeb73d3ceae9d6b1d13a5fa7" -dependencies = [ - "log", - "pest", - "pest_derive", - "quick-error", - "serde", - "serde_json", -] - [[package]] name = "hashbrown" version = "0.9.1" @@ -611,41 +367,6 @@ dependencies = [ "hashbrown", ] -[[package]] -name = "inlinable_string" -version = "0.1.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb6ee2a7da03bfc3b66ca47c92c2e392fcc053ea040a85561749b026f7aad09a" - -[[package]] -name = "inotify" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4816c66d2c8ae673df83366c18341538f234a26d65a9ecea5c348b453ac1d02f" -dependencies = [ - "bitflags", - "inotify-sys", - "libc", -] - -[[package]] -name = "inotify-sys" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e74a1aa87c59aeff6ef2cc2fa62d41bc43f54952f55652656b18a02fd5e356c0" -dependencies = [ - "libc", -] - -[[package]] -name = "instant" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63312a18f7ea8760cdd0a7c5aac1a619752a246b833545e3e36d1f81f7cd9e66" -dependencies = [ - "cfg-if", -] - [[package]] name = "iovec" version = "0.1.4" @@ -692,27 +413,12 @@ 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.79" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2448f6066e80e3bfc792e9c98bf705b4b0fc6e8ef5b43e5889aff0eaa9c58743" -[[package]] -name = "lock_api" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28247cc5a5be2f05fbcd76dd0cf2c7d3b5400cb978a28042abcd4fa0b3f8261c" -dependencies = [ - "scopeguard", -] - [[package]] name = "log" version = "0.4.11" @@ -722,12 +428,6 @@ dependencies = [ "cfg-if", ] -[[package]] -name = "maplit" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d" - [[package]] name = "matches" version = "0.1.8" @@ -779,22 +479,22 @@ dependencies = [ "kernel32-sys", "libc", "log", - "miow", + "miow 0.2.1", "net2", "slab", "winapi 0.2.8", ] [[package]] -name = "mio-extras" -version = "2.0.6" +name = "mio-named-pipes" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52403fe290012ce777c4626790c8951324a2b9e3316b3143779c72b029742f19" +checksum = "0840c1c50fd55e521b247f949c241c9997709f23bd7f023b9762cd561e935656" dependencies = [ - "lazycell", "log", "mio", - "slab", + "miow 0.3.5", + "winapi 0.3.9", ] [[package]] @@ -820,6 +520,16 @@ dependencies = [ "ws2_32-sys", ] +[[package]] +name = "miow" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07b88fb9795d4d36d62a012dfbf49a8f5cf12751f36d31a9dbe66d528e58979e" +dependencies = [ + "socket2", + "winapi 0.3.9", +] + [[package]] name = "native-tls" version = "0.2.4" @@ -849,24 +559,6 @@ dependencies = [ "winapi 0.3.9", ] -[[package]] -name = "notify" -version = "4.0.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80ae4a7688d1fab81c5bf19c64fc8db920be8d519ce6336ed4e7efe024724dbd" -dependencies = [ - "bitflags", - "filetime", - "fsevent", - "fsevent-sys", - "inotify", - "libc", - "mio", - "mio-extras", - "walkdir", - "winapi 0.3.9", -] - [[package]] name = "num_cpus" version = "1.13.0" @@ -883,12 +575,6 @@ version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "260e51e7efe62b592207e9e13a68e43692a7a279171d6ba57abd208bf23645ad" -[[package]] -name = "opaque-debug" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" - [[package]] name = "openssl" version = "0.10.30" @@ -922,102 +608,12 @@ dependencies = [ "vcpkg", ] -[[package]] -name = "parking_lot" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4893845fa2ca272e647da5d0e46660a314ead9c2fdd9a883aabc32e481a8733" -dependencies = [ - "instant", - "lock_api", - "parking_lot_core", -] - -[[package]] -name = "parking_lot_core" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c361aa727dd08437f2f1447be8b59a33b0edd15e0fcee698f935613d9efbca9b" -dependencies = [ - "cfg-if", - "cloudabi", - "instant", - "libc", - "redox_syscall", - "smallvec", - "winapi 0.3.9", -] - -[[package]] -name = "pear" -version = "0.2.0-dev" -source = "git+https://github.com/SergioBenitez/Pear.git?rev=4b68055#4b680556063568a42fcd4328335cdfdf7608be49" -dependencies = [ - "inlinable_string", - "pear_codegen", - "yansi", -] - -[[package]] -name = "pear_codegen" -version = "0.2.0-dev" -source = "git+https://github.com/SergioBenitez/Pear.git?rev=4b68055#4b680556063568a42fcd4328335cdfdf7608be49" -dependencies = [ - "proc-macro2", - "proc-macro2-diagnostics 0.1.0", - "quote", - "syn", -] - [[package]] name = "percent-encoding" version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" -[[package]] -name = "pest" -version = "2.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10f4872ae94d7b90ae48754df22fd42ad52ce740b8f370b03da4835417403e53" -dependencies = [ - "ucd-trie", -] - -[[package]] -name = "pest_derive" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "833d1ae558dc601e9a60366421196a8d94bc0ac980476d0b67e1d0988d72b2d0" -dependencies = [ - "pest", - "pest_generator", -] - -[[package]] -name = "pest_generator" -version = "2.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99b8db626e31e5b81787b9783425769681b347011cc59471e33ea46d2ea0cf55" -dependencies = [ - "pest", - "pest_meta", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "pest_meta" -version = "2.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54be6e404f5317079812fc8f9f5279de376d8856929e21c184ecf6bbd692a11d" -dependencies = [ - "maplit", - "pest", - "sha-1", -] - [[package]] name = "pin-project" version = "0.4.27" @@ -1083,37 +679,6 @@ dependencies = [ "unicode-xid", ] -[[package]] -name = "proc-macro2-diagnostics" -version = "0.1.0" -source = "git+https://github.com/SergioBenitez/proc-macro2-diagnostics.git?rev=13fbb43#13fbb43db72034b6f9660a9b00e338cebd8dcf44" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "version_check", - "yansi", -] - -[[package]] -name = "proc-macro2-diagnostics" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56caa0152d6f336a41d76788ee92569c4e63db855d02eb7f0cb204ad32c99a5d" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "version_check", - "yansi", -] - -[[package]] -name = "quick-error" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ac73b1112776fc109b2e61909bc46c7e1bf0d7f690ffb1676553acce16d5cda" - [[package]] name = "quote" version = "1.0.7" @@ -1170,26 +735,6 @@ version = "0.1.57" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" -[[package]] -name = "ref-cast" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "745c1787167ddae5569661d5ffb8b25ae5fedbf46717eaa92d652221cec72623" -dependencies = [ - "ref-cast-impl", -] - -[[package]] -name = "ref-cast-impl" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d21b475ab879ef0e315ad99067fa25778c3b0377f57f1b00207448dac1a3144" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "remove_dir_all" version = "0.5.3" @@ -1236,109 +781,12 @@ dependencies = [ "winreg", ] -[[package]] -name = "rocket" -version = "0.5.0-dev" -source = "git+https://github.com/SergioBenitez/Rocket#8da034ab835ef1d599cd146164dffda960275c06" -dependencies = [ - "async-trait", - "atomic", - "atty", - "binascii", - "futures", - "log", - "memchr", - "num_cpus", - "parking_lot", - "pear", - "ref-cast", - "rocket_codegen", - "rocket_http", - "state", - "time", - "tokio", - "toml", - "ubyte", - "version_check", - "yansi", -] - -[[package]] -name = "rocket_codegen" -version = "0.5.0-dev" -source = "git+https://github.com/SergioBenitez/Rocket#8da034ab835ef1d599cd146164dffda960275c06" -dependencies = [ - "devise", - "glob", - "indexmap", - "quote", - "rocket_http", -] - -[[package]] -name = "rocket_contrib" -version = "0.5.0-dev" -source = "git+https://github.com/SergioBenitez/Rocket#8da034ab835ef1d599cd146164dffda960275c06" -dependencies = [ - "glob", - "handlebars", - "log", - "notify", - "rocket", - "serde", - "serde_json", - "tokio", -] - -[[package]] -name = "rocket_http" -version = "0.5.0-dev" -source = "git+https://github.com/SergioBenitez/Rocket#8da034ab835ef1d599cd146164dffda960275c06" -dependencies = [ - "cookie", - "either", - "http", - "hyper", - "indexmap", - "log", - "mime", - "parking_lot", - "pear", - "percent-encoding", - "ref-cast", - "smallvec", - "state", - "time", - "tokio", - "uncased", - "unicode-xid", - "version_check", -] - -[[package]] -name = "rustc_version" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" -dependencies = [ - "semver", -] - [[package]] name = "ryu" version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" -[[package]] -name = "same-file" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" -dependencies = [ - "winapi-util", -] - [[package]] name = "schannel" version = "0.1.19" @@ -1349,12 +797,6 @@ dependencies = [ "winapi 0.3.9", ] -[[package]] -name = "scopeguard" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" - [[package]] name = "security-framework" version = "0.4.4" @@ -1378,21 +820,6 @@ dependencies = [ "libc", ] -[[package]] -name = "semver" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" -dependencies = [ - "semver-parser", -] - -[[package]] -name = "semver-parser" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" - [[package]] name = "serde" version = "1.0.117" @@ -1436,24 +863,6 @@ dependencies = [ "url", ] -[[package]] -name = "sha-1" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7d94d0bede923b3cea61f3f1ff57ff8cdfd77b400fb8f9998949e0cf04163df" -dependencies = [ - "block-buffer", - "digest", - "fake-simd", - "opaque-debug", -] - -[[package]] -name = "sha1" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" - [[package]] name = "signal-hook-registry" version = "1.2.1" @@ -1483,12 +892,6 @@ dependencies = [ "serde_json", ] -[[package]] -name = "smallvec" -version = "1.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbee7696b84bbf3d89a1c2eccff0850e3047ed46bfcd2e92c29a2d074d57e252" - [[package]] name = "socket2" version = "0.3.15" @@ -1501,70 +904,6 @@ dependencies = [ "winapi 0.3.9", ] -[[package]] -name = "standback" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4e0831040d2cf2bdfd51b844be71885783d489898a192f254ae25d57cce725c" -dependencies = [ - "version_check", -] - -[[package]] -name = "state" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7345c971d1ef21ffdbd103a75990a15eb03604fc8b8852ca8cb418ee1a099028" - -[[package]] -name = "stdweb" -version = "0.4.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d022496b16281348b52d0e30ae99e01a73d737b2f45d38fed4edf79f9325a1d5" -dependencies = [ - "discard", - "rustc_version", - "stdweb-derive", - "stdweb-internal-macros", - "stdweb-internal-runtime", - "wasm-bindgen", -] - -[[package]] -name = "stdweb-derive" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c87a60a40fccc84bef0652345bbbbbe20a605bf5d0ce81719fc476f5c03b50ef" -dependencies = [ - "proc-macro2", - "quote", - "serde", - "serde_derive", - "syn", -] - -[[package]] -name = "stdweb-internal-macros" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58fa5ff6ad0d98d1ffa8cb115892b6e69d67799f6763e162a1c9db421dc22e11" -dependencies = [ - "base-x", - "proc-macro2", - "quote", - "serde", - "serde_derive", - "serde_json", - "sha1", - "syn", -] - -[[package]] -name = "stdweb-internal-runtime" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "213701ba3370744dcd1a12960caa4843b3d68b4d1c0a5d575e0d65b2ee9d16c0" - [[package]] name = "syn" version = "1.0.44" @@ -1590,44 +929,6 @@ dependencies = [ "winapi 0.3.9", ] -[[package]] -name = "time" -version = "0.2.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55b7151c9065e80917fbf285d9a5d1432f60db41d170ccafc749a136b41a93af" -dependencies = [ - "const_fn", - "libc", - "standback", - "stdweb", - "time-macros", - "version_check", - "winapi 0.3.9", -] - -[[package]] -name = "time-macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "957e9c6e26f12cb6d0dd7fc776bb67a706312e7299aed74c8dd5b17ebb27e2f1" -dependencies = [ - "proc-macro-hack", - "time-macros-impl", -] - -[[package]] -name = "time-macros-impl" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5c3be1edfad6027c69f5491cf4cb310d1a71ecd6af742788c6ff8bced86b8fa" -dependencies = [ - "proc-macro-hack", - "proc-macro2", - "quote", - "standback", - "syn", -] - [[package]] name = "tinyvec" version = "0.3.4" @@ -1648,6 +949,7 @@ dependencies = [ "libc", "memchr", "mio", + "mio-named-pipes", "mio-uds", "num_cpus", "pin-project-lite", @@ -1692,15 +994,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "toml" -version = "0.5.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75cf45bb0bef80604d001caaec0d09da99611b3c0fd39d3080468875cdb65645" -dependencies = [ - "serde", -] - [[package]] name = "tower-service" version = "0.3.0" @@ -1734,33 +1027,6 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" -[[package]] -name = "typenum" -version = "1.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33" - -[[package]] -name = "ubyte" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8576ece1c74e91210e2ec01e016f2fb68037f8274e2e80dee775ca2fbf8a8479" - -[[package]] -name = "ucd-trie" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c" - -[[package]] -name = "uncased" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "369fa7fd7969c5373541d3c9a40dc1b76ce676fc87aba30d87c0ad3b97fad179" -dependencies = [ - "version_check", -] - [[package]] name = "unicase" version = "2.6.0" @@ -1817,17 +1083,6 @@ version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed" -[[package]] -name = "walkdir" -version = "2.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "777182bc735b6424e1a57516d35ed72cb8019d85c8c9bf536dccb3445c1a2f7d" -dependencies = [ - "same-file", - "winapi 0.3.9", - "winapi-util", -] - [[package]] name = "want" version = "0.3.0" @@ -1917,12 +1172,12 @@ name = "weatherstat" version = "0.1.0" dependencies = [ "dotenv", + "futures-util", "reqwest", - "rocket", - "rocket_contrib", "serde", "serde_json", "slack_api", + "tokio", ] [[package]] @@ -1963,15 +1218,6 @@ 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" @@ -1996,9 +1242,3 @@ dependencies = [ "winapi 0.2.8", "winapi-build", ] - -[[package]] -name = "yansi" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fc79f4a1e39857fc00c3f662cbf2651c771f00e9c15fe2abc341806bd46bd71" diff --git a/Cargo.toml b/Cargo.toml index b1a4c5e..97cc540 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,9 +6,9 @@ edition = "2018" [dependencies] dotenv = "0.15.0" +futures-util = "0.3.6" reqwest = { version = "0.10.8", features = ["json"] } -rocket = { git = "https://github.com/SergioBenitez/Rocket", default-features = false } -rocket_contrib = { git = "https://github.com/SergioBenitez/Rocket", default-features = false, features = ["handlebars_templates", "json"] } serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" slack_api = "0.23.1" +tokio = { version = "0.2", features = ["full"] } diff --git a/src/config.rs b/src/config.rs new file mode 100644 index 0000000..6426de5 --- /dev/null +++ b/src/config.rs @@ -0,0 +1,22 @@ +use serde::Deserialize; +use std::error::Error; +use std::fs; + +#[derive(Debug, Deserialize)] +pub struct ConfigUser { + pub name: String, + pub location: String, +} + +#[derive(Debug, Deserialize)] +pub struct Config { + pub config_users: Vec, +} + +const CONFIG_FILENAME: &str = "config.json"; + +pub fn get_config() -> Result> { + let data = fs::read_to_string(CONFIG_FILENAME)?; + + serde_json::from_str(&data).map_err(|e| e.into()) +} diff --git a/src/main.rs b/src/main.rs index 1c4f94d..e9affce 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,39 +1,49 @@ -#[macro_use] -extern crate rocket; - -use dotenv::dotenv; -use rocket_contrib::templates::Template; -use serde::Serialize; - +mod config; mod slack; mod weather; -#[derive(Serialize)] -struct Context {} +use config::ConfigUser; +use dotenv::dotenv; +use serde::Serialize; +use slack::SlackUser; +use tokio::prelude::*; -#[get("/weather/")] -async fn get_weather(loc: String) -> Result { - let sum = weather::get_summary(&loc).await?; - Ok(format!("The weather in {} is: {:?}", loc, sum)) -} - -#[get("/slack/")] -async fn set_status(msg: String) -> Result { - slack::set_status(&msg).await?; - Ok("woohoo".to_owned()) -} - -#[get("/")] -async fn index() -> Template { - let ctx = Context {}; - Template::render("index", &ctx) -} - -#[rocket::launch] -async fn rocket() -> rocket::Rocket { +#[tokio::main] +async fn main() { dotenv().ok(); - rocket::ignite() - .attach(Template::fairing()) - .mount("/", routes![index, get_weather, set_status]) + let config = config::get_config().unwrap(); + println!("Got config: {:?}", config); + + let slack_users = slack::list_users().await.unwrap(); + println!("Got {} users: {:?}", slack_users.len(), slack_users); + + for slack_user in slack_users { + let config_user = config + .config_users + .iter() + .find(|config_user| config_user.name == slack_user.name); + + if let Some(config_user) = config_user { + match set_user_status(&config_user, &slack_user).await { + Ok(_) => (), + Err(e) => println!( + "Error calling set_user_status for user {}: {}", + config_user.name, e + ), + } + } + } +} + +async fn set_user_status(config_user: &ConfigUser, slack_user: &SlackUser) -> Result<(), String> { + let sum = weather::get_summary(&config_user.location).await?; + + let status = format!("{} {}\u{00b0}C", sum.name, sum.temp_max); + let emoji = format!(":{}:", sum.emoji); + println!( + "Set status for user {} to: {} {:?}", + &slack_user.id, &emoji, &status + ); + Ok(slack::set_status(&slack_user.id, &status, &emoji, 0).await?) } diff --git a/src/slack.rs b/src/slack.rs index fe7854b..5306038 100644 --- a/src/slack.rs +++ b/src/slack.rs @@ -1,4 +1,4 @@ -use crate::rocket::futures::TryFutureExt; +use futures_util::future::TryFutureExt; use serde::Serialize; use serde_json::json; use slack_api; @@ -11,17 +11,41 @@ struct SlackProfile<'a> { status_expiration: i32, } -pub async fn set_status(msg: &str) -> Result<(), String> { +#[derive(Debug, Serialize)] +pub struct SlackUser { + pub id: String, + pub name: String, + pub tz_label: String, + pub tz_offset: i32, +} + +impl From for SlackUser { + fn from(user: slack_api::User) -> Self { + SlackUser { + id: user.id.unwrap_or_default(), + name: user.name.unwrap_or_default(), + tz_label: user.tz_label.unwrap_or_default(), + tz_offset: user.tz_offset.unwrap_or_default() as i32, + } + } +} + +pub async fn set_status( + user_id: &str, + status_text: &str, + status_emoji: &str, + status_expiration: i32, +) -> Result<(), String> { let client = slack_api::default_client().map_err(|e| e.to_string())?; let api_key = env::var("SLACK_OAUTH_ACCESS_TOKEN").expect("SLACK_OAUTH_ACCESS_TOKEN"); let profile = SlackProfile { - status_text: msg, - status_emoji: ":mountain:", - status_expiration: 0, + status_text, + status_emoji, + status_expiration, }; let encoded_profile = json!(profile).to_string(); let set_req = slack_api::users_profile::SetRequest { - user: None, + user: Some(&user_id), profile: Some(&encoded_profile), name: None, value: None, @@ -34,16 +58,24 @@ pub async fn set_status(msg: &str) -> Result<(), String> { Ok(()) } -pub async fn update_all() -> Result<(), String> { +pub async fn list_users() -> Result, String> { let client = slack_api::default_client().map_err(|e| e.to_string())?; let api_key = env::var("SLACK_OAUTH_ACCESS_TOKEN").expect("SLACK_OAUTH_ACCESS_TOKEN"); let list_req = slack_api::users::ListRequest::default(); + let resp = slack_api::users::list(&client, &api_key, &list_req) .map_err(|e| e.to_string()) .await?; - let members = resp.members.unwrap(); - println!("Got vec with {} members", members.len()); + let users = resp + .members + .unwrap_or_default() + .into_iter() + .map(|m| { + println!("Member: {:?}", m); + m.into() + }) + .collect::>(); - Ok(()) + Ok(users) } diff --git a/src/weather.rs b/src/weather.rs index 028f511..17ec6e1 100644 --- a/src/weather.rs +++ b/src/weather.rs @@ -1,4 +1,4 @@ -use crate::rocket::futures::TryFutureExt; +use futures_util::future::TryFutureExt; use serde::Deserialize; use std::env; @@ -11,6 +11,8 @@ struct APIResponseWeather { #[derive(Debug, Deserialize)] struct APIResponseMain { temp: f32, + temp_min: f32, + temp_max: f32, feels_like: f32, humidity: u32, pressure: u32, @@ -23,27 +25,77 @@ struct APIResponse { } #[derive(Debug)] -pub enum WeatherSummary { - Clear(i32), - Drizzle(i32), - Rain(i32), - Snow(i32), - Cloudy(i32), - Thunderstorm(i32), - Other(i32, String), +pub struct WeatherSummary { + pub name: String, + pub emoji: String, + pub temp: i32, + pub temp_min: i32, + pub temp_max: i32, } impl From for WeatherSummary { fn from(resp: APIResponse) -> Self { let temp = resp.main.temp as i32; + let temp_min = resp.main.temp_min as i32; + let temp_max = resp.main.temp_max as i32; + match resp.weather[0].main.as_ref() { - "Thunderstorm" => Self::Thunderstorm(temp), - "Drizzle" => Self::Drizzle(temp), - "Rain" => Self::Rain(temp), - "Snow" => Self::Snow(temp), - "Clear" => Self::Clear(temp), - "Clouds" => Self::Cloudy(temp), - _ => Self::Other(temp, resp.weather[0].description.clone()), + "Thunderstorm" => Self { + name: "Thunderstorm".to_string(), + emoji: "thunder_cloud_and_rain".to_string(), + temp, + temp_min, + temp_max, + }, + "Clouds" => Self { + name: "Cloudy".to_string(), + emoji: "cloud".to_string(), + temp, + temp_min, + temp_max, + }, + "Snow" => Self { + name: "Snow".to_string(), + emoji: "snow_cloud".to_string(), + temp, + temp_min, + temp_max, + }, + "Rain" => Self { + name: "Rain".to_string(), + emoji: "rain_cloud".to_string(), + temp, + temp_min, + temp_max, + }, + "Drizzle" => Self { + name: "Drizzle".to_string(), + emoji: "rain_cloud".to_string(), + temp, + temp_min, + temp_max, + }, + "Clear" => Self { + name: "Clear".to_string(), + emoji: "sunny".to_string(), + temp, + temp_min, + temp_max, + }, + "Atmosphere" => Self { + name: "Atmospheric".to_string(), + emoji: "foggy".to_string(), + temp, + temp_min, + temp_max, + }, + _ => Self { + name: "Unknown".to_string(), + emoji: "cloud".to_string(), + temp, + temp_min, + temp_max, + }, } } } @@ -55,9 +107,12 @@ pub async fn get_summary(loc: &str) -> Result { env::var("OPEN_WEATHERMAP_API_KEY").expect("could not load OPEN_WEATHERMAP_API_KEY") ); - let body = reqwest::get(&url) - .map_err(|e| e.to_string()) - .await? + let resp = reqwest::get(&url).map_err(|e| e.to_string()).await?; + if !resp.status().is_success() { + return Err(format!("Weather API response: {}", resp.status()).into()); + } + + let body = resp .json::() .map_err(|e| e.to_string()) .await?;