diff --git a/.gitignore b/.gitignore index fe70cd1..8aa45b7 100644 --- a/.gitignore +++ b/.gitignore @@ -60,6 +60,8 @@ buck-out/ # Rust /target/ +/cms/target/ +/cms/cms_macro/target/ # Environment *.env diff --git a/Cargo.lock b/Cargo.lock index 3ce2388..608b363 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,13 +2,76 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "aead" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fc95d1bdb8e6666b2b217308eeeb09f2d6728d104be3e31916cc74d15420331" +dependencies = [ + "generic-array 0.14.4", +] + +[[package]] +name = "aes" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "884391ef1066acaa41e766ba8f596341b96e93ce34f9a43e7d24bf0a0eaf0561" +dependencies = [ + "aes-soft", + "aesni", + "cipher", +] + +[[package]] +name = "aes-gcm" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5278b5fabbb9bd46e24aa69b2fdea62c99088e0a950a9be40e3e0101298f88da" +dependencies = [ + "aead", + "aes", + "cipher", + "ctr", + "ghash", + "subtle", +] + +[[package]] +name = "aes-soft" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be14c7498ea50828a38d0e24a765ed2effe92a705885b57d029cd67d45744072" +dependencies = [ + "cipher", + "opaque-debug 0.3.0", +] + +[[package]] +name = "aesni" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea2e11f5e94c2f7d386164cc2aa1f97823fed6f259e486940a71c174dd01b0ce" +dependencies = [ + "cipher", + "opaque-debug 0.3.0", +] + +[[package]] +name = "aho-corasick" +version = "0.7.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f" +dependencies = [ + "memchr", +] + [[package]] name = "ansi_term" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" dependencies = [ - "winapi", + "winapi 0.3.9", ] [[package]] @@ -17,48 +80,7 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" dependencies = [ - "winapi", -] - -[[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", -] - -[[package]] -name = "async-trait" -version = "0.1.51" -source = "registry+https://github.com/rust-lang/crates.io-index" -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", + "winapi 0.3.9", ] [[package]] @@ -69,7 +91,7 @@ checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ "hermit-abi", "libc", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -79,10 +101,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" [[package]] -name = "base-x" -version = "0.2.8" +name = "base64" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4521f3e3d031370679b3b140beb36dfe4801b09ac77e30c61941f97df3ef28b" +checksum = "489d6c0ed21b11d038c31b6ceccca973e65d73ba3bd8ecb9a2babf5546164643" +dependencies = [ + "byteorder", + "safemem", +] [[package]] name = "base64" @@ -101,25 +127,40 @@ dependencies = [ "num-traits", ] -[[package]] -name = "binascii" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "383d29d513d8764dcdc42ea295d979eb99c3c9f00607b3692cf68a431f7dca72" - [[package]] name = "bitflags" version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "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 0.12.4", +] + [[package]] name = "block-buffer" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" dependencies = [ - "generic-array", + "generic-array 0.14.4", +] + +[[package]] +name = "block-padding" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5" +dependencies = [ + "byte-tools", ] [[package]] @@ -128,6 +169,12 @@ version = "3.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c59e7af012c713f529e7a3ee57ce9b31ddd858d4b512923602f74608b009631" +[[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.4.3" @@ -168,8 +215,17 @@ dependencies = [ "num-integer", "num-traits", "serde", - "time 0.1.44", - "winapi", + "time", + "winapi 0.3.9", +] + +[[package]] +name = "cipher" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12f8e7987cbd042a63249497f41aed09f8e65add917ea6566effbc56578d6801" +dependencies = [ + "generic-array 0.14.4", ] [[package]] @@ -192,31 +248,65 @@ name = "cms" version = "0.1.0" dependencies = [ "ansi_term 0.12.1", + "base64 0.13.0", "chrono", "clap", + "cms_macro", "diesel", + "diesel_migrations", "dotenv", "oauth2", + "quote 1.0.9", + "rand", + "reqwest", "rocket", + "rocket_contrib", + "serde", + "serde_json", + "url 2.2.2", ] [[package]] -name = "const_fn" -version = "0.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f92cfa0fd5690b3cf8c1ef2cabbd9b7ef22fa53cf5e1f92b05103f6d5d1cf6e7" +name = "cms_macro" +version = "0.1.0" +dependencies = [ + "diesel", + "proc-macro2 1.0.28", + "quote 1.0.9", +] [[package]] name = "cookie" -version = "0.15.1" +version = "0.11.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5f1c7727e460397e56abc4bddc1d49e07a1ad78fc98eb2e1c8f032a58a2f80d" +checksum = "80f6044740a4a516b8aac14c140cdf35c1a640b1bd6b98b6224e49143b2f1566" dependencies = [ - "percent-encoding", - "time 0.2.27", - "version_check", + "aes-gcm", + "base64 0.13.0", + "hkdf", + "hmac", + "percent-encoding 2.1.0", + "rand", + "sha2", + "time", ] +[[package]] +name = "core-foundation" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a89e2ae426ea83155dccf10c0fa6b1463ef6d5fcb44cee0b224a408fa640a62" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea221b5284a47e40033bf9b66f35f984ec0ea2931eb03505246cd27a963f981b" + [[package]] name = "cpufeatures" version = "0.1.5" @@ -227,10 +317,35 @@ dependencies = [ ] [[package]] -name = "devise" -version = "0.3.1" +name = "cpuid-bool" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50c7580b072f1c8476148f16e0a0d5dedddab787da98d86c5082c5e9ed8ab595" +checksum = "dcb25d077389e53838a8158c8e99174c5a9d902dee4904320db714f3c653ffba" + +[[package]] +name = "crypto-mac" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bff07008ec701e8028e2ceb8f83f0e4274ee62bd2dbdc4fefff2e9a91824081a" +dependencies = [ + "generic-array 0.14.4", + "subtle", +] + +[[package]] +name = "ctr" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb4a30d54f7443bf3d6191dcd486aca19e67cb3c49fa7a06a319966346707e7f" +dependencies = [ + "cipher", +] + +[[package]] +name = "devise" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74e04ba2d03c5fa0d954c061fc8c9c288badadffc272ebb87679a89846de3ed3" dependencies = [ "devise_codegen", "devise_core", @@ -238,25 +353,24 @@ dependencies = [ [[package]] name = "devise_codegen" -version = "0.3.1" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "123c73e7a6e51b05c75fe1a1b2f4e241399ea5740ed810b0e3e6cacd9db5e7b2" +checksum = "066ceb7928ca93a9bedc6d0e612a8a0424048b0ab1f75971b203d01420c055d7" dependencies = [ "devise_core", - "quote", + "quote 0.6.13", ] [[package]] name = "devise_core" -version = "0.3.1" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "841ef46f4787d9097405cac4e70fb8644fc037b526e8c14054247c0263c400d0" +checksum = "cf41c59b22b5e3ec0ea55c7847e5f358d340f3a8d6d53a5cf4f1564967f96487" dependencies = [ "bitflags", - "proc-macro2", - "proc-macro2-diagnostics", - "quote", - "syn", + "proc-macro2 0.4.30", + "quote 0.6.13", + "syn 0.15.44", ] [[package]] @@ -278,7 +392,7 @@ dependencies = [ "pq-sys", "r2d2", "serde_json", - "time 0.1.44", + "time", "uuid", ] @@ -288,9 +402,28 @@ version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "45f5098f628d02a7a0f68ddba586fb61e80edec3bdc1be3b921f4ceec60858d3" dependencies = [ - "proc-macro2", - "quote", - "syn", + "proc-macro2 1.0.28", + "quote 1.0.9", + "syn 1.0.74", +] + +[[package]] +name = "diesel_migrations" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf3cde8413353dc7f5d72fa8ce0b99a560a359d2c5ef1e5817ca731cd9008f4c" +dependencies = [ + "migrations_internals", + "migrations_macros", +] + +[[package]] +name = "digest" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" +dependencies = [ + "generic-array 0.12.4", ] [[package]] @@ -299,27 +432,15 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" dependencies = [ - "generic-array", + "generic-array 0.14.4", ] -[[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" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77c90badedccf4105eca100756a0b1289e191f6fcbdadd3cee1d2f614f97da8f" -[[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.28" @@ -330,17 +451,21 @@ dependencies = [ ] [[package]] -name = "figment" -version = "0.10.6" +name = "fake-simd" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "790b4292c72618abbab50f787a477014fe15634f96291de45672ce46afe122df" +checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" + +[[package]] +name = "filetime" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "975ccf83d8d9d0d84682850a38c8169027be83368805971cc4f238c2b245bc98" dependencies = [ - "atomic", - "pear", - "serde", - "toml", - "uncased", - "version_check", + "cfg-if 1.0.0", + "libc", + "redox_syscall", + "winapi 0.3.9", ] [[package]] @@ -349,6 +474,21 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + [[package]] name = "form_urlencoded" version = "1.0.1" @@ -356,24 +496,44 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191" dependencies = [ "matches", - "percent-encoding", + "percent-encoding 2.1.0", ] [[package]] -name = "futures" -version = "0.3.16" +name = "fsevent" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1adc00f486adfc9ce99f77d717836f0c5aa84965eb0b4f051f4e83f7cab53f8b" +checksum = "5ab7d1bd1bd33cc98b0889831b72da23c0aa4df9cec7e0702f46ecea04b35db6" dependencies = [ - "futures-channel", - "futures-core", - "futures-executor", - "futures-io", - "futures-sink", - "futures-task", - "futures-util", + "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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" +dependencies = [ + "bitflags", + "fuchsia-zircon-sys", +] + +[[package]] +name = "fuchsia-zircon-sys" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" + [[package]] name = "futures-channel" version = "0.3.16" @@ -381,7 +541,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "74ed2411805f6e4e3d9bc904c95d5d423b89b3b25dc0250aa74729de20629ff9" dependencies = [ "futures-core", - "futures-sink", ] [[package]] @@ -390,17 +549,6 @@ version = "0.3.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af51b1b4a7fdff033703db39de8802c673eb91855f2e0d47dcf3bf2c0ef01f99" -[[package]] -name = "futures-executor" -version = "0.3.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d0d535a57b87e1ae31437b892713aee90cd2d7b0ee48727cd11fc72ef54761c" -dependencies = [ - "futures-core", - "futures-task", - "futures-util", -] - [[package]] name = "futures-io" version = "0.3.16" @@ -415,9 +563,9 @@ checksum = "c54913bae956fb8df7f4dc6fc90362aa72e69148e3f39041fbe8742d21e0ac57" dependencies = [ "autocfg", "proc-macro-hack", - "proc-macro2", - "quote", - "syn", + "proc-macro2 1.0.28", + "quote 1.0.9", + "syn 1.0.74", ] [[package]] @@ -439,11 +587,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67eb846bfd58e44a8481a00049e82c43e0ccb5d61f8dc071057cb19249dd4d78" dependencies = [ "autocfg", - "futures-channel", "futures-core", "futures-io", "futures-macro", - "futures-sink", "futures-task", "memchr", "pin-project-lite", @@ -454,16 +600,12 @@ dependencies = [ ] [[package]] -name = "generator" -version = "0.7.0" +name = "generic-array" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1d9279ca822891c1a4dae06d185612cf8fc6acfe5dff37781b41297811b12ee" +checksum = "ffdf9f34f1447443d37393cc6c2b8313aebddcd96906caf34e54c68d8e57d7bd" dependencies = [ - "cc", - "libc", - "log", - "rustversion", - "winapi", + "typenum", ] [[package]] @@ -473,7 +615,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "501466ecc8a30d1d3b7fc9229b122b2ce8ed6e9d9223f1138d4babb253e51817" dependencies = [ "typenum", - "version_check", + "version_check 0.9.3", ] [[package]] @@ -489,6 +631,16 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "ghash" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97304e4cd182c3846f7575ced3890c53012ce534ad9114046b0a9e00bb30a375" +dependencies = [ + "opaque-debug 0.3.0", + "polyval", +] + [[package]] name = "glob" version = "0.3.0" @@ -497,9 +649,9 @@ 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", @@ -514,6 +666,23 @@ dependencies = [ "tracing", ] +[[package]] +name = "handlebars" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d82e5750d8027a97b9640e3fefa66bbaf852a35228e1c90790efd13c4b09c166" +dependencies = [ + "lazy_static", + "log 0.4.14", + "pest", + "pest_derive", + "quick-error", + "regex", + "serde", + "serde_json", + "walkdir", +] + [[package]] name = "hashbrown" version = "0.11.2" @@ -529,6 +698,26 @@ dependencies = [ "libc", ] +[[package]] +name = "hkdf" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51ab2f639c231793c5f6114bdb9bbe50a7dbbfcd7c7c6bd8475dec2d991e964f" +dependencies = [ + "digest 0.9.0", + "hmac", +] + +[[package]] +name = "hmac" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1441c6b1e930e2817404b5046f1f989899143a12bf92de603b69f4e0aee1e15" +dependencies = [ + "crypto-mac", + "digest 0.9.0", +] + [[package]] name = "http" version = "0.2.4" @@ -563,6 +752,25 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6456b8a6c8f33fee7d958fcd1b60d55b11940a79e63ae87013e6d22e26034440" +[[package]] +name = "hyper" +version = "0.10.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a0652d9a2609a968c14be1a9ea00bf4b1d64e2e1f53a1b51b6fff3a6e829273" +dependencies = [ + "base64 0.9.3", + "httparse", + "language-tags", + "log 0.3.9", + "mime 0.2.6", + "num_cpus", + "time", + "traitobject", + "typeable", + "unicase", + "url 1.7.2", +] + [[package]] name = "hyper" version = "0.14.11" @@ -587,6 +795,45 @@ dependencies = [ "want", ] +[[package]] +name = "hyper-rustls" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f9f7a97316d44c0af9b0301e65010573a853a9fc97046d7331d7f6bc0fd5a64" +dependencies = [ + "futures-util", + "hyper 0.14.11", + "log 0.4.14", + "rustls", + "tokio", + "tokio-rustls", + "webpki", +] + +[[package]] +name = "hyper-tls" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" +dependencies = [ + "bytes", + "hyper 0.14.11", + "native-tls", + "tokio", + "tokio-native-tls", +] + +[[package]] +name = "idna" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e" +dependencies = [ + "matches", + "unicode-bidi", + "unicode-normalization", +] + [[package]] name = "idna" version = "0.2.3" @@ -606,14 +853,27 @@ checksum = "bc633605454125dec4b66843673f01c7df2b89479b32e0ed634e43a91cff62a5" dependencies = [ "autocfg", "hashbrown", - "serde", ] [[package]] -name = "inlinable_string" -version = "0.1.14" +name = "inotify" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3094308123a0e9fd59659ce45e22de9f53fc1d2ac6e1feb9fef988e4f76cad77" +checksum = "4816c66d2c8ae673df83366c18341538f234a26d65a9ecea5c348b453ac1d02f" +dependencies = [ + "bitflags", + "inotify-sys", + "libc", +] + +[[package]] +name = "inotify-sys" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e05c02b5e89bff3b946cedeca278abc628fe811e604f027c45a8aa3cf793d0eb" +dependencies = [ + "libc", +] [[package]] name = "instant" @@ -624,6 +884,21 @@ dependencies = [ "cfg-if 1.0.0", ] +[[package]] +name = "iovec" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e" +dependencies = [ + "libc", +] + +[[package]] +name = "ipnet" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68f2d64f2edebec4ce84ad108148e67e1064789bee435edc5b60ad398714a3a9" + [[package]] name = "ipnetwork" version = "0.18.0" @@ -648,12 +923,34 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "kernel32-sys" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" +dependencies = [ + "winapi 0.2.8", + "winapi-build", +] + +[[package]] +name = "language-tags" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a" + [[package]] name = "lazy_static" 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.99" @@ -669,6 +966,15 @@ dependencies = [ "scopeguard", ] +[[package]] +name = "log" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b" +dependencies = [ + "log 0.4.14", +] + [[package]] name = "log" version = "0.4.14" @@ -679,17 +985,10 @@ dependencies = [ ] [[package]] -name = "loom" -version = "0.5.1" +name = "maplit" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2111607c723d7857e0d8299d5ce7a0bf4b844d3e44f8de136b13da513eaf8fc4" -dependencies = [ - "cfg-if 1.0.0", - "generator", - "scoped-tls", - "serde", - "serde_json", -] +checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d" [[package]] name = "matches" @@ -703,12 +1002,61 @@ version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" +[[package]] +name = "migrations_internals" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b4fc84e4af020b837029e017966f86a1c2d5e83e64b589963d5047525995860" +dependencies = [ + "diesel", +] + +[[package]] +name = "migrations_macros" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9753f12909fd8d923f75ae5c3258cae1ed3c8ec052e1b38c93c21a6d157f789c" +dependencies = [ + "migrations_internals", + "proc-macro2 1.0.28", + "quote 1.0.9", + "syn 1.0.74", +] + +[[package]] +name = "mime" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba626b8a6de5da682e1caa06bdb42a335aee5a84db8e5046a3e8ab17ba0a3ae0" +dependencies = [ + "log 0.3.9", +] + [[package]] name = "mime" version = "0.3.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" +[[package]] +name = "mio" +version = "0.6.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4afd66f5b91bf2a3bc13fad0e21caedac168ca4c707504e75585648ae80e4cc4" +dependencies = [ + "cfg-if 0.1.10", + "fuchsia-zircon", + "fuchsia-zircon-sys", + "iovec", + "kernel32-sys", + "libc", + "log 0.4.14", + "miow 0.2.2", + "net2", + "slab", + "winapi 0.2.8", +] + [[package]] name = "mio" version = "0.7.13" @@ -716,10 +1064,34 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8c2bdb6314ec10835cd3293dd268473a835c02b7b352e788be788b3c6ca6bb16" dependencies = [ "libc", - "log", - "miow", + "log 0.4.14", + "miow 0.3.7", "ntapi", - "winapi", + "winapi 0.3.9", +] + +[[package]] +name = "mio-extras" +version = "2.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52403fe290012ce777c4626790c8951324a2b9e3316b3143779c72b029742f19" +dependencies = [ + "lazycell", + "log 0.4.14", + "mio 0.6.23", + "slab", +] + +[[package]] +name = "miow" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebd808424166322d4a38da87083bfddd3ac4c131334ed55856112eb06d46944d" +dependencies = [ + "kernel32-sys", + "net2", + "winapi 0.2.8", + "ws2_32-sys", ] [[package]] @@ -728,27 +1100,54 @@ version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21" dependencies = [ - "winapi", + "winapi 0.3.9", ] [[package]] -name = "multer" -version = "2.0.1" +name = "native-tls" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "408327e2999b839cd1af003fc01b2019a6c10a1361769542203f6fedc5179680" +checksum = "48ba9f7719b5a0f42f338907614285fb5fd70e53858141f69898a1fb7203b24d" dependencies = [ - "bytes", - "encoding_rs", - "futures-util", - "http", - "httparse", - "log", - "mime", - "spin", - "tokio", - "tokio-util", - "twoway", - "version_check", + "lazy_static", + "libc", + "log 0.4.14", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] + +[[package]] +name = "net2" +version = "0.2.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "391630d12b68002ae1e25e8f974306474966550ad82dac6886fb8910c19568ae" +dependencies = [ + "cfg-if 0.1.10", + "libc", + "winapi 0.3.9", +] + +[[package]] +name = "notify" +version = "4.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae03c8c853dba7bfd23e571ff0cff7bc9dceb40a4cd684cd1681824183f45257" +dependencies = [ + "bitflags", + "filetime", + "fsevent", + "fsevent-sys", + "inotify", + "libc", + "mio 0.6.23", + "mio-extras", + "walkdir", + "winapi 0.3.9", ] [[package]] @@ -757,7 +1156,7 @@ version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f6bb902e437b6d86e03cce10a7e2af662292c5dfef23b65899ea3ac9354ad44" dependencies = [ - "winapi", + "winapi 0.3.9", ] [[package]] @@ -806,17 +1205,18 @@ version = "4.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "80e47cfc4c0a1a519d9a025ebfbac3a2439d1b5cdf397d72dcb79b11d9920dab" dependencies = [ - "base64", + "base64 0.13.0", "chrono", "getrandom", "http", "rand", + "reqwest", "serde", "serde_json", "serde_path_to_error", "sha2", "thiserror", - "url", + "url 2.2.2", ] [[package]] @@ -825,12 +1225,51 @@ version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56" +[[package]] +name = "opaque-debug" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" + [[package]] name = "opaque-debug" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" +[[package]] +name = "openssl" +version = "0.10.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d9facdb76fec0b73c406f125d44d86fdad818d66fef0531eec9233ca425ff4a" +dependencies = [ + "bitflags", + "cfg-if 1.0.0", + "foreign-types", + "libc", + "once_cell", + "openssl-sys", +] + +[[package]] +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 = "1996d2d305e561b70d1ee0c53f1542833f4e1ac6ce9a6708b6ff2738ca67dc82" +dependencies = [ + "autocfg", + "cc", + "libc", + "pkg-config", + "vcpkg", +] + [[package]] name = "parking_lot" version = "0.11.1" @@ -853,38 +1292,86 @@ dependencies = [ "libc", "redox_syscall", "smallvec", - "winapi", + "winapi 0.3.9", ] [[package]] name = "pear" -version = "0.2.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15e44241c5e4c868e3eaa78b7c1848cadd6344ed4f54d029832d32b415a58702" +checksum = "5320f212db967792b67cfe12bd469d08afd6318a249bd917d5c19bc92200ab8a" dependencies = [ - "inlinable_string", "pear_codegen", - "yansi", ] [[package]] name = "pear_codegen" -version = "0.2.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82a5ca643c2303ecb740d506539deba189e16f2754040a42901cd8105d0282d0" +checksum = "bfc1c836fdc3d1ef87c348b237b5b5c4dff922156fb2d968f57734f9669768ca" dependencies = [ - "proc-macro2", - "proc-macro2-diagnostics", - "quote", - "syn", + "proc-macro2 0.4.30", + "quote 0.6.13", + "syn 0.15.44", + "version_check 0.9.3", + "yansi", ] +[[package]] +name = "percent-encoding" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" + [[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 1.0.28", + "quote 1.0.9", + "syn 1.0.74", +] + +[[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-lite" version = "0.2.7" @@ -897,6 +1384,23 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "pkg-config" +version = "0.3.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" + +[[package]] +name = "polyval" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eebcc4aa140b9abd2bc40d9c3f7ccec842679cd79045ac3a7ac698c1a064b7cd" +dependencies = [ + "cpuid-bool", + "opaque-debug 0.3.0", + "universal-hash", +] + [[package]] name = "ppv-lite86" version = "0.2.10" @@ -924,26 +1428,37 @@ version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bc881b2c22681370c6a780e47af9840ef841837bc98118431d4e1868bd0c1086" +[[package]] +name = "proc-macro2" +version = "0.4.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" +dependencies = [ + "unicode-xid 0.1.0", +] + [[package]] name = "proc-macro2" version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c7ed8b8c7b886ea3ed7dde405212185f423ab44682667c8c6dd14aa1d9f6612" dependencies = [ - "unicode-xid", + "unicode-xid 0.2.2", ] [[package]] -name = "proc-macro2-diagnostics" -version = "0.9.1" +name = "quick-error" +version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bf29726d67464d49fa6224a1d07936a8c08bb3fba727c7493f6cf1616fdaada" +checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" + +[[package]] +name = "quote" +version = "0.6.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1" dependencies = [ - "proc-macro2", - "quote", - "syn", - "version_check", - "yansi", + "proc-macro2 0.4.30", ] [[package]] @@ -952,7 +1467,7 @@ version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" dependencies = [ - "proc-macro2", + "proc-macro2 1.0.28", ] [[package]] @@ -961,7 +1476,7 @@ version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "545c5bc2b880973c9c10e4067418407a0ccaa3091781d1671d46eb35107cb26f" dependencies = [ - "log", + "log 0.4.14", "parking_lot", "scheduled-thread-pool", ] @@ -1016,24 +1531,21 @@ dependencies = [ ] [[package]] -name = "ref-cast" -version = "1.0.6" +name = "regex" +version = "1.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "300f2a835d808734ee295d45007adacb9ebb29dd3ae2424acfa17930cae541da" +checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461" dependencies = [ - "ref-cast-impl", + "aho-corasick", + "memchr", + "regex-syntax", ] [[package]] -name = "ref-cast-impl" -version = "1.0.6" +name = "regex-syntax" +version = "0.6.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c38e3aecd2b21cb3959637b883bb3714bc7e43f0268b9a29d3743ee3e55cdd2" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] +checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" [[package]] name = "remove_dir_all" @@ -1041,112 +1553,190 @@ version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" dependencies = [ - "winapi", + "winapi 0.3.9", +] + +[[package]] +name = "reqwest" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "246e9f61b9bb77df069a947682be06e31ac43ea37862e244a69f177694ea6d22" +dependencies = [ + "base64 0.13.0", + "bytes", + "encoding_rs", + "futures-core", + "futures-util", + "http", + "http-body", + "hyper 0.14.11", + "hyper-rustls", + "hyper-tls", + "ipnet", + "js-sys", + "lazy_static", + "log 0.4.14", + "mime 0.3.16", + "native-tls", + "percent-encoding 2.1.0", + "pin-project-lite", + "rustls", + "serde", + "serde_json", + "serde_urlencoded", + "tokio", + "tokio-native-tls", + "tokio-rustls", + "url 2.2.2", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "webpki-roots", + "winreg", +] + +[[package]] +name = "ring" +version = "0.16.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" +dependencies = [ + "cc", + "libc", + "once_cell", + "spin", + "untrusted", + "web-sys", + "winapi 0.3.9", ] [[package]] name = "rocket" -version = "0.5.0-rc.1" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a71c18c42a0eb15bf3816831caf0dad11e7966f2a41aaf486a701979c4dd1f2" +checksum = "4a7ab1dfdc75bb8bd2be381f37796b1b300c45a3c9145b34d86715e8dd90bf28" dependencies = [ - "async-stream", - "async-trait", - "atomic", "atty", - "binascii", - "bytes", - "either", - "figment", - "futures", - "indexmap", - "log", + "base64 0.13.0", + "log 0.4.14", "memchr", - "multer", "num_cpus", - "parking_lot", - "pin-project-lite", - "rand", - "ref-cast", + "pear", "rocket_codegen", "rocket_http", - "serde", "state", - "tempfile", - "time 0.2.27", - "tokio", - "tokio-stream", - "tokio-util", - "ubyte", - "version_check", + "time", + "toml", + "version_check 0.9.3", "yansi", ] [[package]] name = "rocket_codegen" -version = "0.5.0-rc.1" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66f5fa462f7eb958bba8710c17c5d774bbbd59809fa76fb1957af7e545aea8bb" +checksum = "1729e687d6d2cf434d174da84fb948f7fef4fac22d20ce94ca61c28b72dbcf9f" dependencies = [ "devise", "glob", "indexmap", - "proc-macro2", - "quote", + "quote 0.6.13", "rocket_http", - "syn", - "unicode-xid", + "version_check 0.9.3", + "yansi", +] + +[[package]] +name = "rocket_contrib" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b6303dccab46dce6c7ac26c9b9d8d8cde1b19614b027c3f913be6611bff6d9b" +dependencies = [ + "diesel", + "glob", + "handlebars", + "log 0.4.14", + "notify", + "r2d2", + "rocket", + "rocket_contrib_codegen", + "serde", + "serde_json", +] + +[[package]] +name = "rocket_contrib_codegen" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0f2cbcb6c09b3ac0acdf77682ff8c9d1f317361498a773ee50b32be7fddfe2b" +dependencies = [ + "devise", + "quote 0.6.13", + "version_check 0.9.3", + "yansi", ] [[package]] name = "rocket_http" -version = "0.5.0-rc.1" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23c8b7d512d2fcac2316ebe590cde67573844b99e6cc9ee0f53375fa16e25ebd" +checksum = "6131e6e6d38a9817f4a494ff5da95971451c2eb56a53915579fc9c80f6ef0117" dependencies = [ "cookie", - "either", - "http", - "hyper", + "hyper 0.10.16", "indexmap", - "log", - "memchr", - "mime", - "parking_lot", "pear", - "percent-encoding", - "pin-project-lite", - "ref-cast", - "serde", + "percent-encoding 1.0.1", "smallvec", - "stable-pattern", "state", - "time 0.2.27", - "tokio", - "uncased", + "time", + "unicode-xid 0.1.0", ] [[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 0.13.0", + "log 0.4.14", + "ring", + "sct", + "webpki", ] -[[package]] -name = "rustversion" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61b3909d758bb75c79f23d4736fac9433868679d3ad2ea7a61e3c25cfda9a088" - [[package]] name = "ryu" version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" +[[package]] +name = "safemem" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef703b7cb59335eae2eb93ceb664c0eb7ea6bf567079d843e09420219668e072" + +[[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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f05ba609c234e60bee0d547fe94a4c7e9da733d1c962cf6e59efa4cd9c8bc75" +dependencies = [ + "lazy_static", + "winapi 0.3.9", +] + [[package]] name = "scheduled-thread-pool" version = "0.2.5" @@ -1156,12 +1746,6 @@ dependencies = [ "parking_lot", ] -[[package]] -name = "scoped-tls" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea6a9290e3c9cf0f18145ef7ffa62d68ee0bf5fcd651017e586dc7fd5da448c2" - [[package]] name = "scopeguard" version = "1.1.0" @@ -1169,19 +1753,37 @@ 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.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" +checksum = "23a2ac85147a3a11d77ecf1bc7166ec0b92febfa4461c37944e180f319ece467" +dependencies = [ + "bitflags", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e4effb91b4b8b6fb7732e670b6cee160278ff8e6bf485c7805d9e319d76e284" +dependencies = [ + "core-foundation-sys", + "libc", +] [[package]] name = "serde" @@ -1198,9 +1800,9 @@ version = "1.0.127" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a024926d3432516606328597e0f224a51355a493b49fdd67e9209187cbe55ecc" dependencies = [ - "proc-macro2", - "quote", - "syn", + "proc-macro2 1.0.28", + "quote 1.0.9", + "syn 1.0.74", ] [[package]] @@ -1224,10 +1826,28 @@ dependencies = [ ] [[package]] -name = "sha1" -version = "0.6.0" +name = "serde_urlencoded" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" +checksum = "edfa57a7f8d9c1d260a549e7224100f6c43d43f9103e06dd8b4095a9b2b43ce9" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "sha-1" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7d94d0bede923b3cea61f3f1ff57ff8cdfd77b400fb8f9998949e0cf04163df" +dependencies = [ + "block-buffer 0.7.3", + "digest 0.8.1", + "fake-simd", + "opaque-debug 0.2.3", +] [[package]] name = "sha2" @@ -1235,20 +1855,11 @@ version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b362ae5752fd2137731f9fa25fd4d9058af34666ca1966fb969119cc35719f12" dependencies = [ - "block-buffer", + "block-buffer 0.9.0", "cfg-if 1.0.0", "cpufeatures", - "digest", - "opaque-debug", -] - -[[package]] -name = "signal-hook-registry" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51e73328dc4ac0c7ccbda3a494dfa03df1de2f46018127f60c693f2648455b0" -dependencies = [ - "libc", + "digest 0.9.0", + "opaque-debug 0.3.0", ] [[package]] @@ -1270,90 +1881,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "765f090f0e423d2b55843402a07915add955e7d60657db13707a159727326cad" dependencies = [ "libc", - "winapi", + "winapi 0.3.9", ] [[package]] name = "spin" -version = "0.9.2" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "511254be0c5bcf062b019a6c89c01a664aa359ded62f78aa72c6fc137c0590e5" - -[[package]] -name = "stable-pattern" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4564168c00635f88eaed410d5efa8131afa8d8699a612c80c455a0ba05c21045" -dependencies = [ - "memchr", -] - -[[package]] -name = "standback" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e113fb6f3de07a243d434a56ec6f186dfd51cb08448239fe7bcae73f87ff28ff" -dependencies = [ - "version_check", -] +checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" [[package]] name = "state" -version = "0.5.2" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cf4f5369e6d3044b5e365c9690f451516ac8f0954084622b49ea3fde2f6de5" -dependencies = [ - "loom", -] - -[[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" +checksum = "3015a7d0a5fd5105c91c3710d42f9ccf0abfb287d62206484dcc67f9569a6483" [[package]] name = "strsim" @@ -1361,15 +1902,32 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" +[[package]] +name = "subtle" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" + +[[package]] +name = "syn" +version = "0.15.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5" +dependencies = [ + "proc-macro2 0.4.30", + "quote 0.6.13", + "unicode-xid 0.1.0", +] + [[package]] name = "syn" version = "1.0.74" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1873d832550d4588c3dbc20f01361ab00bfe741048f71e3fecf145a7cc18b29c" dependencies = [ - "proc-macro2", - "quote", - "unicode-xid", + "proc-macro2 1.0.28", + "quote 1.0.9", + "unicode-xid 0.2.2", ] [[package]] @@ -1383,7 +1941,7 @@ dependencies = [ "rand", "redox_syscall", "remove_dir_all", - "winapi", + "winapi 0.3.9", ] [[package]] @@ -1410,9 +1968,9 @@ version = "1.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "060d69a0afe7796bf42e9e2ff91f5ee691fb15c53d38b4b62a9a53eb23164745" dependencies = [ - "proc-macro2", - "quote", - "syn", + "proc-macro2 1.0.28", + "quote 1.0.9", + "syn 1.0.74", ] [[package]] @@ -1423,45 +1981,7 @@ checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" dependencies = [ "libc", "wasi", - "winapi", -] - -[[package]] -name = "time" -version = "0.2.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4752a97f8eebd6854ff91f1c1824cd6160626ac4bd44287f7f4ea2035a02a242" -dependencies = [ - "const_fn", - "libc", - "standback", - "stdweb", - "time-macros", - "version_check", - "winapi", -] - -[[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.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd3c141a1b43194f3f56a1411225df8646c55781d5f26db825b3d98507eb482f" -dependencies = [ - "proc-macro-hack", - "proc-macro2", - "quote", - "standback", - "syn", + "winapi 0.3.9", ] [[package]] @@ -1489,37 +2009,33 @@ dependencies = [ "bytes", "libc", "memchr", - "mio", + "mio 0.7.13", "num_cpus", - "once_cell", "pin-project-lite", - "signal-hook-registry", - "tokio-macros", - "winapi", + "winapi 0.3.9", ] [[package]] -name = "tokio-macros" -version = "1.3.0" +name = "tokio-native-tls" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54473be61f4ebe4efd09cec9bd5d16fa51d70ea0192213d754d2d500457db110" +checksum = "f7d995660bd2b7f8c1568414c1126076c13fbb725c40112dc0120b78eb9b717b" dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "tokio-stream" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b2f3f698253f03119ac0102beaa64f67a67e08074d03a22d18784104543727f" -dependencies = [ - "futures-core", - "pin-project-lite", + "native-tls", "tokio", ] +[[package]] +name = "tokio-rustls" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc6844de72e57df1980054b38be3a9f4702aba4858be64dd700181a8a6d0e1b6" +dependencies = [ + "rustls", + "tokio", + "webpki", +] + [[package]] name = "tokio-util" version = "0.6.7" @@ -1529,16 +2045,16 @@ dependencies = [ "bytes", "futures-core", "futures-sink", - "log", + "log 0.4.14", "pin-project-lite", "tokio", ] [[package]] name = "toml" -version = "0.5.8" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a31142970826733df8241ef35dc040ef98c679ab14d7c3e54d827099b3acecaa" +checksum = "758664fc71a3a69038656bee8b6be6477d2a6c315a6b81f7081f591bffa4111f" dependencies = [ "serde", ] @@ -1569,6 +2085,12 @@ dependencies = [ "lazy_static", ] +[[package]] +name = "traitobject" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "efd1f82c56340fdf16f2a953d7bda4f8fdffba13d93b00844c25572110b26079" + [[package]] name = "try-lock" version = "0.2.3" @@ -1576,14 +2098,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" [[package]] -name = "twoway" -version = "0.2.2" +name = "typeable" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c57ffb460d7c24cd6eda43694110189030a3d1dfe418416d9468fd1c1d290b47" -dependencies = [ - "memchr", - "unchecked-index", -] +checksum = "1410f6f91f21d1612654e7cc69193b0334f909dcf2c790c4826254fbb86f8887" [[package]] name = "typenum" @@ -1592,30 +2110,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "879f6906492a7cd215bfa4cf595b600146ccfac0c79bcbd1f3000162af5e8b06" [[package]] -name = "ubyte" -version = "0.10.1" +name = "ucd-trie" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42756bb9e708855de2f8a98195643dff31a97f0485d90d8467b39dc24be9e8fe" -dependencies = [ - "serde", -] +checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c" [[package]] -name = "uncased" -version = "0.9.6" +name = "unicase" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5baeed7327e25054889b9bd4f975f32e5f4c5d434042d59ab6cd4142c0a76ed0" +checksum = "7f4765f83163b74f957c797ad9253caf97f103fb064d3999aea9568d09fc8a33" dependencies = [ - "serde", - "version_check", + "version_check 0.1.5", ] -[[package]] -name = "unchecked-index" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eeba86d422ce181a719445e51872fa30f1f7413b62becb52e95ec91aa262d85c" - [[package]] name = "unicode-bidi" version = "0.3.6" @@ -1637,12 +2145,45 @@ version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" +[[package]] +name = "unicode-xid" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" + [[package]] name = "unicode-xid" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" +[[package]] +name = "universal-hash" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f214e8f697e925001e66ec2c6e37a4ef93f0f78c2eed7814394e10c62025b05" +dependencies = [ + "generic-array 0.14.4", + "subtle", +] + +[[package]] +name = "untrusted" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" + +[[package]] +name = "url" +version = "1.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a" +dependencies = [ + "idna 0.1.5", + "matches", + "percent-encoding 1.0.1", +] + [[package]] name = "url" version = "2.2.2" @@ -1650,9 +2191,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c" dependencies = [ "form_urlencoded", - "idna", + "idna 0.2.3", "matches", - "percent-encoding", + "percent-encoding 2.1.0", "serde", ] @@ -1677,19 +2218,36 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" +[[package]] +name = "version_check" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd" + [[package]] name = "version_check" version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe" +[[package]] +name = "walkdir" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56" +dependencies = [ + "same-file", + "winapi 0.3.9", + "winapi-util", +] + [[package]] name = "want" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" dependencies = [ - "log", + "log 0.4.14", "try-lock", ] @@ -1706,6 +2264,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b608ecc8f4198fe8680e2ed18eccab5f0cd4caaf3d83516fa5fb2e927fda2586" dependencies = [ "cfg-if 1.0.0", + "serde", + "serde_json", "wasm-bindgen-macro", ] @@ -1717,20 +2277,32 @@ checksum = "580aa3a91a63d23aac5b6b267e2d13cb4f363e31dce6c352fca4752ae12e479f" dependencies = [ "bumpalo", "lazy_static", - "log", - "proc-macro2", - "quote", - "syn", + "log 0.4.14", + "proc-macro2 1.0.28", + "quote 1.0.9", + "syn 1.0.74", "wasm-bindgen-shared", ] +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16646b21c3add8e13fdb8f20172f8a28c3dbf62f45406bcff0233188226cfe0c" +dependencies = [ + "cfg-if 1.0.0", + "js-sys", + "wasm-bindgen", + "web-sys", +] + [[package]] name = "wasm-bindgen-macro" version = "0.2.75" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "171ebf0ed9e1458810dfcb31f2e766ad6b3a89dbda42d8901f2b268277e5f09c" dependencies = [ - "quote", + "quote 1.0.9", "wasm-bindgen-macro-support", ] @@ -1740,9 +2312,9 @@ version = "0.2.75" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c2657dd393f03aa2a659c25c6ae18a13a4048cebd220e147933ea837efc589f" dependencies = [ - "proc-macro2", - "quote", - "syn", + "proc-macro2 1.0.28", + "quote 1.0.9", + "syn 1.0.74", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -1753,6 +2325,41 @@ version = "0.2.75" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2e0c4a743a309662d45f4ede961d7afa4ba4131a59a639f29b0069c3798bbcc2" +[[package]] +name = "web-sys" +version = "0.3.52" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01c70a82d842c9979078c772d4a1344685045f1a5628f677c2b2eab4dd7d2696" +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" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" + [[package]] name = "winapi" version = "0.3.9" @@ -1763,18 +2370,52 @@ 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" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "winreg" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0120db82e8a1e0b9fb3345a539c478767c0048d842860994d96113d5b667bd69" +dependencies = [ + "winapi 0.3.9", +] + +[[package]] +name = "ws2_32-sys" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" +dependencies = [ + "winapi 0.2.8", + "winapi-build", +] + [[package]] name = "yansi" version = "0.5.0" diff --git a/cms/Cargo.toml b/cms/Cargo.toml index 7a3c8eb..a5a5ff3 100644 --- a/cms/Cargo.toml +++ b/cms/Cargo.toml @@ -3,14 +3,39 @@ name = "cms" version = "0.1.0" edition = "2018" -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - [dependencies] -rocket = "0.5.0-rc.1" +rocket = "0.4.10" dotenv = "0.15.0" -oauth2 = { version = "4.1.0", default-features = false } clap = "2.33.3" ansi_term = "0.12.1" chrono = "0.4.19" -diesel = { version = "1.4.4", features = ["postgres", "extras"] } +diesel_migrations = "1.4.0" +url = "2.2.2" +oauth2 = "4.1.0" +serde_json = "1.0.66" +base64 = "0.13.0" +quote = "1.0.9" +[dependencies.reqwest] +version = "0.11.4" +features = ["blocking", "json"] + +[dependencies.diesel] +version = "1.4.4" +features = ["postgres", "extras"] + +[dependencies.rocket_contrib] +version = "0.4.10" +default-features = false +features = ["handlebars_templates", "diesel_postgres_pool", "json"] + +[dependencies.serde] +version = "1.0.126" +features = ["derive"] + +[dependencies.rand] +version = "0.8.4" +features = ["getrandom"] + +[dependencies.cms_macro] +path = "cms_macro" diff --git a/cms/Dockerfile b/cms/Dockerfile new file mode 100644 index 0000000..a157a91 --- /dev/null +++ b/cms/Dockerfile @@ -0,0 +1,10 @@ +FROM rustlang/rust:nightly AS build +COPY / /build +WORKDIR /build +RUN cargo build --release + +FROM ubuntu:20.04 AS release +WORKDIR /root +COPY --from=build /build/target/release/cms ./cms +CMD [ "./cms" ] + diff --git a/cms/auth.rs b/cms/auth.rs deleted file mode 100644 index e69de29..0000000 diff --git a/cms/cms_macro/Cargo.toml b/cms/cms_macro/Cargo.toml new file mode 100644 index 0000000..1a31a2d --- /dev/null +++ b/cms/cms_macro/Cargo.toml @@ -0,0 +1,17 @@ +[package] +name = "cms_macro" +version = "0.1.0" +edition = "2018" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[lib] +proc-macro=true + +[dependencies] +quote = "1.0.9" +proc-macro2 = "1.0.28" + +[dependencies.diesel] +version = "1.4.4" +features = ["postgres", "extras"] diff --git a/cms/cms_macro/src/lib.rs b/cms/cms_macro/src/lib.rs new file mode 100644 index 0000000..166b5e2 --- /dev/null +++ b/cms/cms_macro/src/lib.rs @@ -0,0 +1,311 @@ +extern crate proc_macro; +#[macro_use] +extern crate quote; + +use proc_macro2::*; +use std::fmt::Debug; + +#[derive(Debug)] +struct Row(Ident, Ident, Ident, Ident); + +fn api_route_inner(item: TokenStream) -> TokenStream { + let iterator = item.into_iter().clone().collect::>(); + let name = iterator[0].clone(); + let name_literal = &iterator[0].clone().to_string(); + let name_dir = format!("/{}", name_literal); + let name_add = format!("/{}/add", name_literal); + let name_upd = format!("/{}/upd", name_literal); + let name_del = format!("/{}/del", name_literal); + let name_api = format!("//{}", name_literal); + let name_redir = format!("/ui/{}", name_literal); + + let value_group = iterator[1].clone(); + + let (delim, stream) = match value_group { + TokenTree::Group(g) => (g.delimiter(), g.stream()), + n => panic!("Incorrect syntax at brace => {:?}", n), + }; + + assert_eq!(delim, Delimiter::Brace); + let splitted = &mut stream.into_iter().clone().collect::>()[..] + .split(|token| { + if let TokenTree::Punct(p) = token.clone() { + p.as_char() == ',' && p.spacing() == Spacing::Alone + } else { + false + } + }) + .map(Vec::from) + .collect::>>(); + + splitted.pop(); + + let mut rows: Vec = vec![]; + + for vecs in splitted.into_iter() { + let mut vals_iter = vecs.split(|token| { + if let TokenTree::Punct(p) = token.clone() { + p.as_char() == ':' && p.spacing() == Spacing::Alone + } else { + false + } + }); + + let name = vals_iter.next().unwrap().to_vec(); + let vals = vals_iter.next().unwrap().to_vec(); + let (brack, val_stream) = match vals.get(0).unwrap() { + TokenTree::Group(g) => (g.delimiter(), g.stream()), + n => panic!("Incorrect syntax at parenthesis => {:?}", n), + }; + assert_eq!(brack, Delimiter::Parenthesis); + assert_eq!(name.len(), 1); + let name = match name.get(0).unwrap() { + TokenTree::Ident(g) => g, + n => panic!("Incorrect syntax at name => {:?}", n), + }; + + let vals = &val_stream.into_iter().clone().collect::>()[..] + .split(|token| { + if let TokenTree::Punct(p) = token.clone() { + p.as_char() == ',' && p.spacing() == Spacing::Alone + } else { + false + } + }) + .map(|x| match x.to_vec().get(0).unwrap().clone() { + TokenTree::Ident(i) => i, + n => panic!("Incorrect syntax at group => {:?}", n), + }) + .collect::>(); + rows.push(Row( + name.clone(), + vals.get(0).unwrap().clone(), + vals.get(1).unwrap().clone(), + vals.get(2).unwrap().clone(), + )); + } + + let names_vec = rows + .iter() + .map(|x| TokenTree::Ident(x.0.clone())) + .collect::>(); + + let schema_value = rows + .iter() + .map(|x| TokenTree::Ident(x.1.clone())) + .collect::>(); + + let get_value = rows + .iter() + .map(|x| TokenTree::Ident(x.2.clone())) + .collect::>(); + + let put_value = rows + .iter() + .map(|x| TokenTree::Ident(x.3.clone())) + .collect::>(); + + let impl_value = rows + .iter() + .map(|x| { + if x.2.to_string() == x.3.to_string() { + let s = x.0.clone(); + quote! { + #s: self.#s, + } + } else { + let s = x.0.clone(); + quote! { + #s: *self.#s, + } + } + }) + .collect::>() + .into_iter() + .map(|x| x.into_iter().collect::>()) + .flatten() + .collect::>(); + + let impls = quote! { + + impl Post { + fn convert(self) -> Create { + Create { + lang: self.lang, + #(#impl_value)* + } + } + } + + impl Update { + fn convert(self) -> Create { + Create { + lang: self.lang, + #(#impl_value)* + } + } + } + }; + + let schema = quote! { + + pub mod schema { + table! { + use diesel::sql_types::*; + + #name (id) { + id -> Integer, + lang -> Text, + #(#names_vec -> #schema_value,) + * + } + } + } + }; + + let structs = quote! { + + use schema::#name; + + #[derive(Debug, Clone, Queryable, Serialize)] + pub struct Get { + pub id: i32, + pub lang: String, + #(pub #names_vec: #get_value), + * + } + + #[derive(Debug, AsChangeset, Insertable)] + #[table_name = #name_literal] + pub struct Create { + pub lang: String, + #(pub #names_vec: #get_value), + * + } + + #[derive(Debug, FromForm)] + pub struct Post { + pub lang: String, + #(pub #names_vec: #put_value), + * + } + + #[derive(Debug, FromForm)] + pub struct Update { + pub id: i32, + pub lang: String, + #(pub #names_vec: #put_value), + * + } + + #[derive(Debug, FromForm)] + pub struct Delete { + pub id: i32, + } + }; + + let imports = quote! { + use crate::data::{defs::*, Lang}; + use crate::auth::Token; + use ::chrono::naive::*; + use ::diesel::{prelude::*, Insertable, Queryable}; + use ::rocket::{http::Status, request::Form, response::Redirect, State}; + use ::rocket_contrib::{json::Json, templates::Template}; + use ::serde::Serialize; + use ::std::{collections::*, sync::Mutex}; + }; + + let endpoints = quote! { + + pub fn create(conn: &PgConnection, create: Create) -> Result { + diesel::insert_into(#name::table) + .values(&create) + .get_result(conn) + } + + pub fn get(conn: &PgConnection, lg: Lang) -> Result, diesel::result::Error> { + use schema::#name::dsl::*; + + #name.filter(lang.eq(lg.0)).load::(conn) + } + + pub fn get_all(conn: &PgConnection) -> Result, diesel::result::Error> { + use schema::#name::dsl::*; + #name.load::(conn) + } + + pub fn update( + conn: &PgConnection, + idn: i32, + create: Create, + ) -> Result { + use schema::#name::dsl::*; + diesel::update(#name.find(idn)) + .set(&create) + .get_result::(conn) + } + + pub fn delete(conn: &PgConnection, idn: i32) -> Result { + use schema::#name::dsl::*; + diesel::delete(#name.find(idn)).execute(conn) + } + + #[get(#name_api)] + pub fn api(pg: State>, lang: Lang) -> Result>, Status> { + Ok(Json( + get(&*(pg.lock().unwrap()), lang).map_err(|_| Status::InternalServerError)?, + )) + } + + #[post(#name_add, data = "
")] + pub fn add(_token: Token, pg: State>, form: Form) -> Result { + match create(&*(pg.lock().unwrap()), form.into_inner().convert()) { + Ok(_) => Ok(Redirect::to(#name_redir)), + Err(_) => Err(Status::InternalServerError), + } + } + + #[post(#name_del, data = "")] + pub fn del(_token: Token, pg: State>, form: Form) -> Result { + match delete(&*(pg.lock().unwrap()), form.id) { + Ok(_) => Ok(Redirect::to(#name_redir)), + Err(_) => Err(Status::InternalServerError), + } + } + + #[post(#name_upd, data = "")] + pub fn upd(_token: Token, pg: State>, form: Form) -> Result { + match update(&*(pg.lock().unwrap()), form.id, form.into_inner().convert()) { + Ok(_) => Ok(Redirect::to(#name_redir)), + Err(_) => Err(Status::InternalServerError), + } + } + + #[get(#name_dir)] + pub fn ui(_token: Token, pg: State>) -> Result { + let ctx = get_all(&*(pg.lock().unwrap())) + .map_err(|_| Status::InternalServerError)? + .iter() + .map(|x| (x.id, x.clone())) + .collect::>(); + Ok(Template::render(#name_literal, &ctx)) + } + }; + + let tok = quote! { + pub mod #name { + #imports + #schema + #structs + #impls + #endpoints + } + }; + + tok.into() +} + +#[proc_macro] +pub fn api_route(item: proc_macro::TokenStream) -> proc_macro::TokenStream { + api_route_inner(TokenStream::from(item)).into() +} diff --git a/cms/migrations/setup/down.sql b/cms/migrations/setup/down.sql index 92c3065..49a5779 100644 --- a/cms/migrations/setup/down.sql +++ b/cms/migrations/setup/down.sql @@ -1,2 +1,3 @@ -DROP TABLE events; +DROP TABLE auth_val; +DROP TABLE events; diff --git a/cms/migrations/setup/up.sql b/cms/migrations/setup/up.sql index c07f970..3c0adc4 100644 --- a/cms/migrations/setup/up.sql +++ b/cms/migrations/setup/up.sql @@ -1,5 +1,13 @@ +CREATE TABLE auth_val ( + id SERIAL PRIMARY KEY, + email VARCHAR +); + +INSERT INTO auth_val(email) VALUES('hkailadka88@gmail.com'); + CREATE TABLE events ( id SERIAL PRIMARY KEY, + lang VARCHAR, title VARCHAR NOT NULL, text VARCHAR, location VARCHAR NOT NULL, diff --git a/cms/src/auth.rs b/cms/src/auth.rs index c69337b..170b85c 100644 --- a/cms/src/auth.rs +++ b/cms/src/auth.rs @@ -1,3 +1,209 @@ -pub fn auth() { +use diesel::{prelude::*, Queryable}; +use oauth2::{ + basic::BasicClient, reqwest::http_client, AuthUrl, AuthorizationCode, ClientId, ClientSecret, + CsrfToken, RedirectUrl, RevocationUrl, Scope, TokenResponse, TokenUrl, +}; +use reqwest::blocking::Client; +use rocket::{ + http::{Cookie, Cookies, SameSite, Status}, + request, + request::FromRequest, + response::Redirect, + Outcome, Request, State, +}; +use serde::Serialize; +use serde_json::Value; +use std::{fmt::Debug, sync::Mutex}; +mod schema { + table! { + use diesel::sql_types::*; + + auth_val (id) { + id -> Integer, + email -> Text, + } + } +} + +pub struct Host(String); +pub struct Token(String); + +#[derive(Clone)] +pub struct Settings { + pub id: String, + pub secret: String, + pub auth_url: AuthUrl, + pub token_url: TokenUrl, +} + +#[derive(Debug, Queryable, Serialize)] +struct Auth { + pub id: i32, + pub email: String, +} + +fn get_auth(conn: &PgConnection) -> Result, diesel::result::Error> { + use schema::auth_val::dsl::*; + auth_val.load::(conn) +} + +impl<'a, 'r> FromRequest<'a, 'r> for Host { + type Error = (); + + fn from_request(request: &'a Request<'r>) -> request::Outcome { + let host = request.headers().get_one("Host"); + match host { + Some(host) => Outcome::Success(Host(host.to_string())), + None => Outcome::Failure((Status::Unauthorized, ())), + } + } +} + +impl<'a, 'r> FromRequest<'a, 'r> for Token { + type Error = (); + + fn from_request(request: &'a Request<'r>) -> request::Outcome { + match request.cookies().get("token") { + Some(token) => { + let resp: Value = Client::new() + .get("https://www.googleapis.com/userinfo/v2/me") + .bearer_auth(token.name_value().1) + .send() + .unwrap() + .json() + .unwrap(); + + if resp["error"] != Value::Null { + return Outcome::Failure((Status::Forbidden, ())); + } else { + let email = resp["email"].clone(); + let pg = request.guard::>>()?; + let diesel_op = get_auth(&*(pg.lock().unwrap())); + let auths: Vec = match diesel_op { + Ok(n) => n.into_iter().map(|x| x.email).collect::>(), + Err(_) => vec![], + }; + + if auths.into_iter().any(|x| x == email.as_str().unwrap_or("")) { + return Outcome::Success(Token(String::from(email.as_str().unwrap_or("")))); + } else { + return Outcome::Failure((Status::Forbidden, ())); + } + } + } + None => Outcome::Failure((Status::Unauthorized, ())), + } + } +} + +#[get("/oauth")] +pub fn oauth( + mut cookies: Cookies, + settings: State, + host: Host, +) -> Result { + let client = get_client(settings.inner().clone(), host); + let csrf_token = CsrfToken::new_random(); + let csrf: String = csrf_token.secret().into(); + cookies.add(Cookie::new("state", csrf)); + let (authorize_url, _csrf_state) = client + .authorize_url(|| csrf_token.clone()) + .add_scope(Scope::new( + "https://www.googleapis.com/auth/userinfo.email".to_owned(), + )) + .url(); + let auth = authorize_url.to_string(); + Ok(Redirect::to(auth)) +} + +#[get("/logout")] +pub fn logout(mut cookies: Cookies) -> Redirect { + match cookies.get("token") { + Some(_) => { + cookies.remove(Cookie::named("token")); + Redirect::to("/") + } + None => Redirect::to("/"), + } +} + +#[get("/callback?&")] +pub fn callback( + state: String, + code: String, + pg: State>, + mut cookies: Cookies, + host: Host, + sa: State, +) -> Result { + let sc = cookies.get("state"); + match sc { + Some(c) => { + if state != c.value() { + return Err(Status::Forbidden); + } else { + cookies.remove(Cookie::named("state")); + let client = get_client(sa.inner().clone(), host); + let token_result = client + .exchange_code(AuthorizationCode::new(code)) + .request(http_client); + match token_result { + Ok(n) => { + let secret = n.access_token().secret(); + + let resp: Value = Client::new() + .get("https://www.googleapis.com/userinfo/v2/me") + .bearer_auth(secret) + .send() + .unwrap() + .json() + .unwrap(); + if resp["error"] != Value::Null { + return Err(Status::BadRequest); + } else { + let email = resp["email"].clone(); + let diesel_op = get_auth(&*(pg.lock().unwrap())); + let auths: Vec = match diesel_op { + Ok(n) => n.into_iter().map(|x| x.email).collect::>(), + Err(_) => vec![], + }; + if auths.into_iter().any(|x| x == email.as_str().unwrap_or("")) { + let mut cook = Cookie::new("token", secret.to_string()); + cook.set_same_site(SameSite::Strict); + cook.set_http_only(true); + cook.set_secure(true); + cookies.add(cook); + return Ok(Redirect::to("/")); + } else { + return Err(Status::Forbidden); + } + } + } + Err(_) => return Err(Status::InternalServerError), + } + } + } + None => Err(Status::BadRequest), + } +} + +pub fn get_client(settings: Settings, host: Host) -> BasicClient { + let gcid = ClientId::new(settings.id); + + let gcs = ClientSecret::new(settings.secret); + + let auth_url = settings.auth_url; + let token_url = settings.token_url; + + let base: String = host.0.to_owned(); + + BasicClient::new(gcid, Some(gcs), auth_url, Some(token_url)) + .set_redirect_uri( + RedirectUrl::new(format!("http://{}/callback", base)).expect("Invalid redirect URL"), + ) + .set_revocation_uri( + RevocationUrl::new("https://oauth2.googleapis.com/revoke".to_owned()) + .expect("Invalid revocation endpoint URL"), + ) } diff --git a/cms/src/data/events/mod.rs b/cms/src/data/events/mod.rs deleted file mode 100644 index 38de1c2..0000000 --- a/cms/src/data/events/mod.rs +++ /dev/null @@ -1,20 +0,0 @@ -use diesel::prelude::*; -use super::models::{Event, NewEvent}; -use super::super::utils::{exit_with_error}; - -pub fn create_event(conn: &PgConnection, event: NewEvent) -> Event { - - use super::schema::events; - diesel::insert_into(events::table) - .values(&event) - .get_result(conn) - .unwrap_or_else(|_| exit_with_error("Error saving new post")) - -} - -pub fn get_all(conn: &PgConnection) -> Result, diesel::result::Error> { - - use super::schema::events::dsl::*; - - events.load::(conn) -} diff --git a/cms/src/data/mod.rs b/cms/src/data/mod.rs index 8b8157c..4a368e9 100644 --- a/cms/src/data/mod.rs +++ b/cms/src/data/mod.rs @@ -1,3 +1,238 @@ -pub mod events; -pub mod schema; -pub mod models; +#[macro_use] +use cms_macro::api_route; +use rocket::{ + http::{RawStr, Status}, + request::FromParam, +}; +use std::borrow::Cow; + +pub struct Lang<'a>(Cow<'a, str>); + +fn valid_lang(lang: &str) -> bool { + lang.chars().all(|c| (c >= 'a' && c <= 'z')) && lang.chars().count() == 2 +} + +impl<'a> FromParam<'a> for Lang<'a> { + type Error = Status; + fn from_param(param: &'a RawStr) -> Result, Status> { + match valid_lang(param) { + true => Ok(Lang(Cow::Borrowed(param))), + false => Err(Status::InternalServerError), + } + } +} + +pub mod defs { + use chrono::naive::NaiveDate; + use rocket::{http::RawStr, request::FromFormValue}; + use std::ops::Deref; + + #[derive(Debug)] + pub struct DateForm(NaiveDate); + + impl Deref for DateForm { + type Target = NaiveDate; + + fn deref(&self) -> &NaiveDate { + &self.0 + } + } + + impl<'v> FromFormValue<'v> for DateForm { + type Error = (); + + fn from_form_value(value: &'v RawStr) -> Result { + let value_uri = match value.url_decode() { + Ok(n) => n, + Err(_) => return Err(()), + }; + let naivedate = NaiveDate::parse_from_str(&value_uri[..], "%m/%d/%Y"); + match naivedate { + Ok(n) => Ok(DateForm(n)), + Err(_) => Err(()), + } + } + } +} + +api_route! { + events { + title: (Text, String, String), + location: (Text, String, String), + text: (Text, String, String), + event_date: (Text, NaiveDate, DateForm), + } +} + +/* +pub mod events { + + use crate::data::{defs::*, Lang}; + use crate::auth::Token; + use ::chrono::naive::*; + use ::diesel::{prelude::*, Insertable, Queryable}; + use ::rocket::{http::Status, request::Form, response::Redirect, State}; + use ::rocket_contrib::{json::Json, templates::Template}; + use ::serde::Serialize; + use ::std::{collections::*, sync::Mutex}; + + pub mod schema { + table! { + use diesel::sql_types::*; + + events (id) { + id -> Integer, + lang -> Text, + title -> Text, + location -> Text, + text -> Text, + event_date -> Date, + } + } + } + + use schema::events; + + #[derive(Debug, Clone, Queryable, Serialize)] + pub struct Get { + pub id: i32, + pub lang: String, + pub title: String, + pub location: String, + pub text: String, + pub event_date: NaiveDate, + } + + #[derive(Debug, AsChangeset, Insertable)] + #[table_name = "events"] + pub struct Create { + pub lang: String, + pub title: String, + pub location: String, + pub text: String, + pub event_date: NaiveDate, + } + + #[derive(Debug, FromForm)] + pub struct Post { + pub lang: String, + pub title: String, + pub location: String, + pub text: String, + pub event_date: DateForm, + } + + #[derive(Debug, FromForm)] + pub struct Update { + pub id: i32, + pub lang: String, + pub title: String, + pub location: String, + pub text: String, + pub event_date: DateForm, + } + + #[derive(Debug, FromForm)] + pub struct Delete { + pub id: i32, + } + + impl Post { + fn convert(self) -> Create { + Create { + lang: self.lang, + title: self.title, + location: self.location, + text: self.text, + event_date: *self.event_date, + } + } + } + + impl Update { + fn convert(self) -> Create { + Create { + lang: self.lang, + title: self.title, + location: self.location, + text: self.text, + event_date: *self.event_date, + } + } + } + + pub fn create(conn: &PgConnection, event: Create) -> Result { + diesel::insert_into(events::table) + .values(&event) + .get_result(conn) + } + + pub fn get(conn: &PgConnection, lg: Lang) -> Result, diesel::result::Error> { + use schema::events::dsl::*; + + events.filter(lang.eq(lg.0)).load::(conn) + } + + pub fn get_all(conn: &PgConnection) -> Result, diesel::result::Error> { + use schema::events::dsl::*; + events.load::(conn) + } + + pub fn update( + conn: &PgConnection, + idn: i32, + event: Create, + ) -> Result { + use schema::events::dsl::*; + diesel::update(events.find(idn)) + .set(&event) + .get_result::(conn) + } + + pub fn delete(conn: &PgConnection, idn: i32) -> Result { + use schema::events::dsl::*; + diesel::delete(events.find(idn)).execute(conn) + } + + #[get("//events")] + pub fn api(pg: State>, lang: Lang) -> Result>, Status> { + Ok(Json( + get(&*(pg.lock().unwrap()), lang).map_err(|_| Status::InternalServerError)?, + )) + } + + #[post("/events/add", data = "")] + pub fn add(pg: State>, form: Form) -> Result { + match create(&*(pg.lock().unwrap()), form.into_inner().convert()) { + Ok(_) => Ok(Redirect::to("/ui/events")), + Err(_) => Err(Status::InternalServerError), + } + } + + #[post("/events/del", data = "")] + pub fn del(pg: State>, form: Form) -> Result { + match delete(&*(pg.lock().unwrap()), form.id) { + Ok(_) => Ok(Redirect::to("/ui/events")), + Err(_) => Err(Status::InternalServerError), + } + } + + #[post("/events/upd", data = "")] + pub fn upd(pg: State>, form: Form) -> Result { + match update(&*(pg.lock().unwrap()), form.id, form.into_inner().convert()) { + Ok(_) => Ok(Redirect::to("/ui/events")), + Err(_) => Err(Status::InternalServerError), + } + } + + #[get("/events")] + pub fn ui(_token: Token, pg: State>) -> Result { + let ctx = get_all(&*(pg.lock().unwrap())) + .map_err(|_| Status::InternalServerError)? + .iter() + .map(|x| (x.id, x.clone())) + .collect::>(); + Ok(Template::render("events", &ctx)) + } +} +*/ diff --git a/cms/src/data/models.rs b/cms/src/data/models.rs deleted file mode 100644 index 684d9e1..0000000 --- a/cms/src/data/models.rs +++ /dev/null @@ -1,22 +0,0 @@ -use super::schema::events; -use diesel::Insertable; -use diesel::Queryable; -use chrono::naive::NaiveDate; - -#[derive(Queryable)] -pub struct Event { - pub id: i32, - pub title: String, - pub location: String, - pub text: String, - pub event_date: NaiveDate, -} - -#[derive(Insertable)] -#[table_name="events"] -pub struct NewEvent<'a> { - pub title: &'a str, - pub location: &'a str, - pub text: &'a str, - pub event_date: &'a NaiveDate -} diff --git a/cms/src/data/schema.rs b/cms/src/data/schema.rs deleted file mode 100644 index a23cdbb..0000000 --- a/cms/src/data/schema.rs +++ /dev/null @@ -1,12 +0,0 @@ - -table! { - use diesel::sql_types::*; - - events (id) { - id -> Integer, - title -> Text, - text -> Text, - location -> Text, - event_date -> Date, - } -} diff --git a/cms/src/main.rs b/cms/src/main.rs index 821beaa..2205538 100644 --- a/cms/src/main.rs +++ b/cms/src/main.rs @@ -1,53 +1,141 @@ -#[macro_use] extern crate diesel; -#[macro_use] extern crate rocket; +#![feature(proc_macro_hygiene, decl_macro)] +#[macro_use] +extern crate diesel; +#[macro_use] +extern crate diesel_migrations; +#[macro_use] +extern crate rocket; -mod utils; +mod auth; mod data; +mod secret; +mod utils; +use auth::Settings; use clap::{App, Arg}; -use rocket::{Build, Rocket}; -use utils::{exit_with_error, db_conn}; +use diesel::prelude::*; use dotenv::dotenv; +use oauth2::{AuthUrl, TokenUrl}; +use rocket::{ + config::{Config, Environment}, + Rocket, +}; +use rocket_contrib::templates::Template; +use std::{ + collections::*, + env, + net::IpAddr, + path::{Path, PathBuf}, + sync::Mutex, +}; +use utils::{db_conn, exit_with_error}; #[get("/")] -fn index() -> &'static str { - "Hello, world!" +fn index() -> Template { + let context: HashMap<&str, &str> = [("oauth", "/oauth")].iter().cloned().collect(); + Template::render("index", &context) } - -fn rocket(port: u32) -> Rocket { - let figment = rocket::Config::figment() - .merge(("port", port)); - rocket::custom(figment) - .mount("/", routes![index]) - +#[get("/static/")] +fn static_files(path: PathBuf) -> Option { + rocket::response::NamedFile::open(Path::new("cms/static/").join(path)).ok() } +fn rocket(port: u16, address: String, env: Environment, pg: PgConnection, sa: Settings) -> Rocket { + let mut config = Config::build(env) + .port(port) + .address(address) + .secret_key(secret::create_secret()) + .unwrap(); + let mut extras = HashMap::new(); + extras.insert("template_dir".to_string(), "cms/templates/".into()); + config.set_extras(extras); + rocket::custom(config) + .attach(Template::fairing()) + .manage(Mutex::new(pg)) + .manage(sa) + .mount( + "/", + routes![index, auth::callback, auth::oauth, static_files], + ) + .mount("/api", routes![data::events::api]) + .mount( + "/ui", + routes![ + data::events::ui, + data::events::add, + data::events::del, + data::events::upd + ], + ) +} -#[rocket::main] -async fn main() { +fn main() { dotenv().ok(); - let postgres = db_conn("/postgres") - .unwrap_or_else(|_| exit_with_error("Error connecting to database. ")); + let gcid = env::var("BLAZERCMS_CLIENT_ID") + .unwrap_or_else(|_| exit_with_error("BLAZERCMS_CLIENT_ID must be set")); + let gcs = env::var("BLAZERCMS_SECRET") + .unwrap_or_else(|_| exit_with_error("BLAZERCMS_SECRET must be set")); + + let auth_url = AuthUrl::new("https://accounts.google.com/o/oauth2/v2/auth".to_owned()) + .expect("Invalid authorization endpoint."); + + let token_url = TokenUrl::new("https://www.googleapis.com/oauth2/v3/token".to_owned()) + .expect("Invalid token endpoint. "); + + let postgres = db_conn(); let matches = App::new("blazercms") .version("1.0") - .arg(Arg::with_name("port") - .short("p") - .long("port") - .default_value("8080")) + .arg( + Arg::with_name("port") + .short("p") + .long("port") + .default_value("8080"), + ) + .arg( + Arg::with_name("prod") + .short("r") + .long("prod") + .takes_value(false), + ) + .arg( + Arg::with_name("addr") + .short("a") + .long("addr") + .default_value("127.0.0.1"), + ) .get_matches(); let port = matches .value_of("port") .unwrap() - .parse::() + .parse::() .unwrap_or_else(|_| exit_with_error("Port must be an integer! ")); - if let Err(_) = rocket(port).launch().await { - exit_with_error(&format!("Error binding port {}. ", port)); - } -} + let addr = matches + .value_of("addr") + .unwrap() + .parse::() + .unwrap_or_else(|_| exit_with_error("Address must be a valid IP Address! ")) + .to_string(); + let env; + if matches.is_present("prod") { + env = Environment::Production; + } else { + env = Environment::Development; + } + + let auth_settings = Settings { + id: gcid, + secret: gcs, + auth_url: auth_url, + token_url: token_url, + }; + + let err = rocket(port, addr, env, postgres, auth_settings).launch(); + exit_with_error(&format!("Error: {}", err)); +} diff --git a/cms/src/secret.rs b/cms/src/secret.rs new file mode 100644 index 0000000..ce8c93d --- /dev/null +++ b/cms/src/secret.rs @@ -0,0 +1,7 @@ +use rand::{rngs::OsRng, RngCore}; + +pub fn create_secret() -> String { + let mut secret = [0u8; 32]; + OsRng.fill_bytes(&mut secret); + base64::encode(&secret) +} diff --git a/cms/src/utils.rs b/cms/src/utils.rs index ef1b2f6..2d74172 100644 --- a/cms/src/utils.rs +++ b/cms/src/utils.rs @@ -1,21 +1,21 @@ use ansi_term::Colour::Red; -use diesel::prelude::*; -use diesel::pg::{PgConnection}; -use std::{env}; +use diesel::{pg::PgConnection, prelude::*}; +use std::env; pub fn exit_with_error(msg: &str) -> ! { eprintln!("{}", Red.paint(msg)); std::process::exit(1); } +pub fn db_conn() -> PgConnection { + embed_migrations!("migrations"); - -pub fn db_conn(dbname: &str) -> Result { - - let mut database_url = env::var("BLAZERCMS_DATABASE_URL") + let database_url = env::var("BLAZERCMS_DATABASE_URL") .unwrap_or_else(|_| exit_with_error("BLAZERCMS_DATABASE_URL must be set")); - database_url.push_str(dbname); + let db = PgConnection::establish(&database_url) + .unwrap_or_else(|_| exit_with_error("Error connecting to database. ")); - PgConnection::establish(&database_url) + embedded_migrations::run(&db).unwrap_or_else(|_| exit_with_error("Error migrating database. ")); + db } diff --git a/cms/static/style.css b/cms/static/style.css new file mode 100644 index 0000000..eed8207 --- /dev/null +++ b/cms/static/style.css @@ -0,0 +1,3 @@ +body { + background-color: lightblue; +} diff --git a/cms/templates/events.html.hbs b/cms/templates/events.html.hbs new file mode 100644 index 0000000..fcde65f --- /dev/null +++ b/cms/templates/events.html.hbs @@ -0,0 +1,25 @@ + + + + + + + +

