From ad11dd0e47d52714a7395fca38487651ffa0bf43 Mon Sep 17 00:00:00 2001 From: Dustin Rouillard Date: Mon, 20 May 2024 20:35:12 -0600 Subject: [PATCH 01/13] Update everything Start working on blog system Better route structure with scopes Rename redis to valkey Make app_data no longer a mutex --- .gitignore | 2 + Cargo.lock | 2885 +++++++++++++++------- Cargo.toml | 26 +- README.md | 8 +- src/config.rs | 11 +- src/connectivity/mod.rs | 2 +- src/connectivity/{redis.rs => valkey.rs} | 8 +- src/main.rs | 87 +- src/modules/spotify.rs | 6 +- src/services/base.rs | 8 +- src/services/blog/assets.rs | 6 + src/services/blog/auth.rs | 103 + src/services/blog/middleware.rs | 66 + src/services/blog/mod.rs | 4 + src/services/blog/posts.rs | 6 + src/services/mod.rs | 1 + src/services/spotify.rs | 26 +- src/structs/blog.rs | 33 + src/structs/mod.rs | 1 + 19 files changed, 2367 insertions(+), 922 deletions(-) rename src/connectivity/{redis.rs => valkey.rs} (97%) create mode 100644 src/services/blog/assets.rs create mode 100644 src/services/blog/auth.rs create mode 100644 src/services/blog/middleware.rs create mode 100644 src/services/blog/mod.rs create mode 100644 src/services/blog/posts.rs create mode 100644 src/structs/blog.rs diff --git a/.gitignore b/.gitignore index ea8c4bf..ec47942 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ /target + +.env \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index 6553b9a..e62947c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,34 +4,34 @@ version = 3 [[package]] name = "actix-codec" -version = "0.5.0" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57a7559404a7f3573127aab53c08ce37a6c6a315c374a31070f3c91cd1b4a7fe" +checksum = "5f7b0a21988c1bf877cf4759ef5ddaac04c1c9fe808c9142ecb78ba97d97a28a" dependencies = [ - "bitflags", + "bitflags 2.5.0", "bytes", "futures-core", "futures-sink", - "log", "memchr", "pin-project-lite", "tokio", "tokio-util", + "tracing", ] [[package]] name = "actix-http" -version = "3.2.2" +version = "3.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c83abf9903e1f0ad9973cc4f7b9767fd5a03a583f51a5b7a339e07987cd2724" +checksum = "4eb9843d84c775696c37d9a418bbb01b932629d01870722c0f13eb3f95e2536d" dependencies = [ "actix-codec", "actix-rt", "actix-service", "actix-utils", "ahash", - "base64", - "bitflags", + "base64 0.22.1", + "bitflags 2.5.0", "brotli", "bytes", "bytestring", @@ -39,8 +39,8 @@ dependencies = [ "encoding_rs", "flate2", "futures-core", - "h2", - "http", + "h2 0.3.26", + "http 0.2.12", "httparse", "httpdate", "itoa", @@ -50,40 +50,44 @@ dependencies = [ "percent-encoding", "pin-project-lite", "rand", - "sha1 0.10.5", + "sha1", "smallvec", + "tokio", + "tokio-util", "tracing", "zstd", ] [[package]] name = "actix-macros" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "465a6172cf69b960917811022d8f29bc0b7fa1398bc4f78b3c466673db1213b6" +checksum = "e01ed3140b2f8d422c68afa1ed2e85d996ea619c988ac834d255db32138655cb" dependencies = [ "quote", - "syn", + "syn 2.0.65", ] [[package]] name = "actix-router" -version = "0.5.1" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d66ff4d247d2b160861fa2866457e85706833527840e4133f8f49aa423a38799" +checksum = "13d324164c51f63867b57e73ba5936ea151b8a41a1d23d1031eeb9f70d0236f8" dependencies = [ "bytestring", - "http", + "cfg-if", + "http 0.2.12", "regex", + "regex-lite", "serde", "tracing", ] [[package]] name = "actix-rt" -version = "2.7.0" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ea16c295198e958ef31930a6ef37d0fb64e9ca3b6116e6b93a8bdae96ee1000" +checksum = "28f32d40287d3f402ae0028a9d54bef51af15c8769492826a69d28f81893151d" dependencies = [ "futures-core", "tokio", @@ -91,9 +95,9 @@ dependencies = [ [[package]] name = "actix-server" -version = "2.1.1" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0da34f8e659ea1b077bb4637948b815cd3768ad5a188fdcd74ff4d84240cd824" +checksum = "3eb13e7eef0423ea6eab0e59f6c72e7cb46d33691ad56a726b3cd07ddec2c2d4" dependencies = [ "actix-rt", "actix-service", @@ -101,8 +105,7 @@ dependencies = [ "futures-core", "futures-util", "mio", - "num_cpus", - "socket2", + "socket2 0.5.7", "tokio", "tracing", ] @@ -130,9 +133,9 @@ dependencies = [ [[package]] name = "actix-web" -version = "4.2.1" +version = "4.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d48f7b6534e06c7bfc72ee91db7917d4af6afe23e7d223b51e68fffbb21e96b9" +checksum = "b1cf67dadb19d7c95e5a299e2dda24193b89d5d4f33a3b9800888ede9e19aa32" dependencies = [ "actix-codec", "actix-http", @@ -152,7 +155,6 @@ dependencies = [ "encoding_rs", "futures-core", "futures-util", - "http", "itoa", "language-tags", "log", @@ -160,25 +162,84 @@ dependencies = [ "once_cell", "pin-project-lite", "regex", + "regex-lite", "serde", "serde_json", "serde_urlencoded", "smallvec", - "socket2", - "time 0.3.17", + "socket2 0.5.7", + "time", "url", ] [[package]] name = "actix-web-codegen" -version = "4.1.0" +version = "4.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb1f50ebbb30eca122b188319a4398b3f7bb4a8cdf50ecfb73bfc6a3c3ce54f5" +dependencies = [ + "actix-router", + "proc-macro2", + "quote", + "syn 2.0.65", +] + +[[package]] +name = "actix-web-lab" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fa9362663c8643d67b2d5eafba49e4cb2c8a053a29ed00a0bea121f17c76b13" +checksum = "7675c1a84eec1b179c844cdea8488e3e409d8e4984026e92fa96c87dd86f33c6" dependencies = [ + "actix-http", "actix-router", + "actix-service", + "actix-utils", + "actix-web", + "actix-web-lab-derive", + "ahash", + "arc-swap", + "async-trait", + "bytes", + "bytestring", + "csv", + "derive_more", + "futures-core", + "futures-util", + "http 0.2.12", + "impl-more", + "itertools", + "local-channel", + "mediatype", + "mime", + "once_cell", + "pin-project-lite", + "regex", + "serde", + "serde_html_form", + "serde_json", + "tokio", + "tokio-stream", + "tracing", +] + +[[package]] +name = "actix-web-lab-derive" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aa0b287c8de4a76b691f29dbb5451e8dd5b79d777eaf87350c9b0cbfdb5e968" +dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.65", +] + +[[package]] +name = "addr2line" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" +dependencies = [ + "gimli", ] [[package]] @@ -187,22 +248,35 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +[[package]] +name = "aes" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + [[package]] name = "ahash" -version = "0.7.6" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" dependencies = [ + "cfg-if", "getrandom", "once_cell", "version_check", + "zerocopy", ] [[package]] name = "aho-corasick" -version = "0.7.20" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" dependencies = [ "memchr", ] @@ -222,11 +296,17 @@ dependencies = [ "alloc-no-stdlib", ] +[[package]] +name = "allocator-api2" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" + [[package]] name = "amq-protocol" -version = "7.0.1" +version = "7.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acc7cad07d1b4533fcb46f0819a6126fa201fd0385469aba75e405424f3fe009" +checksum = "f051d4d77904272e9be7e292607378dc9900d15b8d314bfd3ed4b82fdd84f125" dependencies = [ "amq-protocol-tcp", "amq-protocol-types", @@ -238,9 +318,9 @@ dependencies = [ [[package]] name = "amq-protocol-tcp" -version = "7.0.1" +version = "7.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d8b20aba8c35a0b885e1e978eff456ced925730a4e012e63e4ff89a1deb602b" +checksum = "4e3d51dd36e67d757c9ba80a7b2a2a2a69254c1dbe4d8c631824ec7f5b69f60e" dependencies = [ "amq-protocol-uri", "tcp-stream", @@ -249,9 +329,9 @@ dependencies = [ [[package]] name = "amq-protocol-types" -version = "7.0.1" +version = "7.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e245e0e9083b6a6db5f8c10013074cb382266eb9e2a37204d19c651b8d3b8114" +checksum = "0acdd47054ced8b9bc89ee0dbb42ccc8028de48d8658b24de4c255a226c9bfec" dependencies = [ "cookie-factory", "nom", @@ -261,15 +341,21 @@ dependencies = [ [[package]] name = "amq-protocol-uri" -version = "7.0.1" +version = "7.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56987108bf48d2eb500cae8896cd9291564eedd8744776ecc5c3338a8b2ca5f8" +checksum = "f17881b7575dab3e71403f28a3e50b71f0d1bd026829abca3c48664522ce0df0" dependencies = [ "amq-protocol-types", "percent-encoding", "url", ] +[[package]] +name = "android-tzdata" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" + [[package]] name = "android_system_properties" version = "0.1.5" @@ -284,13 +370,17 @@ name = "api" version = "0.1.0" dependencies = [ "actix-web", + "actix-web-lab", "chrono", "envconfig", + "futures", "lapin", "lazy_static", "postgres", + "rand", "redis", "reqwest", + "rust-argon2", "serde", "serde_json", "serde_urlencoded", @@ -304,47 +394,98 @@ dependencies = [ [[package]] name = "arc-swap" -version = "1.5.1" +version = "1.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69f7f8c3906b62b754cd5326047894316021dcfe5a194c8ea52bdd94934a3457" + +[[package]] +name = "arrayref" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b4930d2cb77ce62f89ee5d5289b4ac049559b1c45539271f5ed4fdc7db34545" + +[[package]] +name = "arrayvec" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" + +[[package]] +name = "asn1-rs" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22ad1373757efa0f70ec53939aabc7152e1591cb485208052993070ac8d2429d" +dependencies = [ + "asn1-rs-derive", + "asn1-rs-impl", + "displaydoc", + "nom", + "num-traits", + "rusticata-macros", + "thiserror", + "time", +] + +[[package]] +name = "asn1-rs-derive" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "983cd8b9d4b02a6dc6ffa557262eb5858a27a0038ffffe21a0f133eaa819a164" +checksum = "7378575ff571966e99a744addeff0bff98b8ada0dedf1956d59e634db95eaac1" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.65", + "synstructure", +] + +[[package]] +name = "asn1-rs-impl" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b18050c2cd6fe86c3a76584ef5e0baf286d038cda203eb6223df2cc413565f7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.65", +] [[package]] name = "async-channel" -version = "1.7.1" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e14485364214912d3b19cc3435dde4df66065127f05fa0d75c712f36f12c2f28" +checksum = "89b47800b0be77592da0afd425cc03468052844aff33b84e33cc696f64e77b6a" dependencies = [ - "concurrent-queue 1.2.4", - "event-listener", + "concurrent-queue", + "event-listener-strategy 0.5.2", "futures-core", + "pin-project-lite", ] [[package]] name = "async-executor" -version = "1.5.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17adb73da160dfb475c183343c8cccd80721ea5a605d3eb57125f0a7b7a92d0b" +checksum = "b10202063978b3351199d68f8b22c4e47e4b1b822f8d43fd862d5ea8c006b29a" dependencies = [ - "async-lock", "async-task", - "concurrent-queue 2.0.0", - "fastrand", - "futures-lite", + "concurrent-queue", + "fastrand 2.1.0", + "futures-lite 2.3.0", "slab", ] [[package]] name = "async-global-executor" -version = "2.3.1" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1b6f5d7df27bd294849f8eec66ecfc63d11814df7a4f5d74168a2394467b776" +checksum = "05b1b633a2115cd122d73b955eadd9916c18c8f510ec9cd1686404c60ad1c29c" dependencies = [ "async-channel", "async-executor", - "async-io", - "async-lock", + "async-io 2.3.2", + "async-lock 3.3.0", "blocking", - "futures-lite", + "futures-lite 2.3.0", "once_cell", ] @@ -361,32 +502,61 @@ dependencies = [ [[package]] name = "async-io" -version = "1.10.0" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8121296a9f05be7f34aa4196b1747243b3b62e048bb7906f644f3fbfc490cf7" +checksum = "0fc5b45d93ef0529756f812ca52e44c221b35341892d3dcc34132ac02f3dd2af" dependencies = [ - "async-lock", + "async-lock 2.8.0", "autocfg", - "concurrent-queue 1.2.4", - "futures-lite", - "libc", + "cfg-if", + "concurrent-queue", + "futures-lite 1.13.0", "log", "parking", - "polling", + "polling 2.8.0", + "rustix 0.37.27", "slab", - "socket2", + "socket2 0.4.10", "waker-fn", - "winapi", +] + +[[package]] +name = "async-io" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcccb0f599cfa2f8ace422d3555572f47424da5648a4382a9dd0310ff8210884" +dependencies = [ + "async-lock 3.3.0", + "cfg-if", + "concurrent-queue", + "futures-io", + "futures-lite 2.3.0", + "parking", + "polling 3.7.0", + "rustix 0.38.34", + "slab", + "tracing", + "windows-sys 0.52.0", ] [[package]] name = "async-lock" -version = "2.6.0" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "287272293e9d8c41773cec55e365490fe034813a2f172f502d6ddcf75b2f582b" +dependencies = [ + "event-listener 2.5.3", +] + +[[package]] +name = "async-lock" +version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8101efe8695a6c17e02911402145357e718ac92d3ff88ae8419e84b1707b685" +checksum = "d034b430882f8381900d3fe6f0aaa3ad94f2cb4ac519b429692a1bc2dda4ae7b" dependencies = [ - "event-listener", - "futures-lite", + "event-listener 4.0.3", + "event-listener-strategy 0.4.0", + "pin-project-lite", ] [[package]] @@ -395,7 +565,7 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a6012d170ad00de56c9ee354aef2e358359deb1ec504254e0e5a3774771de0e" dependencies = [ - "async-io", + "async-io 1.13.0", "async-trait", "futures-core", "reactor-trait", @@ -403,47 +573,124 @@ dependencies = [ [[package]] name = "async-task" -version = "4.3.0" +version = "4.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a40729d2133846d9ed0ea60a8b9541bccddab49cd30f0715a1da672fe9a2524" +checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de" [[package]] name = "async-trait" -version = "0.1.58" +version = "0.1.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e805d94e6b5001b651426cf4cd446b1ab5f319d27bab5c644f61de0a804360c" +checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.65", ] [[package]] name = "atoi" -version = "1.0.0" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7c57d12312ff59c811c0643f4d80830505833c9ffaebd193d819392b265be8e" +checksum = "f28d99ec8bfea296261ca1af174f24225171fea9664ba9003cbebee704810528" dependencies = [ "num-traits", ] [[package]] name = "atomic-waker" -version = "1.0.0" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "065374052e7df7ee4047b1160cca5e1467a12351a40b3da123c870ba0b8eda2a" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" [[package]] name = "autocfg" -version = "1.1.0" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" + +[[package]] +name = "aws-lc-rs" +version = "1.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8487b59d62764df8231cb371c459314df895b41756df457a1fb1243d65c89195" +dependencies = [ + "aws-lc-sys", + "mirai-annotations", + "paste", + "zeroize", +] + +[[package]] +name = "aws-lc-sys" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c15eb61145320320eb919d9bab524617a7aa4216c78d342fae3a758bc33073e4" +dependencies = [ + "bindgen", + "cc", + "cmake", + "dunce", + "fs_extra", + "libc", + "paste", +] + +[[package]] +name = "backtrace" +version = "0.3.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +checksum = "26b05800d2e817c8b3b4b54abd461726265fa9789ae34330622f2db9ee696f9d" +dependencies = [ + "addr2line", + "cc", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", +] [[package]] name = "base64" -version = "0.13.1" +version = "0.21.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "base64ct" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" +checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" + +[[package]] +name = "bindgen" +version = "0.69.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a00dc851838a2120612785d195287475a3ac45514741da670b735818822129a0" +dependencies = [ + "bitflags 2.5.0", + "cexpr", + "clang-sys", + "itertools", + "lazy_static", + "lazycell", + "log", + "prettyplease", + "proc-macro2", + "quote", + "regex", + "rustc-hash", + "shlex", + "syn 2.0.65", + "which", +] [[package]] name = "bitflags" @@ -451,43 +698,63 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "bitflags" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" +dependencies = [ + "serde", +] + +[[package]] +name = "blake2b_simd" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23285ad32269793932e830392f2fe2f83e26488fd3ec778883a93c8323735780" +dependencies = [ + "arrayref", + "arrayvec", + "constant_time_eq", +] + [[package]] name = "block-buffer" -version = "0.10.3" +version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69cce20737498f97b993470a6e536b8523f0af7892a4f928cceb1ac5e52ebe7e" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" dependencies = [ "generic-array", ] [[package]] name = "block-padding" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a90ec2df9600c28a01c56c4784c9207a96d2451833aeceb8cc97e4c9548bb78" +checksum = "a8894febbff9f758034a5b8e12d87918f56dfc64a8e1fe757d65e29041538d93" dependencies = [ "generic-array", ] [[package]] name = "blocking" -version = "1.2.0" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6ccb65d468978a086b69884437ded69a90faab3bbe6e67f242173ea728acccc" +checksum = "495f7104e962b7356f0aeb34247aca1fe7d2e783b346582db7f2904cb5717e88" dependencies = [ "async-channel", + "async-lock 3.3.0", "async-task", - "atomic-waker", - "fastrand", - "futures-lite", - "once_cell", + "futures-io", + "futures-lite 2.3.0", + "piper", ] [[package]] name = "brotli" -version = "3.3.4" +version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1a0b1dbcc8ae29329621f8d4f0d835787c1c38bb1401979b49d13b0b305ff68" +checksum = "74f7971dbd9326d58187408ab83117d8ac1bb9c17b085fdacd1cf2f598719b6b" dependencies = [ "alloc-no-stdlib", "alloc-stdlib", @@ -496,9 +763,9 @@ dependencies = [ [[package]] name = "brotli-decompressor" -version = "2.3.2" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59ad2d4653bf5ca36ae797b1f4bb4dbddb60ce49ca4aed8a2ce4829f60425b80" +checksum = "e6221fe77a248b9117d431ad93761222e1cf8ff282d9d1d5d9f53d6299a1cf76" dependencies = [ "alloc-no-stdlib", "alloc-stdlib", @@ -506,37 +773,31 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.11.1" +version = "3.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "572f695136211188308f16ad2ca5c851a712c464060ae6974944458eb83880ba" +checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" [[package]] name = "byteorder" -version = "1.4.3" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.3.0" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfb24e866b15a1af2a1b663f10c6b6b8f397a84aadb828f12e5b289ec23a3a3c" +checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" [[package]] name = "bytestring" -version = "1.2.0" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7f83e57d9154148e355404702e2694463241880b939570d7c97c014da7a69a1" +checksum = "74d80203ea6b29df88012294f62733de21cfeab47f17b41af3a38bc30a03ee72" dependencies = [ "bytes", ] -[[package]] -name = "cache-padded" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1db59621ec70f09c5e9b597b220c7a2b43611f4710dc03ceb8748637775692c" - [[package]] name = "cbc" version = "0.1.2" @@ -548,11 +809,22 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.77" +version = "1.0.98" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9f73505338f7d905b19d18738976aae232eb46b8efc15554ffc56deb5d9ebe4" +checksum = "41c270e7540d725e65ac7f1b212ac8ce349719624d7bcff99f8e2e488e8cf03f" dependencies = [ "jobserver", + "libc", + "once_cell", +] + +[[package]] +name = "cexpr" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" +dependencies = [ + "nom", ] [[package]] @@ -563,45 +835,66 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.23" +version = "0.4.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16b0a3d9ed01224b22057780a37bb8c5dbfe1be8ba48678e7bf57ec4b385411f" +checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" dependencies = [ + "android-tzdata", "iana-time-zone", "js-sys", - "num-integer", "num-traits", "serde", - "time 0.1.44", "wasm-bindgen", - "winapi", + "windows-targets 0.52.5", ] [[package]] name = "cipher" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1873270f8f7942c191139cb8a40fd228da6c3fd2fc376d7e92d47aa14aeb59e" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" dependencies = [ "crypto-common", "inout", ] [[package]] -name = "codespan-reporting" -version = "0.11.1" +name = "clang-sys" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67523a3b4be3ce1989d607a828d036249522dd9c1c8de7f4dd2dae43a37369d1" +dependencies = [ + "glob", + "libc", + "libloading", +] + +[[package]] +name = "cmake" +version = "0.1.50" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a31c789563b815f77f4250caee12365734369f942439b7defd71e18a48197130" +dependencies = [ + "cc", +] + +[[package]] +name = "cms" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" +checksum = "7b77c319abfd5219629c45c34c89ba945ed3c5e49fcde9d16b6c3885f118a730" dependencies = [ - "termcolor", - "unicode-width", + "const-oid", + "der", + "spki", + "x509-cert", ] [[package]] name = "combine" -version = "4.6.6" +version = "4.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35ed6e9d84f0b51a7f52daf1c7d71dd136fd7a3f41a8462b8cdb8c78d920fad4" +checksum = "ba5a308b75df32fe02788e748662718f03fde005016435c444eea572398219fd" dependencies = [ "bytes", "futures-core", @@ -613,21 +906,24 @@ dependencies = [ [[package]] name = "concurrent-queue" -version = "1.2.4" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af4780a44ab5696ea9e28294517f1fffb421a83a25af521333c838635509db9c" +checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973" dependencies = [ - "cache-padded", + "crossbeam-utils", ] [[package]] -name = "concurrent-queue" -version = "2.0.0" +name = "const-oid" +version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd7bef69dc86e3c610e4e7aed41035e2a7ed12e72dd7530f61327a6579a4390b" -dependencies = [ - "crossbeam-utils", -] +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + +[[package]] +name = "constant_time_eq" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7144d30dcf0fafbce74250a3963025d8d52177934239851c917d29f1df280c2" [[package]] name = "convert_case" @@ -637,26 +933,26 @@ checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" [[package]] name = "cookie" -version = "0.16.1" +version = "0.16.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "344adc371239ef32293cb1c4fe519592fcf21206c79c02854320afcdf3ab4917" +checksum = "e859cd57d0710d9e06c381b550c06e76992472a8c6d527aecd2fc673dcc231fb" dependencies = [ "percent-encoding", - "time 0.3.17", + "time", "version_check", ] [[package]] name = "cookie-factory" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "396de984970346b0d9e93d1415082923c679e5ae5c3ee3dcbd104f5610af126b" +checksum = "9885fa71e26b8ab7855e2ec7cae6e9b380edff76cd052e07c683a0319d51b3a2" [[package]] name = "core-foundation" -version = "0.9.3" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" dependencies = [ "core-foundation-sys", "libc", @@ -664,61 +960,57 @@ dependencies = [ [[package]] name = "core-foundation-sys" -version = "0.8.3" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" +checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" [[package]] name = "cpufeatures" -version = "0.2.5" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28d997bd5e24a5928dd43e46dc529867e207907fe0b239c3477d924f7f2ca320" +checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" dependencies = [ "libc", ] [[package]] name = "crc" -version = "3.0.0" +version = "3.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53757d12b596c16c78b83458d732a5d1a17ab3f53f2f7412f6fb57cc8a140ab3" +checksum = "69e6e4d7b33a94f0991c26729976b10ebde1d34c3ee82408fb536164fa10d636" dependencies = [ "crc-catalog", ] [[package]] name = "crc-catalog" -version = "2.1.0" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d0165d2900ae6778e36e80bbc4da3b5eefccee9ba939761f9c2882a5d9af3ff" +checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5" [[package]] name = "crc32fast" -version = "1.3.2" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" +checksum = "b3855a8a784b474f333699ef2bbca9db2c4a1f6d9088a90a2d25b1eb53111eaa" dependencies = [ "cfg-if", ] [[package]] name = "crossbeam-queue" -version = "0.3.8" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1cfb3ea8a53f37c40dea2c7bedcbd88bdfae54f5e2175d6ecaff1c988353add" +checksum = "df0346b5d5e76ac2fe4e327c5fd1118d6be7c51dfb18f9b7922923f287471e35" dependencies = [ - "cfg-if", "crossbeam-utils", ] [[package]] name = "crossbeam-utils" -version = "0.8.14" +version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fb766fa798726286dbbb842f174001dab8abc7b627a1dd86e0b7222a95d929f" -dependencies = [ - "cfg-if", -] +checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" [[package]] name = "crypto-common" @@ -731,82 +1023,113 @@ dependencies = [ ] [[package]] -name = "cxx" -version = "1.0.82" +name = "csv" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4a41a86530d0fe7f5d9ea779916b7cadd2d4f9add748b99c2c029cbbdfaf453" +checksum = "ac574ff4d437a7b5ad237ef331c17ccca63c46479e5b5453eb8e10bb99a759fe" dependencies = [ - "cc", - "cxxbridge-flags", - "cxxbridge-macro", - "link-cplusplus", + "csv-core", + "itoa", + "ryu", + "serde", ] [[package]] -name = "cxx-build" -version = "1.0.82" +name = "csv-core" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06416d667ff3e3ad2df1cd8cd8afae5da26cf9cec4d0825040f88b5ca659a2f0" +checksum = "5efa2b3d7902f4b634a20cae3c9c4e6209dc4779feb6863329607560143efa70" dependencies = [ - "cc", - "codespan-reporting", - "once_cell", - "proc-macro2", - "quote", - "scratch", - "syn", + "memchr", ] [[package]] -name = "cxxbridge-flags" -version = "1.0.82" +name = "darling" +version = "0.20.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "820a9a2af1669deeef27cb271f476ffd196a2c4b6731336011e0ba63e2c7cf71" +checksum = "83b2eb4d90d12bdda5ed17de686c2acb4c57914f8f921b8da7e112b5a36f3fe1" +dependencies = [ + "darling_core", + "darling_macro", +] [[package]] -name = "cxxbridge-macro" -version = "1.0.82" +name = "darling_core" +version = "0.20.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a08a6e2fcc370a089ad3b4aaf54db3b1b4cee38ddabce5896b33eb693275f470" +checksum = "622687fe0bac72a04e5599029151f5796111b90f1baaa9b544d807a5e31cd120" dependencies = [ + "fnv", + "ident_case", "proc-macro2", "quote", - "syn", + "strsim", + "syn 2.0.65", ] [[package]] -name = "darling" -version = "0.14.2" +name = "darling_macro" +version = "0.20.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0dd3cd20dc6b5a876612a6e5accfe7f3dd883db6d07acfbf14c128f61550dfa" +checksum = "733cabb43482b1a1b53eee8583c2b9e8684d592215ea83efd305dd31bc2f0178" dependencies = [ "darling_core", - "darling_macro", + "quote", + "syn 2.0.65", ] [[package]] -name = "darling_core" -version = "0.14.2" +name = "data-encoding" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8566979429cf69b49a5c740c60791108e86440e8be149bbea4fe54d2c32d6e2" + +[[package]] +name = "der" +version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a784d2ccaf7c98501746bf0be29b2022ba41fd62a2e622af997a03e9f972859f" +checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" +dependencies = [ + "const-oid", + "der_derive", + "flagset", + "pem-rfc7468", + "zeroize", +] + +[[package]] +name = "der-parser" +version = "9.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5cd0a5c643689626bec213c4d8bd4d96acc8ffdb4ad4bb6bc16abf27d5f4b553" +dependencies = [ + "asn1-rs", + "displaydoc", + "nom", + "num-bigint", + "num-traits", + "rusticata-macros", +] + +[[package]] +name = "der_derive" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fe87ce4529967e0ba1dcf8450bab64d97dfd5010a6256187ffe2e43e6f0e049" dependencies = [ - "fnv", - "ident_case", "proc-macro2", "quote", - "strsim", - "syn", + "syn 2.0.65", ] [[package]] -name = "darling_macro" -version = "0.14.2" +name = "deranged" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7618812407e9402654622dd402b0a89dff9ba93badd6540781526117b92aab7e" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" dependencies = [ - "darling_core", - "quote", - "syn", + "powerfmt", + "serde", ] [[package]] @@ -819,7 +1142,7 @@ dependencies = [ "proc-macro2", "quote", "rustc_version", - "syn", + "syn 1.0.109", ] [[package]] @@ -833,33 +1156,25 @@ dependencies = [ [[package]] name = "digest" -version = "0.10.6" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer", + "const-oid", "crypto-common", "subtle", ] [[package]] -name = "dirs" -version = "4.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059" -dependencies = [ - "dirs-sys", -] - -[[package]] -name = "dirs-sys" -version = "0.3.7" +name = "displaydoc" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" +checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" dependencies = [ - "libc", - "redox_users", - "winapi", + "proc-macro2", + "quote", + "syn 2.0.65", ] [[package]] @@ -870,21 +1185,30 @@ checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10" [[package]] name = "dotenvy" -version = "0.15.6" +version = "0.15.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b" + +[[package]] +name = "dunce" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03d8c417d7a8cb362e0c37e5d815f5eb7c37f79ff93707329d5a194e42e54ca0" +checksum = "56ce8c6da7551ec6c462cbaf3bfbc75131ebbfa1c944aeaa9dab51ca1c5f0c3b" [[package]] name = "either" -version = "1.8.0" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797" +checksum = "3dca9240753cf90908d7e4aac30f630662b02aebaa1b58a3cadabdb23385b58b" +dependencies = [ + "serde", +] [[package]] name = "encoding_rs" -version = "0.8.31" +version = "0.8.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9852635589dc9f9ea1b6fe9f05b50ef208c85c834a562f0c6abb1c475736ec2b" +checksum = "b45de904aa0b010bce2ab45264d0631681847fa7b6f2eaa7dab7619943bc4f59" dependencies = [ "cfg-if", ] @@ -906,7 +1230,34 @@ checksum = "7dfca278e5f84b45519acaaff758ebfa01f18e96998bc24b8f1b722dd804b9bf" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", +] + +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + +[[package]] +name = "errno" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + +[[package]] +name = "etcetera" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "136d1b5283a1ab77bd9257427ffd09d8667ced0570b6f938942bc7568ed5b943" +dependencies = [ + "cfg-if", + "home", + "windows-sys 0.48.0", ] [[package]] @@ -915,6 +1266,48 @@ version = "2.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" +[[package]] +name = "event-listener" +version = "4.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67b215c49b2b248c855fb73579eb1f4f26c38ffdc12973e20e07b91d78d5646e" +dependencies = [ + "concurrent-queue", + "parking", + "pin-project-lite", +] + +[[package]] +name = "event-listener" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d9944b8ca13534cdfb2800775f8dd4902ff3fc75a50101466decadfdf322a24" +dependencies = [ + "concurrent-queue", + "parking", + "pin-project-lite", +] + +[[package]] +name = "event-listener-strategy" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "958e4d70b6d5e81971bebec42271ec641e7ff4e170a6fa605f2b8a8b65cb97d3" +dependencies = [ + "event-listener 4.0.3", + "pin-project-lite", +] + +[[package]] +name = "event-listener-strategy" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f214dc438f977e6d4e3500aaa277f5ad94ca83fbbd9b1a15713ce2344ccc5a1" +dependencies = [ + "event-listener 5.3.0", + "pin-project-lite", +] + [[package]] name = "executor-trait" version = "2.1.0" @@ -932,18 +1325,36 @@ checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" [[package]] name = "fastrand" -version = "1.8.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7a407cfaa3385c4ae6b23e84623d48c2798d06e3e6a1878f7f59f17b3f86499" +checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" dependencies = [ "instant", ] +[[package]] +name = "fastrand" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" + +[[package]] +name = "finl_unicode" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fcfdc7a0362c9f4444381a9e697c79d435fe65b52a37466fc2c1184cee9edc6" + +[[package]] +name = "flagset" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdeb3aa5e95cf9aabc17f060cfa0ced7b83f042390760ca53bf09df9968acaa1" + [[package]] name = "flate2" -version = "1.0.24" +version = "1.0.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f82b0f4c27ad9f8bfd1f3208d882da2b09c301bc1c828fd3a00d0216d2fbbff6" +checksum = "5f54427cfd1c7829e2a139fcefea601bf088ebca651d2bf53ebc600eac295dae" dependencies = [ "crc32fast", "miniz_oxide", @@ -951,14 +1362,13 @@ dependencies = [ [[package]] name = "flume" -version = "0.10.14" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1657b4441c3403d9f7b3409e47575237dac27b1b5726df654a6ecbf92f0f7577" +checksum = "55ac459de2512911e4b674ce33cf20befaba382d05b62b008afc1c8b57cbf181" dependencies = [ "futures-core", "futures-sink", - "pin-project", - "spin 0.9.4", + "spin 0.9.8", ] [[package]] @@ -984,18 +1394,24 @@ checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" [[package]] name = "form_urlencoded" -version = "1.1.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" dependencies = [ "percent-encoding", ] +[[package]] +name = "fs_extra" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c" + [[package]] name = "futures" -version = "0.3.25" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38390104763dc37a5145a53c29c63c1290b5d316d6086ec32c293f6736051bb0" +checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" dependencies = [ "futures-channel", "futures-core", @@ -1008,9 +1424,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.25" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52ba265a92256105f45b719605a571ffe2d1f0fea3807304b522c1d778f79eed" +checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" dependencies = [ "futures-core", "futures-sink", @@ -1018,15 +1434,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.25" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04909a7a7e4633ae6c4a9ab280aeb86da1236243a77b694a49eacd659a4bd3ac" +checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" [[package]] name = "futures-executor" -version = "0.3.25" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7acc85df6714c176ab5edf386123fafe217be88c0840ec11f199441134a074e2" +checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" dependencies = [ "futures-core", "futures-task", @@ -1035,28 +1451,28 @@ dependencies = [ [[package]] name = "futures-intrusive" -version = "0.4.2" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a604f7a68fbf8103337523b1fadc8ade7361ee3f112f7c680ad179651616aed5" +checksum = "1d930c203dd0b6ff06e0201a4a2fe9149b43c684fd4420555b26d21b1a02956f" dependencies = [ "futures-core", "lock_api", - "parking_lot 0.11.2", + "parking_lot", ] [[package]] name = "futures-io" -version = "0.3.25" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00f5fb52a06bdcadeb54e8d3671f8888a39697dcb0b81b23b55174030427f4eb" +checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" [[package]] name = "futures-lite" -version = "1.12.0" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7694489acd39452c77daa48516b894c153f192c3578d5a839b62c58099fcbf48" +checksum = "49a9d51ce47660b1e808d3c990b4709f2f415d928835a17dfd16991515c46bce" dependencies = [ - "fastrand", + "fastrand 1.9.0", "futures-core", "futures-io", "memchr", @@ -1065,34 +1481,47 @@ dependencies = [ "waker-fn", ] +[[package]] +name = "futures-lite" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52527eb5074e35e9339c6b4e8d12600c7128b68fb25dcb9fa9dec18f7c25f3a5" +dependencies = [ + "fastrand 2.1.0", + "futures-core", + "futures-io", + "parking", + "pin-project-lite", +] + [[package]] name = "futures-macro" -version = "0.3.25" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdfb8ce053d86b91919aad980c220b1fb8401a9394410e1c289ed7e66b61835d" +checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.65", ] [[package]] name = "futures-sink" -version = "0.3.25" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39c15cf1a4aa79df40f1bb462fb39676d0ad9e366c2a33b590d7c66f4f81fcf9" +checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" [[package]] name = "futures-task" -version = "0.3.25" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ffb393ac5d9a6eaa9d3fdf37ae2776656b706e200c8e16b1bdb227f5198e6ea" +checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" [[package]] name = "futures-util" -version = "0.3.25" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "197676987abd2f9cadff84926f410af1c183608d36641465df73ae8211dc65d6" +checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" dependencies = [ "futures-channel", "futures-core", @@ -1108,9 +1537,9 @@ dependencies = [ [[package]] name = "generic-array" -version = "0.14.6" +version = "0.14.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bff49e947297f3312447abdca79f45f4738097cc82b06e72054d2223f601f1b9" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ "typenum", "version_check", @@ -1118,28 +1547,59 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.8" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", "libc", - "wasi 0.11.0+wasi-snapshot-preview1", + "wasi", ] +[[package]] +name = "gimli" +version = "0.28.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" + +[[package]] +name = "glob" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" + [[package]] name = "h2" -version = "0.3.15" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f9f29bc9dda355256b2916cf526ab02ce0aeaaaf2bad60d65ef3f12f11dd0f4" +checksum = "81fe527a889e1532da5c525686d96d4c2e74cdd345badf8dfef9f6b39dd5f5e8" dependencies = [ "bytes", "fnv", "futures-core", "futures-sink", "futures-util", - "http", - "indexmap", + "http 0.2.12", + "indexmap 2.2.6", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "h2" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa82e28a107a8cc405f0839610bdc9b15f1e25ec7d696aa5cf173edbcb1486ab" +dependencies = [ + "atomic-waker", + "bytes", + "fnv", + "futures-core", + "futures-sink", + "http 1.1.0", + "indexmap 2.2.6", "slab", "tokio", "tokio-util", @@ -1151,36 +1611,40 @@ name = "hashbrown" version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + +[[package]] +name = "hashbrown" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" dependencies = [ "ahash", + "allocator-api2", ] [[package]] name = "hashlink" -version = "0.8.1" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69fe1fcf8b4278d860ad0548329f892a3631fb63f82574df68275f34cdbe0ffa" +checksum = "e8094feaf31ff591f651a2664fb9cfd92bba7a60ce3197265e9482ebe753c8f7" dependencies = [ - "hashbrown", + "hashbrown 0.14.5", ] [[package]] name = "heck" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" dependencies = [ "unicode-segmentation", ] [[package]] name = "hermit-abi" -version = "0.1.19" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" -dependencies = [ - "libc", -] +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" [[package]] name = "hex" @@ -1190,9 +1654,9 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] name = "hkdf" -version = "0.12.3" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "791a029f6b9fc27657f6f188ec6e5e43f6911f6f878e0dc5501396e09809d437" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" dependencies = [ "hmac", ] @@ -1206,11 +1670,31 @@ dependencies = [ "digest", ] +[[package]] +name = "home" +version = "0.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" +dependencies = [ + "windows-sys 0.52.0", +] + [[package]] name = "http" -version = "0.2.8" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75f43d41e26995c17e71ee126451dd3941010b0514a81a9d11f3b341debc2399" +checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" dependencies = [ "bytes", "fnv", @@ -1219,12 +1703,24 @@ dependencies = [ [[package]] name = "http-body" -version = "0.4.5" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643" +dependencies = [ + "bytes", + "http 1.1.0", +] + +[[package]] +name = "http-body-util" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" +checksum = "0475f8b2ac86659c21b64320d5d653f9efe42acd2a4e560073ec61a155a34f1d" dependencies = [ "bytes", - "http", + "futures-core", + "http 1.1.0", + "http-body", "pin-project-lite", ] @@ -1236,69 +1732,87 @@ checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" [[package]] name = "httpdate" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" [[package]] name = "hyper" -version = "0.14.23" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "034711faac9d2166cb1baf1a2fb0b60b1f277f8492fd72176c17f3515e1abd3c" +checksum = "fe575dd17d0862a9a33781c8c4696a55c320909004a67a00fb286ba8b1bc496d" dependencies = [ "bytes", "futures-channel", - "futures-core", "futures-util", - "h2", - "http", + "h2 0.4.5", + "http 1.1.0", "http-body", "httparse", - "httpdate", "itoa", "pin-project-lite", - "socket2", + "smallvec", "tokio", - "tower-service", - "tracing", "want", ] [[package]] name = "hyper-tls" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" +checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" dependencies = [ "bytes", + "http-body-util", "hyper", + "hyper-util", "native-tls", "tokio", "tokio-native-tls", + "tower-service", +] + +[[package]] +name = "hyper-util" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca38ef113da30126bbff9cd1705f9273e15d45498615d138b0c20279ac7a76aa" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "http 1.1.0", + "http-body", + "hyper", + "pin-project-lite", + "socket2 0.5.7", + "tokio", + "tower", + "tower-service", + "tracing", ] [[package]] name = "iana-time-zone" -version = "0.1.53" +version = "0.1.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64c122667b287044802d6ce17ee2ddf13207ed924c712de9a66a5814d5b64765" +checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141" dependencies = [ "android_system_properties", "core-foundation-sys", "iana-time-zone-haiku", "js-sys", "wasm-bindgen", - "winapi", + "windows-core", ] [[package]] name = "iana-time-zone-haiku" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0703ae284fc167426161c2e3f1da3ea71d94b21bedbcc9494e92b28e334e3dca" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" dependencies = [ - "cxx", - "cxx-build", + "cc", ] [[package]] @@ -1309,22 +1823,39 @@ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" [[package]] name = "idna" -version = "0.3.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6" +checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" dependencies = [ "unicode-bidi", "unicode-normalization", ] +[[package]] +name = "impl-more" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "206ca75c9c03ba3d4ace2460e57b189f39f43de612c2f85836e65c929701bb2d" + [[package]] name = "indexmap" -version = "1.9.2" +version = "1.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" dependencies = [ "autocfg", - "hashbrown", + "hashbrown 0.12.3", + "serde", +] + +[[package]] +name = "indexmap" +version = "2.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" +dependencies = [ + "equivalent", + "hashbrown 0.14.5", "serde", ] @@ -1340,48 +1871,59 @@ dependencies = [ [[package]] name = "instant" -version = "0.1.12" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +checksum = "e0242819d153cba4b4b05a5a8f2a7e9bbf97b6055b2a002b395c96b5ff3c0222" dependencies = [ "cfg-if", ] +[[package]] +name = "io-lifetimes" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" +dependencies = [ + "hermit-abi", + "libc", + "windows-sys 0.48.0", +] + [[package]] name = "ipnet" -version = "2.5.1" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f88c5561171189e69df9d98bcf18fd5f9558300f7ea7b801eb8a0fd748bd8745" +checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" [[package]] name = "itertools" -version = "0.10.5" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" dependencies = [ "either", ] [[package]] name = "itoa" -version = "1.0.4" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4217ad341ebadf8d8e724e264f13e593e0648f5b3e94b3896a5df283be015ecc" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "jobserver" -version = "0.1.25" +version = "0.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "068b1ee6743e4d11fb9c6a1e6064b3693a1b600e7f5f5988047d98b3dc9fb90b" +checksum = "d2b099aaa34a9751c5bf0878add70444e1ed2dd73f347be99003d4577277de6e" dependencies = [ "libc", ] [[package]] name = "js-sys" -version = "0.3.60" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49409df3e3bf0856b916e2ceaca09ee28e6871cf7d9ce97a692cacfdb2a25a47" +checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" dependencies = [ "wasm-bindgen", ] @@ -1394,9 +1936,9 @@ checksum = "d4345964bb142484797b161f473a503a434de77149dd8c7427788c6e13379388" [[package]] name = "lapin" -version = "2.1.1" +version = "2.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd03ea5831b44775e296239a64851e2fd14a80a363d202ba147009ffc994ff0f" +checksum = "fae02c316a8a5922ce7518afa6b6c00e9a099f8e59587567e3331efdd11b8ceb" dependencies = [ "amq-protocol", "async-global-executor-trait", @@ -1406,7 +1948,7 @@ dependencies = [ "flume", "futures-core", "futures-io", - "parking_lot 0.12.1", + "parking_lot", "pinky-swear", "reactor-trait", "serde", @@ -1419,45 +1961,83 @@ name = "lazy_static" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +dependencies = [ + "spin 0.5.2", +] + +[[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.137" +version = "0.2.155" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc7fcc620a3bff7cdd7a365be3376c97191aeaccc2a603e600951e452615bf89" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" [[package]] -name = "link-cplusplus" -version = "1.0.7" +name = "libloading" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c2a198fb6b0eada2a8df47933734e6d35d350665a33a3593d7164fa52c75c19" +dependencies = [ + "cfg-if", + "windows-targets 0.52.5", +] + +[[package]] +name = "libm" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" + +[[package]] +name = "libsqlite3-sys" +version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9272ab7b96c9046fbc5bc56c06c117cb639fe2d509df0c421cad82d2915cf369" +checksum = "cf4e226dcd58b4be396f7bd3c20da8fdee2911400705297ba7d2d7cc2c30f716" dependencies = [ "cc", + "pkg-config", + "vcpkg", ] +[[package]] +name = "linux-raw-sys" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" + +[[package]] +name = "linux-raw-sys" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" + [[package]] name = "local-channel" -version = "0.1.3" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f303ec0e94c6c54447f84f3b0ef7af769858a9c4ef56ef2a986d3dcd4c3fc9c" +checksum = "b6cbc85e69b8df4b8bb8b89ec634e7189099cea8927a276b7384ce5488e53ec8" dependencies = [ "futures-core", "futures-sink", - "futures-util", "local-waker", ] [[package]] name = "local-waker" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e34f76eb3611940e0e7d53a9aaa4e6a3151f69541a282fd0dad5571420c53ff1" +checksum = "4d873d7c67ce09b42110d801813efbc9364414e356be9935700d368351657487" [[package]] name = "lock_api" -version = "0.4.9" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df" +checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" dependencies = [ "autocfg", "scopeguard", @@ -1465,12 +2045,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.17" +version = "0.4.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" -dependencies = [ - "cfg-if", -] +checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" [[package]] name = "matchers" @@ -1478,29 +2055,36 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" dependencies = [ - "regex-automata", + "regex-automata 0.1.10", ] [[package]] name = "md-5" -version = "0.10.5" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6365506850d44bff6e2fbcb5176cf63650e48bd45ef2fe2665ae1570e0f4b9ca" +checksum = "d89e7ee0cfbedfc4da3340218492196241d89eefb6dab27de5df917a6d2e78cf" dependencies = [ + "cfg-if", "digest", ] +[[package]] +name = "mediatype" +version = "0.19.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8878cd8d1b3c8c8ae4b2ba0a36652b7cf192f618a599a7fbdfa25cffd4ea72dd" + [[package]] name = "memchr" -version = "2.5.0" +version = "2.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" [[package]] name = "mime" -version = "0.3.16" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" [[package]] name = "minimal-lexical" @@ -1510,25 +2094,37 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" -version = "0.5.4" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96590ba8f175222643a85693f33d26e9c8a015f599c216509b1a6894af675d34" +checksum = "87dfd01fe195c66b572b37921ad8803d010623c0aca821bea2302239d155cdae" dependencies = [ "adler", ] [[package]] name = "mio" -version = "0.8.5" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5d732bc30207a6423068df043e3d02e0735b155ad7ce1a6f76fe2baa5b158de" +checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" dependencies = [ "libc", "log", - "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys 0.42.0", + "wasi", + "windows-sys 0.48.0", ] +[[package]] +name = "mirai-annotations" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9be0862c1b3f26a88803c4a49de6889c10e608b3ee9344e6ef5b45fb37ad3d1" + +[[package]] +name = "mutually_exclusive_features" +version = "0.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d02c0b00610773bb7fc61d85e13d86c7858cbdf00e1a120bfc41bc055dbaa0e" + [[package]] name = "native-tls" version = "0.2.11" @@ -1549,9 +2145,9 @@ dependencies = [ [[package]] name = "nom" -version = "7.1.1" +version = "7.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8903e5a29a317527874d0402f867152a3d21c908bb0b933e416c65e301d4c36" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" dependencies = [ "memchr", "minimal-lexical", @@ -1567,48 +2163,110 @@ dependencies = [ "winapi", ] +[[package]] +name = "num-bigint" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c165a9ab64cf766f73521c0dd2cfdff64f488b8f0b3e621face3462d3db536d7" +dependencies = [ + "num-integer", + "num-traits", +] + +[[package]] +name = "num-bigint-dig" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc84195820f291c7697304f3cbdadd1cb7199c0efc917ff5eafd71225c136151" +dependencies = [ + "byteorder", + "lazy_static", + "libm", + "num-integer", + "num-iter", + "num-traits", + "rand", + "smallvec", + "zeroize", +] + +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + [[package]] name = "num-integer" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-iter" version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" dependencies = [ "autocfg", + "num-integer", "num-traits", ] [[package]] name = "num-traits" -version = "0.2.15" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", + "libm", ] [[package]] name = "num_cpus" -version = "1.14.0" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6058e64324c71e02bc2b150e4f3bc8286db6c83092132ffa3f6b1eab0f9def5" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ "hermit-abi", "libc", ] +[[package]] +name = "object" +version = "0.32.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" +dependencies = [ + "memchr", +] + +[[package]] +name = "oid-registry" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c958dd45046245b9c3c2547369bb634eb461670b2e7e0de552905801a648d1d" +dependencies = [ + "asn1-rs", +] + [[package]] name = "once_cell" -version = "1.16.0" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "openssl" -version = "0.10.42" +version = "0.10.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12fc0523e3bd51a692c8850d075d74dc062ccf251c0110668cbd921917118a13" +checksum = "95a0481286a310808298130d22dd1fef0fa571e05a8f44ec801801e84b216b1f" dependencies = [ - "bitflags", + "bitflags 2.5.0", "cfg-if", "foreign-types", "libc", @@ -1619,13 +2277,13 @@ dependencies = [ [[package]] name = "openssl-macros" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b501e44f11665960c7e7fcf062c7d96a14ade4aa98116c004b2e37b5be7d736c" +checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.65", ] [[package]] @@ -1636,11 +2294,10 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.77" +version = "0.9.102" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b03b84c3b2d099b81f0953422b4d4ad58761589d0229b5506356afca05a3670a" +checksum = "c597637d56fbc83893a35eb0dd04b2b8e7a50c91e64e9493e398b5df4fb45fa2" dependencies = [ - "autocfg", "cc", "libc", "pkg-config", @@ -1654,131 +2311,130 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" [[package]] -name = "p12" -version = "0.6.3" +name = "p12-keystore" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4873306de53fe82e7e484df31e1e947d61514b6ea2ed6cd7b45d63006fd9224" +checksum = "fbd7792ed56836118732faffa19b8c2bb20d5f3ff8b403002cd817d6c4ffc96c" dependencies = [ "cbc", - "cipher", + "cms", + "der", "des", - "getrandom", + "hex", "hmac", - "lazy_static", + "pkcs12", + "pkcs5", + "rand", "rc2", - "sha1 0.10.5", - "yasna", + "sha1", + "sha2", + "thiserror", + "x509-parser", ] [[package]] name = "parking" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "427c3892f9e783d91cc128285287e70a59e206ca452770ece88a76f7a3eddd72" - -[[package]] -name = "parking_lot" -version = "0.11.2" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" -dependencies = [ - "instant", - "lock_api", - "parking_lot_core 0.8.5", -] +checksum = "bb813b8af86854136c6922af0598d719255ecb2179515e6e7730d468f05c9cae" [[package]] name = "parking_lot" -version = "0.12.1" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +checksum = "7e4af0ca4f6caed20e900d564c242b8e5d4903fdacf31d3daf527b66fe6f42fb" dependencies = [ "lock_api", - "parking_lot_core 0.9.4", + "parking_lot_core", ] [[package]] name = "parking_lot_core" -version = "0.8.5" +version = "0.9.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216" +checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" dependencies = [ "cfg-if", - "instant", "libc", - "redox_syscall", + "redox_syscall 0.5.1", "smallvec", - "winapi", + "windows-targets 0.52.5", ] [[package]] -name = "parking_lot_core" -version = "0.9.4" +name = "paste" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dc9e0dc2adc1c69d09143aff38d3d30c5c3f0df0dad82e6d25547af174ebec0" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + +[[package]] +name = "pbkdf2" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2" dependencies = [ - "cfg-if", - "libc", - "redox_syscall", - "smallvec", - "windows-sys 0.42.0", + "digest", + "hmac", ] [[package]] -name = "paste" -version = "1.0.9" +name = "pem-rfc7468" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1de2e551fb905ac83f73f7aedf2f0cb4a0da7e35efa24a202a936269f1f18e1" +checksum = "88b39c9bfcfc231068454382784bb460aae594343fb030d46e9f50a645418412" +dependencies = [ + "base64ct", +] [[package]] name = "percent-encoding" -version = "2.2.0" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "phf" -version = "0.11.1" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "928c6535de93548188ef63bb7c4036bd415cd8f36ad25af44b9789b2ee72a48c" +checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc" dependencies = [ "phf_shared", ] [[package]] name = "phf_shared" -version = "0.11.1" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1fb5f6f826b772a8d4c0394209441e7d37cbbb967ae9c7e0e8134365c9ee676" +checksum = "90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b" dependencies = [ "siphasher", ] [[package]] name = "pin-project" -version = "1.0.12" +version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad29a609b6bcd67fee905812e544992d216af9d755757c05ed2d0e15a74c6ecc" +checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.0.12" +version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "069bdb1e05adc7a8990dce9cc75370895fbe4e3d58b9b73bf1aee56359344a55" +checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.65", ] [[package]] name = "pin-project-lite" -version = "0.2.9" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" +checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" [[package]] name = "pin-utils" @@ -1788,41 +2444,120 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pinky-swear" -version = "6.1.0" +version = "6.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d894b67aa7a4bf295db5e85349078c604edaa6fa5c8721e8eca3c7729a27f2ac" +checksum = "6cfae3ead413ca051a681152bd266438d3bfa301c9bdf836939a14c721bb2a21" dependencies = [ "doc-comment", "flume", - "parking_lot 0.12.1", + "parking_lot", "tracing", ] +[[package]] +name = "piper" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "464db0c665917b13ebb5d453ccdec4add5658ee1adc7affc7677615356a8afaf" +dependencies = [ + "atomic-waker", + "fastrand 2.1.0", + "futures-io", +] + +[[package]] +name = "pkcs1" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8ffb9f10fa047879315e6625af03c164b16962a5368d724ed16323b68ace47f" +dependencies = [ + "der", + "pkcs8", + "spki", +] + +[[package]] +name = "pkcs12" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "695b3df3d3cc1015f12d70235e35b6b79befc5fa7a9b95b951eab1dd07c9efc2" +dependencies = [ + "cms", + "const-oid", + "der", + "digest", + "spki", + "x509-cert", + "zeroize", +] + +[[package]] +name = "pkcs5" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e847e2c91a18bfa887dd028ec33f2fe6f25db77db3619024764914affe8b69a6" +dependencies = [ + "aes", + "cbc", + "der", + "pbkdf2", + "scrypt", + "sha2", + "spki", +] + +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der", + "spki", +] + [[package]] name = "pkg-config" -version = "0.3.26" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160" +checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" [[package]] name = "polling" -version = "2.4.0" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab4609a838d88b73d8238967b60dd115cc08d38e2bbaf51ee1e4b695f89122e2" +checksum = "4b2d323e8ca7996b3e23126511a523f7e62924d93ecd5ae73b333815b0eb3dce" dependencies = [ "autocfg", + "bitflags 1.3.2", "cfg-if", + "concurrent-queue", "libc", "log", - "wepoll-ffi", - "winapi", + "pin-project-lite", + "windows-sys 0.48.0", +] + +[[package]] +name = "polling" +version = "3.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "645493cf344456ef24219d02a768cf1fb92ddf8c92161679ae3d91b91a637be3" +dependencies = [ + "cfg-if", + "concurrent-queue", + "hermit-abi", + "pin-project-lite", + "rustix 0.38.34", + "tracing", + "windows-sys 0.52.0", ] [[package]] name = "postgres" -version = "0.19.4" +version = "0.19.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "960c214283ef8f0027974c03e9014517ced5db12f021a9abb66185a5751fab0a" +checksum = "7915b33ed60abc46040cbcaa25ffa1c7ec240668e0477c4f3070786f5916d451" dependencies = [ "bytes", "fallible-iterator", @@ -1834,11 +2569,11 @@ dependencies = [ [[package]] name = "postgres-protocol" -version = "0.6.4" +version = "0.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "878c6cbf956e03af9aa8204b407b9cbf47c072164800aa918c516cd4b056c50c" +checksum = "49b6c5ef183cd3ab4ba005f1ca64c21e8bd97ce4699cfea9e8d9a2c4958ca520" dependencies = [ - "base64", + "base64 0.21.7", "byteorder", "bytes", "fallible-iterator", @@ -1852,35 +2587,51 @@ dependencies = [ [[package]] name = "postgres-types" -version = "0.2.4" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73d946ec7d256b04dfadc4e6a3292324e6f417124750fc5c0950f981b703a0f1" +checksum = "8d2234cdee9408b523530a9b6d2d6b373d1db34f6a8e51dc03ded1828d7fb67c" dependencies = [ "bytes", "fallible-iterator", "postgres-protocol", ] +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + [[package]] name = "ppv-lite86" version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" +[[package]] +name = "prettyplease" +version = "0.2.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f12335488a2f3b0a83b14edad48dca9879ce89b2edd10e80237e4e852dd645e" +dependencies = [ + "proc-macro2", + "syn 2.0.65", +] + [[package]] name = "proc-macro2" -version = "1.0.47" +version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ea3d908b0e36316caf9e9e2c4625cdde190a7e6f440d794667ed17a1855e725" +checksum = "0b33eb56c327dec362a9e55b3ad14f9d2f0904fb5a5b03b513ab5465399e9f43" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.21" +version = "1.0.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179" +checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" dependencies = [ "proc-macro2", ] @@ -1937,9 +2688,9 @@ dependencies = [ [[package]] name = "redis" -version = "0.21.6" +version = "0.25.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "571c252c68d09a2ad3e49edd14e9ee48932f3e0f27b06b4ea4c9b2a706d31103" +checksum = "6472825949c09872e8f2c50bde59fcefc17748b6be5c90fd67cd8b4daca73bfd" dependencies = [ "arc-swap", "async-trait", @@ -1951,41 +2702,42 @@ dependencies = [ "percent-encoding", "pin-project-lite", "ryu", - "sha1 0.6.1", + "sha1_smol", + "socket2 0.5.7", "tokio", + "tokio-retry", "tokio-util", "url", ] [[package]] name = "redox_syscall" -version = "0.2.16" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" dependencies = [ - "bitflags", + "bitflags 1.3.2", ] [[package]] -name = "redox_users" -version = "0.4.3" +name = "redox_syscall" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" +checksum = "469052894dcb553421e483e4209ee581a45100d31b4018de03e5a7ad86374a7e" dependencies = [ - "getrandom", - "redox_syscall", - "thiserror", + "bitflags 2.5.0", ] [[package]] name = "regex" -version = "1.7.0" +version = "1.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e076559ef8e241f2ae3479e36f97bd5741c0330689e217ad51ce2c76808b868a" +checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c" dependencies = [ "aho-corasick", "memchr", - "regex-syntax", + "regex-automata 0.4.6", + "regex-syntax 0.8.3", ] [[package]] @@ -1994,40 +2746,56 @@ version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" dependencies = [ - "regex-syntax", + "regex-syntax 0.6.29", +] + +[[package]] +name = "regex-automata" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax 0.8.3", ] +[[package]] +name = "regex-lite" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30b661b2f27137bdbc16f00eda72866a92bb28af1753ffbd56744fb6e2e9cd8e" + [[package]] name = "regex-syntax" -version = "0.6.28" +version = "0.6.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" +checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] -name = "remove_dir_all" -version = "0.5.3" +name = "regex-syntax" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" -dependencies = [ - "winapi", -] +checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" [[package]] name = "reqwest" -version = "0.11.13" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68cc60575865c7831548863cc02356512e3f1dc2f3f82cb837d7fc4cc8f3c97c" +checksum = "566cafdd92868e0939d3fb961bd0dc25fcfaaed179291093b3d43e6b3150ea10" dependencies = [ - "base64", + "base64 0.22.1", "bytes", "encoding_rs", "futures-core", "futures-util", - "h2", - "http", + "h2 0.4.5", + "http 1.1.0", "http-body", + "http-body-util", "hyper", "hyper-tls", + "hyper-util", "ipnet", "js-sys", "log", @@ -2036,9 +2804,12 @@ dependencies = [ "once_cell", "percent-encoding", "pin-project-lite", + "rustls-pemfile 2.1.2", "serde", "serde_json", "serde_urlencoded", + "sync_wrapper", + "system-configuration", "tokio", "tokio-native-tls", "tower-service", @@ -2051,19 +2822,62 @@ dependencies = [ [[package]] name = "ring" -version = "0.16.20" +version = "0.17.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" +checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" dependencies = [ "cc", + "cfg-if", + "getrandom", "libc", - "once_cell", - "spin 0.5.2", + "spin 0.9.8", "untrusted", - "web-sys", - "winapi", + "windows-sys 0.52.0", +] + +[[package]] +name = "rsa" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d0e5124fcb30e76a7e79bfee683a2746db83784b86289f6251b54b7950a0dfc" +dependencies = [ + "const-oid", + "digest", + "num-bigint-dig", + "num-integer", + "num-traits", + "pkcs1", + "pkcs8", + "rand_core", + "signature", + "spki", + "subtle", + "zeroize", +] + +[[package]] +name = "rust-argon2" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d9848531d60c9cbbcf9d166c885316c24bc0e2a9d3eba0956bb6cbbd79bc6e8" +dependencies = [ + "base64 0.21.7", + "blake2b_simd", + "constant_time_eq", ] +[[package]] +name = "rustc-demangle" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" + +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + [[package]] name = "rustc_version" version = "0.4.0" @@ -2073,84 +2887,187 @@ dependencies = [ "semver", ] +[[package]] +name = "rusticata-macros" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "faf0c4a6ece9950b9abdb62b1cfcf2a68b3b67a10ba445b3bb85be2a293d0632" +dependencies = [ + "nom", +] + +[[package]] +name = "rustix" +version = "0.37.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fea8ca367a3a01fe35e6943c400addf443c0f57670e6ec51196f71a4b8762dd2" +dependencies = [ + "bitflags 1.3.2", + "errno", + "io-lifetimes", + "libc", + "linux-raw-sys 0.3.8", + "windows-sys 0.48.0", +] + +[[package]] +name = "rustix" +version = "0.38.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" +dependencies = [ + "bitflags 2.5.0", + "errno", + "libc", + "linux-raw-sys 0.4.14", + "windows-sys 0.52.0", +] + [[package]] name = "rustls" -version = "0.20.7" +version = "0.21.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "539a2bfe908f471bfa933876bd1eb6a19cf2176d375f82ef7f99530a40e48c2c" +checksum = "3f56a14d1f48b391359b22f731fd4bd7e43c97f3c50eee276f3aa09c94784d3e" dependencies = [ - "log", "ring", + "rustls-webpki 0.101.7", "sct", - "webpki", +] + +[[package]] +name = "rustls" +version = "0.23.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebbbdb961df0ad3f2652da8f3fdc4b36122f568f968f45ad3316f26c025c677b" +dependencies = [ + "aws-lc-rs", + "log", + "once_cell", + "rustls-pki-types", + "rustls-webpki 0.102.4", + "subtle", + "zeroize", ] [[package]] name = "rustls-connector" -version = "0.16.1" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c6a18f8d10f71bce9bca6eaeb80429460e652f3bcf0381f0c5f8954abf7b3b8" +checksum = "727a826801254b6cfcd2508a0508c01b7c1bca21d3673e84d86da084781b83d5" dependencies = [ "log", - "rustls", + "rustls 0.23.7", "rustls-native-certs", - "webpki", + "rustls-pki-types", + "rustls-webpki 0.102.4", ] [[package]] name = "rustls-native-certs" -version = "0.6.2" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0167bac7a9f490495f3c33013e7722b53cb087ecbe082fb0c6387c96f634ea50" +checksum = "8f1fb85efa936c42c6d5fc28d2629bb51e4b2f4b8a5211e297d599cc5a093792" dependencies = [ "openssl-probe", - "rustls-pemfile", + "rustls-pemfile 2.1.2", + "rustls-pki-types", "schannel", "security-framework", ] [[package]] name = "rustls-pemfile" -version = "1.0.1" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" +dependencies = [ + "base64 0.21.7", +] + +[[package]] +name = "rustls-pemfile" +version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0864aeff53f8c05aa08d86e5ef839d3dfcf07aeba2db32f12db0ef716e87bd55" +checksum = "29993a25686778eb88d4189742cd713c9bce943bc54251a33509dc63cbacf73d" dependencies = [ - "base64", + "base64 0.22.1", + "rustls-pki-types", +] + +[[package]] +name = "rustls-pki-types" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "976295e77ce332211c0d24d92c0e83e50f5c5f046d11082cea19f3df13a3562d" + +[[package]] +name = "rustls-webpki" +version = "0.101.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" +dependencies = [ + "ring", + "untrusted", +] + +[[package]] +name = "rustls-webpki" +version = "0.102.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff448f7e92e913c4b7d4c6d8e4540a1724b319b4152b8aef6d4cf8339712b33e" +dependencies = [ + "aws-lc-rs", + "ring", + "rustls-pki-types", + "untrusted", ] [[package]] name = "ryu" -version = "1.0.11" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" + +[[package]] +name = "salsa20" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09" +checksum = "97a22f5af31f73a954c10289c93e8a50cc23d971e80ee446f1f6f7137a088213" +dependencies = [ + "cipher", +] [[package]] name = "schannel" -version = "0.1.20" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88d6731146462ea25d9244b2ed5fd1d716d25c52e4d54aa4fb0f3c4e9854dbe2" +checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534" dependencies = [ - "lazy_static", - "windows-sys 0.36.1", + "windows-sys 0.52.0", ] [[package]] name = "scopeguard" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] -name = "scratch" -version = "1.0.2" +name = "scrypt" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8132065adcfd6e02db789d9285a0deb2f3fcb04002865ab67d5fb103533898" +checksum = "0516a385866c09368f0b5bcd1caff3366aace790fcd46e2bb032697bb172fd1f" +dependencies = [ + "pbkdf2", + "salsa20", + "sha2", +] [[package]] name = "sct" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" +checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" dependencies = [ "ring", "untrusted", @@ -2158,11 +3075,11 @@ dependencies = [ [[package]] name = "security-framework" -version = "2.7.0" +version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bc1bb97804af6631813c55739f771071e0f2ed33ee20b68c86ec505d906356c" +checksum = "c627723fd09706bacdb5cf41499e95098555af3c3c29d014dc3c458ef6be11c0" dependencies = [ - "bitflags", + "bitflags 2.5.0", "core-foundation", "core-foundation-sys", "libc", @@ -2171,9 +3088,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.6.1" +version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0160a13a177a45bfb43ce71c01580998474f556ad854dcbca936dd2841a5c556" +checksum = "317936bbbd05227752583946b9e66d7ce3b489f84e11a94a510b4437fef407d7" dependencies = [ "core-foundation-sys", "libc", @@ -2181,35 +3098,48 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.14" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e25dfac463d778e353db5be2449d1cce89bd6fd23c9f1ea21310ce6e5a1b29c4" +checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" [[package]] name = "serde" -version = "1.0.147" +version = "1.0.202" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d193d69bae983fc11a79df82342761dfbf28a99fc8d203dca4c3c1b590948965" +checksum = "226b61a0d411b2ba5ff6d7f73a476ac4f8bb900373459cd00fab8512828ba395" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.147" +version = "1.0.202" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f1d362ca8fc9c3e3a7484440752472d68a6caa98f1ab81d99b5dfe517cec852" +checksum = "6048858004bcff69094cd972ed40a32500f153bd3be9f716b2eed2e8217c4838" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.65", +] + +[[package]] +name = "serde_html_form" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8de514ef58196f1fc96dcaef80fe6170a1ce6215df9687a93fe8300e773fefc5" +dependencies = [ + "form_urlencoded", + "indexmap 2.2.6", + "itoa", + "ryu", + "serde", ] [[package]] name = "serde_json" -version = "1.0.89" +version = "1.0.117" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "020ff22c755c2ed3f8cf162dbb41a7268d934702f3ed3631656ea597e08fc3db" +checksum = "455182ea6142b14f93f4bc5320a2b31c1f266b66a4a5c858b013302a5d8cbfc3" dependencies = [ "itoa", "ryu", @@ -2230,46 +3160,39 @@ dependencies = [ [[package]] name = "serde_with" -version = "2.1.0" +version = "3.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25bf4a5a814902cd1014dbccfa4d4560fb8432c779471e96e035602519f82eef" +checksum = "0ad483d2ab0149d5a5ebcd9972a3852711e0153d863bf5a5d0391d28883c4a20" dependencies = [ - "base64", + "base64 0.22.1", "chrono", "hex", - "indexmap", + "indexmap 1.9.3", + "indexmap 2.2.6", "serde", + "serde_derive", "serde_json", "serde_with_macros", - "time 0.3.17", + "time", ] [[package]] name = "serde_with_macros" -version = "2.1.0" +version = "3.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3452b4c0f6c1e357f73fdb87cd1efabaa12acf328c7a528e252893baeb3f4aa" +checksum = "65569b702f41443e8bc8bbb1c5779bd0450bbe723b56198980e80ec45780bce2" dependencies = [ "darling", "proc-macro2", "quote", - "syn", + "syn 2.0.65", ] [[package]] name = "sha1" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1da05c97445caa12d05e848c4a4fcbbea29e748ac28f7e80e9b010392063770" -dependencies = [ - "sha1_smol", -] - -[[package]] -name = "sha1" -version = "0.10.5" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3" +checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" dependencies = [ "cfg-if", "cpufeatures", @@ -2284,9 +3207,9 @@ checksum = "ae1a47186c03a32177042e55dbc5fd5aee900b8e0069a8d70fba96a9375cd012" [[package]] name = "sha2" -version = "0.10.6" +version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" dependencies = [ "cfg-if", "cpufeatures", @@ -2295,53 +3218,79 @@ dependencies = [ [[package]] name = "sharded-slab" -version = "0.1.4" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "900fba806f70c630b0a382d0d825e17a0f19fcd059a2ade1ff237bcddf446b31" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" dependencies = [ "lazy_static", ] +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + [[package]] name = "signal-hook-registry" -version = "1.4.0" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51e73328dc4ac0c7ccbda3a494dfa03df1de2f46018127f60c693f2648455b0" +checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1" dependencies = [ "libc", ] +[[package]] +name = "signature" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +dependencies = [ + "digest", + "rand_core", +] + [[package]] name = "siphasher" -version = "0.3.10" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7bd3e3206899af3f8b12af284fafc038cc1dc2b41d1b89dd17297221c5d225de" +checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" [[package]] name = "slab" -version = "0.4.7" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4614a76b2a8be0058caa9dbbaf66d988527d86d003c11a94fbd335d7661edcef" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" dependencies = [ "autocfg", ] [[package]] name = "smallvec" -version = "1.10.0" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "socket2" -version = "0.4.7" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02e2d2db9033d13a1567121ddd7a095ee144db4e1ca1b1bda3419bc0da294ebd" +checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d" dependencies = [ "libc", "winapi", ] +[[package]] +name = "socket2" +version = "0.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + [[package]] name = "spin" version = "0.5.2" @@ -2350,18 +3299,28 @@ checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" [[package]] name = "spin" -version = "0.9.4" +version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f6002a767bff9e83f8eeecf883ecb8011875a21ae8da43bffb817a57e78cc09" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" dependencies = [ "lock_api", ] +[[package]] +name = "spki" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +dependencies = [ + "base64ct", + "der", +] + [[package]] name = "sqlformat" -version = "0.2.0" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f87e292b4291f154971a43c3774364e2cbcaec599d3f5bf6fa9d122885dbc38a" +checksum = "ce81b7bd7c4493975347ef60d8c7e8b742d4694f4c49f93e0a12ea263938176c" dependencies = [ "itertools", "nom", @@ -2370,125 +3329,233 @@ dependencies = [ [[package]] name = "sqlx" -version = "0.6.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9249290c05928352f71c077cc44a464d880c63f26f7534728cca008e135c0428" +checksum = "c9a2ccff1a000a5a59cd33da541d9f2fdcd9e6e8229cc200565942bff36d0aaa" dependencies = [ "sqlx-core", "sqlx-macros", + "sqlx-mysql", + "sqlx-postgres", + "sqlx-sqlite", +] + +[[package]] +name = "sqlx-core" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24ba59a9342a3d9bab6c56c118be528b27c9b60e490080e9711a04dccac83ef6" +dependencies = [ + "ahash", + "atoi", + "byteorder", + "bytes", + "chrono", + "crc", + "crossbeam-queue", + "either", + "event-listener 2.5.3", + "futures-channel", + "futures-core", + "futures-intrusive", + "futures-io", + "futures-util", + "hashlink", + "hex", + "indexmap 2.2.6", + "log", + "memchr", + "once_cell", + "paste", + "percent-encoding", + "rustls 0.21.12", + "rustls-pemfile 1.0.4", + "serde", + "serde_json", + "sha2", + "smallvec", + "sqlformat", + "thiserror", + "tokio", + "tokio-stream", + "tracing", + "url", + "webpki-roots", +] + +[[package]] +name = "sqlx-macros" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ea40e2345eb2faa9e1e5e326db8c34711317d2b5e08d0d5741619048a803127" +dependencies = [ + "proc-macro2", + "quote", + "sqlx-core", + "sqlx-macros-core", + "syn 1.0.109", +] + +[[package]] +name = "sqlx-macros-core" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5833ef53aaa16d860e92123292f1f6a3d53c34ba8b1969f152ef1a7bb803f3c8" +dependencies = [ + "dotenvy", + "either", + "heck", + "hex", + "once_cell", + "proc-macro2", + "quote", + "serde", + "serde_json", + "sha2", + "sqlx-core", + "sqlx-mysql", + "sqlx-postgres", + "sqlx-sqlite", + "syn 1.0.109", + "tempfile", + "tokio", + "url", +] + +[[package]] +name = "sqlx-mysql" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ed31390216d20e538e447a7a9b959e06ed9fc51c37b514b46eb758016ecd418" +dependencies = [ + "atoi", + "base64 0.21.7", + "bitflags 2.5.0", + "byteorder", + "bytes", + "chrono", + "crc", + "digest", + "dotenvy", + "either", + "futures-channel", + "futures-core", + "futures-io", + "futures-util", + "generic-array", + "hex", + "hkdf", + "hmac", + "itoa", + "log", + "md-5", + "memchr", + "once_cell", + "percent-encoding", + "rand", + "rsa", + "serde", + "sha1", + "sha2", + "smallvec", + "sqlx-core", + "stringprep", + "thiserror", + "tracing", + "whoami", ] [[package]] -name = "sqlx-core" -version = "0.6.2" +name = "sqlx-postgres" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcbc16ddba161afc99e14d1713a453747a2b07fc097d2009f4c300ec99286105" +checksum = "7c824eb80b894f926f89a0b9da0c7f435d27cdd35b8c655b114e58223918577e" dependencies = [ - "ahash", "atoi", - "base64", - "bitflags", + "base64 0.21.7", + "bitflags 2.5.0", "byteorder", - "bytes", "chrono", "crc", - "crossbeam-queue", - "dirs", "dotenvy", - "either", - "event-listener", + "etcetera", "futures-channel", "futures-core", - "futures-intrusive", + "futures-io", "futures-util", - "hashlink", "hex", "hkdf", "hmac", - "indexmap", + "home", "itoa", - "libc", "log", "md-5", "memchr", "once_cell", - "paste", - "percent-encoding", "rand", - "rustls", - "rustls-pemfile", "serde", "serde_json", - "sha1 0.10.5", "sha2", "smallvec", - "sqlformat", - "sqlx-rt", + "sqlx-core", "stringprep", "thiserror", - "tokio-stream", - "url", - "webpki-roots", + "tracing", "whoami", ] [[package]] -name = "sqlx-macros" -version = "0.6.2" +name = "sqlx-sqlite" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b850fa514dc11f2ee85be9d055c512aa866746adfacd1cb42d867d68e6a5b0d9" +checksum = "b244ef0a8414da0bed4bb1910426e890b19e5e9bccc27ada6b797d05c55ae0aa" dependencies = [ - "dotenvy", - "either", - "heck", - "once_cell", - "proc-macro2", - "quote", - "sha2", + "atoi", + "chrono", + "flume", + "futures-channel", + "futures-core", + "futures-executor", + "futures-intrusive", + "futures-util", + "libsqlite3-sys", + "log", + "percent-encoding", + "serde", "sqlx-core", - "sqlx-rt", - "syn", + "tracing", "url", -] - -[[package]] -name = "sqlx-rt" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24c5b2d25fa654cc5f841750b8e1cdedbe21189bf9a9382ee90bfa9dd3562396" -dependencies = [ - "once_cell", - "tokio", - "tokio-rustls", + "urlencoding", ] [[package]] name = "stringprep" -version = "0.1.2" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ee348cb74b87454fff4b551cbf727025810a004f88aeacae7f85b87f4e9a1c1" +checksum = "bb41d74e231a107a1b4ee36bd1214b11285b77768d2e3824aedafa988fd36ee6" dependencies = [ + "finl_unicode", "unicode-bidi", "unicode-normalization", ] [[package]] name = "strsim" -version = "0.10.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "subtle" -version = "2.4.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" +checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" [[package]] name = "syn" -version = "1.0.103" +version = "1.0.109" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a864042229133ada95abf3b54fdc62ef5ccabe9515b64717bcb9a1919e59445d" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" dependencies = [ "proc-macro2", "quote", @@ -2496,87 +3563,118 @@ dependencies = [ ] [[package]] -name = "tcp-stream" -version = "0.24.4" +name = "syn" +version = "2.0.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09a4b0a70bac0a58ca6a7659d1328e34ee462339c70b0fa49f72bad1f278910a" +checksum = "d2863d96a84c6439701d7a38f9de935ec562c8832cc55d1dde0f513b52fad106" dependencies = [ - "cfg-if", - "p12", - "rustls-connector", - "rustls-pemfile", + "proc-macro2", + "quote", + "unicode-ident", ] [[package]] -name = "tempfile" -version = "3.3.0" +name = "sync_wrapper" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" +checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" + +[[package]] +name = "synstructure" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" dependencies = [ - "cfg-if", - "fastrand", + "proc-macro2", + "quote", + "syn 2.0.65", +] + +[[package]] +name = "system-configuration" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" +dependencies = [ + "bitflags 1.3.2", + "core-foundation", + "system-configuration-sys", +] + +[[package]] +name = "system-configuration-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" +dependencies = [ + "core-foundation-sys", "libc", - "redox_syscall", - "remove_dir_all", - "winapi", ] [[package]] -name = "termcolor" -version = "1.1.3" +name = "tcp-stream" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "495b0abdce3dc1f8fd27240651c9e68890c14e9d9c61527b1ce44d8a5a7bd3d5" +dependencies = [ + "cfg-if", + "p12-keystore", + "rustls-connector", + "rustls-pemfile 2.1.2", +] + +[[package]] +name = "tempfile" +version = "3.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" +checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" dependencies = [ - "winapi-util", + "cfg-if", + "fastrand 2.1.0", + "rustix 0.38.34", + "windows-sys 0.52.0", ] [[package]] name = "thiserror" -version = "1.0.37" +version = "1.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10deb33631e3c9018b9baf9dcbbc4f737320d2b576bac10f6aefa048fa407e3e" +checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.37" +version = "1.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "982d17546b47146b28f7c22e3d08465f6b8903d0ea13c1660d9d84a6e7adcdbb" +checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.65", ] [[package]] name = "thread_local" -version = "1.1.4" +version = "1.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5516c27b78311c50bf42c071425c560ac799b11c30b31f87e3081965fe5e0180" +checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c" dependencies = [ + "cfg-if", "once_cell", ] [[package]] name = "time" -version = "0.1.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" -dependencies = [ - "libc", - "wasi 0.10.0+wasi-snapshot-preview1", - "winapi", -] - -[[package]] -name = "time" -version = "0.3.17" +version = "0.3.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a561bf4617eebd33bca6434b988f39ed798e527f51a1e797d0ee4f61c0a38376" +checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" dependencies = [ + "deranged", "itoa", + "num-conv", + "powerfmt", "serde", "time-core", "time-macros", @@ -2584,16 +3682,17 @@ dependencies = [ [[package]] name = "time-core" -version = "0.1.0" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e153e1f1acaef8acc537e68b44906d2db6436e2b35ac2c6b42640fff91f00fd" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.6" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d967f99f534ca7e495c575c62638eebc2898a8c84c119b89e250477bc4ba16b2" +checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" dependencies = [ + "num-conv", "time-core", ] @@ -2608,46 +3707,45 @@ dependencies = [ [[package]] name = "tinyvec_macros" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.22.0" +version = "1.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d76ce4a75fb488c605c54bf610f221cea8b0dafb53333c1a67e8ee199dcd2ae3" +checksum = "1adbebffeca75fcfd058afa480fb6c0b81e165a0323f9c9d39c9697e37c46787" dependencies = [ - "autocfg", + "backtrace", "bytes", "libc", - "memchr", "mio", "num_cpus", - "parking_lot 0.12.1", + "parking_lot", "pin-project-lite", "signal-hook-registry", - "socket2", + "socket2 0.5.7", "tokio-macros", - "winapi", + "windows-sys 0.48.0", ] [[package]] name = "tokio-macros" -version = "1.8.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9724f9a975fb987ef7a3cd9be0350edcbe130698af5b8f7a631e23d42d052484" +checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.65", ] [[package]] name = "tokio-native-tls" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7d995660bd2b7f8c1568414c1126076c13fbb725c40112dc0120b78eb9b717b" +checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" dependencies = [ "native-tls", "tokio", @@ -2655,9 +3753,9 @@ dependencies = [ [[package]] name = "tokio-postgres" -version = "0.7.7" +version = "0.7.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29a12c1b3e0704ae7dfc25562629798b29c72e6b1d0a681b6f29ab4ae5e7f7bf" +checksum = "d340244b32d920260ae7448cb72b6e238bddc3d4f7603394e7dd46ed8e48f5b8" dependencies = [ "async-trait", "byteorder", @@ -2666,33 +3764,35 @@ dependencies = [ "futures-channel", "futures-util", "log", - "parking_lot 0.12.1", + "parking_lot", "percent-encoding", "phf", "pin-project-lite", "postgres-protocol", "postgres-types", - "socket2", + "rand", + "socket2 0.5.7", "tokio", "tokio-util", + "whoami", ] [[package]] -name = "tokio-rustls" -version = "0.23.4" +name = "tokio-retry" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c43ee83903113e03984cb9e5cebe6c04a5116269e900e3ddba8f068a62adda59" +checksum = "7f57eb36ecbe0fc510036adff84824dd3c24bb781e21bfa67b69d556aa85214f" dependencies = [ - "rustls", + "pin-project", + "rand", "tokio", - "webpki", ] [[package]] name = "tokio-stream" -version = "0.1.11" +version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d660770404473ccd7bc9f8b28494a811bc18542b915c0855c51e8f419d5223ce" +checksum = "267ac89e0bec6e691e5813911606935d77c476ff49024f98abcea3e7b15e37af" dependencies = [ "futures-core", "pin-project-lite", @@ -2701,18 +3801,39 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.4" +version = "0.7.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bb2e075f03b3d66d8d8785356224ba688d2906a371015e225beeb65ca92c740" +checksum = "9cf6b47b3771c49ac75ad09a6162f53ad4b8088b76ac60e8ec1455b31a189fe1" dependencies = [ "bytes", "futures-core", "futures-sink", "pin-project-lite", "tokio", +] + +[[package]] +name = "tower" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" +dependencies = [ + "futures-core", + "futures-util", + "pin-project", + "pin-project-lite", + "tokio", + "tower-layer", + "tower-service", "tracing", ] +[[package]] +name = "tower-layer" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" + [[package]] name = "tower-service" version = "0.3.2" @@ -2721,11 +3842,10 @@ checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" [[package]] name = "tracing" -version = "0.1.37" +version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ - "cfg-if", "log", "pin-project-lite", "tracing-attributes", @@ -2734,11 +3854,12 @@ dependencies = [ [[package]] name = "tracing-actix-web" -version = "0.6.2" +version = "0.7.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d725b8fa6ef307b3f4856913523337de45c47cc79271bafd7acfb39559e3a2da" +checksum = "fa069bd1503dd526ee793bb3fce408895136c95fc86d2edb2acf1c646d7f0684" dependencies = [ "actix-web", + "mutually_exclusive_features", "pin-project", "tracing", "uuid", @@ -2746,20 +3867,20 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.23" +version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4017f8f45139870ca7e672686113917c71c7a6e02d4924eda67186083c03081a" +checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.65", ] [[package]] name = "tracing-core" -version = "0.1.30" +version = "0.1.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24eb03ba0eab1fd845050058ce5e616558e8f8d8fca633e6b163fe25c797213a" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" dependencies = [ "once_cell", "valuable", @@ -2767,20 +3888,20 @@ dependencies = [ [[package]] name = "tracing-log" -version = "0.1.3" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ddad33d2d10b1ed7eb9d1f518a5674713876e97e5bb9b7345a7984fbb4f922" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" dependencies = [ - "lazy_static", "log", + "once_cell", "tracing-core", ] [[package]] name = "tracing-subscriber" -version = "0.3.16" +version = "0.3.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6176eae26dd70d0c919749377897b54a9276bd7061339665dd68777926b5a70" +checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" dependencies = [ "matchers", "nu-ansi-term", @@ -2795,48 +3916,42 @@ dependencies = [ [[package]] name = "try-lock" -version = "0.2.3" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] name = "typenum" -version = "1.15.0" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] name = "unicode-bidi" -version = "0.3.8" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" +checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" [[package]] name = "unicode-ident" -version = "1.0.5" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ceab39d59e4c9499d4e5a8ee0e2735b891bb7308ac83dfb4e80cad195c9f6f3" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "unicode-normalization" -version = "0.1.22" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5" dependencies = [ "tinyvec", ] [[package]] name = "unicode-segmentation" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fdbf052a0783de01e944a6ce7a8cb939e295b1e7be835a1112c3b9a7f047a5a" - -[[package]] -name = "unicode-width" -version = "0.1.10" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" +checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" [[package]] name = "unicode_categories" @@ -2846,26 +3961,32 @@ checksum = "39ec24b3121d976906ece63c9daad25b85969647682eee313cb5779fdd69e14e" [[package]] name = "untrusted" -version = "0.7.1" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "url" -version = "2.3.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643" +checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" dependencies = [ "form_urlencoded", "idna", "percent-encoding", ] +[[package]] +name = "urlencoding" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" + [[package]] name = "uuid" -version = "1.2.2" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "422ee0de9031b5b948b97a8fc04e3aa35230001a722ddd27943e0be31564ce4c" +checksum = "a183cf7feeba97b4dd1c0d46788634f6221d87fa961b305bed08c851829efcc0" dependencies = [ "getrandom", ] @@ -2890,37 +4011,36 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "waker-fn" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d5b2c62b4012a3e1eca5a7e077d13b3bf498c4073e33ccd58626607748ceeca" +checksum = "317211a0dc0ceedd78fb2ca9a44aed3d7b9b26f81870d485c07122b4350673b7" [[package]] name = "want" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" dependencies = [ - "log", "try-lock", ] [[package]] name = "wasi" -version = "0.10.0+wasi-snapshot-preview1" +version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" +name = "wasite" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" +checksum = "b8dad83b4f25e74f184f64c43b150b91efe7647395b42289f38e50566d82855b" [[package]] name = "wasm-bindgen" -version = "0.2.83" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eaf9f5aceeec8be17c128b2e93e031fb8a4d469bb9c4ae2d7dc1888b26887268" +checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -2928,24 +4048,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.83" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c8ffb332579b0557b52d268b91feab8df3615f265d5270fec2a8c95b17c1142" +checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn", + "syn 2.0.65", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.33" +version = "0.4.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23639446165ca5a5de86ae1d8896b737ae80319560fbaa4c2887b7da6e7ebd7d" +checksum = "76bc14366121efc8dbb487ab05bcc9d346b3b5ec0eaa76e46594cabbe51762c0" dependencies = [ "cfg-if", "js-sys", @@ -2955,9 +4075,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.83" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "052be0f94026e6cbc75cdefc9bae13fd6052cdcaf532fa6c45e7ae33a1e6c810" +checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -2965,69 +4085,59 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.83" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c" +checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.65", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.83" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f" +checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" [[package]] name = "web-sys" -version = "0.3.60" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcda906d8be16e728fd5adc5b729afad4e444e106ab28cd1c7256e54fa61510f" +checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef" dependencies = [ "js-sys", "wasm-bindgen", ] -[[package]] -name = "webpki" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f095d78192e208183081cc07bc5515ef55216397af48b873e5edcd72637fa1bd" -dependencies = [ - "ring", - "untrusted", -] - [[package]] name = "webpki-roots" -version = "0.22.5" +version = "0.25.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "368bfe657969fb01238bb756d351dcade285e0f6fcbd36dcb23359a5169975be" -dependencies = [ - "webpki", -] +checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1" [[package]] -name = "wepoll-ffi" -version = "0.1.2" +name = "which" +version = "4.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d743fdedc5c64377b5fc2bc036b01c7fd642205a0d96356034ae3404d49eb7fb" +checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" dependencies = [ - "cc", + "either", + "home", + "once_cell", + "rustix 0.38.34", ] [[package]] name = "whoami" -version = "1.2.3" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6631b6a2fd59b1841b622e8f1a7ad241ef0a46f2d580464ce8140ac94cbd571" +checksum = "a44ab49fad634e88f55bf8f9bb3abd2f27d7204172a112c7c9987e01c1c94ea9" dependencies = [ - "bumpalo", - "wasm-bindgen", + "redox_syscall 0.4.1", + "wasite", "web-sys", ] @@ -3048,160 +4158,247 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] -name = "winapi-util" -version = "0.1.5" +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows-core" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" dependencies = [ - "winapi", + "windows-targets 0.52.5", ] [[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" +name = "windows-sys" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.5", +] [[package]] name = "windows-sys" -version = "0.36.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows_aarch64_msvc 0.36.1", - "windows_i686_gnu 0.36.1", - "windows_i686_msvc 0.36.1", - "windows_x86_64_gnu 0.36.1", - "windows_x86_64_msvc 0.36.1", + "windows-targets 0.52.5", ] [[package]] -name = "windows-sys" -version = "0.42.0" +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + +[[package]] +name = "windows-targets" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" +checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc 0.42.0", - "windows_i686_gnu 0.42.0", - "windows_i686_msvc 0.42.0", - "windows_x86_64_gnu 0.42.0", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc 0.42.0", + "windows_aarch64_gnullvm 0.52.5", + "windows_aarch64_msvc 0.52.5", + "windows_i686_gnu 0.52.5", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.5", + "windows_x86_64_gnu 0.52.5", + "windows_x86_64_gnullvm 0.52.5", + "windows_x86_64_msvc 0.52.5", ] [[package]] name = "windows_aarch64_gnullvm" -version = "0.42.0" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e" +checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" [[package]] name = "windows_aarch64_msvc" -version = "0.36.1" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_aarch64_msvc" -version = "0.42.0" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4" +checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" [[package]] name = "windows_i686_gnu" -version = "0.36.1" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_gnu" -version = "0.42.0" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7" +checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" [[package]] name = "windows_i686_msvc" -version = "0.36.1" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_i686_msvc" -version = "0.42.0" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246" +checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" [[package]] name = "windows_x86_64_gnu" -version = "0.36.1" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnu" -version = "0.42.0" +version = "0.52.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_gnullvm" -version = "0.42.0" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028" +checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" [[package]] name = "windows_x86_64_msvc" -version = "0.36.1" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "windows_x86_64_msvc" -version = "0.42.0" +version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5" +checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" [[package]] name = "winreg" -version = "0.10.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d" +checksum = "a277a57398d4bfa075df44f501a17cfdf8542d224f0d36095a2adc7aee4ef0a5" dependencies = [ - "winapi", + "cfg-if", + "windows-sys 0.48.0", ] [[package]] -name = "yasna" -version = "0.5.0" +name = "x509-cert" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1301e935010a701ae5f8655edc0ad17c44bad3ac5ce8c39185f75453b720ae94" +dependencies = [ + "const-oid", + "der", + "spki", +] + +[[package]] +name = "x509-parser" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcbc162f30700d6f3f82a24bf7cc62ffe7caea42c0b2cba8bf7f3ae50cf51f69" +dependencies = [ + "asn1-rs", + "data-encoding", + "der-parser", + "lazy_static", + "nom", + "oid-registry", + "rusticata-macros", + "thiserror", + "time", +] + +[[package]] +name = "zerocopy" +version = "0.7.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae87e3fcd617500e5d106f0380cf7b77f3c6092aae37191433159dda23cfb087" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "15e934569e47891f7d9411f1a451d947a60e000ab3bd24fbb970f000387d1b3b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.65", +] + +[[package]] +name = "zeroize" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "346d34a236c9d3e5f3b9b74563f238f955bbd05fa0b8b4efa53c130c43982f4c" +checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" [[package]] name = "zstd" -version = "0.11.2+zstd.1.5.2" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20cc960326ece64f010d2d2107537f26dc589a6573a316bd5b1dba685fa5fde4" +checksum = "2d789b1514203a1120ad2429eae43a7bd32b90976a7bb8a05f7ec02fa88cc23a" dependencies = [ "zstd-safe", ] [[package]] name = "zstd-safe" -version = "5.0.2+zstd.1.5.2" +version = "7.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d2a5585e04f9eea4b2a3d1eca508c4dee9592a89ef6f450c11719da0726f4db" +checksum = "1cd99b45c6bc03a018c8b8a86025678c87e55526064e38f9df301989dce7ec0a" dependencies = [ - "libc", "zstd-sys", ] [[package]] name = "zstd-sys" -version = "2.0.1+zstd.1.5.2" +version = "2.0.10+zstd.1.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fd07cbbc53846d9145dbffdf6dd09a7a0aa52be46741825f5c97bdd4f73f12b" +checksum = "c253a4914af5bafc8fa8c86ee400827e83cf6ec01195ec1f1ed8441bf00d65aa" dependencies = [ "cc", - "libc", + "pkg-config", ] diff --git a/Cargo.toml b/Cargo.toml index fdae9e7..13d207d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,23 +9,27 @@ edition = "2021" lazy_static = "1.4" actix-web = "4" envconfig = "0.10.0" -serde_with = "2.1.0" +serde_with = "3.8.1" serde_json = "1.0" serde_urlencoded = "0.7" -serde = { version = "1.0.144", features = ["derive"] } +serde = { version = "1.0.202", features = ["derive"] } tracing = "0.1" -tracing-actix-web = "0.6" -tracing-subscriber = { version = "0.3.1", default-features = false, features = ["fmt", "ansi", "env-filter", "registry", "tracing-log"] } -reqwest = { version = "0.11", features = ["json"] } +tracing-actix-web = "0.7" +tracing-subscriber = { version = "0.3.18", default-features = false, features = ["fmt", "ansi", "env-filter", "registry", "tracing-log"] } +reqwest = { version = "0.12", features = ["json"] } tokio = { version = "1", features = ["full"] } -chrono = "0.4.23" -sqlx = { version = "0.6", features = [ "runtime-tokio-rustls", "postgres", "chrono" ] } -postgres = "0.19.4" -redis = {version ="0.21.5", features = ["tokio-comp", "connection-manager"]} -lapin = "2.1.1" +chrono = "0.4.38" +sqlx = { version = "0.7", features = [ "runtime-tokio-rustls", "postgres", "chrono" ] } +postgres = "0.19.7" +redis = {version ="0.25.3", features = ["tokio-comp", "connection-manager"]} +lapin = "2.3.4" +futures = "0.3" +rand = "0.8.5" +rust-argon2 = "2.1.0" +actix-web-lab = "0.20.2" [profile.release] lto = true codegen-units = 1 panic = 'abort' -strip = true \ No newline at end of file +strip = true diff --git a/README.md b/README.md index c9c2252..cfa9bf3 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,9 @@ # Dustin API -This time in rust. +There is probably a lot of better ways to do many of the things I've done here, but this is one of the first things I've done in rust, make suggestions if you see anything done weirdly! -Used for tracking spotify playing data, eventually will be used for uploading files using multipart formdata to minio. +## Used for + +- Spotify History and Now Playing API / Queue Messages +- **WIP:** Blog System *(SOON)* +- ~~File and Screenshot Uploads~~ *(SOON, After blog system)* \ No newline at end of file diff --git a/src/config.rs b/src/config.rs index e927900..3a605f1 100644 --- a/src/config.rs +++ b/src/config.rs @@ -2,6 +2,9 @@ use envconfig::Envconfig; #[derive(Envconfig)] pub struct Config { + #[envconfig(from = "ENV", default = "dev")] + pub env: String, + #[envconfig(from = "LISTEN_HOST", default = "0.0.0.0")] pub listen_host: String, @@ -25,14 +28,14 @@ pub struct Config { #[envconfig( from = "POSTGRES_DSN", - default = "postgres://postgres:postgres@10.8.0.7/testing" + default = "postgres://postgres:postgres@postgres/testing" )] pub postgres_dsn: String, - #[envconfig(from = "REDIS_DSN", default = "redis://10.7.20.3:6379")] - pub redis_dsn: String, + #[envconfig(from = "VALKEY_DSN", default = "redis://valkey:6379")] + pub valkey_dsn: String, - #[envconfig(from = "RABBIT_DSN", default = "amqp://rabbit:password@10.7.20.3:5672")] + #[envconfig(from = "RABBIT_DSN", default = "amqp://rabbit:password@rabbitmq:5672")] pub rabbit_dsn: String, #[envconfig(from = "RABBIT_QUEUE_NAME", default = "dstn-gateway-ingest")] diff --git a/src/connectivity/mod.rs b/src/connectivity/mod.rs index bf49932..0c2f8ff 100644 --- a/src/connectivity/mod.rs +++ b/src/connectivity/mod.rs @@ -1,3 +1,3 @@ pub mod postgres; pub mod rabbit; -pub mod redis; +pub mod valkey; diff --git a/src/connectivity/redis.rs b/src/connectivity/valkey.rs similarity index 97% rename from src/connectivity/redis.rs rename to src/connectivity/valkey.rs index f961b8a..c7ff519 100644 --- a/src/connectivity/redis.rs +++ b/src/connectivity/valkey.rs @@ -8,7 +8,7 @@ use serde_json::json; use crate::{config::Config, modules::spotify::CurrentPlaying, services::spotify::SpotifyTokens}; #[derive(Clone)] -pub struct RedisManager { +pub struct ValkeyManager { pub cm: ConnectionManager, } @@ -26,12 +26,12 @@ pub struct AuthorizationData { redirect_uri: String, } -impl RedisManager { +impl ValkeyManager { pub async fn new() -> Self { let config = Config::init_from_env().unwrap(); - let client = Client::open(config.redis_dsn).unwrap(); + let client = Client::open(config.valkey_dsn).unwrap(); let cm = ConnectionManager::new(client).await.unwrap(); - tracing::info!("Connected to redis"); + tracing::info!("Connected to valkey"); Self { cm } } diff --git a/src/main.rs b/src/main.rs index 86eafb6..1e676cd 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4,76 +4,95 @@ pub mod modules; pub mod services; pub mod structs; -use std::{env, error::Error, time::Duration}; +use std::{error::Error, time::Duration}; -use actix_web::{web, App, HttpServer}; -use connectivity::{postgres::PostgresManager, rabbit::RabbitManager, redis::RedisManager}; +use actix_web::{middleware, web, App, HttpServer}; +use actix_web_lab::middleware::from_fn; +use connectivity::{postgres::PostgresManager, rabbit::RabbitManager, valkey::ValkeyManager}; use envconfig::Envconfig; -use tokio::{sync::Mutex, time}; +use tokio::time; use tracing_actix_web::TracingLogger; use tracing_subscriber::{fmt, prelude::__tracing_subscriber_SubscriberExt, EnvFilter, Registry}; use crate::config::Config; pub struct ServerState { - pub redis: RedisManager, + pub valkey: ValkeyManager, pub rabbit: RabbitManager, pub postgres: PostgresManager, } #[tokio::main] async fn main() -> Result<(), Box> { + let config = Config::init_from_env().unwrap(); + let env_filter = EnvFilter::try_from_default_env().unwrap_or(EnvFilter::new("info")); let fmt_layer = fmt::layer().with_target(false); let subscriber = Registry::default().with(env_filter).with(fmt_layer); tracing::subscriber::set_global_default(subscriber) .expect("Failed to initalize global tracing subscriber"); - let redis = connectivity::redis::RedisManager::new().await; + let valkey = connectivity::valkey::ValkeyManager::new().await; let rabbit = connectivity::rabbit::RabbitManager::new().await; let postgres = connectivity::postgres::PostgresManager::new().await; - let config = Config::init_from_env().unwrap(); - - let addr = env::var("LISTEN_ADDR") - .ok() - .unwrap_or_else(|| "127.0.0.1".to_string()); - let port = env::var("LISTEN_PORT") - .ok() - .unwrap_or_else(|| 8080.to_string()) - .parse::() - .unwrap(); + tracing::info!( + "Starting HTTP Server on {}:{}", + config.listen_host, + config.listen_port + ); - tracing::info!("Starting HTTP Server on {}:{}", addr, port); + if config.env == "dev" { + tracing::info!("Running in DEV mode"); + } - let data = web::Data::new(Mutex::new(ServerState { - redis, + let data = web::Data::new(ServerState { + valkey, rabbit, postgres, - })); + }); let data_http = web::Data::clone(&data); + // Fetch spotify current playing every second. let mut interval = time::interval(Duration::from_secs(1)); - - tokio::spawn(async move { - interval.tick().await; - loop { + if config.env != "dev" { + tokio::spawn(async move { interval.tick().await; - tokio::spawn(modules::spotify::fetch_spotify_current(web::Data::clone( - &data, - ))); - } - }); + loop { + interval.tick().await; + tokio::spawn(modules::spotify::fetch_spotify_current(web::Data::clone( + &data, + ))); + } + }); + } HttpServer::new(move || { App::new() .app_data(web::Data::clone(&data_http)) + .wrap(middleware::NormalizePath::default()) .wrap(TracingLogger::default()) - .service(services::base::index) - .service(services::base::health) - .service(services::spotify::current) - .service(services::spotify::authorize) - .service(services::spotify::setup) + .default_service(web::to(services::base::index)) + .service( + web::scope("/v2") + .service(services::base::health) + .service( + web::scope("/spotify") + .service(services::spotify::current) + .service(services::spotify::authorize) + .service(services::spotify::setup), + ) + .service( + web::scope("/blog") + .service(services::blog::auth::login) + .service( + web::scope("") + .wrap(from_fn(services::blog::middleware::blog_admin_auth_mw)) + .service(services::blog::auth::logout) + .service(services::blog::auth::get_user), + ), + ), + ) }) .bind(((config.listen_host).to_owned(), config.listen_port))? .run() diff --git a/src/modules/spotify.rs b/src/modules/spotify.rs index bec50e6..e7438b0 100644 --- a/src/modules/spotify.rs +++ b/src/modules/spotify.rs @@ -5,7 +5,6 @@ use chrono::prelude::*; use serde::{Deserialize, Serialize}; use serde_with::{self, skip_serializing_none}; use sqlx::types::{chrono::DateTime, Json}; -use tokio::sync::Mutex; use crate::{ connectivity::postgres::{SpotifyArtist, SpotifyHistoryItem}, @@ -43,9 +42,8 @@ pub struct Device { device_type: String, } -pub(crate) async fn fetch_spotify_current(data: web::Data>) { - let data = data.lock().await; - let redis = &mut data.redis.clone(); +pub(crate) async fn fetch_spotify_current(data: web::Data) { + let redis = &mut data.valkey.clone(); let rabbit = &mut data.rabbit.clone(); let postgres = &mut data.postgres.clone(); diff --git a/src/services/base.rs b/src/services/base.rs index 18812c2..8b62f1e 100644 --- a/src/services/base.rs +++ b/src/services/base.rs @@ -1,8 +1,10 @@ use actix_web::{get, http::Error, HttpResponse}; +use serde_json::json; -#[get("/")] -async fn index() -> Result { - Ok(HttpResponse::Ok().body("Ok")) +pub async fn index() -> Result { + Ok(HttpResponse::NotFound() + .append_header(("Content-type", "application/json")) + .body(json!({"code": "route_not_found"}).to_string())) } #[get("/health")] diff --git a/src/services/blog/assets.rs b/src/services/blog/assets.rs new file mode 100644 index 0000000..e17e6c3 --- /dev/null +++ b/src/services/blog/assets.rs @@ -0,0 +1,6 @@ +use actix_web::{http::Error, post, HttpResponse}; + +#[post("/assets")] +async fn index() -> Result { + Ok(HttpResponse::Ok().body("Ok")) +} diff --git a/src/services/blog/auth.rs b/src/services/blog/auth.rs new file mode 100644 index 0000000..0319904 --- /dev/null +++ b/src/services/blog/auth.rs @@ -0,0 +1,103 @@ +use crate::{ + structs::blog::{BlogAdminIntSession, BlogAdminUser, BlogLoginRequest}, + ServerState, +}; + +use argon2::{self}; +use rand::{distributions::Alphanumeric, Rng}; + +use actix_web::{delete, get, http::Error, post, web, HttpMessage, HttpRequest, HttpResponse}; +use redis::aio::ConnectionManager; +use serde_json::json; + +#[post("/auth")] +async fn login( + body: web::Json, + state: web::Data, +) -> Result { + let username = body.username.to_string(); + + let redis = &mut state.valkey.clone(); + let postgres = &mut state.postgres.clone(); + + let user_record = sqlx::query_as::<_, BlogAdminUser>( + "SELECT * FROM blog_admin_users WHERE username = $1 LIMIT 1;", + ) + .bind(username) + .fetch_one(&postgres.pool) + .await + .map_err(|e| format!("{}", e)); + + // if user_record.is_err() { + // return Err(Error); + // } + + let user = user_record.unwrap(); + + let password = body.password.as_bytes(); + let valid = argon2::verify_encoded(&user.password.unwrap(), password).unwrap(); + + if !valid { + let json = json!({"code": "invalid_authentication"}); + + return Ok(HttpResponse::Unauthorized() + .append_header(("Content-type", "application/json")) + .body(json.to_string())); + } + + let session_token: String = rand::thread_rng() + .sample_iter(&Alphanumeric) + .take(96) + .map(char::from) + .collect(); + + let _ = redis::cmd("SET") + .arg(format!("blog_admin_session/{}", session_token)) + .arg(json!({"user_id": user.id}).to_string()) + .query_async::(&mut redis.cm) + .await; + + let json = json!({ "user": { "id": user.id, "username": user.username, "display_name": user.display_name, }, "session": { "token": session_token } }); + + Ok(HttpResponse::Ok() + .append_header(("Content-type", "application/json")) + .body(json.to_string())) +} + +#[get("/me")] +async fn get_user(req: HttpRequest) -> Result { + let exts = req.extensions_mut(); + let user = exts.get::().unwrap(); + + Ok(HttpResponse::Ok() + .append_header(("Content-type", "application/json")) + .body( + json!({ + "user": { + "id": user.id, + "username": user.username, + "display_name": user.display_name, + } + }) + .to_string(), + )) +} + +#[delete("/auth")] +async fn logout(req: HttpRequest, state: web::Data) -> Result { + // let state = state.get_mut(); + let redis = &mut state.valkey.clone(); + + let exts = req.extensions_mut(); + let session = exts.get::().unwrap(); + + println!("{}", session.token); + println!("{}", session.user_id); + + let _ = redis::cmd("DEL") + .arg(format!("blog_admin_session/{}", session.token)) + .query_async::(&mut redis.cm) + .await; + + Ok(HttpResponse::NoContent().finish()) +} diff --git a/src/services/blog/middleware.rs b/src/services/blog/middleware.rs new file mode 100644 index 0000000..66f0fee --- /dev/null +++ b/src/services/blog/middleware.rs @@ -0,0 +1,66 @@ +use actix_web::{ + body::MessageBody, + dev::{ServiceRequest, ServiceResponse}, + http::header, + web::Data, + Error, HttpMessage, HttpResponse, +}; +use actix_web_lab::middleware::Next; +use serde_json::json; + +use crate::{ + structs::blog::{BlogAdminIntSession, BlogAdminSession, BlogAdminUser}, + ServerState, +}; + +pub async fn blog_admin_auth_mw( + req: ServiceRequest, + next: Next, +) -> Result, Error> { + let auth_token = req.headers().get(header::AUTHORIZATION); + + let state = req.app_data::>().unwrap().clone(); + + let redis = &mut state.valkey.clone(); + let postgres = &mut state.postgres.clone(); + + match auth_token { + None => { + return Ok(ServiceResponse::new( + req.request().to_owned(), + HttpResponse::Unauthorized() + .append_header(("Content-type", "application/json")) + .body(json!({"code": "missing_authentication"}).to_string()), + ) + .map_into_boxed_body()); + } + Some(token) => { + let redis_session: String = redis::cmd("GET") + .arg(format!("blog_admin_session/{}", token.to_str().unwrap())) + .query_async(&mut redis.cm) + .await + .unwrap(); + + let session = serde_json::from_str::(&redis_session).unwrap(); + + let user = sqlx::query_as::<_, BlogAdminUser>( + "SELECT id, username, display_name FROM blog_admin_users WHERE id = $1;", + ) + .bind(session.user_id) + .fetch_one(&postgres.pool) + .await + .map_err(|e| format!("{}", e)); + + req.extensions_mut().insert(user.clone().unwrap()); + req.extensions_mut().insert(BlogAdminIntSession { + user_id: user.unwrap().id.to_string(), + token: token.to_str().unwrap().to_string(), + }); + + return next + .call(req) + .await + .map(ServiceResponse::map_into_boxed_body); + } + } +} diff --git a/src/services/blog/mod.rs b/src/services/blog/mod.rs new file mode 100644 index 0000000..de8237a --- /dev/null +++ b/src/services/blog/mod.rs @@ -0,0 +1,4 @@ +pub mod assets; +pub mod auth; +pub mod middleware; +pub mod posts; diff --git a/src/services/blog/posts.rs b/src/services/blog/posts.rs new file mode 100644 index 0000000..0e40e2d --- /dev/null +++ b/src/services/blog/posts.rs @@ -0,0 +1,6 @@ +use actix_web::{http::Error, post, HttpResponse}; + +#[post("/posts")] +async fn index() -> Result { + Ok(HttpResponse::Ok().body("Ok")) +} diff --git a/src/services/mod.rs b/src/services/mod.rs index d044cc2..3eee771 100644 --- a/src/services/mod.rs +++ b/src/services/mod.rs @@ -1,2 +1,3 @@ pub mod base; +pub mod blog; pub mod spotify; diff --git a/src/services/spotify.rs b/src/services/spotify.rs index 791d71d..4bb7329 100644 --- a/src/services/spotify.rs +++ b/src/services/spotify.rs @@ -2,7 +2,6 @@ use actix_web::{get, http::Error, web, HttpResponse}; use envconfig::Envconfig; use serde::{Deserialize, Serialize}; use serde_json::json; -use tokio::sync::Mutex; use crate::{config::Config, ServerState}; @@ -33,10 +32,9 @@ pub struct SpotifyTokens { pub scope: String, } -#[get("/v2/spotify")] -async fn current(data: web::Data>) -> Result { - let data = data.lock().await; - let redis = &mut data.redis.clone(); +#[get("")] +async fn current(data: web::Data) -> Result { + let redis = &mut data.valkey.clone(); let current = redis.get_current().await; @@ -45,10 +43,9 @@ async fn current(data: web::Data>) -> Result>) -> Result { - let data = data.lock().await; - let redis = &mut data.redis.clone(); +#[get("/authorize")] +async fn authorize(data: web::Data) -> Result { + let redis = &mut data.valkey.clone(); let setup_check = redis.check_spotify_setup().await; if setup_check { @@ -66,7 +63,7 @@ async fn authorize(data: web::Data>) -> Result>) -> Result>, + data: web::Data, info: web::Query, ) -> Result> { - let data = data.lock().await; - let redis = &mut data.redis.clone(); + let redis = &mut data.valkey.clone(); let setup_check = redis.check_spotify_setup().await; if setup_check { @@ -99,7 +95,7 @@ async fn setup( let config = Config::init_from_env().unwrap(); let code = &info.code; - let redirect_uri = "http://127.0.0.1:8080/v2/spotify/setup"; + let redirect_uri = "http://127.0.0.1:8080/spotify/setup"; let data = AuthorizationData { code: code.into(), grant_type: "authorization_code".into(), diff --git a/src/structs/blog.rs b/src/structs/blog.rs new file mode 100644 index 0000000..2a5ff7b --- /dev/null +++ b/src/structs/blog.rs @@ -0,0 +1,33 @@ +use serde::Deserialize; +use sqlx::FromRow; +extern crate serde_json; + +#[derive(Deserialize)] +pub struct BlogLoginRequest { + pub username: String, + pub password: String, +} + +#[allow(dead_code)] +#[derive(Deserialize, Debug, Clone)] +pub struct BlogAdminSession { + pub user_id: String, +} + +#[allow(dead_code)] +#[derive(Deserialize, Debug, Clone)] +pub struct BlogAdminIntSession { + pub user_id: String, + pub token: String, +} + +#[allow(dead_code)] +#[derive(Debug, Clone, FromRow)] +pub struct BlogAdminUser { + pub id: String, + pub username: String, + #[sqlx(default)] + pub display_name: Option, + #[sqlx(default)] + pub password: Option, +} diff --git a/src/structs/mod.rs b/src/structs/mod.rs index 16b75bc..9043e5f 100644 --- a/src/structs/mod.rs +++ b/src/structs/mod.rs @@ -1 +1,2 @@ +pub mod blog; pub mod spotify; From eaf2dea36e79d38eb0048b6678b70e57c7399411 Mon Sep 17 00:00:00 2001 From: Dustin Rouillard Date: Mon, 20 May 2024 20:56:10 -0600 Subject: [PATCH 02/13] Error handling and less panics --- src/services/blog/auth.rs | 23 +++++------ src/services/blog/middleware.rs | 70 +++++++++++++++++++++++---------- 2 files changed, 58 insertions(+), 35 deletions(-) diff --git a/src/services/blog/auth.rs b/src/services/blog/auth.rs index 0319904..606502e 100644 --- a/src/services/blog/auth.rs +++ b/src/services/blog/auth.rs @@ -25,12 +25,13 @@ async fn login( ) .bind(username) .fetch_one(&postgres.pool) - .await - .map_err(|e| format!("{}", e)); + .await; - // if user_record.is_err() { - // return Err(Error); - // } + if user_record.is_err() { + return Ok(HttpResponse::Unauthorized() + .append_header(("Content-type", "application/json")) + .body(json!({"code": "invalid_username"}).to_string())); + } let user = user_record.unwrap(); @@ -38,11 +39,9 @@ async fn login( let valid = argon2::verify_encoded(&user.password.unwrap(), password).unwrap(); if !valid { - let json = json!({"code": "invalid_authentication"}); - return Ok(HttpResponse::Unauthorized() .append_header(("Content-type", "application/json")) - .body(json.to_string())); + .body(json!({"code": "invalid_authentication"}).to_string())); } let session_token: String = rand::thread_rng() @@ -57,11 +56,11 @@ async fn login( .query_async::(&mut redis.cm) .await; - let json = json!({ "user": { "id": user.id, "username": user.username, "display_name": user.display_name, }, "session": { "token": session_token } }); + let response = json!({ "user": { "id": user.id, "username": user.username, "display_name": user.display_name, }, "session": { "token": session_token } }); Ok(HttpResponse::Ok() .append_header(("Content-type", "application/json")) - .body(json.to_string())) + .body(response.to_string())) } #[get("/me")] @@ -85,15 +84,11 @@ async fn get_user(req: HttpRequest) -> Result { #[delete("/auth")] async fn logout(req: HttpRequest, state: web::Data) -> Result { - // let state = state.get_mut(); let redis = &mut state.valkey.clone(); let exts = req.extensions_mut(); let session = exts.get::().unwrap(); - println!("{}", session.token); - println!("{}", session.user_id); - let _ = redis::cmd("DEL") .arg(format!("blog_admin_session/{}", session.token)) .query_async::(&mut redis.cm) diff --git a/src/services/blog/middleware.rs b/src/services/blog/middleware.rs index 66f0fee..d565a31 100644 --- a/src/services/blog/middleware.rs +++ b/src/services/blog/middleware.rs @@ -6,6 +6,7 @@ use actix_web::{ Error, HttpMessage, HttpResponse, }; use actix_web_lab::middleware::Next; +use redis::aio::ConnectionManager; use serde_json::json; use crate::{ @@ -35,32 +36,59 @@ pub async fn blog_admin_auth_mw( .map_into_boxed_body()); } Some(token) => { - let redis_session: String = redis::cmd("GET") + let redis_session = redis::cmd("GET") .arg(format!("blog_admin_session/{}", token.to_str().unwrap())) - .query_async(&mut redis.cm) - .await - .unwrap(); + .query_async::(&mut redis.cm) + .await; - let session = serde_json::from_str::(&redis_session).unwrap(); + match redis_session { + Err(_) => { + return Ok(ServiceResponse::new( + req.request().to_owned(), + HttpResponse::Unauthorized() + .append_header(("Content-type", "application/json")) + .body(json!({"code": "invalid_authentication_state"}).to_string()), + ) + .map_into_boxed_body()); + } - let user = sqlx::query_as::<_, BlogAdminUser>( - "SELECT id, username, display_name FROM blog_admin_users WHERE id = $1;", - ) - .bind(session.user_id) - .fetch_one(&postgres.pool) - .await - .map_err(|e| format!("{}", e)); + Ok(session_token) => { + let session = serde_json::from_str::(&session_token).unwrap(); + + let user = sqlx::query_as::<_, BlogAdminUser>( + "SELECT id, username, display_name FROM blog_admin_users WHERE id = $1;", + ) + .bind(session.user_id) + .fetch_one(&postgres.pool) + .await; - req.extensions_mut().insert(user.clone().unwrap()); - req.extensions_mut().insert(BlogAdminIntSession { - user_id: user.unwrap().id.to_string(), - token: token.to_str().unwrap().to_string(), - }); + match user { + Ok(user) => { + req.extensions_mut().insert(user.clone()); + req.extensions_mut().insert(BlogAdminIntSession { + user_id: user.id.to_string(), + token: token.to_str().unwrap().to_string(), + }); - return next - .call(req) - .await - .map(ServiceResponse::map_into_boxed_body); + return next + .call(req) + .await + .map(ServiceResponse::map_into_boxed_body); + } + Err(_) => { + return Ok(ServiceResponse::new( + req.request().to_owned(), + HttpResponse::Unauthorized() + .append_header(("Content-type", "application/json")) + .body( + json!({"code": "invalid_authentication_user"}).to_string(), + ), + ) + .map_into_boxed_body()); + } + } + } + } } } } From 841f1a6c47445c71020ebf577fbce1f1418f878b Mon Sep 17 00:00:00 2001 From: Dustin Rouillard Date: Mon, 20 May 2024 22:25:17 -0600 Subject: [PATCH 03/13] Adding base draft post creation --- Cargo.toml | 4 +-- src/main.rs | 7 ++++- src/services/blog/posts.rs | 62 ++++++++++++++++++++++++++++++++++++-- src/structs/blog.rs | 25 ++++++++++++++- 4 files changed, 91 insertions(+), 7 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 13d207d..74c8415 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,7 @@ edition = "2021" lazy_static = "1.4" actix-web = "4" envconfig = "0.10.0" -serde_with = "3.8.1" +serde_with = { version = "3.8.1", features = ["chrono_0_4"] } serde_json = "1.0" serde_urlencoded = "0.7" serde = { version = "1.0.202", features = ["derive"] } @@ -18,7 +18,7 @@ tracing-actix-web = "0.7" tracing-subscriber = { version = "0.3.18", default-features = false, features = ["fmt", "ansi", "env-filter", "registry", "tracing-log"] } reqwest = { version = "0.12", features = ["json"] } tokio = { version = "1", features = ["full"] } -chrono = "0.4.38" +chrono = { version = "0.4.38", features = ["serde"]} sqlx = { version = "0.7", features = [ "runtime-tokio-rustls", "postgres", "chrono" ] } postgres = "0.19.7" redis = {version ="0.25.3", features = ["tokio-comp", "connection-manager"]} diff --git a/src/main.rs b/src/main.rs index 1e676cd..49dad64 100644 --- a/src/main.rs +++ b/src/main.rs @@ -85,11 +85,16 @@ async fn main() -> Result<(), Box> { .service( web::scope("/blog") .service(services::blog::auth::login) + .service(services::blog::posts::get_post) + .service(services::blog::posts::get_posts) .service( web::scope("") .wrap(from_fn(services::blog::middleware::blog_admin_auth_mw)) .service(services::blog::auth::logout) - .service(services::blog::auth::get_user), + .service(services::blog::auth::get_user) + .service(services::blog::posts::create_post) + .service(services::blog::posts::update_post) + .service(services::blog::posts::delete_post), ), ), ) diff --git a/src/services/blog/posts.rs b/src/services/blog/posts.rs index 0e40e2d..8e2b2e9 100644 --- a/src/services/blog/posts.rs +++ b/src/services/blog/posts.rs @@ -1,6 +1,62 @@ -use actix_web::{http::Error, post, HttpResponse}; +use actix_web::{delete, get, http::Error, patch, post, web, HttpResponse}; +use serde_json::json; + +use crate::{structs::blog::BlogPost, ServerState}; + +#[get("/posts")] +async fn get_posts() -> Result { + Ok(HttpResponse::NotImplemented().finish()) +} #[post("/posts")] -async fn index() -> Result { - Ok(HttpResponse::Ok().body("Ok")) +async fn create_post(state: web::Data) -> Result { + let postgres = &mut &state.postgres; + + let post_record = sqlx::query_as::<_, BlogPost>( + "INSERT INTO blog_posts DEFAULT VALUES RETURNING id, slug, title, description, visibility, created_at", + ) + .fetch_one(&postgres.pool) + .await; + + match post_record { + Ok(post) => Ok(HttpResponse::Created() + .append_header(("Content-type", "application/json")) + .body( + json!({ + "post": { + "id": post.id, + "title": post.title, + "slug": post.slug, + "description": post.description, + "image": post.image, + "visibility": post.visibility, + "tags": post.tags, + "body": post.body, + "created_at": post.created_at, + "published_at": post.published_at, + } + }) + .to_string(), + )), + Err(_) => { + return Ok(HttpResponse::Unauthorized() + .append_header(("Content-type", "application/json")) + .body(json!({"code": "uncaught_error_creating_post"}).to_string())); + } + } +} + +#[get("/posts/{id}")] +async fn get_post() -> Result { + Ok(HttpResponse::NotImplemented().finish()) +} + +#[patch("/posts/{id}")] +async fn update_post() -> Result { + Ok(HttpResponse::NotImplemented().finish()) +} + +#[delete("/posts/{id}")] +async fn delete_post() -> Result { + Ok(HttpResponse::NotImplemented().finish()) } diff --git a/src/structs/blog.rs b/src/structs/blog.rs index 2a5ff7b..fecf5b9 100644 --- a/src/structs/blog.rs +++ b/src/structs/blog.rs @@ -1,4 +1,6 @@ -use serde::Deserialize; +use chrono::NaiveDateTime; +use serde::{Deserialize, Serialize}; +use serde_with::serde_as; use sqlx::FromRow; extern crate serde_json; @@ -31,3 +33,24 @@ pub struct BlogAdminUser { #[sqlx(default)] pub password: Option, } + +#[serde_as] +#[allow(dead_code)] +#[derive(Serialize, Deserialize, Debug, Clone, FromRow)] +pub struct BlogPost { + pub id: String, + pub slug: String, + pub title: String, + #[sqlx(default)] + pub description: Option, + #[sqlx(default)] + pub image: Option, + pub visibility: String, + #[sqlx(default)] + pub tags: Option>, + #[sqlx(default)] + pub body: Option, + pub created_at: NaiveDateTime, + #[sqlx(default)] + pub published_at: Option, +} From d98a1324068b5f63636a8f15911a44ac649590f7 Mon Sep 17 00:00:00 2001 From: Dustin Rouillard Date: Tue, 21 May 2024 23:23:16 -0600 Subject: [PATCH 04/13] Add rustfmt Remove sqlx and all refs Switch to prisma and for spotify Refactor redis > valkey Refactor spotify code --- .cargo/config.toml | 2 + .gitignore | 2 + .rustfmt.toml | 4 + Cargo.lock | 2528 ++++++++++++++++++++++++------- Cargo.toml | 9 +- prisma/schema.prisma | 67 + src/bin/prisma.rs | 3 + src/connectivity/mod.rs | 2 +- src/connectivity/postgres.rs | 134 -- src/connectivity/rabbit.rs | 121 +- src/connectivity/valkey.rs | 173 +-- src/main.rs | 164 +- src/modules/spotify.rs | 465 +++--- src/services/blog/auth.rs | 159 +- src/services/blog/middleware.rs | 170 ++- src/services/blog/posts.rs | 286 +++- src/services/spotify.rs | 131 -- src/services/spotify/helpers.rs | 187 +++ src/services/spotify/mod.rs | 2 + src/services/spotify/routes.rs | 162 ++ src/structs/blog.rs | 63 +- src/structs/spotify.rs | 194 ++- 22 files changed, 3420 insertions(+), 1608 deletions(-) create mode 100644 .cargo/config.toml create mode 100644 .rustfmt.toml create mode 100644 prisma/schema.prisma create mode 100644 src/bin/prisma.rs delete mode 100644 src/connectivity/postgres.rs delete mode 100644 src/services/spotify.rs create mode 100644 src/services/spotify/helpers.rs create mode 100644 src/services/spotify/mod.rs create mode 100644 src/services/spotify/routes.rs diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 0000000..e9a9c3f --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,2 @@ +[alias] +prisma = "run --bin prisma --" \ No newline at end of file diff --git a/.gitignore b/.gitignore index ec47942..3dce0ed 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ /target +src/connectivity/prisma.rs + .env \ No newline at end of file diff --git a/.rustfmt.toml b/.rustfmt.toml new file mode 100644 index 0000000..748c2d2 --- /dev/null +++ b/.rustfmt.toml @@ -0,0 +1,4 @@ +edition = "2021" +tab_spaces = 2 +max_width = 75 +reorder_imports = true \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index e62947c..d040bc3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -29,7 +29,7 @@ dependencies = [ "actix-rt", "actix-service", "actix-utils", - "ahash", + "ahash 0.8.11", "base64 0.22.1", "bitflags 2.5.0", "brotli", @@ -49,7 +49,7 @@ dependencies = [ "mime", "percent-encoding", "pin-project-lite", - "rand", + "rand 0.8.5", "sha1", "smallvec", "tokio", @@ -68,6 +68,44 @@ dependencies = [ "syn 2.0.65", ] +[[package]] +name = "actix-multipart" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b960e2aea75f49c8f069108063d12a48d329fc8b60b786dfc7552a9d5918d2d" +dependencies = [ + "actix-multipart-derive", + "actix-utils", + "actix-web", + "bytes", + "derive_more", + "futures-core", + "futures-util", + "httparse", + "local-waker", + "log", + "memchr", + "mime", + "serde", + "serde_json", + "serde_plain", + "tempfile", + "tokio", +] + +[[package]] +name = "actix-multipart-derive" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a0a77f836d869f700e5b47ac7c3c8b9c8bc82e4aec861954c6198abee3ebd4d" +dependencies = [ + "darling", + "parse-size", + "proc-macro2", + "quote", + "syn 2.0.65", +] + [[package]] name = "actix-router" version = "0.5.3" @@ -146,7 +184,7 @@ dependencies = [ "actix-service", "actix-utils", "actix-web-codegen", - "ahash", + "ahash 0.8.11", "bytes", "bytestring", "cfg-if", @@ -196,7 +234,7 @@ dependencies = [ "actix-utils", "actix-web", "actix-web-lab-derive", - "ahash", + "ahash 0.8.11", "arc-swap", "async-trait", "bytes", @@ -207,7 +245,7 @@ dependencies = [ "futures-util", "http 0.2.12", "impl-more", - "itertools", + "itertools 0.12.1", "local-channel", "mediatype", "mime", @@ -259,6 +297,17 @@ dependencies = [ "cpufeatures", ] +[[package]] +name = "ahash" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "891477e0c6a8957309ee5c45a6368af3ae14bb510732d2684ffa19af310920f9" +dependencies = [ + "getrandom 0.2.15", + "once_cell", + "version_check", +] + [[package]] name = "ahash" version = "0.8.11" @@ -266,12 +315,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" dependencies = [ "cfg-if", - "getrandom", + "getrandom 0.2.15", "once_cell", "version_check", "zerocopy", ] +[[package]] +name = "aho-corasick" +version = "0.7.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" +dependencies = [ + "memchr", +] + [[package]] name = "aho-corasick" version = "1.1.3" @@ -296,12 +354,6 @@ dependencies = [ "alloc-no-stdlib", ] -[[package]] -name = "allocator-api2" -version = "0.2.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" - [[package]] name = "amq-protocol" version = "7.2.0" @@ -365,10 +417,17 @@ dependencies = [ "libc", ] +[[package]] +name = "anyhow" +version = "1.0.86" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" + [[package]] name = "api" version = "0.1.0" dependencies = [ + "actix-multipart", "actix-web", "actix-web-lab", "chrono", @@ -376,16 +435,17 @@ dependencies = [ "futures", "lapin", "lazy_static", - "postgres", - "rand", + "prisma-client-rust", + "prisma-client-rust-cli", + "rand 0.8.5", "redis", - "reqwest", + "reqwest 0.12.4", "rust-argon2", + "rust-s3", "serde", "serde_json", "serde_urlencoded", "serde_with", - "sqlx", "tokio", "tracing", "tracing-actix-web", @@ -410,6 +470,12 @@ version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +[[package]] +name = "ascii" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eab1c04a571841102f5345a8fc0f6bb3d31c315dec879b5c6e42e40ce7ffa34e" + [[package]] name = "asn1-rs" version = "0.6.1" @@ -435,7 +501,7 @@ dependencies = [ "proc-macro2", "quote", "syn 2.0.65", - "synstructure", + "synstructure 0.13.1", ] [[package]] @@ -589,12 +655,12 @@ dependencies = [ ] [[package]] -name = "atoi" -version = "2.0.0" +name = "atomic-shim" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f28d99ec8bfea296261ca1af174f24225171fea9664ba9003cbebee704810528" +checksum = "67cd4b51d303cf3501c301e8125df442128d3c6d7c69f71b27833d253de47e77" dependencies = [ - "num-traits", + "crossbeam-utils", ] [[package]] @@ -603,12 +669,43 @@ version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" +[[package]] +name = "attohttpc" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fcf00bc6d5abb29b5f97e3c61a90b6d3caa12f3faf897d4a3e3607c050a35a7" +dependencies = [ + "http 0.2.12", + "log", + "native-tls", + "serde", + "serde_json", + "url", +] + [[package]] name = "autocfg" version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +[[package]] +name = "aws-creds" +version = "0.34.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3776743bb68d4ad02ba30ba8f64373f1be4e082fe47651767171ce75bb2f6cf5" +dependencies = [ + "attohttpc", + "dirs", + "log", + "quick-xml", + "rust-ini", + "serde", + "thiserror", + "time", + "url", +] + [[package]] name = "aws-lc-rs" version = "1.7.1" @@ -636,6 +733,15 @@ dependencies = [ "paste", ] +[[package]] +name = "aws-region" +version = "0.25.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42fed2b9fca70f2908268d057a607f2a906f47edbf856ea8587de9038d264e22" +dependencies = [ + "thiserror", +] + [[package]] name = "backtrace" version = "0.3.71" @@ -651,6 +757,34 @@ dependencies = [ "rustc-demangle", ] +[[package]] +name = "base-x" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cbbc9d0964165b47557570cce6c952866c2678457aca742aafc9fb771d30270" + +[[package]] +name = "base36" +version = "0.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9c26bddc1271f7112e5ec797e8eeba6de2de211c1488e506b9500196dbf77c5" +dependencies = [ + "base-x", + "failure", +] + +[[package]] +name = "base64" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" + +[[package]] +name = "base64" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" + [[package]] name = "base64" version = "0.21.7" @@ -669,6 +803,18 @@ version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" +[[package]] +name = "bigdecimal" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6773ddc0eafc0e509fb60e48dff7f450f8e674a0686ae8605e8d9901bd5eefa" +dependencies = [ + "num-bigint", + "num-integer", + "num-traits", + "serde", +] + [[package]] name = "bindgen" version = "0.69.4" @@ -678,7 +824,7 @@ dependencies = [ "bitflags 2.5.0", "cexpr", "clang-sys", - "itertools", + "itertools 0.12.1", "lazy_static", "lazycell", "log", @@ -692,6 +838,12 @@ dependencies = [ "which", ] +[[package]] +name = "bit-vec" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" + [[package]] name = "bitflags" version = "1.3.2" @@ -703,9 +855,6 @@ name = "bitflags" version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" -dependencies = [ - "serde", -] [[package]] name = "blake2b_simd" @@ -718,6 +867,15 @@ dependencies = [ "constant_time_eq", ] +[[package]] +name = "block-buffer" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" +dependencies = [ + "generic-array", +] + [[package]] name = "block-buffer" version = "0.10.4" @@ -771,6 +929,21 @@ dependencies = [ "alloc-stdlib", ] +[[package]] +name = "builtin-psl-connectors" +version = "0.1.0" +source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.10#c4aeef82dbae310e974d6122160c7e3b5fb6df53" +dependencies = [ + "connection-string", + "either", + "enumflags2", + "indoc", + "lsp-types", + "once_cell", + "psl-core", + "regex", +] + [[package]] name = "bumpalo" version = "3.16.0" @@ -890,6 +1063,29 @@ dependencies = [ "x509-cert", ] +[[package]] +name = "colored" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cbf2150cce219b664a8a70df7a1f933836724b503f8a413af9365b4dcc4d90b8" +dependencies = [ + "lazy_static", + "windows-sys 0.48.0", +] + +[[package]] +name = "combine" +version = "3.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da3da6baa321ec19e1cc41d31bf599f00c783d0517095cdaf0332e3fe8d20680" +dependencies = [ + "ascii", + "byteorder", + "either", + "memchr", + "unreachable", +] + [[package]] name = "combine" version = "4.6.7" @@ -913,6 +1109,15 @@ dependencies = [ "crossbeam-utils", ] +[[package]] +name = "connection-string" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97faeec45f49581c458f8bf81992c5e3ec17d82cda99f59d3cea14eff62698d" +dependencies = [ + "wasm-bindgen", +] + [[package]] name = "const-oid" version = "0.9.6" @@ -931,6 +1136,21 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" +[[package]] +name = "convert_case" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb4a24b1aaf0fd0ce8b45161144d6f42cd91677fd5940fd431183eb023b3a2b8" + +[[package]] +name = "convert_case" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec182b0ca2f35d8fc196cf3404988fd8b8c739a4d270ff118a398feb0cbec1ca" +dependencies = [ + "unicode-segmentation", +] + [[package]] name = "cookie" version = "0.16.2" @@ -974,27 +1194,30 @@ dependencies = [ ] [[package]] -name = "crc" -version = "3.2.1" +name = "crc32fast" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69e6e4d7b33a94f0991c26729976b10ebde1d34c3ee82408fb536164fa10d636" +checksum = "b3855a8a784b474f333699ef2bbca9db2c4a1f6d9088a90a2d25b1eb53111eaa" dependencies = [ - "crc-catalog", + "cfg-if", ] [[package]] -name = "crc-catalog" -version = "2.4.0" +name = "crossbeam-channel" +version = "0.5.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5" +checksum = "33480d6946193aa8033910124896ca395333cae7e2d1113d1fef6c3272217df2" +dependencies = [ + "crossbeam-utils", +] [[package]] -name = "crc32fast" -version = "1.4.0" +name = "crossbeam-epoch" +version = "0.9.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3855a8a784b474f333699ef2bbca9db2c4a1f6d9088a90a2d25b1eb53111eaa" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" dependencies = [ - "cfg-if", + "crossbeam-utils", ] [[package]] @@ -1043,6 +1266,39 @@ dependencies = [ "memchr", ] +[[package]] +name = "cuid" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51294db11d38eb763c92936c5c88425d0090e27dce21dd15748134af9e53e739" +dependencies = [ + "base36", + "cuid-util", + "cuid2", + "hostname", + "num", + "once_cell", + "rand 0.8.5", +] + +[[package]] +name = "cuid-util" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ea2bfe0336ff1b7ca74819b2df8dfae9afea358aff6b1688baa5c181d8c3713" + +[[package]] +name = "cuid2" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47d99cacd52fd67db7490ad051c8c1973fb75520174d69aabbae08c534c9d0e8" +dependencies = [ + "cuid-util", + "num", + "rand 0.8.5", + "sha3", +] + [[package]] name = "darling" version = "0.20.9" @@ -1084,6 +1340,17 @@ version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e8566979429cf69b49a5c740c60791108e86440e8be149bbea4fe54d2c32d6e2" +[[package]] +name = "datamodel-renderer" +version = "0.1.0" +source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.10#c4aeef82dbae310e974d6122160c7e3b5fb6df53" +dependencies = [ + "base64 0.13.1", + "once_cell", + "psl", + "regex", +] + [[package]] name = "der" version = "0.7.9" @@ -1138,7 +1405,7 @@ version = "0.99.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" dependencies = [ - "convert_case", + "convert_case 0.4.0", "proc-macro2", "quote", "rustc_version", @@ -1154,56 +1421,139 @@ dependencies = [ "cipher", ] +[[package]] +name = "diagnostics" +version = "0.1.0" +source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.10#c4aeef82dbae310e974d6122160c7e3b5fb6df53" +dependencies = [ + "colored", + "indoc", + "pest", +] + +[[package]] +name = "digest" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" +dependencies = [ + "generic-array", +] + [[package]] name = "digest" version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ - "block-buffer", - "const-oid", + "block-buffer 0.10.4", "crypto-common", "subtle", ] [[package]] -name = "displaydoc" -version = "0.2.4" +name = "directories" +version = "4.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" +checksum = "f51c5d4ddabd36886dd3e1438cb358cdcb0d7c499cb99cb4ac2e38e18b5cb210" dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.65", + "dirs-sys", ] [[package]] -name = "doc-comment" -version = "0.3.3" +name = "dirs" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10" +checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059" +dependencies = [ + "dirs-sys", +] [[package]] -name = "dotenvy" -version = "0.15.7" +name = "dirs-sys" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b" +checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" +dependencies = [ + "libc", + "redox_users", + "winapi", +] [[package]] -name = "dunce" -version = "1.0.4" +name = "displaydoc" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56ce8c6da7551ec6c462cbaf3bfbc75131ebbfa1c944aeaa9dab51ca1c5f0c3b" +checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.65", +] [[package]] -name = "either" -version = "1.12.0" +name = "dlv-list" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dca9240753cf90908d7e4aac30f630662b02aebaa1b58a3cadabdb23385b58b" +checksum = "0688c2a7f92e427f44895cd63841bff7b29f8d7a1648b9e7e07a4a365b2e1257" + +[[package]] +name = "dml" +version = "0.1.0" +source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.10#c4aeef82dbae310e974d6122160c7e3b5fb6df53" +dependencies = [ + "chrono", + "cuid", + "either", + "enumflags2", + "indoc", + "prisma-value", + "psl-core", + "schema-ast", + "serde", + "serde_json", + "uuid", +] + +[[package]] +name = "dmmf" +version = "0.1.0" +source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.10#c4aeef82dbae310e974d6122160c7e3b5fb6df53" dependencies = [ + "bigdecimal", + "indexmap 1.9.3", + "prisma-models", + "psl", + "schema", + "schema-builder", "serde", + "serde_json", ] +[[package]] +name = "doc-comment" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10" + +[[package]] +name = "dotenv" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77c90badedccf4105eca100756a0b1289e191f6fcbdadd3cee1d2f614f97da8f" + +[[package]] +name = "dunce" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56ce8c6da7551ec6c462cbaf3bfbc75131ebbfa1c944aeaa9dab51ca1c5f0c3b" + +[[package]] +name = "either" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3dca9240753cf90908d7e4aac30f630662b02aebaa1b58a3cadabdb23385b58b" + [[package]] name = "encoding_rs" version = "0.8.34" @@ -1213,6 +1563,32 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "endian-type" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c34f04666d835ff5d62e058c3995147c06f42fe86ff053337632bca83e42702d" + +[[package]] +name = "enumflags2" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3278c9d5fb675e0a51dabcf4c0d355f692b064171535ba72361be1528a9d8e8d" +dependencies = [ + "enumflags2_derive", +] + +[[package]] +name = "enumflags2_derive" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c785274071b1b420972453b306eeca06acf4633829db4223b58a2a8c5953bc4" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.65", +] + [[package]] name = "envconfig" version = "0.10.0" @@ -1249,17 +1625,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "etcetera" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "136d1b5283a1ab77bd9257427ffd09d8667ced0570b6f938942bc7568ed5b943" -dependencies = [ - "cfg-if", - "home", - "windows-sys 0.48.0", -] - [[package]] name = "event-listener" version = "2.5.3" @@ -1317,6 +1682,28 @@ dependencies = [ "async-trait", ] +[[package]] +name = "failure" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d32e9bd16cc02eae7db7ef620b392808b89f6a5e16bb3497d159c6b92a0f4f86" +dependencies = [ + "backtrace", + "failure_derive", +] + +[[package]] +name = "failure_derive" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa4da3c766cd7a0db8242e326e9e4e081edd567072893ed320008189715366a4" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", + "synstructure 0.12.6", +] + [[package]] name = "fallible-iterator" version = "0.2.0" @@ -1344,6 +1731,12 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8fcfdc7a0362c9f4444381a9e697c79d435fe65b52a37466fc2c1184cee9edc6" +[[package]] +name = "fixedbitset" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86d4de0081402f5e88cdac65c8dcdcc73118c1a7a465e2a05f0da05843a8ea33" + [[package]] name = "flagset" version = "0.4.5" @@ -1368,7 +1761,7 @@ checksum = "55ac459de2512911e4b674ce33cf20befaba382d05b62b008afc1c8b57cbf181" dependencies = [ "futures-core", "futures-sink", - "spin 0.9.8", + "spin", ] [[package]] @@ -1449,17 +1842,6 @@ dependencies = [ "futures-util", ] -[[package]] -name = "futures-intrusive" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d930c203dd0b6ff06e0201a4a2fe9149b43c684fd4420555b26d21b1a02956f" -dependencies = [ - "futures-core", - "lock_api", - "parking_lot", -] - [[package]] name = "futures-io" version = "0.3.30" @@ -1517,6 +1899,12 @@ version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" +[[package]] +name = "futures-timer" +version = "3.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f288b0a4f20f9a56b5d1da57e2227c661b7b16168e2f72365f57b63326e29b24" + [[package]] name = "futures-util" version = "0.3.30" @@ -1545,6 +1933,17 @@ dependencies = [ "version_check", ] +[[package]] +name = "getrandom" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" +dependencies = [ + "cfg-if", + "libc", + "wasi 0.9.0+wasi-snapshot-preview1", +] + [[package]] name = "getrandom" version = "0.2.15" @@ -1553,7 +1952,7 @@ checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", "libc", - "wasi", + "wasi 0.11.0+wasi-snapshot-preview1", ] [[package]] @@ -1568,6 +1967,16 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" +[[package]] +name = "graphql-parser" +version = "0.3.0" +source = "git+https://github.com/prisma/graphql-parser#6a3f58bd879065588e710cb02b5bd30c1ce182c3" +dependencies = [ + "combine 3.8.1", + "indexmap 1.9.3", + "thiserror", +] + [[package]] name = "h2" version = "0.3.26" @@ -1608,34 +2017,33 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.12.3" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" +dependencies = [ + "ahash 0.7.8", +] [[package]] name = "hashbrown" -version = "0.14.5" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" dependencies = [ - "ahash", - "allocator-api2", + "ahash 0.7.8", ] [[package]] -name = "hashlink" -version = "0.8.4" +name = "hashbrown" +version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8094feaf31ff591f651a2664fb9cfd92bba7a60ce3197265e9482ebe753c8f7" -dependencies = [ - "hashbrown 0.14.5", -] +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" [[package]] name = "heck" -version = "0.4.1" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" +checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" dependencies = [ "unicode-segmentation", ] @@ -1652,22 +2060,13 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" -[[package]] -name = "hkdf" -version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" -dependencies = [ - "hmac", -] - [[package]] name = "hmac" version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" dependencies = [ - "digest", + "digest 0.10.7", ] [[package]] @@ -1679,6 +2078,17 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "hostname" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c731c3e10504cc8ed35cfe2f1db4c9274c3d35fa486e3b31df46f068ef3e867" +dependencies = [ + "libc", + "match_cfg", + "winapi", +] + [[package]] name = "http" version = "0.2.12" @@ -1701,6 +2111,17 @@ dependencies = [ "itoa", ] +[[package]] +name = "http-body" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" +dependencies = [ + "bytes", + "http 0.2.12", + "pin-project-lite", +] + [[package]] name = "http-body" version = "1.0.0" @@ -1720,7 +2141,7 @@ dependencies = [ "bytes", "futures-core", "http 1.1.0", - "http-body", + "http-body 1.0.0", "pin-project-lite", ] @@ -1736,6 +2157,30 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" +[[package]] +name = "hyper" +version = "0.14.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80" +dependencies = [ + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "h2 0.3.26", + "http 0.2.12", + "http-body 0.4.6", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "socket2 0.5.7", + "tokio", + "tower-service", + "tracing", + "want", +] + [[package]] name = "hyper" version = "1.3.1" @@ -1747,7 +2192,7 @@ dependencies = [ "futures-util", "h2 0.4.5", "http 1.1.0", - "http-body", + "http-body 1.0.0", "httparse", "itoa", "pin-project-lite", @@ -1756,6 +2201,19 @@ dependencies = [ "want", ] +[[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.28", + "native-tls", + "tokio", + "tokio-native-tls 0.3.1", +] + [[package]] name = "hyper-tls" version = "0.6.0" @@ -1764,11 +2222,11 @@ checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" dependencies = [ "bytes", "http-body-util", - "hyper", + "hyper 1.3.1", "hyper-util", "native-tls", "tokio", - "tokio-native-tls", + "tokio-native-tls 0.3.1", "tower-service", ] @@ -1782,8 +2240,8 @@ dependencies = [ "futures-channel", "futures-util", "http 1.1.0", - "http-body", - "hyper", + "http-body 1.0.0", + "hyper 1.3.1", "pin-project-lite", "socket2 0.5.7", "tokio", @@ -1859,6 +2317,12 @@ dependencies = [ "serde", ] +[[package]] +name = "indoc" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa799dd5ed20a7e349f3b4639aa80d74549c81716d9ec4f994c9b5815598306" + [[package]] name = "inout" version = "0.1.3" @@ -1878,6 +2342,21 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "introspection-connector" +version = "0.1.0" +source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.10#c4aeef82dbae310e974d6122160c7e3b5fb6df53" +dependencies = [ + "anyhow", + "async-trait", + "enumflags2", + "psl", + "serde", + "serde_json", + "thiserror", + "user-facing-errors", +] + [[package]] name = "io-lifetimes" version = "1.0.11" @@ -1895,6 +2374,15 @@ version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" +[[package]] +name = "itertools" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +dependencies = [ + "either", +] + [[package]] name = "itertools" version = "0.12.1" @@ -1928,6 +2416,41 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "json-rpc-api-build" +version = "0.1.0" +source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.10#c4aeef82dbae310e974d6122160c7e3b5fb6df53" +dependencies = [ + "backtrace", + "heck", + "serde", + "toml", +] + +[[package]] +name = "jsonrpc-core" +version = "17.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4467ab6dfa369b69e52bd0692e480c4d117410538526a57a304a0f2250fd95e" +dependencies = [ + "futures", + "futures-executor", + "futures-util", + "log", + "serde", + "serde_derive", + "serde_json", +] + +[[package]] +name = "keccak" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" +dependencies = [ + "cpufeatures", +] + [[package]] name = "language-tags" version = "0.3.2" @@ -1948,7 +2471,7 @@ dependencies = [ "flume", "futures-core", "futures-io", - "parking_lot", + "parking_lot 0.12.2", "pinky-swear", "reactor-trait", "serde", @@ -1961,9 +2484,6 @@ name = "lazy_static" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" -dependencies = [ - "spin 0.5.2", -] [[package]] name = "lazycell" @@ -1988,21 +2508,20 @@ dependencies = [ ] [[package]] -name = "libm" -version = "0.2.8" +name = "libredox" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" +checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" +dependencies = [ + "bitflags 2.5.0", + "libc", +] [[package]] -name = "libsqlite3-sys" -version = "0.27.0" +name = "linked-hash-map" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf4e226dcd58b4be396f7bd3c20da8fdee2911400705297ba7d2d7cc2c30f716" -dependencies = [ - "cc", - "pkg-config", - "vcpkg", -] +checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" [[package]] name = "linux-raw-sys" @@ -2050,42 +2569,239 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" [[package]] -name = "matchers" -version = "0.1.0" +name = "lru" +version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" +checksum = "e999beba7b6e8345721bd280141ed958096a2e4abdf74f67ff4ce49b4b54e47a" dependencies = [ - "regex-automata 0.1.10", + "hashbrown 0.12.3", ] [[package]] -name = "md-5" -version = "0.10.6" +name = "lru-cache" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d89e7ee0cfbedfc4da3340218492196241d89eefb6dab27de5df917a6d2e78cf" +checksum = "31e24f1ad8321ca0e8a1e0ac13f23cb668e6f5466c2c57319f6a5cf1cc8e3b1c" dependencies = [ - "cfg-if", - "digest", + "linked-hash-map", ] [[package]] -name = "mediatype" -version = "0.19.18" +name = "lsp-types" +version = "0.91.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8878cd8d1b3c8c8ae4b2ba0a36652b7cf192f618a599a7fbdfa25cffd4ea72dd" - -[[package]] -name = "memchr" -version = "2.7.2" +checksum = "2368312c59425dd133cb9a327afee65be0a633a8ce471d248e2202a48f8f68ae" +dependencies = [ + "bitflags 1.3.2", + "serde", + "serde_json", + "serde_repr", + "url", +] + +[[package]] +name = "mach" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b823e83b2affd8f40a9ee8c29dbc56404c1e34cd2710921f2801e2cf29527afa" +dependencies = [ + "libc", +] + +[[package]] +name = "match_cfg" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4" + +[[package]] +name = "matchers" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" +dependencies = [ + "regex-automata 0.1.10", +] + +[[package]] +name = "maybe-async" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5cf92c10c7e361d6b99666ec1c6f9805b0bea2c3bd8c78dc6fe98ac5bd78db11" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.65", +] + +[[package]] +name = "md-5" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d89e7ee0cfbedfc4da3340218492196241d89eefb6dab27de5df917a6d2e78cf" +dependencies = [ + "cfg-if", + "digest 0.10.7", +] + +[[package]] +name = "md5" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "490cc448043f947bae3cbee9c203358d62dbee0db12107a74be5c30ccfd09771" + +[[package]] +name = "mediatype" +version = "0.19.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8878cd8d1b3c8c8ae4b2ba0a36652b7cf192f618a599a7fbdfa25cffd4ea72dd" + +[[package]] +name = "memchr" +version = "2.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" +[[package]] +name = "metrics" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e52eb6380b6d2a10eb3434aec0885374490f5b82c8aaf5cd487a183c98be834" +dependencies = [ + "ahash 0.7.8", + "metrics-macros", +] + +[[package]] +name = "metrics" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "142c53885123b68d94108295a09d4afe1a1388ed95b54d5dacd9a454753030f2" +dependencies = [ + "ahash 0.7.8", + "metrics-macros", +] + +[[package]] +name = "metrics-exporter-prometheus" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "953cbbb6f9ba4b9304f4df79b98cdc9d14071ed93065a9fca11c00c5d9181b66" +dependencies = [ + "hyper 0.14.28", + "indexmap 1.9.3", + "ipnet", + "metrics 0.19.0", + "metrics-util 0.13.0", + "parking_lot 0.11.2", + "quanta", + "thiserror", + "tokio", + "tracing", +] + +[[package]] +name = "metrics-macros" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49e30813093f757be5cf21e50389a24dc7dbb22c49f23b7e8f51d69b508a5ffa" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "metrics-util" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65a9e83b833e1d2e07010a386b197c13aa199bbd0fca5cf69bfa147972db890a" +dependencies = [ + "aho-corasick 0.7.20", + "atomic-shim", + "crossbeam-epoch", + "crossbeam-utils", + "hashbrown 0.11.2", + "indexmap 1.9.3", + "metrics 0.18.1", + "num_cpus", + "ordered-float", + "parking_lot 0.11.2", + "quanta", + "radix_trie", + "sketches-ddsketch", +] + +[[package]] +name = "metrics-util" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd1f4b69bef1e2b392b2d4a12902f2af90bb438ba4a66aa222d1023fa6561b50" +dependencies = [ + "atomic-shim", + "crossbeam-epoch", + "crossbeam-utils", + "hashbrown 0.11.2", + "metrics 0.19.0", + "num_cpus", + "parking_lot 0.11.2", + "quanta", + "sketches-ddsketch", +] + +[[package]] +name = "migration-connector" +version = "0.1.0" +source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.10#c4aeef82dbae310e974d6122160c7e3b5fb6df53" +dependencies = [ + "chrono", + "enumflags2", + "introspection-connector", + "psl", + "sha2 0.9.9", + "tracing", + "tracing-error", + "user-facing-errors", +] + +[[package]] +name = "migration-core" +version = "0.1.0" +source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.10#c4aeef82dbae310e974d6122160c7e3b5fb6df53" +dependencies = [ + "async-trait", + "chrono", + "enumflags2", + "json-rpc-api-build", + "jsonrpc-core", + "migration-connector", + "psl", + "serde", + "serde_json", + "sql-migration-connector", + "tokio", + "tracing", + "tracing-futures", + "tracing-subscriber", + "url", + "user-facing-errors", +] + [[package]] name = "mime" version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" +[[package]] +name = "minidom" +version = "0.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f45614075738ce1b77a1768912a60c0227525971b03e09122a05b8a34a2a6278" +dependencies = [ + "rxml", +] + [[package]] name = "minimal-lexical" version = "0.2.1" @@ -2109,7 +2825,7 @@ checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" dependencies = [ "libc", "log", - "wasi", + "wasi 0.11.0+wasi-snapshot-preview1", "windows-sys 0.48.0", ] @@ -2119,6 +2835,24 @@ version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c9be0862c1b3f26a88803c4a49de6889c10e608b3ee9344e6ef5b45fb37ad3d1" +[[package]] +name = "mobc" +version = "0.7.3" +source = "git+https://github.com/prisma/mobc?tag=1.0.6#80462c4870a2bf6aab49da15c88c021bae531da8" +dependencies = [ + "async-trait", + "futures-channel", + "futures-core", + "futures-timer", + "futures-util", + "log", + "metrics 0.18.1", + "thiserror", + "tokio", + "tracing", + "tracing-subscriber", +] + [[package]] name = "mutually_exclusive_features" version = "0.0.3" @@ -2143,6 +2877,15 @@ dependencies = [ "tempfile", ] +[[package]] +name = "nibble_vec" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a5d83df9f36fe23f0c3648c6bbb8b0298bb5f1939c8f2704431371f4b84d43" +dependencies = [ + "smallvec", +] + [[package]] name = "nom" version = "7.1.3" @@ -2163,6 +2906,20 @@ dependencies = [ "winapi", ] +[[package]] +name = "num" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23" +dependencies = [ + "num-bigint", + "num-complex", + "num-integer", + "num-iter", + "num-rational", + "num-traits", +] + [[package]] name = "num-bigint" version = "0.4.5" @@ -2174,20 +2931,12 @@ dependencies = [ ] [[package]] -name = "num-bigint-dig" -version = "0.8.4" +name = "num-complex" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc84195820f291c7697304f3cbdadd1cb7199c0efc917ff5eafd71225c136151" +checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" dependencies = [ - "byteorder", - "lazy_static", - "libm", - "num-integer", - "num-iter", "num-traits", - "rand", - "smallvec", - "zeroize", ] [[package]] @@ -2216,6 +2965,17 @@ dependencies = [ "num-traits", ] +[[package]] +name = "num-rational" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" +dependencies = [ + "num-bigint", + "num-integer", + "num-traits", +] + [[package]] name = "num-traits" version = "0.2.19" @@ -2223,7 +2983,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", - "libm", ] [[package]] @@ -2260,6 +3019,12 @@ version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +[[package]] +name = "opaque-debug" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" + [[package]] name = "openssl" version = "0.10.64" @@ -2304,6 +3069,51 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "opentelemetry" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6105e89802af13fdf48c49d7646d3b533a70e536d818aae7e78ba0433d01acb8" +dependencies = [ + "async-trait", + "crossbeam-channel", + "futures-channel", + "futures-executor", + "futures-util", + "js-sys", + "lazy_static", + "percent-encoding", + "pin-project", + "rand 0.8.5", + "thiserror", + "tokio", +] + +[[package]] +name = "ordered-float" +version = "2.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68f19d67e5a2795c94e73e0bb1cc1a7edeb2e28efd39e2e1c9b7a40c1108b11c" +dependencies = [ + "num-traits", +] + +[[package]] +name = "ordered-multimap" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccd746e37177e1711c20dd619a1620f34f5c8b569c53590a72dedd5344d8924a" +dependencies = [ + "dlv-list", + "hashbrown 0.12.3", +] + +[[package]] +name = "ordermap" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a86ed3f5f244b372d6b1a00b72ef7f8876d0bc6a78a4c9985c53614041512063" + [[package]] name = "overload" version = "0.1.1" @@ -2324,10 +3134,10 @@ dependencies = [ "hmac", "pkcs12", "pkcs5", - "rand", + "rand 0.8.5", "rc2", "sha1", - "sha2", + "sha2 0.10.8", "thiserror", "x509-parser", ] @@ -2338,6 +3148,17 @@ version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bb813b8af86854136c6922af0598d719255ecb2179515e6e7730d468f05c9cae" +[[package]] +name = "parking_lot" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" +dependencies = [ + "instant", + "lock_api", + "parking_lot_core 0.8.6", +] + [[package]] name = "parking_lot" version = "0.12.2" @@ -2345,7 +3166,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7e4af0ca4f6caed20e900d564c242b8e5d4903fdacf31d3daf527b66fe6f42fb" dependencies = [ "lock_api", - "parking_lot_core", + "parking_lot_core 0.9.10", +] + +[[package]] +name = "parking_lot_core" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60a2cfe6f0ad2bfc16aefa463b497d5c7a5ecd44a23efa72aa342d90177356dc" +dependencies = [ + "cfg-if", + "instant", + "libc", + "redox_syscall 0.2.16", + "smallvec", + "winapi", ] [[package]] @@ -2361,6 +3196,24 @@ dependencies = [ "windows-targets 0.52.5", ] +[[package]] +name = "parse-size" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "944553dd59c802559559161f9816429058b869003836120e262e8caec061b7ae" + +[[package]] +name = "parser-database" +version = "0.1.0" +source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.10#c4aeef82dbae310e974d6122160c7e3b5fb6df53" +dependencies = [ + "diagnostics", + "either", + "enumflags2", + "indexmap 1.9.3", + "schema-ast", +] + [[package]] name = "paste" version = "1.0.15" @@ -2373,7 +3226,7 @@ version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2" dependencies = [ - "digest", + "digest 0.10.7", "hmac", ] @@ -2393,30 +3246,85 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] -name = "phf" -version = "0.11.2" +name = "pest" +version = "2.7.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc" +checksum = "560131c633294438da9f7c4b08189194b20946c8274c6b9e38881a7874dc8ee8" dependencies = [ - "phf_shared", + "memchr", + "thiserror", + "ucd-trie", ] [[package]] -name = "phf_shared" -version = "0.11.2" +name = "pest_derive" +version = "2.7.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b" +checksum = "26293c9193fbca7b1a3bf9b79dc1e388e927e6cacaa78b4a3ab705a1d3d41459" dependencies = [ - "siphasher", + "pest", + "pest_generator", ] [[package]] -name = "pin-project" -version = "1.1.5" +name = "pest_generator" +version = "2.7.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" +checksum = "3ec22af7d3fb470a85dd2ca96b7c577a1eb4ef6f1683a9fe9a8c16e136c04687" dependencies = [ - "pin-project-internal", + "pest", + "pest_meta", + "proc-macro2", + "quote", + "syn 2.0.65", +] + +[[package]] +name = "pest_meta" +version = "2.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7a240022f37c361ec1878d646fc5b7d7c4d28d5946e1a80ad5a7a4f4ca0bdcd" +dependencies = [ + "once_cell", + "pest", + "sha2 0.10.8", +] + +[[package]] +name = "petgraph" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c3659d1ee90221741f65dd128d9998311b0e40c5d3c23a62445938214abce4f" +dependencies = [ + "fixedbitset", + "ordermap", +] + +[[package]] +name = "phf" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc" +dependencies = [ + "phf_shared", +] + +[[package]] +name = "phf_shared" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b" +dependencies = [ + "siphasher", +] + +[[package]] +name = "pin-project" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" +dependencies = [ + "pin-project-internal", ] [[package]] @@ -2450,7 +3358,7 @@ checksum = "6cfae3ead413ca051a681152bd266438d3bfa301c9bdf836939a14c721bb2a21" dependencies = [ "doc-comment", "flume", - "parking_lot", + "parking_lot 0.12.2", "tracing", ] @@ -2465,17 +3373,6 @@ dependencies = [ "futures-io", ] -[[package]] -name = "pkcs1" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8ffb9f10fa047879315e6625af03c164b16962a5368d724ed16323b68ace47f" -dependencies = [ - "der", - "pkcs8", - "spki", -] - [[package]] name = "pkcs12" version = "0.1.0" @@ -2485,7 +3382,7 @@ dependencies = [ "cms", "const-oid", "der", - "digest", + "digest 0.10.7", "spki", "x509-cert", "zeroize", @@ -2502,17 +3399,7 @@ dependencies = [ "der", "pbkdf2", "scrypt", - "sha2", - "spki", -] - -[[package]] -name = "pkcs8" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" -dependencies = [ - "der", + "sha2 0.10.8", "spki", ] @@ -2554,46 +3441,46 @@ dependencies = [ ] [[package]] -name = "postgres" -version = "0.19.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7915b33ed60abc46040cbcaa25ffa1c7ec240668e0477c4f3070786f5916d451" +name = "postgres-native-tls" +version = "0.5.0" +source = "git+https://github.com/pimeys/rust-postgres?rev=064a6a50427542e2c166e870027735aab3b52e77#064a6a50427542e2c166e870027735aab3b52e77" dependencies = [ - "bytes", - "fallible-iterator", - "futures-util", - "log", + "native-tls", "tokio", + "tokio-native-tls 0.3.0", "tokio-postgres", ] [[package]] name = "postgres-protocol" -version = "0.6.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49b6c5ef183cd3ab4ba005f1ca64c21e8bd97ce4699cfea9e8d9a2c4958ca520" +version = "0.6.4" +source = "git+https://github.com/pimeys/rust-postgres?rev=064a6a50427542e2c166e870027735aab3b52e77#064a6a50427542e2c166e870027735aab3b52e77" dependencies = [ - "base64 0.21.7", + "base64 0.13.1", "byteorder", "bytes", "fallible-iterator", "hmac", "md-5", "memchr", - "rand", - "sha2", + "rand 0.8.5", + "sha2 0.10.8", "stringprep", ] [[package]] name = "postgres-types" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d2234cdee9408b523530a9b6d2d6b373d1db34f6a8e51dc03ded1828d7fb67c" +version = "0.2.4" +source = "git+https://github.com/pimeys/rust-postgres?rev=064a6a50427542e2c166e870027735aab3b52e77#064a6a50427542e2c166e870027735aab3b52e77" dependencies = [ + "bit-vec", "bytes", + "chrono", "fallible-iterator", "postgres-protocol", + "serde", + "serde_json", + "uuid", ] [[package]] @@ -2618,6 +3505,119 @@ dependencies = [ "syn 2.0.65", ] +[[package]] +name = "prisma-client-rust" +version = "0.6.11" +source = "git+https://github.com/Brendonovich/prisma-client-rust?tag=0.6.11#3ac68d0052533d3ae0332d93a56a8ad169c2ee18" +dependencies = [ + "base64 0.13.1", + "bigdecimal", + "chrono", + "diagnostics", + "dml", + "dmmf", + "dotenv", + "futures", + "indexmap 1.9.3", + "migration-core", + "paste", + "prisma-client-rust-macros", + "prisma-models", + "psl", + "query-connector", + "query-core", + "schema", + "serde", + "serde-value", + "serde_json", + "thiserror", + "user-facing-errors", + "uuid", +] + +[[package]] +name = "prisma-client-rust-cli" +version = "0.6.11" +source = "git+https://github.com/Brendonovich/prisma-client-rust?tag=0.6.11#3ac68d0052533d3ae0332d93a56a8ad169c2ee18" +dependencies = [ + "directories", + "flate2", + "http 0.2.12", + "prisma-client-rust-sdk", + "proc-macro2", + "quote", + "regex", + "reqwest 0.11.27", + "serde", + "serde_json", + "serde_path_to_error", + "syn 1.0.109", + "thiserror", +] + +[[package]] +name = "prisma-client-rust-macros" +version = "0.6.11" +source = "git+https://github.com/Brendonovich/prisma-client-rust?tag=0.6.11#3ac68d0052533d3ae0332d93a56a8ad169c2ee18" +dependencies = [ + "convert_case 0.6.0", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "prisma-client-rust-sdk" +version = "0.6.11" +source = "git+https://github.com/Brendonovich/prisma-client-rust?tag=0.6.11#3ac68d0052533d3ae0332d93a56a8ad169c2ee18" +dependencies = [ + "convert_case 0.5.0", + "dml", + "dmmf", + "prisma-models", + "proc-macro2", + "psl", + "query-core", + "quote", + "request-handlers", + "serde", + "serde_json", + "serde_path_to_error", + "syn 1.0.109", + "thiserror", +] + +[[package]] +name = "prisma-models" +version = "0.0.0" +source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.10#c4aeef82dbae310e974d6122160c7e3b5fb6df53" +dependencies = [ + "bigdecimal", + "chrono", + "itertools 0.10.5", + "once_cell", + "prisma-value", + "psl", + "serde", + "serde_json", + "thiserror", +] + +[[package]] +name = "prisma-value" +version = "0.1.0" +source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.10#c4aeef82dbae310e974d6122160c7e3b5fb6df53" +dependencies = [ + "base64 0.12.3", + "bigdecimal", + "chrono", + "once_cell", + "regex", + "serde", + "serde_json", + "uuid", +] + [[package]] name = "proc-macro2" version = "1.0.83" @@ -2627,6 +3627,179 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "psl" +version = "0.1.0" +source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.10#c4aeef82dbae310e974d6122160c7e3b5fb6df53" +dependencies = [ + "builtin-psl-connectors", + "dml", + "psl-core", +] + +[[package]] +name = "psl-core" +version = "0.1.0" +source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.10#c4aeef82dbae310e974d6122160c7e3b5fb6df53" +dependencies = [ + "bigdecimal", + "chrono", + "diagnostics", + "enumflags2", + "indoc", + "itertools 0.10.5", + "lsp-types", + "once_cell", + "parser-database", + "prisma-value", + "regex", + "schema-ast", + "serde", + "serde_json", + "url", +] + +[[package]] +name = "quaint" +version = "0.2.0-alpha.13" +source = "git+https://github.com/Brendonovich/quaint?tag=0.6.5#c502995f5e9dd4a86d80fa27f63e641bd6bbc6f2" +dependencies = [ + "async-trait", + "base64 0.12.3", + "bigdecimal", + "bit-vec", + "byteorder", + "bytes", + "chrono", + "connection-string", + "futures", + "hex", + "lru-cache", + "metrics 0.18.1", + "mobc", + "native-tls", + "num_cpus", + "percent-encoding", + "postgres-native-tls", + "postgres-types", + "serde_json", + "sqlformat", + "thiserror", + "tokio", + "tokio-postgres", + "tracing", + "tracing-core", + "url", + "uuid", +] + +[[package]] +name = "quanta" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20afe714292d5e879d8b12740aa223c6a88f118af41870e8b6196e39a02238a8" +dependencies = [ + "crossbeam-utils", + "libc", + "mach", + "once_cell", + "raw-cpuid", + "wasi 0.10.2+wasi-snapshot-preview1", + "web-sys", + "winapi", +] + +[[package]] +name = "query-connector" +version = "0.1.0" +source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.10#c4aeef82dbae310e974d6122160c7e3b5fb6df53" +dependencies = [ + "anyhow", + "async-trait", + "chrono", + "futures", + "indexmap 1.9.3", + "itertools 0.10.5", + "prisma-models", + "prisma-value", + "serde", + "serde_json", + "thiserror", + "user-facing-errors", + "uuid", +] + +[[package]] +name = "query-core" +version = "0.1.0" +source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.10#c4aeef82dbae310e974d6122160c7e3b5fb6df53" +dependencies = [ + "async-trait", + "base64 0.12.3", + "bigdecimal", + "chrono", + "connection-string", + "crossbeam-queue", + "cuid", + "enumflags2", + "futures", + "indexmap 1.9.3", + "itertools 0.10.5", + "lazy_static", + "lru", + "once_cell", + "opentelemetry", + "parking_lot 0.12.2", + "petgraph", + "pin-utils", + "prisma-models", + "prisma-value", + "psl", + "query-connector", + "query-engine-metrics", + "schema", + "schema-builder", + "serde", + "serde_json", + "sql-query-connector", + "thiserror", + "tokio", + "tracing", + "tracing-futures", + "tracing-opentelemetry", + "tracing-subscriber", + "url", + "user-facing-errors", + "uuid", +] + +[[package]] +name = "query-engine-metrics" +version = "0.1.0" +source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.10#c4aeef82dbae310e974d6122160c7e3b5fb6df53" +dependencies = [ + "metrics 0.18.1", + "metrics-exporter-prometheus", + "metrics-util 0.12.1", + "once_cell", + "parking_lot 0.12.2", + "serde", + "serde_json", + "tracing", + "tracing-futures", + "tracing-subscriber", +] + +[[package]] +name = "quick-xml" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f50b1c63b38611e7d4d7f68b82d3ad0cc71a2ad2e7f61fc10f1328d917c93cd" +dependencies = [ + "memchr", + "serde", +] + [[package]] name = "quote" version = "1.0.36" @@ -2636,6 +3809,29 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "radix_trie" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c069c179fcdc6a2fe24d8d18305cf085fdbd4f922c041943e203685d6a1c58fd" +dependencies = [ + "endian-type", + "nibble_vec", +] + +[[package]] +name = "rand" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" +dependencies = [ + "getrandom 0.1.16", + "libc", + "rand_chacha 0.2.2", + "rand_core 0.5.1", + "rand_hc", +] + [[package]] name = "rand" version = "0.8.5" @@ -2643,8 +3839,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ "libc", - "rand_chacha", - "rand_core", + "rand_chacha 0.3.1", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_chacha" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" +dependencies = [ + "ppv-lite86", + "rand_core 0.5.1", ] [[package]] @@ -2654,7 +3860,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" dependencies = [ "ppv-lite86", - "rand_core", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_core" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" +dependencies = [ + "getrandom 0.1.16", ] [[package]] @@ -2663,7 +3878,25 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom", + "getrandom 0.2.15", +] + +[[package]] +name = "rand_hc" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" +dependencies = [ + "rand_core 0.5.1", +] + +[[package]] +name = "raw-cpuid" +version = "10.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c297679cb867470fa8c9f67dbba74a78d78e3e98d7cf2b08d6d71540f797332" +dependencies = [ + "bitflags 1.3.2", ] [[package]] @@ -2695,7 +3928,7 @@ dependencies = [ "arc-swap", "async-trait", "bytes", - "combine", + "combine 4.6.7", "futures", "futures-util", "itoa", @@ -2712,9 +3945,9 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.4.1" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" dependencies = [ "bitflags 1.3.2", ] @@ -2728,13 +3961,24 @@ dependencies = [ "bitflags 2.5.0", ] +[[package]] +name = "redox_users" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd283d9651eeda4b2a83a43c1c91b266c40fd76ecd39a50a8c630ae69dc72891" +dependencies = [ + "getrandom 0.2.15", + "libredox", + "thiserror", +] + [[package]] name = "regex" version = "1.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c" dependencies = [ - "aho-corasick", + "aho-corasick 1.1.3", "memchr", "regex-automata 0.4.6", "regex-syntax 0.8.3", @@ -2755,7 +3999,7 @@ version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" dependencies = [ - "aho-corasick", + "aho-corasick 1.1.3", "memchr", "regex-syntax 0.8.3", ] @@ -2773,10 +4017,74 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] -name = "regex-syntax" -version = "0.8.3" +name = "regex-syntax" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" + +[[package]] +name = "request-handlers" +version = "0.1.0" +source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.10#c4aeef82dbae310e974d6122160c7e3b5fb6df53" +dependencies = [ + "bigdecimal", + "connection-string", + "dmmf", + "futures", + "graphql-parser", + "indexmap 1.9.3", + "itertools 0.10.5", + "psl", + "query-core", + "serde", + "serde_json", + "thiserror", + "tracing", + "url", + "user-facing-errors", +] + +[[package]] +name = "reqwest" +version = "0.11.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" +checksum = "dd67538700a17451e7cba03ac727fb961abb7607553461627b97de0b89cf4a62" +dependencies = [ + "base64 0.21.7", + "bytes", + "encoding_rs", + "futures-core", + "futures-util", + "h2 0.3.26", + "http 0.2.12", + "http-body 0.4.6", + "hyper 0.14.28", + "hyper-tls 0.5.0", + "ipnet", + "js-sys", + "log", + "mime", + "native-tls", + "once_cell", + "percent-encoding", + "pin-project-lite", + "rustls-pemfile 1.0.4", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper", + "system-configuration", + "tokio", + "tokio-native-tls 0.3.1", + "tokio-util", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "wasm-streams", + "web-sys", + "winreg 0.50.0", +] [[package]] name = "reqwest" @@ -2791,10 +4099,10 @@ dependencies = [ "futures-util", "h2 0.4.5", "http 1.1.0", - "http-body", + "http-body 1.0.0", "http-body-util", - "hyper", - "hyper-tls", + "hyper 1.3.1", + "hyper-tls 0.6.0", "hyper-util", "ipnet", "js-sys", @@ -2811,13 +4119,13 @@ dependencies = [ "sync_wrapper", "system-configuration", "tokio", - "tokio-native-tls", + "tokio-native-tls 0.3.1", "tower-service", "url", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", - "winreg", + "winreg 0.52.0", ] [[package]] @@ -2828,33 +4136,13 @@ checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" dependencies = [ "cc", "cfg-if", - "getrandom", + "getrandom 0.2.15", "libc", - "spin 0.9.8", + "spin", "untrusted", "windows-sys 0.52.0", ] -[[package]] -name = "rsa" -version = "0.9.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d0e5124fcb30e76a7e79bfee683a2746db83784b86289f6251b54b7950a0dfc" -dependencies = [ - "const-oid", - "digest", - "num-bigint-dig", - "num-integer", - "num-traits", - "pkcs1", - "pkcs8", - "rand_core", - "signature", - "spki", - "subtle", - "zeroize", -] - [[package]] name = "rust-argon2" version = "2.1.0" @@ -2866,6 +4154,49 @@ dependencies = [ "constant_time_eq", ] +[[package]] +name = "rust-ini" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6d5f2436026b4f6e79dc829837d467cc7e9a55ee40e750d716713540715a2df" +dependencies = [ + "cfg-if", + "ordered-multimap", +] + +[[package]] +name = "rust-s3" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b2ac5ff6acfbe74226fa701b5ef793aaa054055c13ebb7060ad36942956e027" +dependencies = [ + "async-trait", + "aws-creds", + "aws-region", + "base64 0.13.1", + "bytes", + "cfg-if", + "futures", + "hex", + "hmac", + "http 0.2.12", + "log", + "maybe-async", + "md5", + "minidom", + "percent-encoding", + "quick-xml", + "reqwest 0.11.27", + "serde", + "serde_derive", + "sha2 0.10.8", + "thiserror", + "time", + "tokio", + "tokio-stream", + "url", +] + [[package]] name = "rustc-demangle" version = "0.1.24" @@ -2923,17 +4254,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "rustls" -version = "0.21.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f56a14d1f48b391359b22f731fd4bd7e43c97f3c50eee276f3aa09c94784d3e" -dependencies = [ - "ring", - "rustls-webpki 0.101.7", - "sct", -] - [[package]] name = "rustls" version = "0.23.7" @@ -2944,7 +4264,7 @@ dependencies = [ "log", "once_cell", "rustls-pki-types", - "rustls-webpki 0.102.4", + "rustls-webpki", "subtle", "zeroize", ] @@ -2956,10 +4276,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "727a826801254b6cfcd2508a0508c01b7c1bca21d3673e84d86da084781b83d5" dependencies = [ "log", - "rustls 0.23.7", + "rustls", "rustls-native-certs", "rustls-pki-types", - "rustls-webpki 0.102.4", + "rustls-webpki", ] [[package]] @@ -3002,26 +4322,33 @@ checksum = "976295e77ce332211c0d24d92c0e83e50f5c5f046d11082cea19f3df13a3562d" [[package]] name = "rustls-webpki" -version = "0.101.7" +version = "0.102.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" +checksum = "ff448f7e92e913c4b7d4c6d8e4540a1724b319b4152b8aef6d4cf8339712b33e" dependencies = [ + "aws-lc-rs", "ring", + "rustls-pki-types", "untrusted", ] [[package]] -name = "rustls-webpki" -version = "0.102.4" +name = "rxml" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff448f7e92e913c4b7d4c6d8e4540a1724b319b4152b8aef6d4cf8339712b33e" +checksum = "a98f186c7a2f3abbffb802984b7f1dfd65dac8be1aafdaabbca4137f53f0dff7" dependencies = [ - "aws-lc-rs", - "ring", - "rustls-pki-types", - "untrusted", + "bytes", + "rxml_validation", + "smartstring", ] +[[package]] +name = "rxml_validation" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22a197350ece202f19a166d1ad6d9d6de145e1d2a8ef47db299abe164dbd7530" + [[package]] name = "ryu" version = "1.0.18" @@ -3046,6 +4373,39 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "schema" +version = "0.1.0" +source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.10#c4aeef82dbae310e974d6122160c7e3b5fb6df53" +dependencies = [ + "once_cell", + "prisma-models", + "psl", +] + +[[package]] +name = "schema-ast" +version = "0.1.0" +source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.10#c4aeef82dbae310e974d6122160c7e3b5fb6df53" +dependencies = [ + "diagnostics", + "pest", + "pest_derive", +] + +[[package]] +name = "schema-builder" +version = "0.1.0" +source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.10#c4aeef82dbae310e974d6122160c7e3b5fb6df53" +dependencies = [ + "itertools 0.10.5", + "lazy_static", + "once_cell", + "prisma-models", + "psl", + "schema", +] + [[package]] name = "scopeguard" version = "1.2.0" @@ -3060,17 +4420,7 @@ checksum = "0516a385866c09368f0b5bcd1caff3366aace790fcd46e2bb032697bb172fd1f" dependencies = [ "pbkdf2", "salsa20", - "sha2", -] - -[[package]] -name = "sct" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" -dependencies = [ - "ring", - "untrusted", + "sha2 0.10.8", ] [[package]] @@ -3111,6 +4461,16 @@ dependencies = [ "serde_derive", ] +[[package]] +name = "serde-value" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3a1a3341211875ef120e117ea7fd5228530ae7e7036a779fdc9117be6b3282c" +dependencies = [ + "ordered-float", + "serde", +] + [[package]] name = "serde_derive" version = "1.0.202" @@ -3141,11 +4501,42 @@ version = "1.0.117" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "455182ea6142b14f93f4bc5320a2b31c1f266b66a4a5c858b013302a5d8cbfc3" dependencies = [ + "indexmap 2.2.6", "itoa", "ryu", "serde", ] +[[package]] +name = "serde_path_to_error" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af99884400da37c88f5e9146b7f1fd0fbcae8f6eec4e9da38b67d05486f814a6" +dependencies = [ + "itoa", + "serde", +] + +[[package]] +name = "serde_plain" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ce1fc6db65a611022b23a0dec6975d63fb80a302cb3388835ff02c097258d50" +dependencies = [ + "serde", +] + +[[package]] +name = "serde_repr" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.65", +] + [[package]] name = "serde_urlencoded" version = "0.7.1" @@ -3196,7 +4587,7 @@ checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" dependencies = [ "cfg-if", "cpufeatures", - "digest", + "digest 0.10.7", ] [[package]] @@ -3205,6 +4596,19 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae1a47186c03a32177042e55dbc5fd5aee900b8e0069a8d70fba96a9375cd012" +[[package]] +name = "sha2" +version = "0.9.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" +dependencies = [ + "block-buffer 0.9.0", + "cfg-if", + "cpufeatures", + "digest 0.9.0", + "opaque-debug", +] + [[package]] name = "sha2" version = "0.10.8" @@ -3213,7 +4617,17 @@ checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" dependencies = [ "cfg-if", "cpufeatures", - "digest", + "digest 0.10.7", +] + +[[package]] +name = "sha3" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" +dependencies = [ + "digest 0.10.7", + "keccak", ] [[package]] @@ -3240,22 +4654,18 @@ dependencies = [ "libc", ] -[[package]] -name = "signature" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" -dependencies = [ - "digest", - "rand_core", -] - [[package]] name = "siphasher" version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" +[[package]] +name = "sketches-ddsketch" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04d2ecae5fcf33b122e2e6bd520a57ccf152d2dde3b38c71039df1a6867264ee" + [[package]] name = "slab" version = "0.4.9" @@ -3271,6 +4681,17 @@ version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" +[[package]] +name = "smartstring" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fb72c633efbaa2dd666986505016c32c3044395ceaf881518399d2f4127ee29" +dependencies = [ + "autocfg", + "static_assertions", + "version_check", +] + [[package]] name = "socket2" version = "0.4.10" @@ -3292,242 +4713,149 @@ dependencies = [ ] [[package]] -name = "spin" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" - -[[package]] -name = "spin" -version = "0.9.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" -dependencies = [ - "lock_api", -] - -[[package]] -name = "spki" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" -dependencies = [ - "base64ct", - "der", -] - -[[package]] -name = "sqlformat" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce81b7bd7c4493975347ef60d8c7e8b742d4694f4c49f93e0a12ea263938176c" -dependencies = [ - "itertools", - "nom", - "unicode_categories", -] - -[[package]] -name = "sqlx" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9a2ccff1a000a5a59cd33da541d9f2fdcd9e6e8229cc200565942bff36d0aaa" -dependencies = [ - "sqlx-core", - "sqlx-macros", - "sqlx-mysql", - "sqlx-postgres", - "sqlx-sqlite", -] - -[[package]] -name = "sqlx-core" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24ba59a9342a3d9bab6c56c118be528b27c9b60e490080e9711a04dccac83ef6" -dependencies = [ - "ahash", - "atoi", - "byteorder", - "bytes", - "chrono", - "crc", - "crossbeam-queue", - "either", - "event-listener 2.5.3", - "futures-channel", - "futures-core", - "futures-intrusive", - "futures-io", - "futures-util", - "hashlink", - "hex", - "indexmap 2.2.6", - "log", - "memchr", - "once_cell", - "paste", - "percent-encoding", - "rustls 0.21.12", - "rustls-pemfile 1.0.4", - "serde", - "serde_json", - "sha2", - "smallvec", - "sqlformat", - "thiserror", - "tokio", - "tokio-stream", - "tracing", - "url", - "webpki-roots", -] - -[[package]] -name = "sqlx-macros" -version = "0.7.4" +name = "spin" +version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ea40e2345eb2faa9e1e5e326db8c34711317d2b5e08d0d5741619048a803127" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" dependencies = [ - "proc-macro2", - "quote", - "sqlx-core", - "sqlx-macros-core", - "syn 1.0.109", + "lock_api", ] [[package]] -name = "sqlx-macros-core" -version = "0.7.4" +name = "spki" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5833ef53aaa16d860e92123292f1f6a3d53c34ba8b1969f152ef1a7bb803f3c8" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" dependencies = [ - "dotenvy", - "either", - "heck", - "hex", + "base64ct", + "der", +] + +[[package]] +name = "sql-ddl" +version = "0.1.0" +source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.10#c4aeef82dbae310e974d6122160c7e3b5fb6df53" + +[[package]] +name = "sql-introspection-connector" +version = "0.1.0" +source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.10#c4aeef82dbae310e974d6122160c7e3b5fb6df53" +dependencies = [ + "anyhow", + "async-trait", + "bigdecimal", + "datamodel-renderer", + "enumflags2", + "introspection-connector", "once_cell", - "proc-macro2", - "quote", + "psl", + "quaint", + "regex", "serde", "serde_json", - "sha2", - "sqlx-core", - "sqlx-mysql", - "sqlx-postgres", - "sqlx-sqlite", - "syn 1.0.109", - "tempfile", - "tokio", - "url", + "sql-schema-describer", + "thiserror", + "tracing", + "tracing-futures", + "user-facing-errors", ] [[package]] -name = "sqlx-mysql" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ed31390216d20e538e447a7a9b959e06ed9fc51c37b514b46eb758016ecd418" +name = "sql-migration-connector" +version = "0.1.0" +source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.10#c4aeef82dbae310e974d6122160c7e3b5fb6df53" dependencies = [ - "atoi", - "base64 0.21.7", - "bitflags 2.5.0", - "byteorder", - "bytes", "chrono", - "crc", - "digest", - "dotenvy", + "connection-string", "either", - "futures-channel", - "futures-core", - "futures-io", - "futures-util", - "generic-array", - "hex", - "hkdf", - "hmac", - "itoa", - "log", - "md-5", - "memchr", + "enumflags2", + "indoc", + "migration-connector", "once_cell", - "percent-encoding", - "rand", - "rsa", - "serde", - "sha1", - "sha2", - "smallvec", - "sqlx-core", - "stringprep", - "thiserror", + "psl", + "quaint", + "regex", + "serde_json", + "sql-ddl", + "sql-introspection-connector", + "sql-schema-describer", + "tokio", "tracing", - "whoami", + "tracing-futures", + "url", + "user-facing-errors", + "uuid", ] [[package]] -name = "sqlx-postgres" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c824eb80b894f926f89a0b9da0c7f435d27cdd35b8c655b114e58223918577e" +name = "sql-query-connector" +version = "0.1.0" +source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.10#c4aeef82dbae310e974d6122160c7e3b5fb6df53" dependencies = [ - "atoi", - "base64 0.21.7", - "bitflags 2.5.0", - "byteorder", + "anyhow", + "async-trait", + "bigdecimal", "chrono", - "crc", - "dotenvy", - "etcetera", - "futures-channel", - "futures-core", - "futures-io", - "futures-util", - "hex", - "hkdf", - "hmac", - "home", - "itoa", - "log", - "md-5", - "memchr", + "cuid", + "futures", + "itertools 0.10.5", "once_cell", - "rand", + "opentelemetry", + "prisma-models", + "prisma-value", + "psl", + "quaint", + "query-connector", + "rand 0.7.3", "serde", "serde_json", - "sha2", - "smallvec", - "sqlx-core", - "stringprep", + "socket2 0.4.10", "thiserror", + "tokio", "tracing", - "whoami", + "tracing-futures", + "tracing-opentelemetry", + "user-facing-errors", + "uuid", ] [[package]] -name = "sqlx-sqlite" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b244ef0a8414da0bed4bb1910426e890b19e5e9bccc27ada6b797d05c55ae0aa" +name = "sql-schema-describer" +version = "0.1.0" +source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.10#c4aeef82dbae310e974d6122160c7e3b5fb6df53" dependencies = [ - "atoi", - "chrono", - "flume", - "futures-channel", - "futures-core", - "futures-executor", - "futures-intrusive", - "futures-util", - "libsqlite3-sys", - "log", - "percent-encoding", + "async-trait", + "bigdecimal", + "enumflags2", + "indexmap 1.9.3", + "indoc", + "once_cell", + "psl", + "quaint", + "regex", "serde", - "sqlx-core", "tracing", - "url", - "urlencoding", + "tracing-error", + "tracing-futures", +] + +[[package]] +name = "sqlformat" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce81b7bd7c4493975347ef60d8c7e8b742d4694f4c49f93e0a12ea263938176c" +dependencies = [ + "itertools 0.12.1", + "nom", + "unicode_categories", ] +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + [[package]] name = "stringprep" version = "0.1.4" @@ -3579,6 +4907,18 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" +[[package]] +name = "synstructure" +version = "0.12.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", + "unicode-xid", +] + [[package]] name = "synstructure" version = "0.13.1" @@ -3722,7 +5062,7 @@ dependencies = [ "libc", "mio", "num_cpus", - "parking_lot", + "parking_lot 0.12.2", "pin-project-lite", "signal-hook-registry", "socket2 0.5.7", @@ -3741,6 +5081,15 @@ dependencies = [ "syn 2.0.65", ] +[[package]] +name = "tokio-native-tls" +version = "0.3.0" +source = "git+https://github.com/pimeys/tls?branch=vendored-openssl#6d0e6fc7a4bf6f290b1033764b47cb3f26d7fceb" +dependencies = [ + "native-tls", + "tokio", +] + [[package]] name = "tokio-native-tls" version = "0.3.1" @@ -3753,9 +5102,8 @@ dependencies = [ [[package]] name = "tokio-postgres" -version = "0.7.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d340244b32d920260ae7448cb72b6e238bddc3d4f7603394e7dd46ed8e48f5b8" +version = "0.7.7" +source = "git+https://github.com/pimeys/rust-postgres?rev=064a6a50427542e2c166e870027735aab3b52e77#064a6a50427542e2c166e870027735aab3b52e77" dependencies = [ "async-trait", "byteorder", @@ -3764,17 +5112,15 @@ dependencies = [ "futures-channel", "futures-util", "log", - "parking_lot", + "parking_lot 0.12.2", "percent-encoding", "phf", "pin-project-lite", "postgres-protocol", "postgres-types", - "rand", - "socket2 0.5.7", + "socket2 0.4.10", "tokio", "tokio-util", - "whoami", ] [[package]] @@ -3784,7 +5130,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f57eb36ecbe0fc510036adff84824dd3c24bb781e21bfa67b69d556aa85214f" dependencies = [ "pin-project", - "rand", + "rand 0.8.5", "tokio", ] @@ -3812,6 +5158,15 @@ dependencies = [ "tokio", ] +[[package]] +name = "toml" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" +dependencies = [ + "serde", +] + [[package]] name = "tower" version = "0.4.13" @@ -3886,6 +5241,37 @@ dependencies = [ "valuable", ] +[[package]] +name = "tracing-error" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d686ec1c0f384b1277f097b2f279a2ecc11afe8c133c1aabf036a27cb4cd206e" +dependencies = [ + "tracing", + "tracing-subscriber", +] + +[[package]] +name = "tracing-futures" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2" +dependencies = [ + "pin-project", + "tracing", +] + +[[package]] +name = "tracing-log" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f751112709b4e791d8ce53e32c4ed2d353565a795ce84da2285393f41557bdf2" +dependencies = [ + "log", + "once_cell", + "tracing-core", +] + [[package]] name = "tracing-log" version = "0.2.0" @@ -3897,6 +5283,20 @@ dependencies = [ "tracing-core", ] +[[package]] +name = "tracing-opentelemetry" +version = "0.17.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbbe89715c1dbbb790059e2565353978564924ee85017b5fff365c872ff6721f" +dependencies = [ + "once_cell", + "opentelemetry", + "tracing", + "tracing-core", + "tracing-log 0.1.4", + "tracing-subscriber", +] + [[package]] name = "tracing-subscriber" version = "0.3.18" @@ -3908,10 +5308,11 @@ dependencies = [ "once_cell", "regex", "sharded-slab", + "smallvec", "thread_local", "tracing", "tracing-core", - "tracing-log", + "tracing-log 0.2.0", ] [[package]] @@ -3926,6 +5327,12 @@ version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" +[[package]] +name = "ucd-trie" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9" + [[package]] name = "unicode-bidi" version = "0.3.15" @@ -3953,12 +5360,27 @@ version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" +[[package]] +name = "unicode-xid" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" + [[package]] name = "unicode_categories" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39ec24b3121d976906ece63c9daad25b85969647682eee313cb5779fdd69e14e" +[[package]] +name = "unreachable" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56" +dependencies = [ + "void", +] + [[package]] name = "untrusted" version = "0.9.0" @@ -3974,13 +5396,32 @@ dependencies = [ "form_urlencoded", "idna", "percent-encoding", + "serde", ] [[package]] -name = "urlencoding" -version = "2.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" +name = "user-facing-error-macros" +version = "0.1.0" +source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.10#c4aeef82dbae310e974d6122160c7e3b5fb6df53" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "user-facing-errors" +version = "0.1.0" +source = "git+https://github.com/Brendonovich/prisma-engines?tag=pcr-0.6.10#c4aeef82dbae310e974d6122160c7e3b5fb6df53" +dependencies = [ + "backtrace", + "indoc", + "quaint", + "serde", + "serde_json", + "tracing", + "user-facing-error-macros", +] [[package]] name = "uuid" @@ -3988,7 +5429,8 @@ version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a183cf7feeba97b4dd1c0d46788634f6221d87fa961b305bed08c851829efcc0" dependencies = [ - "getrandom", + "getrandom 0.2.15", + "serde", ] [[package]] @@ -4009,6 +5451,12 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +[[package]] +name = "void" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" + [[package]] name = "waker-fn" version = "1.2.0" @@ -4026,15 +5474,21 @@ dependencies = [ [[package]] name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" +version = "0.9.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" +checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" [[package]] -name = "wasite" -version = "0.1.0" +name = "wasi" +version = "0.10.2+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8dad83b4f25e74f184f64c43b150b91efe7647395b42289f38e50566d82855b" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" @@ -4103,20 +5557,27 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" [[package]] -name = "web-sys" -version = "0.3.69" +name = "wasm-streams" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef" +checksum = "b65dc4c90b63b118468cf747d8bf3566c1913ef60be765b5730ead9e0a3ba129" dependencies = [ + "futures-util", "js-sys", "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", ] [[package]] -name = "webpki-roots" -version = "0.25.4" +name = "web-sys" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1" +checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef" +dependencies = [ + "js-sys", + "wasm-bindgen", +] [[package]] name = "which" @@ -4130,17 +5591,6 @@ dependencies = [ "rustix 0.38.34", ] -[[package]] -name = "whoami" -version = "1.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a44ab49fad634e88f55bf8f9bb3abd2f27d7204172a112c7c9987e01c1c94ea9" -dependencies = [ - "redox_syscall 0.4.1", - "wasite", - "web-sys", -] - [[package]] name = "winapi" version = "0.3.9" @@ -4311,6 +5761,16 @@ version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" +[[package]] +name = "winreg" +version = "0.50.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" +dependencies = [ + "cfg-if", + "windows-sys 0.48.0", +] + [[package]] name = "winreg" version = "0.52.0" diff --git a/Cargo.toml b/Cargo.toml index 74c8415..0b3a878 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,8 +2,7 @@ name = "api" version = "0.1.0" edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +default-run = "api" [dependencies] lazy_static = "1.4" @@ -19,14 +18,16 @@ tracing-subscriber = { version = "0.3.18", default-features = false, features = reqwest = { version = "0.12", features = ["json"] } tokio = { version = "1", features = ["full"] } chrono = { version = "0.4.38", features = ["serde"]} -sqlx = { version = "0.7", features = [ "runtime-tokio-rustls", "postgres", "chrono" ] } -postgres = "0.19.7" redis = {version ="0.25.3", features = ["tokio-comp", "connection-manager"]} lapin = "2.3.4" futures = "0.3" rand = "0.8.5" rust-argon2 = "2.1.0" actix-web-lab = "0.20.2" +prisma-client-rust = { git = "https://github.com/Brendonovich/prisma-client-rust", tag = "0.6.11", default-features = false, features = ["postgresql"] } +prisma-client-rust-cli = { git = "https://github.com/Brendonovich/prisma-client-rust", tag = "0.6.11", default-features = false, features = ["postgresql"] } +rust-s3 = "0.33.0" +actix-multipart = "0.6.1" [profile.release] lto = true diff --git a/prisma/schema.prisma b/prisma/schema.prisma new file mode 100644 index 0000000..bf8e1ce --- /dev/null +++ b/prisma/schema.prisma @@ -0,0 +1,67 @@ +generator client { + provider = "cargo prisma" + output = "../src/connectivity/prisma.rs" +} + +datasource db { + provider = "postgresql" + url = env("POSTGRES_DSN") +} + +model blog_admin_users { + id String @id @default(dbgenerated("id_generator()")) + username String @unique(map: "blog_admin_users_username_idx") + display_name String? + password String +} + +model blog_assets { + id String @id + path String + post_id String? + upload_date DateTime? @db.Timestamp(6) + blog_posts blog_posts? @relation(fields: [post_id], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "fk_blog_assets_post") + + @@index([post_id]) + @@index([upload_date]) +} + +model blog_posts { + id String @id @default(dbgenerated("id_generator()")) + slug String @unique(map: "blog_posts_slug_idx") @default(dbgenerated("date_slug()")) + title String @default(dbgenerated("date_title()")) + description String? + image String? + visibility String @default("draft") @db.VarChar(8) + tags String[] @default([]) + body String? + created_at DateTime @default(now()) @db.Timestamp(6) + published_at DateTime? @db.Timestamp(6) + blog_assets blog_assets[] + + @@index([created_at], map: "blog_posts_created_idx") + @@index([description]) + @@index([published_at], map: "blog_posts_published_idx") + @@index([title]) +} + +model spotify_devices { + id Int @id @default(autoincrement()) + name String? + type String? + spotify_history spotify_history[] +} + +model spotify_history { + id String + type String @default("track") + name String + artists Json[] + length Int + image String + device Int @default(autoincrement()) + listened_at DateTime @default(now()) @db.Timestamptz(6) + spotify_devices spotify_devices @relation(fields: [device], references: [id], onDelete: NoAction, onUpdate: NoAction) + + @@id([id, listened_at]) +} diff --git a/src/bin/prisma.rs b/src/bin/prisma.rs new file mode 100644 index 0000000..f758015 --- /dev/null +++ b/src/bin/prisma.rs @@ -0,0 +1,3 @@ +fn main() { + prisma_client_rust_cli::run(); +} diff --git a/src/connectivity/mod.rs b/src/connectivity/mod.rs index 0c2f8ff..4c093c6 100644 --- a/src/connectivity/mod.rs +++ b/src/connectivity/mod.rs @@ -1,3 +1,3 @@ -pub mod postgres; +pub mod prisma; pub mod rabbit; pub mod valkey; diff --git a/src/connectivity/postgres.rs b/src/connectivity/postgres.rs deleted file mode 100644 index 9fff0e8..0000000 --- a/src/connectivity/postgres.rs +++ /dev/null @@ -1,134 +0,0 @@ -use envconfig::Envconfig; -use serde::{Deserialize, Serialize}; -use sqlx::{ - postgres::PgPoolOptions, - types::{ - chrono::{DateTime, Utc}, - Json, - }, - FromRow, Pool, Postgres, -}; - -use crate::config::Config; - -#[derive(Clone)] -pub struct PostgresManager { - pub pool: Pool, -} - -#[allow(dead_code)] -#[derive(Debug, Deserialize, Serialize)] -pub struct SpotifyArtist { - pub name: String, -} - -#[allow(dead_code)] -#[derive(Debug, FromRow)] -pub struct SpotifyHistoryItem { - pub id: String, - #[sqlx(rename = "type")] - pub spotify_history_type: String, - pub name: String, - pub artists: Vec>, - pub length: i32, - pub image: String, - pub device: i32, - pub listened_at: DateTime, -} - -#[allow(dead_code)] -#[derive(Debug, FromRow)] -pub struct SpotifyDevice { - pub id: i32, - #[sqlx(rename = "type")] - pub spotify_device_type: String, - pub name: String, -} - -impl PostgresManager { - pub async fn new() -> PostgresManager { - let config = Config::init_from_env().unwrap(); - let pool = PgPoolOptions::new() - .max_connections(5) - .connect(&config.postgres_dsn) - .await - .unwrap(); - - tracing::info!("Connected to postgres"); - - Self { pool } - } - - pub async fn get_device_by_name(&mut self, name: String) -> Result { - let item = sqlx::query_as::<_, SpotifyDevice>( - "SELECT id, name, type FROM spotify_devices WHERE name = $1;", - ) - .bind(name) - .fetch_one(&self.pool) - .await - .map_err(|e| format!("{}", e)); - - if item.is_err() { - return Err(sqlx::Error::RowNotFound); - } - - Ok(item.unwrap()) - } - - pub async fn insert_new_device( - &mut self, - name: String, - device_type: String, - ) -> Result { - let item = sqlx::query_as::<_, SpotifyDevice>( - "INSERT INTO spotify_devices (\"name\", \"type\") VALUES ($1, $2) RETURNING id, name, type;", - ) - .bind(name) - .bind(device_type) - .fetch_one(&self.pool) - .await - .map_err(|e| format!("{}", e)); - - if item.is_err() { - return Err(sqlx::Error::RowNotFound); - } - - Ok(item.unwrap()) - } - - pub async fn insert_new_history_item(&mut self, item: SpotifyHistoryItem) { - sqlx::query( - "INSERT INTO spotify_history (\"id\", \"type\", \"name\", \"length\", \"image\", \"listened_at\", \"device\", \"artists\") VALUES ($1, $2, $3, $4, $5, $6, $7, $8);", - ) - .bind(item.id) - .bind(item.spotify_history_type) - .bind(item.name) - .bind(item.length) - .bind(item.image) - .bind(item.listened_at) - .bind(item.device) - .bind(item.artists) - .execute(&self.pool) - .await - .map_err(|e| format!("{}", e)).unwrap(); - } - - pub async fn get_latest_history_item( - &mut self, - id: String, - ) -> Result { - let item = sqlx::query_as::<_, SpotifyHistoryItem>( - "SELECT id, type, name, artists, length, image, device, listened_at FROM spotify_history WHERE id = $1 ORDER BY listened_at DESC LIMIT 1;", - ) - .bind(id) - .fetch_one(&self.pool) - .await - .map_err(|e| format!("{}", e)); - - if item.is_err() { - return Err(sqlx::Error::RowNotFound); - } - - Ok(item.unwrap()) - } -} diff --git a/src/connectivity/rabbit.rs b/src/connectivity/rabbit.rs index bb702b2..19ab507 100644 --- a/src/connectivity/rabbit.rs +++ b/src/connectivity/rabbit.rs @@ -1,83 +1,88 @@ use envconfig::Envconfig; use lapin::{ - options::{BasicPublishOptions, QueueDeclareOptions}, - types::FieldTable, - BasicProperties, Channel, Connection, ConnectionProperties, Queue, + options::{BasicPublishOptions, QueueDeclareOptions}, + types::FieldTable, + BasicProperties, Channel, Connection, ConnectionProperties, Queue, }; use serde::{Deserialize, Serialize}; use serde_json::json; -use crate::{config::Config, modules::spotify::CurrentPlaying}; +use crate::{config::Config, structs::spotify::CurrentPlaying}; #[derive(Clone)] pub struct RabbitManager { - pub channel: Channel, - pub queue: Queue, + pub channel: Channel, + pub queue: Queue, } #[derive(Debug, Serialize, Deserialize, Clone)] struct SpotifySocketData { - t: u8, - d: CurrentPlaying, + t: u8, + d: CurrentPlaying, } impl RabbitManager { - pub async fn new() -> RabbitManager { - let config = Config::init_from_env().unwrap(); - let connection = Connection::connect(&config.rabbit_dsn, ConnectionProperties::default()) - .await - .unwrap(); + pub async fn new() -> RabbitManager { + let config = Config::init_from_env().unwrap(); + let connection = Connection::connect( + &config.rabbit_dsn, + ConnectionProperties::default(), + ) + .await + .unwrap(); - let channel = connection.create_channel().await.unwrap(); + let channel = connection.create_channel().await.unwrap(); - let queue = channel - .queue_declare( - &config.rabbit_queue, - QueueDeclareOptions { - durable: true, - ..QueueDeclareOptions::default() - }, - FieldTable::default(), - ) - .await - .unwrap(); + let queue = channel + .queue_declare( + &config.rabbit_queue, + QueueDeclareOptions { + durable: true, + ..QueueDeclareOptions::default() + }, + FieldTable::default(), + ) + .await + .unwrap(); - tracing::info!("Connected to rabbitmq"); + tracing::info!("Connected to rabbitmq"); - Self { channel, queue } - } + Self { channel, queue } + } - pub async fn publish_spotify_current(&mut self, data: &CurrentPlaying) { - let message = SpotifySocketData { - t: 0, - d: data.to_owned(), - }; - let json = serde_json::to_string(&message).unwrap(); + pub async fn publish_spotify_current(&mut self, data: &CurrentPlaying) { + let message = SpotifySocketData { + t: 0, + d: data.to_owned(), + }; + let json = serde_json::to_string(&message).unwrap(); - self.channel - .basic_publish( - "", - "dstn-gateway-ingest", - BasicPublishOptions::default(), - json.as_bytes(), - BasicProperties::default(), - ) - .await - .unwrap(); - } + self + .channel + .basic_publish( + "", + "dstn-gateway-ingest", + BasicPublishOptions::default(), + json.as_bytes(), + BasicProperties::default(), + ) + .await + .unwrap(); + } - pub async fn publish_spotify_not_playing(&mut self) { - let json = json!({"t": 0, "d": {"playing": false}}); + pub async fn publish_spotify_not_playing(&mut self) { + let json = json!({"t": 0, "d": {"playing": false}}); - self.channel - .basic_publish( - "", - "dstn-gateway-ingest", - BasicPublishOptions::default(), - json.to_string().as_bytes(), - BasicProperties::default(), - ) - .await - .unwrap(); - } + self + .channel + .basic_publish( + "", + "dstn-gateway-ingest", + BasicPublishOptions::default(), + json.to_string().as_bytes(), + BasicProperties::default(), + ) + .await + .unwrap(); + } } diff --git a/src/connectivity/valkey.rs b/src/connectivity/valkey.rs index c7ff519..548d614 100644 --- a/src/connectivity/valkey.rs +++ b/src/connectivity/valkey.rs @@ -1,172 +1,19 @@ -use std::io::Error; - use envconfig::Envconfig; -use redis::{aio::ConnectionManager, AsyncCommands, Client}; -use serde::{Deserialize, Serialize}; -use serde_json::json; +use redis::{aio::ConnectionManager, Client}; -use crate::{config::Config, modules::spotify::CurrentPlaying, services::spotify::SpotifyTokens}; +use crate::config::Config; #[derive(Clone)] pub struct ValkeyManager { - pub cm: ConnectionManager, -} - -#[allow(dead_code)] -#[derive(Debug)] -pub struct SpotifyAccount { - pub access_token: String, - pub refresh_token: Option, -} - -#[derive(Debug, Serialize, Deserialize)] -pub struct AuthorizationData { - refresh_token: String, - grant_type: String, - redirect_uri: String, + pub cm: ConnectionManager, } impl ValkeyManager { - pub async fn new() -> Self { - let config = Config::init_from_env().unwrap(); - let client = Client::open(config.valkey_dsn).unwrap(); - let cm = ConnectionManager::new(client).await.unwrap(); - tracing::info!("Connected to valkey"); - Self { cm } - } - - pub async fn check_spotify_setup(&mut self) -> bool { - let res: bool = self.cm.exists("spotify/refresh_token").await.unwrap(); - return res; - } - - pub async fn get_spotify_account(&mut self) -> Result { - let access_token = self.cm.get("spotify/access_token").await; - let refresh_token = self.cm.get("spotify/refresh_token").await.unwrap(); - - if refresh_token == None { - return Err(Error::new( - std::io::ErrorKind::InvalidInput, - "refresh_token missing", - )); - } - - match access_token { - Ok(access_token) => { - return Ok(SpotifyAccount { - access_token, - refresh_token, - }); - } - Err(..) => { - let config = Config::init_from_env().unwrap(); - - let redirect_uri = "http://127.0.0.1:8080/v2/spotify/setup"; - let data = AuthorizationData { - refresh_token: refresh_token.unwrap(), - grant_type: "refresh_token".into(), - redirect_uri: redirect_uri.into(), - }; - - let data = serde_urlencoded::to_string(&data) - .expect("error serializing data for spotify token"); - - let client = reqwest::Client::new(); - let res = client - .post(format!("https://accounts.spotify.com/api/token?{}", data)) - .header("Content-Type", "application/x-www-form-urlencoded") - .header("Content-Length", "0") - .basic_auth(config.spotify_client_id, Some(config.spotify_client_secret)) - .send() - .await - .unwrap(); - - let status = res.status(); - - if status.as_u16() == 200 { - let body = res.json::().await.unwrap(); - - self.save_spotify_account( - &body.access_token, - &body.refresh_token, - &body.expires_in, - ) - .await; - - return Ok(SpotifyAccount { - access_token: body.access_token, - refresh_token: body.refresh_token, - }); - } else { - tracing::debug!("Error regenerating spotify tokens"); - return Ok(SpotifyAccount { - access_token: "".into(), - refresh_token: Some("".to_string()), - }); - } - } - } - } - - pub async fn save_spotify_account( - &mut self, - access_token: &String, - refresh_token: &Option, - expiry_ttl: &u32, - ) { - redis::cmd("SET") - .arg("spotify/access_token") - .arg(access_token) - .arg("EX") - .arg(expiry_ttl) - .query_async::(&mut self.cm) - .await - .unwrap(); - - match refresh_token { - Some(refresh_token) => { - redis::cmd("SET") - .arg("spotify/refresh_token") - .arg(refresh_token) - .query_async::(&mut self.cm) - .await - .unwrap(); - } - None => (), - } - } - - pub async fn get_current(&mut self) -> CurrentPlaying { - let current = redis::cmd("GET") - .arg("spotify/current") - .query_async::(&mut self.cm) - .await - .unwrap(); - - let json: CurrentPlaying = serde_json::from_str(¤t).unwrap(); - - return json; - } - - pub async fn update_current(&mut self, data: &CurrentPlaying) { - let json = serde_json::to_string(data).unwrap(); - - redis::cmd("SET") - .arg("spotify/current") - .arg(json) - .query_async::(&mut self.cm) - .await - .unwrap(); - } - - pub async fn set_not_playing(&mut self) { - let json = json!({"playing": false}); - - redis::cmd("SET") - .arg("spotify/current") - .arg(json.to_string()) - .query_async::(&mut self.cm) - .await - .unwrap(); - } + pub async fn new() -> Self { + let config = Config::init_from_env().unwrap(); + let client = Client::open(config.valkey_dsn).unwrap(); + let cm = ConnectionManager::new(client).await.unwrap(); + tracing::info!("Connected to valkey"); + Self { cm } + } } diff --git a/src/main.rs b/src/main.rs index 49dad64..0cd25c9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -8,101 +8,109 @@ use std::{error::Error, time::Duration}; use actix_web::{middleware, web, App, HttpServer}; use actix_web_lab::middleware::from_fn; -use connectivity::{postgres::PostgresManager, rabbit::RabbitManager, valkey::ValkeyManager}; +use connectivity::{rabbit::RabbitManager, valkey::ValkeyManager}; use envconfig::Envconfig; use tokio::time; use tracing_actix_web::TracingLogger; -use tracing_subscriber::{fmt, prelude::__tracing_subscriber_SubscriberExt, EnvFilter, Registry}; +use tracing_subscriber::{ + fmt, prelude::__tracing_subscriber_SubscriberExt, EnvFilter, Registry, +}; + +use connectivity::prisma::PrismaClient; use crate::config::Config; pub struct ServerState { - pub valkey: ValkeyManager, - pub rabbit: RabbitManager, - pub postgres: PostgresManager, + pub valkey: ValkeyManager, + pub rabbit: RabbitManager, + pub prisma: PrismaClient, } #[tokio::main] async fn main() -> Result<(), Box> { - let config = Config::init_from_env().unwrap(); + let config = Config::init_from_env().unwrap(); - let env_filter = EnvFilter::try_from_default_env().unwrap_or(EnvFilter::new("info")); - let fmt_layer = fmt::layer().with_target(false); - let subscriber = Registry::default().with(env_filter).with(fmt_layer); - tracing::subscriber::set_global_default(subscriber) - .expect("Failed to initalize global tracing subscriber"); + let env_filter = + EnvFilter::try_from_default_env().unwrap_or(EnvFilter::new("info")); + let fmt_layer = fmt::layer().with_target(false); + let subscriber = Registry::default().with(env_filter).with(fmt_layer); + tracing::subscriber::set_global_default(subscriber) + .expect("Failed to initalize global tracing subscriber"); - let valkey = connectivity::valkey::ValkeyManager::new().await; - let rabbit = connectivity::rabbit::RabbitManager::new().await; - let postgres = connectivity::postgres::PostgresManager::new().await; + let valkey = connectivity::valkey::ValkeyManager::new().await; + let rabbit = connectivity::rabbit::RabbitManager::new().await; - tracing::info!( - "Starting HTTP Server on {}:{}", - config.listen_host, - config.listen_port - ); + let prisma = PrismaClient::_builder().build().await.unwrap(); - if config.env == "dev" { - tracing::info!("Running in DEV mode"); - } + tracing::info!( + "Starting HTTP Server on {}:{}", + config.listen_host, + config.listen_port + ); - let data = web::Data::new(ServerState { - valkey, - rabbit, - postgres, - }); - let data_http = web::Data::clone(&data); + if config.env == "dev" { + tracing::info!("Running in DEV mode"); + } - // Fetch spotify current playing every second. - let mut interval = time::interval(Duration::from_secs(1)); - if config.env != "dev" { - tokio::spawn(async move { - interval.tick().await; - loop { - interval.tick().await; - tokio::spawn(modules::spotify::fetch_spotify_current(web::Data::clone( - &data, - ))); - } - }); - } + let data = web::Data::new(ServerState { + valkey, + rabbit, + prisma, + }); + let data_http = web::Data::clone(&data); + + // Fetch spotify current playing every second. + let mut interval = time::interval(Duration::from_secs(1)); + if config.env != "dev" { + tokio::spawn(async move { + interval.tick().await; + loop { + interval.tick().await; + tokio::spawn(modules::spotify::fetch_spotify_current( + web::Data::clone(&data), + )); + } + }); + } - HttpServer::new(move || { - App::new() - .app_data(web::Data::clone(&data_http)) - .wrap(middleware::NormalizePath::default()) - .wrap(TracingLogger::default()) - .default_service(web::to(services::base::index)) - .service( - web::scope("/v2") - .service(services::base::health) - .service( - web::scope("/spotify") - .service(services::spotify::current) - .service(services::spotify::authorize) - .service(services::spotify::setup), - ) - .service( - web::scope("/blog") - .service(services::blog::auth::login) - .service(services::blog::posts::get_post) - .service(services::blog::posts::get_posts) - .service( - web::scope("") - .wrap(from_fn(services::blog::middleware::blog_admin_auth_mw)) - .service(services::blog::auth::logout) - .service(services::blog::auth::get_user) - .service(services::blog::posts::create_post) - .service(services::blog::posts::update_post) - .service(services::blog::posts::delete_post), - ), - ), - ) - }) - .bind(((config.listen_host).to_owned(), config.listen_port))? - .run() - .await - .unwrap(); + HttpServer::new(move || { + App::new() + .app_data(web::Data::clone(&data_http)) + .wrap(middleware::NormalizePath::default()) + .wrap(TracingLogger::default()) + .default_service(web::to(services::base::index)) + .service( + web::scope("/v2") + .service(services::base::health) + .service( + web::scope("/spotify") + .service(services::spotify::routes::current) + .service(services::spotify::routes::authorize) + .service(services::spotify::routes::setup), + ) + .service( + web::scope("/blog") + .service(services::blog::auth::login) + .service(services::blog::posts::get_post) + .service(services::blog::posts::get_posts) + .service( + web::scope("") + .wrap(from_fn( + services::blog::middleware::blog_admin_auth_mw, + )) + .service(services::blog::auth::logout) + .service(services::blog::auth::get_user) + .service(services::blog::posts::create_post) + .service(services::blog::posts::update_post) + .service(services::blog::posts::delete_post), + ), + ), + ) + }) + .bind(((config.listen_host).to_owned(), config.listen_port))? + .run() + .await + .unwrap(); - Ok(()) + Ok(()) } diff --git a/src/modules/spotify.rs b/src/modules/spotify.rs index e7438b0..1245f5c 100644 --- a/src/modules/spotify.rs +++ b/src/modules/spotify.rs @@ -1,252 +1,261 @@ use std::sync::Arc; -use actix_web::web; +use actix_web::web::{self}; use chrono::prelude::*; -use serde::{Deserialize, Serialize}; -use serde_with::{self, skip_serializing_none}; -use sqlx::types::{chrono::DateTime, Json}; +use serde_json::json; use crate::{ - connectivity::postgres::{SpotifyArtist, SpotifyHistoryItem}, - structs::{self, spotify::PlayerState}, - ServerState, + connectivity::prisma::spotify_history, + services::spotify::helpers::{self, get_or_make_device}, + structs::{ + self, + spotify::{ + ArtistName, CurrentPlaying, DeviceRewrite, PlayerState, + SpotifyArtist, + }, + }, + ServerState, }; extern crate chrono; extern crate serde_json; -#[skip_serializing_none] -#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq)] -pub struct CurrentPlaying { - playing: bool, - id: Option, - #[serde(rename = "type")] - current_playing_type: Option, - name: Option, - artists: Option>, - length: Option, - progress: Option, - image: Option, - device: Option, -} +pub(crate) async fn fetch_spotify_current(data: web::Data) { + let valkey = &mut data.valkey.clone(); + let rabbit = &mut data.rabbit.clone(); -#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq)] -pub struct Artist { - name: String, -} + let prisma = &mut &data.prisma; -#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq)] -pub struct Device { - name: String, - #[serde(rename = "type")] - device_type: String, -} + match helpers::get_spotify_account(valkey).await { + Ok(account) => { + let client = reqwest::Client::new(); + let res = client + .get(format!( + "https://api.spotify.com/v1/me/player?additional_types=episode" + )) + .header( + "Authorization", + format!("Bearer {}", account.access_token), + ) + .send() + .await + .unwrap(); -pub(crate) async fn fetch_spotify_current(data: web::Data) { - let redis = &mut data.valkey.clone(); - let rabbit = &mut data.rabbit.clone(); - let postgres = &mut data.postgres.clone(); - - match redis.get_spotify_account().await { - Ok(account) => { - let client = reqwest::Client::new(); - let res = client - .get(format!( - "https://api.spotify.com/v1/me/player?additional_types=episode" - )) - .header("Authorization", format!("Bearer {}", account.access_token)) - .send() - .await - .unwrap(); - - if res.status() != 200 { - return redis.set_not_playing().await; - } + if res.status() != 200 { + return helpers::set_not_playing(valkey).await; + } - let json = res.json::().await.unwrap(); + let json = res.json::().await.unwrap(); - fn get_name(structs::spotify::Artist { name, .. }: structs::spotify::Artist) -> Artist { - Artist { name } - } + fn get_name( + structs::spotify::Artist { name, .. }: structs::spotify::Artist, + ) -> ArtistName { + ArtistName { name } + } + + if json.is_playing { + let mut image: String = String::from("none"); + let mut artists: Vec = [].to_vec(); + + if json.item.album.is_some() && json.item.artists.is_some() { + image = json.item.album.unwrap().images[0].url.to_string(); + artists = json + .item + .artists + .unwrap() + .into_iter() + .map(get_name) + .collect(); + } else if json.item.show.is_some() { + let show = json.item.show.unwrap(); + image = show.images[0].url.to_string(); + artists = [ArtistName { name: show.name }].to_vec() + } + + let current = CurrentPlaying { + id: Some(json.item.id), + name: Some(json.item.name), + current_playing_type: Some( + json.item.item_type.unwrap_or_else(|| String::from("track")), + ), + playing: json.is_playing, + artists: Some(artists), + length: Some(json.item.duration_ms), + progress: Some(json.progress_ms), + image: Some(image), + device: Some(DeviceRewrite { + name: json.device.name, + device_type: json + .device + .device_type + .unwrap_or_else(|| String::from("unknown")), + }), + }; - if json.is_playing { - let mut image: String = String::from("none"); - let mut artists: Vec = [].to_vec(); - - if json.item.album.is_some() && json.item.artists.is_some() { - image = json.item.album.unwrap().images[0].url.to_string(); - artists = json - .item - .artists - .unwrap() - .into_iter() - .map(get_name) - .collect(); - } else if json.item.show.is_some() { - let show = json.item.show.unwrap(); - image = show.images[0].url.to_string(); - artists = [Artist { name: show.name }].to_vec() + let current_query = helpers::get_playing(valkey).await; + + if current_query != current { + let current_clone = Arc::new(current); + + helpers::update_current(valkey, ¤t_clone).await; + rabbit + .publish_spotify_current(&Arc::clone(¤t_clone)) + .await; + + let date: DateTime = + Utc::now().with_timezone(&FixedOffset::east_opt(0).unwrap()); + let current_playing = Arc::clone(¤t_clone); + + match prisma + .spotify_history() + .find_first(vec![spotify_history::id::equals( + current_playing.id.as_ref().unwrap().to_string(), + )]) + .exec() + .await + { + Ok(latest) => match latest { + Some(latest) => { + let listened_date = latest.listened_at.timestamp() * 1000; + let date_minus_length = + (date.timestamp() * 1000) - latest.length as i64; + + if date_minus_length >= listened_date + && current_playing.progress.unwrap() >= 10000 + { + let dev = get_or_make_device( + prisma, + current_playing + .device + .as_ref() + .unwrap() + .name + .to_string(), + current_playing + .device + .as_ref() + .unwrap() + .device_type + .to_string(), + ) + .await; + + let mut artists = Vec::new(); + for artist in current_playing.artists.as_ref().unwrap() { + artists.push(json!(SpotifyArtist { + name: artist.name.clone(), + })); + } + + let current_playing = current_playing.as_ref().clone(); + let _ = prisma.spotify_history().create( + current_playing.id.unwrap(), + current_playing.name.unwrap(), + current_playing.length.unwrap() as i32, + current_playing.image.unwrap(), + crate::connectivity::prisma::spotify_devices::UniqueWhereParam::IdEquals(dev.id), + vec![ + spotify_history::r#type::set(current_playing.current_playing_type.as_ref().unwrap().to_string()), + spotify_history::artists::set(artists), + spotify_history::listened_at::set(date), + ] + ).exec().await; } + } + None => { + if current_playing.progress.unwrap() >= 10000 { + let device = get_or_make_device( + prisma, + current_playing + .device + .as_ref() + .unwrap() + .name + .to_string(), + current_playing + .device + .as_ref() + .unwrap() + .device_type + .to_string(), + ) + .await; + + let mut artists = Vec::new(); + for artist in current_playing.artists.as_ref().unwrap() { + artists.push(json!(SpotifyArtist { + name: artist.name.clone(), + })); + } - let current = CurrentPlaying { - id: Some(json.item.id), - name: Some(json.item.name), - current_playing_type: Some( - json.item.item_type.unwrap_or_else(|| String::from("track")), - ), - playing: json.is_playing, - artists: Some(artists), - length: Some(json.item.duration_ms), - progress: Some(json.progress_ms), - image: Some(image), - device: Some(Device { - name: json.device.name, - device_type: json - .device - .device_type - .unwrap_or_else(|| String::from("unknown")), - }), - }; - - let redis_current = redis.get_current().await; - - if redis_current != current { - let current_clone = Arc::new(current); - - redis.update_current(¤t_clone).await; - rabbit - .publish_spotify_current(&Arc::clone(¤t_clone)) - .await; - - let date: DateTime = Utc::now(); - let current_playing = Arc::clone(¤t_clone); - match postgres - .get_latest_history_item(current_playing.id.as_ref().unwrap().to_string()) - .await - { - Ok(latest) => { - let listened_date = latest.listened_at.timestamp() * 1000; - let date_minus_length = - (date.timestamp() * 1000) - latest.length as i64; - - if date_minus_length >= listened_date - && current_playing.progress.unwrap() >= 10000 - { - let device = match postgres - .get_device_by_name( - current_playing.device.as_ref().unwrap().name.to_string(), - ) - .await - { - Ok(dev) => dev, - Err(..) => postgres - .insert_new_device( - current_playing - .device - .as_ref() - .unwrap() - .name - .to_string(), - current_playing - .device - .as_ref() - .unwrap() - .device_type - .to_string(), - ) - .await - .unwrap(), - }; - - let mut artists = Vec::new(); - for artist in current_playing.artists.as_ref().unwrap() { - artists.push(Json(SpotifyArtist { - name: artist.name.clone(), - })); - } - - let history_item = SpotifyHistoryItem { - id: current_playing.id.as_ref().unwrap().to_string(), - spotify_history_type: current_playing - .current_playing_type - .as_ref() - .unwrap() - .to_string(), - name: current_playing.name.as_ref().unwrap().to_string(), - length: *current_playing.length.as_ref().unwrap() as i32, - image: current_playing.image.as_ref().unwrap().to_string(), - listened_at: date, - device: device.id, - artists, - }; - - postgres.insert_new_history_item(history_item).await; - } - } - Err(..) => { - if current_playing.progress.unwrap() >= 10000 { - let device = match postgres - .get_device_by_name( - current_playing.device.as_ref().unwrap().name.to_string(), - ) - .await - { - Ok(dev) => dev, - Err(..) => postgres - .insert_new_device( - current_playing - .device - .as_ref() - .unwrap() - .name - .to_string(), - current_playing - .device - .as_ref() - .unwrap() - .device_type - .to_string(), - ) - .await - .unwrap(), - }; - - let mut artists = Vec::new(); - for artist in current_playing.artists.as_ref().unwrap() { - artists.push(Json(SpotifyArtist { - name: artist.name.clone(), - })); - } - - let history_item = SpotifyHistoryItem { - id: current_playing.id.as_ref().unwrap().to_string(), - spotify_history_type: current_playing - .current_playing_type - .as_ref() - .unwrap() - .to_string(), - name: current_playing.name.as_ref().unwrap().to_string(), - length: *current_playing.length.as_ref().unwrap() as i32, - image: current_playing.image.as_ref().unwrap().to_string(), - listened_at: date, - device: device.id, - artists, - }; - - postgres.insert_new_history_item(history_item).await; - } - } - } + let current_playing = current_playing.as_ref().clone(); + let _ = prisma.spotify_history().create( + current_playing.id.unwrap(), + current_playing.name.unwrap(), + current_playing.length.unwrap() as i32, + current_playing.image.unwrap(), + crate::connectivity::prisma::spotify_devices::UniqueWhereParam::IdEquals(device.id), + vec![ + spotify_history::r#type::set(current_playing.current_playing_type.as_ref().unwrap().to_string()), + spotify_history::artists::set(artists), + spotify_history::listened_at::set(date), + ] + ).exec().await; } - } else { - let redis_current = redis.get_current().await; + } + }, + Err(_) => { + if current_playing.progress.unwrap() >= 10000 { + let device = get_or_make_device( + prisma, + current_playing + .device + .as_ref() + .unwrap() + .name + .to_string(), + current_playing + .device + .as_ref() + .unwrap() + .device_type + .to_string(), + ) + .await; - if redis_current.playing { - redis.set_not_playing().await; - rabbit.publish_spotify_not_playing().await; + let mut artists = Vec::new(); + for artist in current_playing.artists.as_ref().unwrap() { + artists.push(json!(SpotifyArtist { + name: artist.name.clone(), + })); } + + let current_playing = current_playing.as_ref().clone(); + let _ = prisma.spotify_history().create( + current_playing.id.unwrap(), + current_playing.name.unwrap(), + current_playing.length.unwrap() as i32, + current_playing.image.unwrap(), + crate::connectivity::prisma::spotify_devices::UniqueWhereParam::IdEquals(device.id), + vec![ + spotify_history::r#type::set(current_playing.current_playing_type.as_ref().unwrap().to_string()), + spotify_history::artists::set(artists), + spotify_history::listened_at::set(date), + ] + ).exec().await; + } } + } + } + } else { + let current_query = helpers::get_playing(valkey).await; + + if current_query.playing { + helpers::set_not_playing(valkey).await; + rabbit.publish_spotify_not_playing().await; } - Err(..) => (), - }; + } + } + Err(..) => (), + }; } diff --git a/src/services/blog/auth.rs b/src/services/blog/auth.rs index 606502e..f57c041 100644 --- a/src/services/blog/auth.rs +++ b/src/services/blog/auth.rs @@ -1,98 +1,119 @@ use crate::{ - structs::blog::{BlogAdminIntSession, BlogAdminUser, BlogLoginRequest}, - ServerState, + connectivity::prisma::blog_admin_users, + structs::blog::{BlogAdminIntSession, BlogAdminUser, BlogLoginRequest}, + ServerState, }; use argon2::{self}; use rand::{distributions::Alphanumeric, Rng}; -use actix_web::{delete, get, http::Error, post, web, HttpMessage, HttpRequest, HttpResponse}; +use actix_web::{ + delete, get, http::Error, post, web, HttpMessage, HttpRequest, + HttpResponse, +}; use redis::aio::ConnectionManager; use serde_json::json; #[post("/auth")] async fn login( - body: web::Json, - state: web::Data, + body: web::Json, + state: web::Data, ) -> Result { - let username = body.username.to_string(); + let username = body.username.to_string(); - let redis = &mut state.valkey.clone(); - let postgres = &mut state.postgres.clone(); + let prisma = &state.prisma; + let redis = &mut state.valkey.clone(); - let user_record = sqlx::query_as::<_, BlogAdminUser>( - "SELECT * FROM blog_admin_users WHERE username = $1 LIMIT 1;", - ) - .bind(username) - .fetch_one(&postgres.pool) + let user_lookup = prisma + .blog_admin_users() + .find_first(vec![blog_admin_users::username::equals(username)]) + .exec() .await; - if user_record.is_err() { - return Ok(HttpResponse::Unauthorized() + match user_lookup { + Ok(user) => match user { + Some(user) => { + let password = body.password.as_bytes(); + let valid = + argon2::verify_encoded(&user.password, password).unwrap(); + + if !valid { + return Ok( + HttpResponse::Unauthorized() + .append_header(("Content-type", "application/json")) + .body(json!({"code": "invalid_authentication"}).to_string()), + ); + } + + let session_token: String = rand::thread_rng() + .sample_iter(&Alphanumeric) + .take(96) + .map(char::from) + .collect(); + + let _ = redis::cmd("SET") + .arg(format!("blog_admin_session/{}", session_token)) + .arg(json!({"user_id": user.id}).to_string()) + .query_async::(&mut redis.cm) + .await; + + let response = json!({ "user": { "id": user.id, "username": user.username, "display_name": user.display_name, }, "session": { "token": session_token } }); + + Ok( + HttpResponse::Ok() .append_header(("Content-type", "application/json")) - .body(json!({"code": "invalid_username"}).to_string())); - } - - let user = user_record.unwrap(); - - let password = body.password.as_bytes(); - let valid = argon2::verify_encoded(&user.password.unwrap(), password).unwrap(); - - if !valid { - return Ok(HttpResponse::Unauthorized() - .append_header(("Content-type", "application/json")) - .body(json!({"code": "invalid_authentication"}).to_string())); - } - - let session_token: String = rand::thread_rng() - .sample_iter(&Alphanumeric) - .take(96) - .map(char::from) - .collect(); - - let _ = redis::cmd("SET") - .arg(format!("blog_admin_session/{}", session_token)) - .arg(json!({"user_id": user.id}).to_string()) - .query_async::(&mut redis.cm) - .await; - - let response = json!({ "user": { "id": user.id, "username": user.username, "display_name": user.display_name, }, "session": { "token": session_token } }); - - Ok(HttpResponse::Ok() + .body(response.to_string()), + ) + } + None => Ok( + HttpResponse::Unauthorized() + .append_header(("Content-type", "application/json")) + .body(json!({"code": "invalid_username"}).to_string()), + ), + }, + Err(_) => Ok( + HttpResponse::Unauthorized() .append_header(("Content-type", "application/json")) - .body(response.to_string())) + .body(json!({"code": "failed_to_lookup_user"}).to_string()), + ), + } } #[get("/me")] async fn get_user(req: HttpRequest) -> Result { - let exts = req.extensions_mut(); - let user = exts.get::().unwrap(); - - Ok(HttpResponse::Ok() - .append_header(("Content-type", "application/json")) - .body( - json!({ - "user": { - "id": user.id, - "username": user.username, - "display_name": user.display_name, - } - }) - .to_string(), - )) + let exts = req.extensions_mut(); + let user = exts.get::().unwrap(); + + Ok( + HttpResponse::Ok() + .append_header(("Content-type", "application/json")) + .body( + json!({ + "user": { + "id": user.id, + "username": user.username, + "display_name": user.display_name, + } + }) + .to_string(), + ), + ) } #[delete("/auth")] -async fn logout(req: HttpRequest, state: web::Data) -> Result { - let redis = &mut state.valkey.clone(); +async fn logout( + req: HttpRequest, + state: web::Data, +) -> Result { + let redis = &mut state.valkey.clone(); - let exts = req.extensions_mut(); - let session = exts.get::().unwrap(); + let exts = req.extensions_mut(); + let session = exts.get::().unwrap(); - let _ = redis::cmd("DEL") - .arg(format!("blog_admin_session/{}", session.token)) - .query_async::(&mut redis.cm) - .await; + let _ = redis::cmd("DEL") + .arg(format!("blog_admin_session/{}", session.token)) + .query_async::(&mut redis.cm) + .await; - Ok(HttpResponse::NoContent().finish()) + Ok(HttpResponse::NoContent().finish()) } diff --git a/src/services/blog/middleware.rs b/src/services/blog/middleware.rs index d565a31..201d6de 100644 --- a/src/services/blog/middleware.rs +++ b/src/services/blog/middleware.rs @@ -1,94 +1,124 @@ use actix_web::{ - body::MessageBody, - dev::{ServiceRequest, ServiceResponse}, - http::header, - web::Data, - Error, HttpMessage, HttpResponse, + body::MessageBody, + dev::{ServiceRequest, ServiceResponse}, + http::header, + web::Data, + Error, HttpMessage, HttpResponse, }; use actix_web_lab::middleware::Next; use redis::aio::ConnectionManager; use serde_json::json; use crate::{ - structs::blog::{BlogAdminIntSession, BlogAdminSession, BlogAdminUser}, - ServerState, + connectivity::prisma::blog_admin_users, + structs::blog::{BlogAdminIntSession, BlogAdminSession}, + ServerState, }; pub async fn blog_admin_auth_mw( - req: ServiceRequest, - next: Next, + req: ServiceRequest, + next: Next, ) -> Result, Error> { - let auth_token = req.headers().get(header::AUTHORIZATION); + let auth_token = req.headers().get(header::AUTHORIZATION); - let state = req.app_data::>().unwrap().clone(); + let state = req.app_data::>().unwrap().clone(); - let redis = &mut state.valkey.clone(); - let postgres = &mut state.postgres.clone(); + let prisma = &state.prisma; + let redis = &mut state.valkey.clone(); - match auth_token { - None => { - return Ok(ServiceResponse::new( - req.request().to_owned(), - HttpResponse::Unauthorized() - .append_header(("Content-type", "application/json")) - .body(json!({"code": "missing_authentication"}).to_string()), + match auth_token { + None => { + return Ok( + ServiceResponse::new( + req.request().to_owned(), + HttpResponse::Unauthorized() + .append_header(("Content-type", "application/json")) + .body(json!({"code": "missing_authentication"}).to_string()), + ) + .map_into_boxed_body(), + ); + } + Some(token) => { + let redis_session = redis::cmd("GET") + .arg(format!("blog_admin_session/{}", token.to_str().unwrap())) + .query_async::(&mut redis.cm) + .await; + + match redis_session { + Err(_) => { + return Ok( + ServiceResponse::new( + req.request().to_owned(), + HttpResponse::Unauthorized() + .append_header(("Content-type", "application/json")) + .body( + json!({"code": "invalid_authentication_state"}) + .to_string(), + ), ) - .map_into_boxed_body()); + .map_into_boxed_body(), + ); } - Some(token) => { - let redis_session = redis::cmd("GET") - .arg(format!("blog_admin_session/{}", token.to_str().unwrap())) - .query_async::(&mut redis.cm) - .await; - match redis_session { - Err(_) => { - return Ok(ServiceResponse::new( - req.request().to_owned(), - HttpResponse::Unauthorized() - .append_header(("Content-type", "application/json")) - .body(json!({"code": "invalid_authentication_state"}).to_string()), - ) - .map_into_boxed_body()); - } + Ok(session_token) => { + let session = + serde_json::from_str::(&session_token) + .unwrap(); - Ok(session_token) => { - let session = serde_json::from_str::(&session_token).unwrap(); + let user_record = prisma + .blog_admin_users() + .find_first(vec![blog_admin_users::id::equals( + session.user_id, + )]) + .exec() + .await; - let user = sqlx::query_as::<_, BlogAdminUser>( - "SELECT id, username, display_name FROM blog_admin_users WHERE id = $1;", - ) - .bind(session.user_id) - .fetch_one(&postgres.pool) - .await; + match user_record { + Ok(user) => match user { + Some(user) => { + req.extensions_mut().insert(user.clone()); + req.extensions_mut().insert(BlogAdminIntSession { + user_id: user.id.to_string(), + token: token.to_str().unwrap().to_string(), + }); - match user { - Ok(user) => { - req.extensions_mut().insert(user.clone()); - req.extensions_mut().insert(BlogAdminIntSession { - user_id: user.id.to_string(), - token: token.to_str().unwrap().to_string(), - }); - - return next - .call(req) - .await - .map(ServiceResponse::map_into_boxed_body); - } - Err(_) => { - return Ok(ServiceResponse::new( - req.request().to_owned(), - HttpResponse::Unauthorized() - .append_header(("Content-type", "application/json")) - .body( - json!({"code": "invalid_authentication_user"}).to_string(), - ), - ) - .map_into_boxed_body()); - } - } - } + return next + .call(req) + .await + .map(ServiceResponse::map_into_boxed_body); + } + None => { + return Ok( + ServiceResponse::new( + req.request().to_owned(), + HttpResponse::Unauthorized() + .append_header(("Content-type", "application/json")) + .body( + json!({"code": "invalid_authentication_user"}) + .to_string(), + ), + ) + .map_into_boxed_body(), + ) + } + }, + Err(_) => { + return Ok( + ServiceResponse::new( + req.request().to_owned(), + HttpResponse::Unauthorized() + .append_header(("Content-type", "application/json")) + .body( + json!({"code": "invalid_authentication_user"}) + .to_string(), + ), + ) + .map_into_boxed_body(), + ); } + } } + } } + } } diff --git a/src/services/blog/posts.rs b/src/services/blog/posts.rs index 8e2b2e9..cea3f08 100644 --- a/src/services/blog/posts.rs +++ b/src/services/blog/posts.rs @@ -1,62 +1,266 @@ -use actix_web::{delete, get, http::Error, patch, post, web, HttpResponse}; +use actix_web::{ + delete, get, http::Error, patch, post, web, HttpResponse, +}; use serde_json::json; -use crate::{structs::blog::BlogPost, ServerState}; +use crate::{ + connectivity::prisma::blog_posts, structs::blog::BlogPostMutate, + ServerState, +}; #[get("/posts")] async fn get_posts() -> Result { - Ok(HttpResponse::NotImplemented().finish()) + Ok(HttpResponse::NotImplemented().finish()) } #[post("/posts")] -async fn create_post(state: web::Data) -> Result { - let postgres = &mut &state.postgres; +async fn create_post( + body: Option>, + state: web::Data, +) -> Result { + let prisma = &mut &state.prisma; - let post_record = sqlx::query_as::<_, BlogPost>( - "INSERT INTO blog_posts DEFAULT VALUES RETURNING id, slug, title, description, visibility, created_at", - ) - .fetch_one(&postgres.pool) - .await; + // Trigger public post stuff if the updated visibility is public and there is no published_at before hand. - match post_record { - Ok(post) => Ok(HttpResponse::Created() - .append_header(("Content-type", "application/json")) - .body( - json!({ - "post": { - "id": post.id, - "title": post.title, - "slug": post.slug, - "description": post.description, - "image": post.image, - "visibility": post.visibility, - "tags": post.tags, - "body": post.body, - "created_at": post.created_at, - "published_at": post.published_at, - } - }) - .to_string(), - )), - Err(_) => { - return Ok(HttpResponse::Unauthorized() - .append_header(("Content-type", "application/json")) - .body(json!({"code": "uncaught_error_creating_post"}).to_string())); - } + let body = body.unwrap_or(actix_web::web::Json(BlogPostMutate { + slug: None, + title: None, + description: None, + image: None, + visibility: None, + tags: None, + body: None, + })); + + let post_params: Vec = vec![ + body.title.clone().map(blog_posts::title::set), + body.slug.clone().map(blog_posts::slug::set), + body.visibility.clone().map(blog_posts::visibility::set), + body.tags.clone().map(blog_posts::tags::set), + body.description.clone().map(|value: std::string::String| { + blog_posts::description::set(Some(value)) + }), + body.body.clone().map(|value: std::string::String| { + blog_posts::body::set(Some(value)) + }), + ] + .into_iter() + .flatten() + .collect(); + + let post = prisma.blog_posts().create(post_params).exec().await; + + match post { + Ok(post) => Ok( + HttpResponse::Created() + .append_header(("Content-type", "application/json")) + .body( + json!({ + "post": { + "id": post.id, + "title": post.title, + "slug": post.slug, + "description": post.description, + "image": post.image, + "visibility": post.visibility, + "tags": post.tags, + "body": post.body, + "created_at": post.created_at, + "published_at": post.published_at, + } + }) + .to_string(), + ), + ), + Err(_) => { + return Ok( + HttpResponse::InternalServerError() + .append_header(("Content-type", "application/json")) + .body( + json!({"code": "uncaught_error_creating_post"}).to_string(), + ), + ); } + } } #[get("/posts/{id}")] -async fn get_post() -> Result { - Ok(HttpResponse::NotImplemented().finish()) +async fn get_post( + id: web::Path, + state: web::Data, +) -> Result { + let prisma = &mut &state.prisma; + let post = prisma + .blog_posts() + .find_first(vec![blog_posts::id::equals(id.to_string())]) + .exec() + .await; + + match post { + Ok(post) => match post { + Some(post) => Ok( + HttpResponse::Ok() + .append_header(("Content-type", "application/json")) + .body( + json!({ + "post": { + "id": post.id, + "title": post.title, + "slug": post.slug, + "description": post.description, + "image": post.image, + "visibility": post.visibility, + "tags": post.tags, + "body": post.body, + "created_at": post.created_at, + "published_at": post.published_at, + } + }) + .to_string(), + ), + ), + None => Ok( + HttpResponse::NotFound() + .append_header(("Content-type", "application/json")) + .body(json!({"code": "post_not_found"}).to_string()), + ), + }, + Err(_) => { + return Ok( + HttpResponse::NotFound() + .append_header(("Content-type", "application/json")) + .body(json!({"code": "post_not_found"}).to_string()), + ); + } + } } #[patch("/posts/{id}")] -async fn update_post() -> Result { - Ok(HttpResponse::NotImplemented().finish()) +async fn update_post( + id: web::Path, + state: web::Data, + body: web::Json, +) -> Result { + let prisma = &mut &state.prisma; + let post = prisma + .blog_posts() + .find_first(vec![blog_posts::id::equals(id.to_string())]) + .exec() + .await; + + match post { + Ok(post) => { + let post = match post { + Some(post) => post, + None => { + return Ok( + HttpResponse::NotFound() + .append_header(("Content-type", "application/json")) + .body(json!({"code": "post_not_found"}).to_string()), + ); + } + }; + + let body = body.clone(); + + let post_params: Vec = vec![ + body.title.clone().map(blog_posts::title::set), + body.slug.clone().map(blog_posts::slug::set), + body.visibility.clone().map(blog_posts::visibility::set), + body.tags.clone().map(blog_posts::tags::set), + body.description.clone().map(|value: std::string::String| { + blog_posts::description::set(Some(value)) + }), + body.body.clone().map(|value: std::string::String| { + blog_posts::body::set(Some(value)) + }), + ] + .into_iter() + .flatten() + .collect(); + + let post_update = prisma + .blog_posts() + .update(blog_posts::id::equals(post.id), post_params) + .exec() + .await; + + match post_update { + Err(_) => Ok( + HttpResponse::NotFound() + .append_header(("Content-type", "application/json")) + .body(json!({"code": "post_not_found"}).to_string()), + ), + Ok(post) => Ok( + HttpResponse::Ok() + .append_header(("Content-type", "application/json")) + .body( + json!({ + "post": { + "id": post.id, + "title": post.title, + "slug": post.slug, + "description": post.description, + "image": post.image, + "visibility": post.visibility, + "tags": post.tags, + "body": post.body, + "created_at": post.created_at, + "published_at": post.published_at, + } + }) + .to_string(), + ), + ), + } + } + Err(_) => Ok( + HttpResponse::Unauthorized() + .append_header(("Content-type", "application/json")) + .body(json!({"code": "post_not_found"}).to_string()), + ), + } } #[delete("/posts/{id}")] -async fn delete_post() -> Result { - Ok(HttpResponse::NotImplemented().finish()) +async fn delete_post( + id: web::Path, + state: web::Data, +) -> Result { + let prisma = &mut &state.prisma; + let post = prisma + .blog_posts() + .find_first(vec![blog_posts::id::equals(id.to_string())]) + .exec() + .await; + + match post { + Ok(post) => { + let post = match post { + Some(post) => post, + None => { + return Ok( + HttpResponse::NotFound() + .append_header(("Content-type", "application/json")) + .body(json!({"code": "post_not_found"}).to_string()), + ); + } + }; + + let _ = prisma + .blog_posts() + .delete(blog_posts::id::equals(post.id)) + .exec() + .await; + + Ok(HttpResponse::NoContent().finish()) + } + Err(_) => { + return Ok( + HttpResponse::NotFound() + .append_header(("Content-type", "application/json")) + .body(json!({"code": "post_not_found"}).to_string()), + ); + } + } } diff --git a/src/services/spotify.rs b/src/services/spotify.rs deleted file mode 100644 index 4bb7329..0000000 --- a/src/services/spotify.rs +++ /dev/null @@ -1,131 +0,0 @@ -use actix_web::{get, http::Error, web, HttpResponse}; -use envconfig::Envconfig; -use serde::{Deserialize, Serialize}; -use serde_json::json; - -use crate::{config::Config, ServerState}; - -#[derive(Debug, Deserialize, Clone)] -pub struct AuthorizeQuery { - code: String, -} - -#[derive(Debug, Serialize, Deserialize)] -struct AuthorizationData { - code: String, - grant_type: String, - redirect_uri: String, -} - -#[derive(Debug, Serialize, Deserialize)] -pub struct TokenError { - pub error: String, - pub error_description: String, -} - -#[derive(Debug, Serialize, Deserialize)] -pub struct SpotifyTokens { - pub access_token: String, - pub token_type: String, - pub expires_in: u32, - pub refresh_token: Option, - pub scope: String, -} - -#[get("")] -async fn current(data: web::Data) -> Result { - let redis = &mut data.valkey.clone(); - - let current = redis.get_current().await; - - Ok(HttpResponse::Ok() - .insert_header(("Content-Type", "application/json")) - .body(json!({"success": true, "data": ¤t}).to_string())) -} - -#[get("/authorize")] -async fn authorize(data: web::Data) -> Result { - let redis = &mut data.valkey.clone(); - - let setup_check = redis.check_spotify_setup().await; - if setup_check { - tracing::debug!("spotify already setup"); - let json = json!({ - "code": "already_authorized", - "message": "Spotify is already setup." - }); - - return Ok(HttpResponse::BadRequest() - .insert_header(("Content-Type", "application/json")) - .body(json.to_string())); - } - - let config = Config::init_from_env().unwrap(); - - let scope = "user-read-playback-state+user-read-currently-playing"; - let redirect_uri = "http://127.0.0.1:8080/spotify/setup"; - let url = format!("https://accounts.spotify.com/authorize?client_id={}&response_type=code&scope={}&redirect_uri={}", config.spotify_client_id, scope, redirect_uri); - let json = json!({ "url": url }); - - Ok(HttpResponse::Ok() - .append_header(("Content-type", "application/json")) - .body(json.to_string())) -} - -#[get("/setup")] -async fn setup( - data: web::Data, - info: web::Query, -) -> Result> { - let redis = &mut data.valkey.clone(); - - let setup_check = redis.check_spotify_setup().await; - if setup_check { - tracing::debug!("spotify already setup"); - let json = json!({ - "code": "already_authorized", - "message": "Spotify is already setup." - }); - - return Ok(HttpResponse::BadRequest() - .insert_header(("Content-Type", "application/json")) - .body(json.to_string())); - } - - let config = Config::init_from_env().unwrap(); - - let code = &info.code; - let redirect_uri = "http://127.0.0.1:8080/spotify/setup"; - let data = AuthorizationData { - code: code.into(), - grant_type: "authorization_code".into(), - redirect_uri: redirect_uri.into(), - }; - - let data = - serde_urlencoded::to_string(&data).expect("error serializing data for spotify token"); - - let client = reqwest::Client::new(); - let res = client - .post(format!("https://accounts.spotify.com/api/token?{}", data)) - .header("Content-Type", "application/x-www-form-urlencoded") - .header("Content-Length", "0") - .basic_auth(config.spotify_client_id, Some(config.spotify_client_secret)) - .send() - .await?; - - let status = res.status(); - - if status.as_u16() == 200 { - let body = res.json::().await.unwrap(); - - redis - .save_spotify_account(&body.access_token, &body.refresh_token, &body.expires_in) - .await; - - Ok(HttpResponse::NoContent().finish()) - } else { - let body = res.json::().await.unwrap(); - Ok(HttpResponse::InternalServerError().json(body)) - } -} diff --git a/src/services/spotify/helpers.rs b/src/services/spotify/helpers.rs new file mode 100644 index 0000000..dc6201a --- /dev/null +++ b/src/services/spotify/helpers.rs @@ -0,0 +1,187 @@ +use std::io::Error; + +use envconfig::Envconfig; +use redis::{aio::ConnectionManager, AsyncCommands}; +use serde_json::json; + +use crate::{ + config::Config, + connectivity::{ + prisma::{spotify_devices, PrismaClient}, + valkey::ValkeyManager, + }, + structs::spotify::{ + AuthorizationData, CurrentPlaying, SpotifyAccount, SpotifyTokens, + }, +}; + +pub async fn set_not_playing(valkey: &mut ValkeyManager) { + redis::cmd("SET") + .arg("spotify/current") + .arg(json!({"playing": false}).to_string()) + .query_async::(&mut valkey.cm) + .await + .unwrap(); +} + +pub async fn get_playing(valkey: &mut ValkeyManager) -> CurrentPlaying { + let redis_current_call = redis::cmd("GET") + .arg("spotify/current") + .query_async::(&mut valkey.cm) + .await + .unwrap(); + + serde_json::from_str(&redis_current_call).unwrap() +} + +pub async fn update_current( + valkey: &mut ValkeyManager, + data: &CurrentPlaying, +) { + redis::cmd("SET") + .arg("spotify/current") + .arg(serde_json::to_string(data).unwrap()) + .query_async::(&mut valkey.cm) + .await + .unwrap(); +} + +pub async fn get_spotify_account( + valkey: &mut ValkeyManager, +) -> Result { + let access_token = valkey.cm.get("spotify/access_token").await; + let refresh_token = + valkey.cm.get("spotify/refresh_token").await.unwrap(); + + if refresh_token == None { + return Err(Error::new( + std::io::ErrorKind::InvalidInput, + "refresh_token missing", + )); + } + + match access_token { + Ok(access_token) => { + return Ok(SpotifyAccount { + access_token, + refresh_token, + }); + } + Err(..) => { + let config = Config::init_from_env().unwrap(); + + let redirect_uri = "http://127.0.0.1:8080/v2/spotify/setup"; + let data = AuthorizationData { + refresh_token: refresh_token.unwrap().into(), + grant_type: "refresh_token".into(), + redirect_uri: redirect_uri.into(), + ..AuthorizationData::default() + }; + + let data = serde_urlencoded::to_string(&data) + .expect("error serializing data for spotify token"); + + let client = reqwest::Client::new(); + let res = client + .post(format!("https://accounts.spotify.com/api/token?{}", data)) + .header("Content-Type", "application/x-www-form-urlencoded") + .header("Content-Length", "0") + .basic_auth( + config.spotify_client_id, + Some(config.spotify_client_secret), + ) + .send() + .await + .unwrap(); + + let status = res.status(); + + if status.as_u16() == 200 { + let body = res.json::().await.unwrap(); + + save_spotify_tokens( + valkey, + &body.access_token, + &body.refresh_token, + &body.expires_in, + ) + .await; + + return Ok(SpotifyAccount { + access_token: body.access_token, + refresh_token: body.refresh_token, + }); + } else { + tracing::debug!("Error regenerating spotify tokens"); + return Ok(SpotifyAccount { + access_token: "".into(), + refresh_token: Some("".to_string()), + }); + } + } + } +} + +pub async fn save_spotify_tokens( + valkey: &mut ValkeyManager, + access_token: &String, + refresh_token: &Option, + expiry_ttl: &u32, +) { + redis::cmd("SET") + .arg("spotify/access_token") + .arg(access_token) + .arg("EX") + .arg(expiry_ttl) + .query_async::(&mut valkey.cm) + .await + .unwrap(); + + match refresh_token { + Some(refresh_token) => { + redis::cmd("SET") + .arg("spotify/refresh_token") + .arg(refresh_token) + .query_async::(&mut valkey.cm) + .await + .unwrap(); + } + None => (), + } +} + +pub async fn get_or_make_device( + prisma: &mut &PrismaClient, + name: String, + device_type: String, +) -> spotify_devices::Data { + let name = Some(name); + match prisma + .spotify_devices() + .find_first(vec![spotify_devices::name::equals(name.clone())]) + .exec() + .await + { + Ok(device) => match device { + Some(device) => device, + None => prisma + .spotify_devices() + .create(vec![ + spotify_devices::name::set(name), + spotify_devices::r#type::set(Some(device_type)), + ]) + .exec() + .await + .unwrap(), + }, + Err(_) => prisma + .spotify_devices() + .create(vec![ + spotify_devices::name::set(name), + spotify_devices::r#type::set(Some(device_type)), + ]) + .exec() + .await + .unwrap(), + } +} diff --git a/src/services/spotify/mod.rs b/src/services/spotify/mod.rs new file mode 100644 index 0000000..58e6ac1 --- /dev/null +++ b/src/services/spotify/mod.rs @@ -0,0 +1,2 @@ +pub mod helpers; +pub mod routes; diff --git a/src/services/spotify/routes.rs b/src/services/spotify/routes.rs new file mode 100644 index 0000000..39ee5b7 --- /dev/null +++ b/src/services/spotify/routes.rs @@ -0,0 +1,162 @@ +use actix_web::{get, http::Error, web, HttpResponse}; +use envconfig::Envconfig; +use redis::{aio::ConnectionManager, AsyncCommands}; +use serde::{Deserialize, Serialize}; +use serde_json::json; + +use crate::{ + config::Config, + services::spotify::helpers, + structs::spotify::{AuthorizationData, SpotifyTokens}, + ServerState, +}; + +#[derive(Debug, Deserialize, Clone)] +pub struct AuthorizeQuery { + code: String, +} + +#[derive(Debug, Serialize, Deserialize)] +struct TokenError { + error: String, + error_description: String, +} + +#[get("")] +async fn current( + data: web::Data, +) -> Result { + let redis = &mut data.valkey.clone(); + let json = helpers::get_playing(redis).await; + + Ok( + HttpResponse::Ok() + .insert_header(("Content-Type", "application/json")) + .body(json!({"success": true, "data": &json}).to_string()), + ) +} + +#[get("/authorize")] +async fn authorize( + data: web::Data, +) -> Result { + let redis = &mut data.valkey.clone(); + + let setup_check = redis + .cm + .exists("spotify/refresh_token") + .await + .unwrap_or(false); + if setup_check { + tracing::debug!("spotify already setup"); + let json = json!({ + "code": "already_authorized", + "message": "Spotify is already setup." + }); + + return Ok( + HttpResponse::BadRequest() + .insert_header(("Content-Type", "application/json")) + .body(json.to_string()), + ); + } + + let config = Config::init_from_env().unwrap(); + + let scope = "user-read-playback-state+user-read-currently-playing"; + let redirect_uri = "http://127.0.0.1:8080/spotify/setup"; + let url = format!("https://accounts.spotify.com/authorize?client_id={}&response_type=code&scope={}&redirect_uri={}", config.spotify_client_id, scope, redirect_uri); + let json = json!({ "url": url }); + + Ok( + HttpResponse::Ok() + .append_header(("Content-type", "application/json")) + .body(json.to_string()), + ) +} + +#[get("/setup")] +async fn setup( + data: web::Data, + info: web::Query, +) -> Result> { + let redis = &mut data.valkey.clone(); + + let setup_check = redis + .cm + .exists("spotify/refresh_token") + .await + .unwrap_or(false); + if setup_check { + tracing::debug!("spotify already setup"); + let json = json!({ + "code": "already_authorized", + "message": "Spotify is already setup." + }); + + return Ok( + HttpResponse::BadRequest() + .insert_header(("Content-Type", "application/json")) + .body(json.to_string()), + ); + } + + let config = Config::init_from_env().unwrap(); + + let code = &info.code; + let redirect_uri = "http://127.0.0.1:8080/spotify/setup"; + let data = AuthorizationData { + code: code.clone().into(), + grant_type: "authorization_code".into(), + redirect_uri: redirect_uri.into(), + ..AuthorizationData::default() + }; + + let data = serde_urlencoded::to_string(&data) + .expect("error serializing data for spotify token"); + + let client = reqwest::Client::new(); + let res = client + .post(format!("https://accounts.spotify.com/api/token?{}", data)) + .header("Content-Type", "application/x-www-form-urlencoded") + .header("Content-Length", "0") + .basic_auth( + config.spotify_client_id, + Some(config.spotify_client_secret), + ) + .send() + .await?; + + let status = res.status(); + + if status.as_u16() == 200 { + let body = res.json::().await.unwrap(); + + redis::cmd("SET") + .arg("spotify/access_token") + .arg(&body.access_token) + .arg("EX") + .arg(&body.expires_in) + .query_async::(&mut redis.cm) + .await + .unwrap(); + + let refresh_token = &body.refresh_token; + match refresh_token { + Some(refresh_token) => { + redis::cmd("SET") + .arg("spotify/refresh_token") + .arg(refresh_token) + .query_async::(&mut redis.cm) + .await + .unwrap(); + } + None => (), + } + + Ok(HttpResponse::NoContent().finish()) + } else { + let body = res.json::().await.unwrap(); + Ok(HttpResponse::InternalServerError().json(body)) + } +} diff --git a/src/structs/blog.rs b/src/structs/blog.rs index fecf5b9..6d7bcd3 100644 --- a/src/structs/blog.rs +++ b/src/structs/blog.rs @@ -1,56 +1,61 @@ use chrono::NaiveDateTime; use serde::{Deserialize, Serialize}; use serde_with::serde_as; -use sqlx::FromRow; extern crate serde_json; #[derive(Deserialize)] pub struct BlogLoginRequest { - pub username: String, - pub password: String, + pub username: String, + pub password: String, } #[allow(dead_code)] #[derive(Deserialize, Debug, Clone)] pub struct BlogAdminSession { - pub user_id: String, + pub user_id: String, } #[allow(dead_code)] #[derive(Deserialize, Debug, Clone)] pub struct BlogAdminIntSession { - pub user_id: String, - pub token: String, + pub user_id: String, + pub token: String, } #[allow(dead_code)] -#[derive(Debug, Clone, FromRow)] +#[derive(Debug, Clone)] pub struct BlogAdminUser { - pub id: String, - pub username: String, - #[sqlx(default)] - pub display_name: Option, - #[sqlx(default)] - pub password: Option, + pub id: String, + pub username: String, + pub display_name: Option, + pub password: Option, } #[serde_as] #[allow(dead_code)] -#[derive(Serialize, Deserialize, Debug, Clone, FromRow)] +#[derive(Serialize, Deserialize, Debug, Clone)] +pub struct BlogPostMutate { + pub slug: Option, + pub title: Option, + pub description: Option, + pub image: Option, + pub visibility: Option, + pub tags: Option>, + pub body: Option, +} + +#[serde_as] +#[allow(dead_code)] +#[derive(Serialize, Deserialize, Debug, Clone)] pub struct BlogPost { - pub id: String, - pub slug: String, - pub title: String, - #[sqlx(default)] - pub description: Option, - #[sqlx(default)] - pub image: Option, - pub visibility: String, - #[sqlx(default)] - pub tags: Option>, - #[sqlx(default)] - pub body: Option, - pub created_at: NaiveDateTime, - #[sqlx(default)] - pub published_at: Option, + pub id: String, + pub slug: String, + pub title: String, + pub description: Option, + pub image: Option, + pub visibility: String, + pub tags: Vec, + pub body: Option, + pub created_at: NaiveDateTime, + pub published_at: Option, } diff --git a/src/structs/spotify.rs b/src/structs/spotify.rs index 0c60da8..fafcef0 100644 --- a/src/structs/spotify.rs +++ b/src/structs/spotify.rs @@ -1,106 +1,164 @@ use serde::{Deserialize, Serialize}; +use serde_with::skip_serializing_none; extern crate serde_json; #[derive(Debug, Serialize, Deserialize)] pub struct PlayerState { - pub device: Device, - pub shuffle_state: bool, - pub repeat_state: Option, - pub timestamp: i64, - pub context: Option, - pub progress_ms: i64, - pub item: Item, - #[serde(rename = "type")] - pub currently_playing_type: Option, - pub is_playing: bool, + pub device: Device, + pub shuffle_state: bool, + pub repeat_state: Option, + pub timestamp: i64, + pub context: Option, + pub progress_ms: i64, + pub item: Item, + #[serde(rename = "type")] + pub currently_playing_type: Option, + pub is_playing: bool, } #[derive(Debug, Serialize, Deserialize)] pub struct Context { - pub external_urls: ExternalUrls, - pub href: String, - #[serde(rename = "type")] - pub context_type: Option, - pub uri: String, + pub external_urls: ExternalUrls, + pub href: String, + #[serde(rename = "type")] + pub context_type: Option, + pub uri: String, } #[derive(Debug, Serialize, Deserialize)] pub struct ExternalUrls { - pub spotify: String, + pub spotify: String, } #[derive(Debug, Serialize, Deserialize)] pub struct Device { - pub id: String, - pub is_active: bool, - pub is_private_session: bool, - pub is_restricted: bool, - pub name: String, - #[serde(rename = "type")] - pub device_type: Option, - pub volume_percent: i64, + pub id: String, + pub is_active: bool, + pub is_private_session: bool, + pub is_restricted: bool, + pub name: String, + #[serde(rename = "type")] + pub device_type: Option, + pub volume_percent: i64, } #[derive(Debug, Serialize, Deserialize)] pub struct Item { - pub album: Option, - pub show: Option, - pub artists: Option>, - pub duration_ms: i64, - pub explicit: bool, - pub external_urls: ExternalUrls, - pub href: String, - pub id: String, - pub name: String, - pub popularity: Option, - pub track_number: Option, - #[serde(rename = "type")] - pub item_type: Option, - pub uri: String, + pub album: Option, + pub show: Option, + pub artists: Option>, + pub duration_ms: i64, + pub explicit: bool, + pub external_urls: ExternalUrls, + pub href: String, + pub id: String, + pub name: String, + pub popularity: Option, + pub track_number: Option, + #[serde(rename = "type")] + pub item_type: Option, + pub uri: String, } #[derive(Debug, Serialize, Deserialize)] pub struct Album { - #[serde(rename = "type")] - pub album_type: Option, - pub artists: Option>, - pub external_urls: ExternalUrls, - pub href: String, - pub id: String, - pub images: Vec, - pub name: String, - pub release_date: String, - pub release_date_precision: String, - pub total_tracks: i64, - pub uri: String, + #[serde(rename = "type")] + pub album_type: Option, + pub artists: Option>, + pub external_urls: ExternalUrls, + pub href: String, + pub id: String, + pub images: Vec, + pub name: String, + pub release_date: String, + pub release_date_precision: String, + pub total_tracks: i64, + pub uri: String, } #[derive(Debug, Serialize, Deserialize)] pub struct Show { - #[serde(rename = "type")] - pub show_type: Option, - pub external_urls: ExternalUrls, - pub href: String, - pub id: String, - pub images: Vec, - pub name: String, - pub uri: String, + #[serde(rename = "type")] + pub show_type: Option, + pub external_urls: ExternalUrls, + pub href: String, + pub id: String, + pub images: Vec, + pub name: String, + pub uri: String, } #[derive(Debug, Serialize, Deserialize)] pub struct Artist { - pub external_urls: ExternalUrls, - pub href: String, - pub id: String, - pub name: String, - #[serde(rename = "type")] - pub artist_type: Option, - pub uri: String, + pub external_urls: ExternalUrls, + pub href: String, + pub id: String, + pub name: String, + #[serde(rename = "type")] + pub artist_type: Option, + pub uri: String, } #[derive(Debug, Serialize, Deserialize)] pub struct Image { - pub height: i64, - pub url: String, - pub width: i64, + pub height: i64, + pub url: String, + pub width: i64, +} + +#[skip_serializing_none] +#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq)] +pub struct CurrentPlaying { + pub playing: bool, + pub id: Option, + #[serde(rename = "type")] + pub current_playing_type: Option, + pub name: Option, + pub artists: Option>, + pub length: Option, + pub progress: Option, + pub image: Option, + pub device: Option, +} + +#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq)] +pub struct ArtistName { + pub name: String, +} + +#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq)] +pub struct DeviceRewrite { + pub name: String, + #[serde(rename = "type")] + pub device_type: String, +} + +#[allow(dead_code)] +#[derive(Debug)] +pub struct SpotifyAccount { + pub access_token: String, + pub refresh_token: Option, +} + +#[derive(Debug, Serialize, Deserialize, Default)] +pub struct AuthorizationData { + pub code: Option, + pub refresh_token: Option, + pub grant_type: String, + pub redirect_uri: String, +} + +#[allow(dead_code)] +#[derive(Debug, Deserialize, Serialize)] +pub struct SpotifyArtist { + pub name: String, +} + +#[derive(Debug, Serialize, Deserialize)] +pub struct SpotifyTokens { + pub access_token: String, + pub token_type: String, + pub expires_in: u32, + pub refresh_token: Option, + pub scope: String, } From b6373c4bd9a30bb9230a277e2317fa20ef687dc8 Mon Sep 17 00:00:00 2001 From: Dustin Rouillard Date: Wed, 22 May 2024 16:44:56 -0600 Subject: [PATCH 05/13] Move s3 uploads to v2 api --- Cargo.lock | 25 +++++++++ Cargo.toml | 5 ++ src/config.rs | 79 ++++++++++++++++++----------- src/connectivity/mod.rs | 1 + src/connectivity/s3.rs | 39 +++++++++++++++ src/main.rs | 11 +++- src/services/mod.rs | 1 + src/services/uploads/helpers.rs | 83 ++++++++++++++++++++++++++++++ src/services/uploads/mod.rs | 2 + src/services/uploads/routes.rs | 89 +++++++++++++++++++++++++++++++++ src/structs/mod.rs | 1 + src/structs/uploads.rs | 7 +++ 12 files changed, 313 insertions(+), 30 deletions(-) create mode 100644 src/connectivity/s3.rs create mode 100644 src/services/uploads/helpers.rs create mode 100644 src/services/uploads/mod.rs create mode 100644 src/services/uploads/routes.rs create mode 100644 src/structs/uploads.rs diff --git a/Cargo.lock b/Cargo.lock index d040bc3..b8b4622 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -430,11 +430,15 @@ dependencies = [ "actix-multipart", "actix-web", "actix-web-lab", + "bytes", "chrono", "envconfig", "futures", + "hex", + "infer", "lapin", "lazy_static", + "once_cell", "prisma-client-rust", "prisma-client-rust-cli", "rand 0.8.5", @@ -446,6 +450,7 @@ dependencies = [ "serde_json", "serde_urlencoded", "serde_with", + "sha1", "tokio", "tracing", "tracing-actix-web", @@ -1000,6 +1005,17 @@ dependencies = [ "nom", ] +[[package]] +name = "cfb" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d38f2da7a0a2c4ccf0065be06397cc26a81f4e528be095826eee9d4adbb8c60f" +dependencies = [ + "byteorder", + "fnv", + "uuid", +] + [[package]] name = "cfg-if" version = "1.0.0" @@ -2323,6 +2339,15 @@ version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfa799dd5ed20a7e349f3b4639aa80d74549c81716d9ec4f994c9b5815598306" +[[package]] +name = "infer" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb33622da908807a06f9513c19b3c1ad50fab3e4137d82a78107d502075aa199" +dependencies = [ + "cfb", +] + [[package]] name = "inout" version = "0.1.3" diff --git a/Cargo.toml b/Cargo.toml index 0b3a878..bf90d56 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,6 +28,11 @@ prisma-client-rust = { git = "https://github.com/Brendonovich/prisma-client-rust prisma-client-rust-cli = { git = "https://github.com/Brendonovich/prisma-client-rust", tag = "0.6.11", default-features = false, features = ["postgresql"] } rust-s3 = "0.33.0" actix-multipart = "0.6.1" +infer = "0.15.0" +bytes = "1.6.0" +once_cell = "1.19.0" +sha1 = "0.10.6" +hex = "0.4.3" [profile.release] lto = true diff --git a/src/config.rs b/src/config.rs index 3a605f1..3c7e2b4 100644 --- a/src/config.rs +++ b/src/config.rs @@ -2,42 +2,63 @@ use envconfig::Envconfig; #[derive(Envconfig)] pub struct Config { - #[envconfig(from = "ENV", default = "dev")] - pub env: String, + #[envconfig(from = "ENV", default = "dev")] + pub env: String, - #[envconfig(from = "LISTEN_HOST", default = "0.0.0.0")] - pub listen_host: String, + #[envconfig(from = "LISTEN_HOST", default = "0.0.0.0")] + pub listen_host: String, - #[envconfig(from = "LISTEN_PORT", default = "8080")] - pub listen_port: u16, + #[envconfig(from = "LISTEN_PORT", default = "8080")] + pub listen_port: u16, - #[envconfig( - from = "SPOTIFY_CLIENT_ID", - default = "01ba26764aca4594a26f4cc59cd3f01f" - )] - pub spotify_client_id: String, + #[envconfig( + from = "SPOTIFY_CLIENT_ID", + default = "01ba26764aca4594a26f4cc59cd3f01f" + )] + pub spotify_client_id: String, - #[envconfig(from = "SPOTIFY_CLIENT_SECRET")] - pub spotify_client_secret: String, + #[envconfig(from = "SPOTIFY_CLIENT_SECRET")] + pub spotify_client_secret: String, - #[envconfig( - from = "SPOTIFY_REDIRECT_URI", - default = "http://localhost:8080/v2/spotify/setup" - )] - pub spotify_redirect_uri: String, + #[envconfig( + from = "SPOTIFY_REDIRECT_URI", + default = "http://localhost:8080/v2/spotify/setup" + )] + pub spotify_redirect_uri: String, - #[envconfig( - from = "POSTGRES_DSN", - default = "postgres://postgres:postgres@postgres/testing" - )] - pub postgres_dsn: String, + #[envconfig(from = "VALKEY_DSN", default = "redis://valkey:6379")] + pub valkey_dsn: String, - #[envconfig(from = "VALKEY_DSN", default = "redis://valkey:6379")] - pub valkey_dsn: String, + #[envconfig( + from = "RABBIT_DSN", + default = "amqp://rabbit:password@rabbitmq:5672" + )] + pub rabbit_dsn: String, - #[envconfig(from = "RABBIT_DSN", default = "amqp://rabbit:password@rabbitmq:5672")] - pub rabbit_dsn: String, + #[envconfig( + from = "RABBIT_QUEUE_NAME", + default = "dstn-gateway-ingest" + )] + pub rabbit_queue: String, - #[envconfig(from = "RABBIT_QUEUE_NAME", default = "dstn-gateway-ingest")] - pub rabbit_queue: String, + #[envconfig(from = "S3_ENDPOINT", default = "https://s3.kush")] + pub s3_endpoint: String, + + #[envconfig(from = "S3_CLIENT_ID", default = "")] + pub s3_client_id: String, + + #[envconfig(from = "S3_CLIENT_SECRET", default = "")] + pub s3_client_secret: String, + + #[envconfig(from = "S3_BUCKET_NAME", default = "cdn")] + pub s3_bucket_name: String, + + #[envconfig(from = "S3_REGION", default = "none")] + pub s3_region: String, + + #[envconfig(from = "S3_IMAGES_ALIAS", default = "dustin.pics")] + pub s3_images_alias: String, + + #[envconfig(from = "S3_FILES_ALIAS", default = "files.dstn.to")] + pub s3_files_alias: String, } diff --git a/src/connectivity/mod.rs b/src/connectivity/mod.rs index 4c093c6..2687dee 100644 --- a/src/connectivity/mod.rs +++ b/src/connectivity/mod.rs @@ -1,3 +1,4 @@ pub mod prisma; pub mod rabbit; +pub mod s3; pub mod valkey; diff --git a/src/connectivity/s3.rs b/src/connectivity/s3.rs new file mode 100644 index 0000000..98a8264 --- /dev/null +++ b/src/connectivity/s3.rs @@ -0,0 +1,39 @@ +use envconfig::Envconfig; + +use s3::{creds::Credentials, error::S3Error, Bucket, Region}; + +use crate::config::Config; + +#[warn(dead_code)] +#[derive(Clone)] +pub struct S3Manager { + pub cdn_bucket: Bucket, +} + +impl S3Manager { + pub async fn new() -> Result { + let config = Config::init_from_env().unwrap(); + + let region = Region::Custom { + region: config.s3_region, + endpoint: config.s3_endpoint, + }; + let credentials = Credentials::new( + Some(config.s3_client_id.as_str()), + Some(config.s3_client_secret.as_str()), + None, + None, + None, + ) + .unwrap(); + + let cdn_bucket = Bucket::new( + &config.s3_bucket_name, + region.clone(), + credentials.clone(), + )? + .with_path_style(); + + Ok(Self { cdn_bucket }) + } +} diff --git a/src/main.rs b/src/main.rs index 0cd25c9..1bb745f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -8,7 +8,9 @@ use std::{error::Error, time::Duration}; use actix_web::{middleware, web, App, HttpServer}; use actix_web_lab::middleware::from_fn; -use connectivity::{rabbit::RabbitManager, valkey::ValkeyManager}; +use connectivity::{ + rabbit::RabbitManager, s3::S3Manager, valkey::ValkeyManager, +}; use envconfig::Envconfig; use tokio::time; use tracing_actix_web::TracingLogger; @@ -24,6 +26,7 @@ pub struct ServerState { pub valkey: ValkeyManager, pub rabbit: RabbitManager, pub prisma: PrismaClient, + pub s3: S3Manager, } #[tokio::main] @@ -39,6 +42,7 @@ async fn main() -> Result<(), Box> { let valkey = connectivity::valkey::ValkeyManager::new().await; let rabbit = connectivity::rabbit::RabbitManager::new().await; + let s3 = connectivity::s3::S3Manager::new().await.unwrap(); let prisma = PrismaClient::_builder().build().await.unwrap(); @@ -56,6 +60,7 @@ async fn main() -> Result<(), Box> { valkey, rabbit, prisma, + s3, }); let data_http = web::Data::clone(&data); @@ -82,6 +87,10 @@ async fn main() -> Result<(), Box> { .service( web::scope("/v2") .service(services::base::health) + .service( + web::scope("/uploads") + .service(services::uploads::routes::upload_to_cdn), + ) .service( web::scope("/spotify") .service(services::spotify::routes::current) diff --git a/src/services/mod.rs b/src/services/mod.rs index 3eee771..bba0000 100644 --- a/src/services/mod.rs +++ b/src/services/mod.rs @@ -1,3 +1,4 @@ pub mod base; pub mod blog; pub mod spotify; +pub mod uploads; diff --git a/src/services/uploads/helpers.rs b/src/services/uploads/helpers.rs new file mode 100644 index 0000000..37c599e --- /dev/null +++ b/src/services/uploads/helpers.rs @@ -0,0 +1,83 @@ +use actix_multipart::form::bytes; + +use once_cell::sync::Lazy; +use serde::Deserialize; + +static ALLOWED_IMAGES: Lazy> = Lazy::new(|| { + vec![ + "image/gif", + "image/png", + "image/svg", + "image/webp", + "image/jpeg", + ] +}); + +static ALLOWED_FILES: Lazy> = Lazy::new(|| { + let mut files = vec![ + "application/octet-stream", + "application/ogg", + "application/pdf", + "application/rtf", + "application/x-sh", + "application/x-tar", + "application/zip", + "audio/mpeg", + "audio/ogg", + "audio/opus", + "audio/wav", + "audio/webm", + "font/otf", + "font/ttf", + "font/woff", + "font/woff2", + "image/webp", + "text/css", + "text/csv", + "text/sql", + "text/javascript", + "text/plain", + "video/mov", + "video/mp4", + "video/mpeg", + "video/ogg", + "video/webm", + ]; + files.extend(&*ALLOWED_IMAGES); + files +}); + +#[derive(Deserialize, Debug)] +pub struct AssetType { + pub mime: String, + pub ext: String, +} + +pub fn is_allowed_type( + file: &bytes::Bytes, + asset_type: String, +) -> (bool, AssetType) { + let kind = infer::get(&file.data); + + match kind { + Some(kind) => ( + (if asset_type == "images" { + &ALLOWED_IMAGES + } else { + &ALLOWED_FILES + }) + .contains(&kind.mime_type()), + AssetType { + mime: (&kind.mime_type()).to_string(), + ext: (&kind.extension()).to_string(), + }, + ), + None => ( + false, + AssetType { + mime: "text/plain".to_string(), + ext: "txt".to_string(), + }, + ), + } +} diff --git a/src/services/uploads/mod.rs b/src/services/uploads/mod.rs new file mode 100644 index 0000000..58e6ac1 --- /dev/null +++ b/src/services/uploads/mod.rs @@ -0,0 +1,2 @@ +pub mod helpers; +pub mod routes; diff --git a/src/services/uploads/routes.rs b/src/services/uploads/routes.rs new file mode 100644 index 0000000..dbf6a0e --- /dev/null +++ b/src/services/uploads/routes.rs @@ -0,0 +1,89 @@ +use actix_multipart::form::MultipartForm; +use actix_web::{http::Error, post, web, HttpResponse}; +use envconfig::Envconfig; +use serde_json::json; +use sha1::{Digest, Sha1}; + +use crate::{ + config::Config, services::uploads::helpers, structs::uploads::CdnUpload, + ServerState, +}; + +#[post("{type}")] +async fn upload_to_cdn( + MultipartForm(form): MultipartForm, + state: web::Data, + asset_type: web::Path, +) -> Result { + if asset_type.to_string() != "images" + && asset_type.to_string() != "files" + { + return Ok( + HttpResponse::BadRequest() + .append_header(("Content-type", "application/json")) + .body(json!({"code": "invalid_asset_type"}).to_string()), + ); + } + + let file = &mut form.files.first().unwrap(); + + let type_match: helpers::AssetType = + match helpers::is_allowed_type(file, asset_type.to_string()) { + (true, res) => res, + (false, res) => { + if asset_type.to_string() == "images" { + return Ok( + HttpResponse::BadRequest() + .append_header(("Content-type", "application/json")) + .body(json!({"code": "prohibited_file_type"}).to_string()), + ); + } + + res + } + }; + + let base_dir = if asset_type.to_string() == "images" { + "i" + } else { + "u" + }; + + let mut hasher = Sha1::new(); + hasher.update(&file.data); + let result = hasher.finalize(); + + let hash = hex::encode(result); + let hash = &hash[..16].to_string(); + let ext = type_match.ext; + + let path = format!("{base_dir}/{hash}.{ext}"); + + let s3 = &state.s3; + let response = s3 + .cdn_bucket + .put_object_with_content_type(&path, &file.data, &type_match.mime) + .await + .unwrap(); + + if response.status_code() != 200 { + return Ok( + HttpResponse::BadRequest() + .append_header(("Content-type", "application/json")) + .body(json!({"code": "failed_upload_to_s3"}).to_string()), + ); + } + + let config = Config::init_from_env().unwrap(); + let alias_url = if asset_type.to_string() == "images" { + config.s3_images_alias + } else { + config.s3_files_alias + }; + + Ok( + HttpResponse::Ok() + .append_header(("Content-type", "application/json")) + .body(json!({"data": { "url": format!("https://{alias_url}/{hash}.{ext}") }}).to_string()), + ) +} diff --git a/src/structs/mod.rs b/src/structs/mod.rs index 9043e5f..10ca48c 100644 --- a/src/structs/mod.rs +++ b/src/structs/mod.rs @@ -1,2 +1,3 @@ pub mod blog; pub mod spotify; +pub mod uploads; diff --git a/src/structs/uploads.rs b/src/structs/uploads.rs new file mode 100644 index 0000000..d61d847 --- /dev/null +++ b/src/structs/uploads.rs @@ -0,0 +1,7 @@ +use actix_multipart::form::{bytes::Bytes, MultipartForm}; + +#[derive(Debug, MultipartForm)] +pub struct CdnUpload { + #[multipart(rename = "file")] + pub files: Vec, +} From 7400125e96c1e067620320d6931a1a9e80feb2bd Mon Sep 17 00:00:00 2001 From: Dustin Rouillard Date: Wed, 22 May 2024 16:45:49 -0600 Subject: [PATCH 06/13] Update readme for "used for" --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index cfa9bf3..1a7db4f 100644 --- a/README.md +++ b/README.md @@ -5,5 +5,5 @@ There is probably a lot of better ways to do many of the things I've done here, ## Used for - Spotify History and Now Playing API / Queue Messages -- **WIP:** Blog System *(SOON)* -- ~~File and Screenshot Uploads~~ *(SOON, After blog system)* \ No newline at end of file +- File and Screenshot Uploads +- **WIP:** Blog System *(SOON)* \ No newline at end of file From 9b169f321ea2cce5f54d271ff501685e22dd2ef8 Mon Sep 17 00:00:00 2001 From: Dustin Rouillard Date: Wed, 22 May 2024 20:07:42 -0600 Subject: [PATCH 07/13] Fix docker build Add middleware for uploads to be authed Update multipart config to 10mb Add empty svc functions for new routes - User update - password change - asset upload - asset list - asset delete --- .dockerignore | 3 +- Dockerfile | 8 ++++ src/main.rs | 13 +++++- src/services/blog/assets.rs | 18 ++++++-- src/services/blog/auth.rs | 22 +++++++--- src/services/blog/middleware.rs | 4 +- src/services/spotify/routes.rs | 16 ++++---- src/services/uploads/middleware.rs | 66 ++++++++++++++++++++++++++++++ src/services/uploads/mod.rs | 1 + 9 files changed, 130 insertions(+), 21 deletions(-) create mode 100644 src/services/uploads/middleware.rs diff --git a/.dockerignore b/.dockerignore index 1de5659..e25a3e7 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1 +1,2 @@ -target \ No newline at end of file +target +src/connectivity/prisma.rs \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 57ed34d..4396718 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,17 @@ FROM clux/muslrust AS builder +RUN apt update +RUN apt install wget -y +RUN wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.0g-2ubuntu4_amd64.deb +RUN dpkg -i libssl1.1_1.1.0g-2ubuntu4_amd64.deb + WORKDIR /app COPY . . +RUN cargo prisma generate + +RUN ls -lha src/connectivity/ RUN cargo build --release FROM alpine diff --git a/src/main.rs b/src/main.rs index 1bb745f..aa6cf48 100644 --- a/src/main.rs +++ b/src/main.rs @@ -6,6 +6,7 @@ pub mod structs; use std::{error::Error, time::Duration}; +use actix_multipart::form::MultipartFormConfig; use actix_web::{middleware, web, App, HttpServer}; use actix_web_lab::middleware::from_fn; use connectivity::{ @@ -81,6 +82,11 @@ async fn main() -> Result<(), Box> { HttpServer::new(move || { App::new() .app_data(web::Data::clone(&data_http)) + .app_data( + MultipartFormConfig::default() + .total_limit(10 * 1024 * 1024) + .memory_limit(10 * 1024 * 1024), + ) .wrap(middleware::NormalizePath::default()) .wrap(TracingLogger::default()) .default_service(web::to(services::base::index)) @@ -89,6 +95,9 @@ async fn main() -> Result<(), Box> { .service(services::base::health) .service( web::scope("/uploads") + .wrap(from_fn( + services::uploads::middleware::uploads_auth_mw, + )) .service(services::uploads::routes::upload_to_cdn), ) .service( @@ -111,7 +120,9 @@ async fn main() -> Result<(), Box> { .service(services::blog::auth::get_user) .service(services::blog::posts::create_post) .service(services::blog::posts::update_post) - .service(services::blog::posts::delete_post), + .service(services::blog::posts::delete_post) + .service(services::blog::assets::get_assets_for_post) + .service(services::blog::assets::upload_asset_for_post), ), ), ) diff --git a/src/services/blog/assets.rs b/src/services/blog/assets.rs index e17e6c3..50e286c 100644 --- a/src/services/blog/assets.rs +++ b/src/services/blog/assets.rs @@ -1,6 +1,16 @@ -use actix_web::{http::Error, post, HttpResponse}; +use actix_web::{delete, get, http::Error, post, HttpResponse}; -#[post("/assets")] -async fn index() -> Result { - Ok(HttpResponse::Ok().body("Ok")) +#[post("/posts/{id}/assets")] +async fn upload_asset_for_post() -> Result { + Ok(HttpResponse::NotImplemented().finish()) +} + +#[get("/posts/{id}/assets")] +async fn get_assets_for_post() -> Result { + Ok(HttpResponse::NotImplemented().finish()) +} + +#[delete("/posts/{id}/assets/{hash}")] +async fn delete_asset_for_post() -> Result { + Ok(HttpResponse::NotImplemented().finish()) } diff --git a/src/services/blog/auth.rs b/src/services/blog/auth.rs index f57c041..7c9ed4d 100644 --- a/src/services/blog/auth.rs +++ b/src/services/blog/auth.rs @@ -8,7 +8,7 @@ use argon2::{self}; use rand::{distributions::Alphanumeric, Rng}; use actix_web::{ - delete, get, http::Error, post, web, HttpMessage, HttpRequest, + delete, get, http::Error, patch, post, web, HttpMessage, HttpRequest, HttpResponse, }; use redis::aio::ConnectionManager; @@ -22,7 +22,7 @@ async fn login( let username = body.username.to_string(); let prisma = &state.prisma; - let redis = &mut state.valkey.clone(); + let valkey = &mut state.valkey.clone(); let user_lookup = prisma .blog_admin_users() @@ -54,7 +54,7 @@ async fn login( let _ = redis::cmd("SET") .arg(format!("blog_admin_session/{}", session_token)) .arg(json!({"user_id": user.id}).to_string()) - .query_async::(&mut redis.cm) + .query_async::(&mut valkey.cm) .await; let response = json!({ "user": { "id": user.id, "username": user.username, "display_name": user.display_name, }, "session": { "token": session_token } }); @@ -100,19 +100,31 @@ async fn get_user(req: HttpRequest) -> Result { ) } +#[patch("/me")] +async fn update_user(_req: HttpRequest) -> Result { + Ok(HttpResponse::NotImplemented().finish()) +} + +#[patch("/auth")] +async fn change_password( + _req: HttpRequest, +) -> Result { + Ok(HttpResponse::NotImplemented().finish()) +} + #[delete("/auth")] async fn logout( req: HttpRequest, state: web::Data, ) -> Result { - let redis = &mut state.valkey.clone(); + let valkey = &mut state.valkey.clone(); let exts = req.extensions_mut(); let session = exts.get::().unwrap(); let _ = redis::cmd("DEL") .arg(format!("blog_admin_session/{}", session.token)) - .query_async::(&mut redis.cm) + .query_async::(&mut valkey.cm) .await; Ok(HttpResponse::NoContent().finish()) diff --git a/src/services/blog/middleware.rs b/src/services/blog/middleware.rs index 201d6de..5a69bee 100644 --- a/src/services/blog/middleware.rs +++ b/src/services/blog/middleware.rs @@ -24,7 +24,7 @@ pub async fn blog_admin_auth_mw( let state = req.app_data::>().unwrap().clone(); let prisma = &state.prisma; - let redis = &mut state.valkey.clone(); + let valkey = &mut state.valkey.clone(); match auth_token { None => { @@ -41,7 +41,7 @@ pub async fn blog_admin_auth_mw( Some(token) => { let redis_session = redis::cmd("GET") .arg(format!("blog_admin_session/{}", token.to_str().unwrap())) - .query_async::(&mut redis.cm) + .query_async::(&mut valkey.cm) .await; match redis_session { diff --git a/src/services/spotify/routes.rs b/src/services/spotify/routes.rs index 39ee5b7..c939d37 100644 --- a/src/services/spotify/routes.rs +++ b/src/services/spotify/routes.rs @@ -26,8 +26,8 @@ struct TokenError { async fn current( data: web::Data, ) -> Result { - let redis = &mut data.valkey.clone(); - let json = helpers::get_playing(redis).await; + let valkey = &mut data.valkey.clone(); + let json = helpers::get_playing(valkey).await; Ok( HttpResponse::Ok() @@ -40,9 +40,9 @@ async fn current( async fn authorize( data: web::Data, ) -> Result { - let redis = &mut data.valkey.clone(); + let valkey = &mut data.valkey.clone(); - let setup_check = redis + let setup_check = valkey .cm .exists("spotify/refresh_token") .await @@ -80,9 +80,9 @@ async fn setup( data: web::Data, info: web::Query, ) -> Result> { - let redis = &mut data.valkey.clone(); + let valkey = &mut data.valkey.clone(); - let setup_check = redis + let setup_check = valkey .cm .exists("spotify/refresh_token") .await @@ -137,7 +137,7 @@ async fn setup( .arg(&body.access_token) .arg("EX") .arg(&body.expires_in) - .query_async::(&mut redis.cm) + .query_async::(&mut valkey.cm) .await .unwrap(); @@ -147,7 +147,7 @@ async fn setup( redis::cmd("SET") .arg("spotify/refresh_token") .arg(refresh_token) - .query_async::(&mut redis.cm) + .query_async::(&mut valkey.cm) .await .unwrap(); } diff --git a/src/services/uploads/middleware.rs b/src/services/uploads/middleware.rs new file mode 100644 index 0000000..bcc1584 --- /dev/null +++ b/src/services/uploads/middleware.rs @@ -0,0 +1,66 @@ +use actix_web::{ + body::MessageBody, + dev::{ServiceRequest, ServiceResponse}, + http::header, + web::Data, + Error, HttpResponse, +}; +use actix_web_lab::middleware::Next; +use redis::aio::ConnectionManager; +use serde_json::json; + +use crate::ServerState; + +pub async fn uploads_auth_mw( + req: ServiceRequest, + next: Next, +) -> Result, Error> { + let auth_token = req.headers().get(header::AUTHORIZATION); + + let state = req.app_data::>().unwrap().clone(); + + let valkey = &mut state.valkey.clone(); + + match auth_token { + None => { + return Ok( + ServiceResponse::new( + req.request().to_owned(), + HttpResponse::Unauthorized() + .append_header(("Content-type", "application/json")) + .body(json!({"code": "missing_authentication"}).to_string()), + ) + .map_into_boxed_body(), + ); + } + Some(token) => { + let valkey_session = redis::cmd("GET") + .arg(format!("upload_tokens/{}", token.to_str().unwrap())) + .query_async::(&mut valkey.cm) + .await; + + match valkey_session { + Err(_) => { + return Ok( + ServiceResponse::new( + req.request().to_owned(), + HttpResponse::Unauthorized() + .append_header(("Content-type", "application/json")) + .body( + json!({"code": "invalid_authentication"}).to_string(), + ), + ) + .map_into_boxed_body(), + ); + } + + Ok(_) => { + return next + .call(req) + .await + .map(ServiceResponse::map_into_boxed_body); + } + } + } + } +} diff --git a/src/services/uploads/mod.rs b/src/services/uploads/mod.rs index 58e6ac1..ba41940 100644 --- a/src/services/uploads/mod.rs +++ b/src/services/uploads/mod.rs @@ -1,2 +1,3 @@ pub mod helpers; +pub mod middleware; pub mod routes; From 2ec872ec65d3582f65877e05e9cffffca8b6aa4b Mon Sep 17 00:00:00 2001 From: Dustin Rouillard Date: Wed, 22 May 2024 20:26:13 -0600 Subject: [PATCH 08/13] Register delete service --- src/main.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index aa6cf48..4ee51b7 100644 --- a/src/main.rs +++ b/src/main.rs @@ -122,7 +122,8 @@ async fn main() -> Result<(), Box> { .service(services::blog::posts::update_post) .service(services::blog::posts::delete_post) .service(services::blog::assets::get_assets_for_post) - .service(services::blog::assets::upload_asset_for_post), + .service(services::blog::assets::upload_asset_for_post) + .service(services::blog::assets::delete_asset_for_post), ), ), ) From c23fa41d58873084a96586e78295d796b1fcc447 Mon Sep 17 00:00:00 2001 From: Dustin Rouillard Date: Thu, 23 May 2024 17:54:48 -0600 Subject: [PATCH 09/13] Implement post asset creation/uploading Remade the blog_assets table and add new columns Implement update user and change pwd --- prisma/schema.prisma | 23 +++---- src/main.rs | 2 + src/services/blog/assets.rs | 98 +++++++++++++++++++++++++++-- src/services/blog/auth.rs | 121 +++++++++++++++++++++++++++++++++--- src/services/blog/posts.rs | 7 ++- src/structs/blog.rs | 21 +++++++ 6 files changed, 246 insertions(+), 26 deletions(-) diff --git a/prisma/schema.prisma b/prisma/schema.prisma index bf8e1ce..410018d 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -15,17 +15,6 @@ model blog_admin_users { password String } -model blog_assets { - id String @id - path String - post_id String? - upload_date DateTime? @db.Timestamp(6) - blog_posts blog_posts? @relation(fields: [post_id], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "fk_blog_assets_post") - - @@index([post_id]) - @@index([upload_date]) -} - model blog_posts { id String @id @default(dbgenerated("id_generator()")) slug String @unique(map: "blog_posts_slug_idx") @default(dbgenerated("date_slug()")) @@ -65,3 +54,15 @@ model spotify_history { @@id([id, listened_at]) } + +model blog_assets { + hash String @id + post_id String + file_type String + file_size Int @default(0) + upload_date DateTime @default(now()) @db.Timestamp(6) + blog_posts blog_posts @relation(fields: [post_id], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "fk_blog_assets_post") + + @@index([post_id]) + @@index([upload_date]) +} diff --git a/src/main.rs b/src/main.rs index 4ee51b7..9f62962 100644 --- a/src/main.rs +++ b/src/main.rs @@ -118,6 +118,8 @@ async fn main() -> Result<(), Box> { )) .service(services::blog::auth::logout) .service(services::blog::auth::get_user) + .service(services::blog::auth::update_user) + .service(services::blog::auth::change_password) .service(services::blog::posts::create_post) .service(services::blog::posts::update_post) .service(services::blog::posts::delete_post) diff --git a/src/services/blog/assets.rs b/src/services/blog/assets.rs index 50e286c..4936c7f 100644 --- a/src/services/blog/assets.rs +++ b/src/services/blog/assets.rs @@ -1,16 +1,104 @@ -use actix_web::{delete, get, http::Error, post, HttpResponse}; +use actix_multipart::form::MultipartForm; +use actix_web::{delete, get, http::Error, post, web, HttpResponse}; +use prisma_client_rust::prisma_errors::query_engine::UniqueKeyViolation; +use serde_json::json; +use sha1::{Digest, Sha1}; + +use crate::{ + connectivity::prisma::blog_assets, structs::blog::BlogAssetUpload, + ServerState, +}; #[post("/posts/{id}/assets")] -async fn upload_asset_for_post() -> Result { - Ok(HttpResponse::NotImplemented().finish()) +async fn upload_asset_for_post( + MultipartForm(form): MultipartForm, + state: web::Data, + post_id: web::Path, +) -> Result { + let s3 = &state.s3; + let prisma = &state.prisma; + + let file = &mut form.files.first().unwrap(); + + let type_match = crate::services::uploads::helpers::is_allowed_type( + file, + "files".to_string(), + ) + .1; + + let mut hasher = Sha1::new(); + hasher.update(&file.data); + let result = hasher.finalize(); + + let hash = hex::encode(result); + let ext = type_match.ext; + let path = format!("blog/assets/{hash}.{ext}"); + + let response = s3 + .cdn_bucket + .put_object_with_content_type(&path, &file.data, &type_match.mime) + .await + .unwrap(); + + if response.status_code() != 200 { + return Ok( + HttpResponse::BadRequest() + .append_header(("Content-type", "application/json")) + .body(json!({"code": "failed_upload_to_s3"}).to_string()), + ); + } + + let size = file.data.len() as i32; + + let asset = prisma + .blog_assets() + .create( + hash.clone(), + ext.clone(), + crate::connectivity::prisma::blog_posts::UniqueWhereParam::IdEquals( + post_id.to_string(), + ), + vec![blog_assets::file_size::set(size)], + ) + .exec() + .await; + + match asset { + Err(error) if error.is_prisma_error::() => Ok( + HttpResponse::BadRequest() + .append_header(("Content-type", "application/json")) + .body(json!({"code": "asset_already_exists"}).to_string()), + ), + Err(_) => { + Ok( + HttpResponse::BadRequest() + .append_header(("Content-type", "application/json")) + .body(json!({"code": "failed_to_create_asset"}).to_string()), + ) + }, + Ok(asset) => Ok( + HttpResponse::Ok() + .append_header(("Content-type", "application/json")) + .body( + json!({"asset": { "hash": hash, "post_id": post_id.to_string(), "file_type": ext, "file_size": size, "upload_date": asset.upload_date }}) + .to_string(), + ), + ), + } } #[get("/posts/{id}/assets")] -async fn get_assets_for_post() -> Result { +async fn get_assets_for_post( + post_id: web::Path, +) -> Result { + println!("{:?}", post_id); Ok(HttpResponse::NotImplemented().finish()) } #[delete("/posts/{id}/assets/{hash}")] -async fn delete_asset_for_post() -> Result { +async fn delete_asset_for_post( + params: web::Path>, +) -> Result { + println!("{:?}", params); Ok(HttpResponse::NotImplemented().finish()) } diff --git a/src/services/blog/auth.rs b/src/services/blog/auth.rs index 7c9ed4d..2350810 100644 --- a/src/services/blog/auth.rs +++ b/src/services/blog/auth.rs @@ -1,15 +1,21 @@ use crate::{ connectivity::prisma::blog_admin_users, - structs::blog::{BlogAdminIntSession, BlogAdminUser, BlogLoginRequest}, + structs::blog::{ + BlogAdminIntSession, BlogLoginRequest, BlogUserMutate, + BlogUserPasswordChange, + }, ServerState, }; -use argon2::{self}; +use argon2::{self, Config}; use rand::{distributions::Alphanumeric, Rng}; use actix_web::{ - delete, get, http::Error, patch, post, web, HttpMessage, HttpRequest, - HttpResponse, + delete, get, + http::Error, + patch, post, + web::{self, Json}, + HttpMessage, HttpRequest, HttpResponse, }; use redis::aio::ConnectionManager; use serde_json::json; @@ -82,7 +88,7 @@ async fn login( #[get("/me")] async fn get_user(req: HttpRequest) -> Result { let exts = req.extensions_mut(); - let user = exts.get::().unwrap(); + let user = exts.get::().unwrap(); Ok( HttpResponse::Ok() @@ -101,15 +107,112 @@ async fn get_user(req: HttpRequest) -> Result { } #[patch("/me")] -async fn update_user(_req: HttpRequest) -> Result { - Ok(HttpResponse::NotImplemented().finish()) +async fn update_user( + req: HttpRequest, + state: web::Data, + body: Option>, +) -> Result { + let exts = req.extensions_mut(); + let user = exts.get::().unwrap(); + let prisma = &state.prisma; + + let body: Json = + body.unwrap_or(actix_web::web::Json(BlogUserMutate { + username: None, + display_name: None, + })); + + let update_params: Vec = vec![ + body.username.clone().map(blog_admin_users::username::set), + body.display_name.clone().map(|value: std::string::String| { + blog_admin_users::display_name::set(Some(value)) + }), + ] + .into_iter() + .flatten() + .collect(); + + let user_record = prisma + .blog_admin_users() + .update( + blog_admin_users::id::equals(user.id.to_string()), + update_params, + ) + .exec() + .await + .unwrap(); + + Ok( + HttpResponse::Ok() + .append_header(("Content-type", "application/json")) + .body( + json!({ + "user": { + "id": user_record.id, + "username": user_record.username, + "display_name": user_record.display_name, + } + }) + .to_string(), + ), + ) } #[patch("/auth")] async fn change_password( - _req: HttpRequest, + req: HttpRequest, + state: web::Data, + body: web::Json, ) -> Result { - Ok(HttpResponse::NotImplemented().finish()) + let exts = req.extensions_mut(); + let user = exts.get::().unwrap(); + + let prisma = &state.prisma; + + if body.password == body.new_password { + return Ok( + HttpResponse::BadRequest() + .append_header(("Content-type", "application/json")) + .body(json!({"code": "old_and_new_passwords_match"}).to_string()), + ); + } + + let password = body.password.as_bytes(); + let valid = argon2::verify_encoded(&user.password, password).unwrap(); + + if !valid { + return Ok( + HttpResponse::Unauthorized() + .append_header(("Content-type", "application/json")) + .body(json!({"code": "current_password_invalid"}).to_string()), + ); + } + + let password_salt: String = rand::thread_rng() + .sample_iter(&Alphanumeric) + .take(48) + .map(char::from) + .collect(); + + let config = Config::default(); + let new_hash = argon2::hash_encoded( + body.new_password.as_bytes(), + password_salt.as_bytes(), + &config, + ) + .unwrap(); + + let _ = prisma + .blog_admin_users() + .update( + blog_admin_users::id::equals(user.id.to_string()), + vec![blog_admin_users::password::set(new_hash)], + ) + .exec() + .await + .unwrap(); + + Ok(HttpResponse::NoContent().finish()) } #[delete("/auth")] diff --git a/src/services/blog/posts.rs b/src/services/blog/posts.rs index cea3f08..e5df648 100644 --- a/src/services/blog/posts.rs +++ b/src/services/blog/posts.rs @@ -1,3 +1,5 @@ +use std::vec; + use actix_web::{ delete, get, http::Error, patch, post, web, HttpResponse, }; @@ -249,7 +251,10 @@ async fn delete_post( let _ = prisma .blog_posts() - .delete(blog_posts::id::equals(post.id)) + .update( + blog_posts::id::equals(post.id), + vec![blog_posts::visibility::set("deleted".to_string())], + ) .exec() .await; diff --git a/src/structs/blog.rs b/src/structs/blog.rs index 6d7bcd3..7fae66a 100644 --- a/src/structs/blog.rs +++ b/src/structs/blog.rs @@ -1,8 +1,23 @@ +use actix_multipart::form::{bytes::Bytes, MultipartForm}; use chrono::NaiveDateTime; use serde::{Deserialize, Serialize}; use serde_with::serde_as; extern crate serde_json; +#[serde_as] +#[allow(dead_code)] +#[derive(Serialize, Deserialize, Debug, Clone)] +pub struct BlogUserMutate { + pub username: Option, + pub display_name: Option, +} + +#[derive(Deserialize)] +pub struct BlogUserPasswordChange { + pub password: String, + pub new_password: String, +} + #[derive(Deserialize)] pub struct BlogLoginRequest { pub username: String, @@ -59,3 +74,9 @@ pub struct BlogPost { pub created_at: NaiveDateTime, pub published_at: Option, } + +#[derive(Debug, MultipartForm)] +pub struct BlogAssetUpload { + #[multipart(rename = "file")] + pub files: Vec, +} From 8dc3d44e5fd00d8378c0607d17598c0d87c1d228 Mon Sep 17 00:00:00 2001 From: Dustin Rouillard Date: Thu, 23 May 2024 20:08:38 -0600 Subject: [PATCH 10/13] Prefix all blog manage routes with /admin Make fetch posts route work Add admin fetech all posts route --- src/main.rs | 3 +- src/services/blog/posts.rs | 86 ++++++++++++++++++++++++++++++++++++-- src/structs/blog.rs | 6 +++ 3 files changed, 90 insertions(+), 5 deletions(-) diff --git a/src/main.rs b/src/main.rs index 9f62962..58d3e68 100644 --- a/src/main.rs +++ b/src/main.rs @@ -112,7 +112,7 @@ async fn main() -> Result<(), Box> { .service(services::blog::posts::get_post) .service(services::blog::posts::get_posts) .service( - web::scope("") + web::scope("/admin") .wrap(from_fn( services::blog::middleware::blog_admin_auth_mw, )) @@ -120,6 +120,7 @@ async fn main() -> Result<(), Box> { .service(services::blog::auth::get_user) .service(services::blog::auth::update_user) .service(services::blog::auth::change_password) + .service(services::blog::posts::get_all_posts) .service(services::blog::posts::create_post) .service(services::blog::posts::update_post) .service(services::blog::posts::delete_post) diff --git a/src/services/blog/posts.rs b/src/services/blog/posts.rs index e5df648..6ee2065 100644 --- a/src/services/blog/posts.rs +++ b/src/services/blog/posts.rs @@ -1,18 +1,96 @@ use std::vec; use actix_web::{ - delete, get, http::Error, patch, post, web, HttpResponse, + delete, get, + http::Error, + patch, post, + web::{self}, + HttpResponse, }; +use prisma_client_rust::Direction; use serde_json::json; use crate::{ - connectivity::prisma::blog_posts, structs::blog::BlogPostMutate, + connectivity::prisma::blog_posts, + structs::blog::{BlogPostMutate, BlogPostsQuery}, ServerState, }; #[get("/posts")] -async fn get_posts() -> Result { - Ok(HttpResponse::NotImplemented().finish()) +async fn get_posts( + query: Option>, + state: web::Data, +) -> Result { + let prisma = &mut &state.prisma; + + let query: web::Query = + query.unwrap_or(actix_web::web::Query(BlogPostsQuery { + limit: Some(25), + offset: Some(0), + })); + + let posts = prisma + .blog_posts() + .find_many(vec![blog_posts::visibility::equals("public".to_string())]) + .take(query.limit.unwrap_or(25)) + .skip(query.offset.unwrap_or(0)) + .order_by(blog_posts::published_at::order(Direction::Asc)) + .exec() + .await; + + let posts: Vec = posts + .unwrap() + .iter() + .map(|post| { + json!({ + "id": post.id, + "slug": post.slug, + "title": post.title, + "description": post.description, + "image": post.image, + "visibility": post.visibility, + "body": post.body, + "tags": post.tags, + "published_at": post.published_at, + }) + }) + .collect(); + + Ok( + HttpResponse::Ok() + .append_header(("Content-type", "application/json")) + .body(json!({"posts": posts}).to_string()), + ) +} + +#[get("/posts")] +async fn get_all_posts( + query: Option>, + state: web::Data, +) -> Result { + let prisma = &mut &state.prisma; + + let query: web::Query = + query.unwrap_or(actix_web::web::Query(BlogPostsQuery { + limit: Some(25), + offset: Some(0), + })); + + let posts = prisma + .blog_posts() + .find_many(vec![]) + .take(query.limit.unwrap_or(25)) + .skip(query.offset.unwrap_or(0)) + .order_by(blog_posts::created_at::order(Direction::Asc)) + .exec() + .await + .unwrap(); + + Ok( + HttpResponse::Ok() + .append_header(("Content-type", "application/json")) + .body(json!({"posts": posts}).to_string()), + ) } #[post("/posts")] diff --git a/src/structs/blog.rs b/src/structs/blog.rs index 7fae66a..7b28b3b 100644 --- a/src/structs/blog.rs +++ b/src/structs/blog.rs @@ -4,6 +4,12 @@ use serde::{Deserialize, Serialize}; use serde_with::serde_as; extern crate serde_json; +#[derive(Deserialize, Debug)] +pub struct BlogPostsQuery { + pub limit: Option, + pub offset: Option, +} + #[serde_as] #[allow(dead_code)] #[derive(Serialize, Deserialize, Debug, Clone)] From 2861d7f5ad7a620e430ab2dded7ac7f0e72264b3 Mon Sep 17 00:00:00 2001 From: Dustin Rouillard Date: Thu, 23 May 2024 21:24:30 -0600 Subject: [PATCH 11/13] Map the posts on admin response similar to pub response Impl get assets and delete assets route --- prisma/schema.prisma | 5 +- src/services/blog/assets.rs | 106 ++++++++++++++++++++++++++++++++++-- src/services/blog/posts.rs | 23 +++++++- 3 files changed, 124 insertions(+), 10 deletions(-) diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 410018d..c1a7829 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -1,6 +1,7 @@ generator client { - provider = "cargo prisma" - output = "../src/connectivity/prisma.rs" + provider = "cargo prisma" + output = "../src/connectivity/prisma.rs" + module_path = "crate::connectivity::prisma" } datasource db { diff --git a/src/services/blog/assets.rs b/src/services/blog/assets.rs index 4936c7f..053f8ca 100644 --- a/src/services/blog/assets.rs +++ b/src/services/blog/assets.rs @@ -1,6 +1,8 @@ use actix_multipart::form::MultipartForm; use actix_web::{delete, get, http::Error, post, web, HttpResponse}; -use prisma_client_rust::prisma_errors::query_engine::UniqueKeyViolation; +use prisma_client_rust::{ + prisma_errors::query_engine::UniqueKeyViolation, Direction, +}; use serde_json::json; use sha1::{Digest, Sha1}; @@ -90,15 +92,109 @@ async fn upload_asset_for_post( #[get("/posts/{id}/assets")] async fn get_assets_for_post( post_id: web::Path, + state: web::Data, ) -> Result { - println!("{:?}", post_id); - Ok(HttpResponse::NotImplemented().finish()) + let prisma = &mut &state.prisma; + + let assets: Vec = prisma + .blog_assets() + .find_many(vec![blog_assets::post_id::equals(post_id.to_string())]) + .order_by(blog_assets::upload_date::order(Direction::Asc)) + .exec() + .await + .unwrap(); + + let assets: Vec = assets + .iter() + .map(|post| { + json!({ + "hash": post.hash, + "post_id": post.post_id, + "file_type": post.file_type, + "file_size": post.file_size, + "upload_date": post.upload_date, + }) + }) + .collect(); + + Ok( + HttpResponse::Ok() + .append_header(("Content-type", "application/json")) + .body(json!({"assets": assets}).to_string()), + ) } #[delete("/posts/{id}/assets/{hash}")] async fn delete_asset_for_post( + state: web::Data, params: web::Path>, ) -> Result { - println!("{:?}", params); - Ok(HttpResponse::NotImplemented().finish()) + let post_id = params.first().unwrap(); + let hash = params.last().unwrap(); + + let prisma = &mut &state.prisma; + let s3 = &state.s3; + + let asset = prisma + .blog_assets() + .find_first(vec![ + blog_assets::hash::equals(hash.to_string()), + blog_assets::post_id::equals(post_id.to_string()), + ]) + .exec() + .await; + + match asset { + Ok(asset) => match asset { + Some(asset) => { + let file_type = asset.file_type; + + let res = s3 + .cdn_bucket + .delete_object(format!("blog/assets/{hash}.{file_type}")) + .await; + + if res.unwrap().status_code() != 204 { + return Ok( + HttpResponse::BadRequest() + .append_header(("Content-type", "application/json")) + .body( + json!({ + "code": "failed_to_delete_from_s3" + }) + .to_string(), + ), + ); + } + + let _ = prisma + .blog_assets() + .delete(blog_assets::hash::equals(hash.to_string())) + .exec() + .await; + + Ok(HttpResponse::NoContent().finish()) + } + None => Ok( + HttpResponse::NotFound() + .append_header(("Content-type", "application/json")) + .body( + json!({ + "code": "asset_not_found" + }) + .to_string(), + ), + ), + }, + Err(_) => Ok( + HttpResponse::BadRequest() + .append_header(("Content-type", "application/json")) + .body( + json!({ + "code": "error_with_asset_lookup" + }) + .to_string(), + ), + ), + } } diff --git a/src/services/blog/posts.rs b/src/services/blog/posts.rs index 6ee2065..0ecf0fb 100644 --- a/src/services/blog/posts.rs +++ b/src/services/blog/posts.rs @@ -83,8 +83,26 @@ async fn get_all_posts( .skip(query.offset.unwrap_or(0)) .order_by(blog_posts::created_at::order(Direction::Asc)) .exec() - .await - .unwrap(); + .await; + + let posts: Vec = posts + .unwrap() + .iter() + .map(|post| { + json!({ + "id": post.id, + "slug": post.slug, + "title": post.title, + "description": post.description, + "image": post.image, + "visibility": post.visibility, + "body": post.body, + "tags": post.tags, + "created_at": post.created_at, + "published_at": post.published_at, + }) + }) + .collect(); Ok( HttpResponse::Ok() @@ -192,7 +210,6 @@ async fn get_post( "visibility": post.visibility, "tags": post.tags, "body": post.body, - "created_at": post.created_at, "published_at": post.published_at, } }) From c07b1f8e3b480bf584f8d52146017e0760401f96 Mon Sep 17 00:00:00 2001 From: Dustin Rouillard Date: Thu, 23 May 2024 22:00:00 -0600 Subject: [PATCH 12/13] Service registration cleanup --- src/bin/prisma.rs | 2 +- src/main.rs | 40 +++------------------------------ src/services/base.rs | 10 +++++---- src/services/blog/factory.rs | 26 +++++++++++++++++++++ src/services/blog/mod.rs | 1 + src/services/spotify/factory.rs | 10 +++++++++ src/services/spotify/mod.rs | 1 + src/services/uploads/factory.rs | 18 +++++++++++++++ src/services/uploads/mod.rs | 1 + 9 files changed, 67 insertions(+), 42 deletions(-) create mode 100644 src/services/blog/factory.rs create mode 100644 src/services/spotify/factory.rs create mode 100644 src/services/uploads/factory.rs diff --git a/src/bin/prisma.rs b/src/bin/prisma.rs index f758015..b873b53 100644 --- a/src/bin/prisma.rs +++ b/src/bin/prisma.rs @@ -1,3 +1,3 @@ fn main() { - prisma_client_rust_cli::run(); + prisma_client_rust_cli::run(); } diff --git a/src/main.rs b/src/main.rs index 58d3e68..ad5062d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -8,7 +8,6 @@ use std::{error::Error, time::Duration}; use actix_multipart::form::MultipartFormConfig; use actix_web::{middleware, web, App, HttpServer}; -use actix_web_lab::middleware::from_fn; use connectivity::{ rabbit::RabbitManager, s3::S3Manager, valkey::ValkeyManager, }; @@ -93,42 +92,9 @@ async fn main() -> Result<(), Box> { .service( web::scope("/v2") .service(services::base::health) - .service( - web::scope("/uploads") - .wrap(from_fn( - services::uploads::middleware::uploads_auth_mw, - )) - .service(services::uploads::routes::upload_to_cdn), - ) - .service( - web::scope("/spotify") - .service(services::spotify::routes::current) - .service(services::spotify::routes::authorize) - .service(services::spotify::routes::setup), - ) - .service( - web::scope("/blog") - .service(services::blog::auth::login) - .service(services::blog::posts::get_post) - .service(services::blog::posts::get_posts) - .service( - web::scope("/admin") - .wrap(from_fn( - services::blog::middleware::blog_admin_auth_mw, - )) - .service(services::blog::auth::logout) - .service(services::blog::auth::get_user) - .service(services::blog::auth::update_user) - .service(services::blog::auth::change_password) - .service(services::blog::posts::get_all_posts) - .service(services::blog::posts::create_post) - .service(services::blog::posts::update_post) - .service(services::blog::posts::delete_post) - .service(services::blog::assets::get_assets_for_post) - .service(services::blog::assets::upload_asset_for_post) - .service(services::blog::assets::delete_asset_for_post), - ), - ), + .service(services::uploads::factory::uploads_factory()) + .service(services::spotify::factory::spotify_factory()) + .service(services::blog::factory::blog_factory()), ) }) .bind(((config.listen_host).to_owned(), config.listen_port))? diff --git a/src/services/base.rs b/src/services/base.rs index 8b62f1e..2a771e0 100644 --- a/src/services/base.rs +++ b/src/services/base.rs @@ -2,12 +2,14 @@ use actix_web::{get, http::Error, HttpResponse}; use serde_json::json; pub async fn index() -> Result { - Ok(HttpResponse::NotFound() - .append_header(("Content-type", "application/json")) - .body(json!({"code": "route_not_found"}).to_string())) + Ok( + HttpResponse::NotFound() + .append_header(("Content-type", "application/json")) + .body(json!({"code": "route_not_found"}).to_string()), + ) } #[get("/health")] async fn health() -> Result { - Ok(HttpResponse::NoContent().finish()) + Ok(HttpResponse::NoContent().finish()) } diff --git a/src/services/blog/factory.rs b/src/services/blog/factory.rs new file mode 100644 index 0000000..c824fb8 --- /dev/null +++ b/src/services/blog/factory.rs @@ -0,0 +1,26 @@ +use actix_web::{web, Scope}; +use actix_web_lab::middleware::from_fn; + +use crate::services; + +pub fn blog_factory() -> Scope { + web::scope("/blog") + .service(services::blog::auth::login) + .service(services::blog::posts::get_post) + .service(services::blog::posts::get_posts) + .service( + web::scope("/admin") + .wrap(from_fn(services::blog::middleware::blog_admin_auth_mw)) + .service(services::blog::auth::logout) + .service(services::blog::auth::get_user) + .service(services::blog::auth::update_user) + .service(services::blog::auth::change_password) + .service(services::blog::posts::get_all_posts) + .service(services::blog::posts::create_post) + .service(services::blog::posts::update_post) + .service(services::blog::posts::delete_post) + .service(services::blog::assets::get_assets_for_post) + .service(services::blog::assets::upload_asset_for_post) + .service(services::blog::assets::delete_asset_for_post), + ) +} diff --git a/src/services/blog/mod.rs b/src/services/blog/mod.rs index de8237a..2f8af4d 100644 --- a/src/services/blog/mod.rs +++ b/src/services/blog/mod.rs @@ -1,4 +1,5 @@ pub mod assets; pub mod auth; +pub mod factory; pub mod middleware; pub mod posts; diff --git a/src/services/spotify/factory.rs b/src/services/spotify/factory.rs new file mode 100644 index 0000000..f767580 --- /dev/null +++ b/src/services/spotify/factory.rs @@ -0,0 +1,10 @@ +use actix_web::{web, Scope}; + +use crate::services; + +pub fn spotify_factory() -> Scope { + web::scope("/spotify") + .service(services::spotify::routes::current) + .service(services::spotify::routes::authorize) + .service(services::spotify::routes::setup) +} diff --git a/src/services/spotify/mod.rs b/src/services/spotify/mod.rs index 58e6ac1..0d9f9ec 100644 --- a/src/services/spotify/mod.rs +++ b/src/services/spotify/mod.rs @@ -1,2 +1,3 @@ +pub mod factory; pub mod helpers; pub mod routes; diff --git a/src/services/uploads/factory.rs b/src/services/uploads/factory.rs new file mode 100644 index 0000000..fa6c5f8 --- /dev/null +++ b/src/services/uploads/factory.rs @@ -0,0 +1,18 @@ +use actix_web::{body::MessageBody, dev::ServiceFactory, web, Scope}; +use actix_web_lab::middleware::from_fn; + +use crate::services; + +pub fn uploads_factory() -> Scope< + impl ServiceFactory< + actix_web::dev::ServiceRequest, + Config = (), + Response = actix_web::dev::ServiceResponse, + Error = actix_web::Error, + InitError = (), + >, +> { + web::scope("/uploads") + .wrap(from_fn(services::uploads::middleware::uploads_auth_mw)) + .service(services::uploads::routes::upload_to_cdn) +} diff --git a/src/services/uploads/mod.rs b/src/services/uploads/mod.rs index ba41940..b5ffb04 100644 --- a/src/services/uploads/mod.rs +++ b/src/services/uploads/mod.rs @@ -1,3 +1,4 @@ +pub mod factory; pub mod helpers; pub mod middleware; pub mod routes; From 86d1ded612f1c1dcd7950f59e820e902cc78c5f0 Mon Sep 17 00:00:00 2001 From: Dustin Rouillard Date: Thu, 23 May 2024 22:08:36 -0600 Subject: [PATCH 13/13] Update readme used for --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1a7db4f..1d6650e 100644 --- a/README.md +++ b/README.md @@ -6,4 +6,4 @@ There is probably a lot of better ways to do many of the things I've done here, - Spotify History and Now Playing API / Queue Messages - File and Screenshot Uploads -- **WIP:** Blog System *(SOON)* \ No newline at end of file +- Blog System for Personal Site \ No newline at end of file