{{6.title}}

+
+ + + + + + + + +
+ + +
+ + + + diff --git a/cms/templates/index.html.hbs b/cms/templates/index.html.hbs new file mode 100644 index 0000000..3ffad37 --- /dev/null +++ b/cms/templates/index.html.hbs @@ -0,0 +1,10 @@ + + + + + + + Login + + + diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..782a4bd --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,19 @@ +version: "3.9" +services: + + postgres: + image: "postgres:alpine" + environment: + POSTGRES_PASSWORD: ${BLAZERCMS_POSTGRES} + ports: + - "5432:5432" + web: + build: cms/ + ports: + - "8080:8080" + depends_on: + - postgres + environment: + BLAZERCMS_DATABASE_URL: ${BLAZERCMS_DATABASE_URL} + BLAZERCMS_CLIENT_ID: ${BLAZERCMS_CLIENT_ID} + BLAZERCMS_SECRET: ${BLAZERCMS_SECRET} diff --git a/rustfmt.toml b/rustfmt.toml new file mode 100644 index 0000000..7f00408 --- /dev/null +++ b/rustfmt.toml @@ -0,0 +1,2 @@ +imports_granularity="Crate" +reorder_imports = true diff --git a/testfile.rs b/testfile.rs new file mode 100644 index 0000000..a4993ee --- /dev/null +++ b/testfile.rs @@ -0,0 +1,150 @@ +pub mod events { + use super::{defs::DateForm, Lang}; + use crate::auth::Token; + use chrono::naive::NaiveDate; + use diesel::{prelude::*, Insertable, Queryable}; + use rocket::{http::Status, request::Form, response::Redirect, State}; + use rocket_contrib::{json::Json, templates::Template}; + use serde::Serialize; + use std::{collections::*, sync::Mutex}; + pub mod schema { + table! { use diesel :: sql_types :: * ; events (id) { id -> Integer , lang -> Text , title -> Text , location -> Text , text -> Text , event_date -> Text , } } + } + use schema::events; + #[derive(Debug, Clone, Queryable, Serialize)] + pub struct Get { + pub id: i32, + pub lang: String, + pub title: String, + pub location: String, + pub text: String, + pub event_date: NaiveDate, + } + #[derive(Debug, AsChangeset, Insertable)] + #[table_name = "events"] + pub struct Create { + pub lang: String, + pub title: String, + pub location: String, + pub text: String, + pub event_date: NaiveDate, + } + #[derive(Debug, FromForm)] + pub struct Post { + pub lang: String, + pub title: String, + pub location: String, + pub text: String, + pub event_date: FormDate, + } + #[derive(Debug, FromForm)] + pub struct Update { + pub id: i32, + pub lang: String, + pub title: String, + pub location: String, + pub text: String, + pub event_date: FormDate, + } + #[derive(Debug, FromForm)] + pub struct Delete { + pub id: i32, + } + impl Post { + fn convert(self) -> Create { + Create { + lang: self.lang, + title: self.title, + location: self.location, + text: self.text, + event_date: *self.event_date, + } + } + } + impl Update { + fn convert(self) -> Create { + Create { + lang: self.lang, + title: self.title, + location: self.location, + text: self.text, + event_date: *self.event_date, + } + } + } + pub fn create(conn: &PgConnection, create: Create) -> Result { + diesel::insert_into(events::table) + .values(&create) + .get_result(conn) + } + pub fn get(conn: &PgConnection, lg: Lang) -> Result, diesel::result::Error> { + use schema::events::dsl::*; + events.filter(lang.eq(lg.0)).load::(conn) + } + pub fn get_all(conn: &PgConnection) -> Result, diesel::result::Error> { + use schema::events::dsl::*; + events.load::(conn) + } + pub fn update( + conn: &PgConnection, + idn: i32, + create: Create, + ) -> Result { + use schema::events::dsl::*; + diesel::update(events.find(idn)) + .set(&create) + .get_result::(conn) + } + pub fn delete(conn: &PgConnection, idn: i32) -> Result { + use schema::events::dsl::*; + diesel::delete(events.find(idn)).execute(conn) + } + #[get("//events")] + pub fn api(pg: State>, lang: Lang) -> Result>, Status> { + Ok(Json( + get(&*(pg.lock().unwrap()), lang).map_err(|_| Status::InternalServerError)?, + )) + } + #[post("/events/add", data = "
")] + pub fn add( + _token: Token, + pg: State>, + form: Form, + ) -> Result { + match create(&*(pg.lock().unwrap()), form.into_inner().convert()) { + Ok(_) => Ok(Redirect::to("/ui/events")), + Err(_) => Err(Status::InternalServerError), + } + } + #[post("/events/del", data = "")] + pub fn del( + _token: Token, + pg: State>, + form: Form, + ) -> Result { + match delete(&*(pg.lock().unwrap()), form.id) { + Ok(_) => Ok(Redirect::to("/ui/events")), + Err(_) => Err(Status::InternalServerError), + } + } + #[post("/events/upd", data = "")] + pub fn upd( + _token: Token, + pg: State>, + form: Form, + ) -> Result { + match update(&*(pg.lock().unwrap()), form.id, form.into_inner().convert()) { + Ok(_) => Ok(Redirect::to("/ui/events")), + Err(_) => Err(Status::InternalServerError), + } + } + #[get("/events")] + pub fn ui(_token: Token, pg: State>) -> Result { + let ctx = get_all(&*(pg.lock().unwrap())) + .map_err(|_| Status::InternalServerError)? + .iter() + .map(|x| (x.id, x.clone())) + .collect::>(); + Ok(Template::render("events", &ctx)) + } +}