diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml
index 0f680cc..547e2e8 100644
--- a/.github/workflows/build_and_test.yml
+++ b/.github/workflows/build_and_test.yml
@@ -2,133 +2,133 @@ name: Build and Test
on:
push:
- branches: [ "main" ]
+ branches: ["main"]
pull_request:
- branches: [ "main", "dev" ]
+ branches: ["main", "dev"]
env:
CARGO_TERM_COLOR: always
jobs:
linux:
-
runs-on: ubuntu-latest
timeout-minutes: 30
-
steps:
- - uses: actions/checkout@v4
- - name: Clone spacebar server
- run: |
- git clone https://github.com/bitfl0wer/server.git
- - uses: actions/setup-node@v4
- with:
+ - uses: actions/checkout@v4
+ - name: Clone spacebar server
+ run: |
+ git clone https://github.com/bitfl0wer/server.git
+ - uses: actions/setup-node@v4
+ with:
node-version: 18
- cache: 'npm'
+ cache: "npm"
cache-dependency-path: server/package-lock.json
- - name: Prepare and start Spacebar server
- run: |
- npm install
- npm run setup
- npm run start &
- working-directory: ./server
- - uses: Swatinem/rust-cache@v2
- with:
- cache-all-crates: "true"
- prefix-key: "linux"
- - name: Build, Test and Publish Coverage
- run: |
- if [ -n "${{ secrets.COVERALLS_REPO_TOKEN }}" ]; then
- curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
- cargo binstall --no-confirm cargo-tarpaulin --force
- cargo tarpaulin --all-features --avoid-cfg-tarpaulin --tests --verbose --skip-clean --coveralls ${{ secrets.COVERALLS_REPO_TOKEN }} --timeout 120
- else
- echo "Code Coverage step is skipped on forks!"
- cargo build --verbose --all-features
- cargo test --verbose --all-features
- fi
- # wasm-safari:
- # runs-on: macos-latest
- # steps:
- # - uses: actions/checkout@v4
- # - name: Clone spacebar server
- # run: |
- # git clone https://github.com/bitfl0wer/server.git
- # - uses: actions/setup-node@v4
- # with:
- # node-version: 18
- # cache: 'npm'
- # cache-dependency-path: server/package-lock.json
- # - name: Prepare and start Spacebar server
- # run: |
- # npm install
- # npm run setup
- # npm run start &
- # working-directory: ./server
- # - uses: Swatinem/rust-cache@v2
- # with:
- # cache-all-crates: "true"
- # prefix-key: "macos-safari"
- # - name: Run WASM tests with Safari, Firefox, Chrome
- # run: |
- # rustup target add wasm32-unknown-unknown
- # curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
- # cargo binstall --no-confirm wasm-bindgen-cli --version "0.2.88" --force
- # SAFARIDRIVER=$(which safaridriver) cargo test --target wasm32-unknown-unknown --no-default-features --features="client, rt" --no-fail-fast
+ - name: Prepare and start Spacebar server
+ run: |
+ npm install
+ npm run setup
+ npm run start &
+ working-directory: ./server
+ - uses: Swatinem/rust-cache@v2
+ with:
+ cache-all-crates: "true"
+ prefix-key: "linux"
+ - uses: taiki-e/install-action@nextest
+ - name: Build, Test with nextest, Publish Coverage
+ run: |
+ if [ -n "${{ secrets.COVERALLS_REPO_TOKEN }}" ]; then
+ if [ "${{github.event.pull_request.head.ref}}" = "main" ]; then
+ curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
+ cargo binstall --no-confirm cargo-tarpaulin --force
+ cargo tarpaulin --all-features --avoid-cfg-tarpaulin --tests --verbose --skip-clean --coveralls ${{ secrets.COVERALLS_REPO_TOKEN }} --timeout 120
+ else
+ echo "Code Coverage step is skipped on non-main PRs and PRs from forks."
+ cargo nextest run --verbose --all-features
+ fi
+ else
+ echo "Code Coverage step is skipped on non-main PRs and PRs from forks."
+ cargo nextest run --verbose --all-features
+ fi
+ linux-non-default-features:
+ runs-on: ubuntu-latest
+ timeout-minutes: 10
+ steps:
+ - uses: actions/checkout@v4
+ - name: Check common non-default feature configurations
+ run: |
+ echo "No features:"
+ cargo check --features="" --no-default-features
+ echo "Only client:"
+ cargo check --features="client" --no-default-features
+ echo "Only backend:"
+ cargo check --features="backend" --no-default-features
+ echo "Only voice:"
+ cargo check --features="voice" --no-default-features
+ echo "Only voice gateway:"
+ cargo check --features="voice_gateway" --no-default-features
+ echo "Backend + client:"
+ cargo check --features="backend, client" --no-default-features
+ echo "Backend + voice:"
+ cargo check --features="backend, voice" --no-default-features
+ echo "Backend + voice gateway:"
+ cargo check --features="backend, voice_gateway" --no-default-features
+ echo "Client + voice gateway:"
+ cargo check --features="client, voice_gateway" --no-default-features
wasm-gecko:
- runs-on: macos-latest
+ runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- - uses: actions/checkout@v4
- - name: Clone spacebar server
- run: |
- git clone https://github.com/bitfl0wer/server.git
- - uses: actions/setup-node@v4
- with:
+ - uses: actions/checkout@v4
+ - name: Clone spacebar server
+ run: |
+ git clone https://github.com/bitfl0wer/server.git
+ - uses: actions/setup-node@v4
+ with:
node-version: 18
- cache: 'npm'
+ cache: "npm"
cache-dependency-path: server/package-lock.json
- - name: Prepare and start Spacebar server
- run: |
- npm install
- npm run setup
- npm run start &
- working-directory: ./server
- - uses: Swatinem/rust-cache@v2
- with:
- cache-all-crates: "true"
- prefix-key: "macos"
- - name: Run WASM tests with Safari, Firefox, Chrome
- run: |
- rustup target add wasm32-unknown-unknown
- curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
- cargo binstall --no-confirm wasm-bindgen-cli --version "0.2.88" --force
- GECKODRIVER=$(which geckodriver) cargo test --target wasm32-unknown-unknown --no-default-features --features="client, rt, voice_gateway"
+ - name: Prepare and start Spacebar server
+ run: |
+ npm install
+ npm run setup
+ npm run start &
+ working-directory: ./server
+ - uses: Swatinem/rust-cache@v2
+ with:
+ cache-all-crates: "true"
+ prefix-key: "macos"
+ - name: Run WASM tests with Safari, Firefox, Chrome
+ run: |
+ rustup target add wasm32-unknown-unknown
+ curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
+ cargo binstall --no-confirm wasm-bindgen-cli --version "0.2.93" --force
+ GECKODRIVER=$(which geckodriver) cargo test --target wasm32-unknown-unknown --no-default-features --features="client, rt, voice_gateway"
wasm-chrome:
- runs-on: macos-latest
+ runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- - uses: actions/checkout@v4
- - name: Clone spacebar server
- run: |
- git clone https://github.com/bitfl0wer/server.git
- - uses: actions/setup-node@v4
- with:
+ - uses: actions/checkout@v4
+ - name: Clone spacebar server
+ run: |
+ git clone https://github.com/bitfl0wer/server.git
+ - uses: actions/setup-node@v4
+ with:
node-version: 18
- cache: 'npm'
+ cache: "npm"
cache-dependency-path: server/package-lock.json
- - name: Prepare and start Spacebar server
- run: |
- npm install
- npm run setup
- npm run start &
- working-directory: ./server
- - uses: Swatinem/rust-cache@v2
- with:
- cache-all-crates: "true"
- prefix-key: "macos"
- - name: Run WASM tests with Safari, Firefox, Chrome
- run: |
- rustup target add wasm32-unknown-unknown
- curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
- cargo binstall --no-confirm wasm-bindgen-cli --version "0.2.88" --force
- CHROMEDRIVER=$(which chromedriver) cargo test --target wasm32-unknown-unknown --no-default-features --features="client, rt, voice_gateway"
+ - name: Prepare and start Spacebar server
+ run: |
+ npm install
+ npm run setup
+ npm run start &
+ working-directory: ./server
+ - uses: Swatinem/rust-cache@v2
+ with:
+ cache-all-crates: "true"
+ prefix-key: "macos"
+ - name: Run WASM tests with Safari, Firefox, Chrome
+ run: |
+ rustup target add wasm32-unknown-unknown
+ curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
+ cargo binstall --no-confirm wasm-bindgen-cli --version "0.2.93" --force
+ CHROMEDRIVER=$(which chromedriver) cargo test --target wasm32-unknown-unknown --no-default-features --features="client, rt, voice_gateway"
diff --git a/.github/workflows/cargo-doc.yml b/.github/workflows/cargo-doc.yml
new file mode 100644
index 0000000..017dbe2
--- /dev/null
+++ b/.github/workflows/cargo-doc.yml
@@ -0,0 +1,35 @@
+name: cargo doc lints
+
+on:
+ push:
+ branches: [ "main", "preserve/*" ]
+ pull_request:
+ branches: [ "main", "dev" ]
+
+jobs:
+ cargo-doc-lints:
+ name: Run cargo doc for doc lints
+ runs-on: ubuntu-latest
+ permissions:
+ contents: read
+ security-events: write
+ actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v4
+
+ - name: Install Rust toolchain
+ uses: dtolnay/rust-toolchain@stable
+
+ - name: Install aditional components for sarif
+ run: cargo install clippy-sarif sarif-fmt
+
+ - name: Run cargo doc
+ run: cargo doc --no-deps --all-features --locked --message-format=json | clippy-sarif | sed 's/rust-lang.github.io\/rust-clippy/doc.rust-lang.org\/rustdoc\/lints.html/g' | sed 's/clippy/rustdoc/g' | tee cargo-doc-results.sarif | sarif-fmt
+ continue-on-error: true
+
+ - name: Upload analysis results to GitHub
+ uses: github/codeql-action/upload-sarif@v3
+ with:
+ sarif_file: cargo-doc-results.sarif
+ wait-for-processing: true
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 34a1153..84e7021 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -3,8 +3,10 @@
**Please refer to the [contribution guidelines](https://github.com/polyphony-chat/.github/blob/main/CONTRIBUTION_GUIDELINES.md) and [our Code of Conduct](https://github.com/polyphony-chat/.github/blob/main/CODE_OF_CONDUCT.md) before making a contribution.**
+Contributions should always fork from and merge back into the `dev` branch.
+
Chorus is currently missing voice support and a lot of API endpoints, many of which should be trivial to implement,
ever since [we streamlined the process of doing so](https://github.com/polyphony-chat/chorus/discussions/401).
If you'd like to contribute new functionality, check out [The 'Meta'-issues.](https://github.com/polyphony-chat/chorus/issues?q=is%3Aissue+label%3A%22Type%3A+Meta%22+) They contain a comprehensive list of all features which are yet missing for full Discord.com compatibility.
-Please feel free to open an Issue with the idea you have, or a Pull Request.
\ No newline at end of file
+Please feel free to open an Issue with the idea you have, or a Pull Request.
diff --git a/Cargo.lock b/Cargo.lock
index 456ae43..e2fb0d2 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -4,9 +4,9 @@ version = 3
[[package]]
name = "addr2line"
-version = "0.21.0"
+version = "0.22.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb"
+checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678"
dependencies = [
"gimli",
]
@@ -17,6 +17,12 @@ version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
+[[package]]
+name = "adler2"
+version = "2.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627"
+
[[package]]
name = "aead"
version = "0.5.2"
@@ -29,12 +35,11 @@ dependencies = [
[[package]]
name = "ahash"
-version = "0.8.7"
+version = "0.8.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "77c3a9648d43b9cd48db467b3f87fdd6e146bcc88ab0180006cef2179fe11d01"
+checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011"
dependencies = [
"cfg-if",
- "getrandom",
"once_cell",
"version_check",
"zerocopy",
@@ -42,18 +47,18 @@ dependencies = [
[[package]]
name = "aho-corasick"
-version = "1.1.2"
+version = "1.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0"
+checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916"
dependencies = [
"memchr",
]
[[package]]
name = "allocator-api2"
-version = "0.2.16"
+version = "0.2.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5"
+checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f"
[[package]]
name = "android-tzdata"
@@ -72,13 +77,13 @@ dependencies = [
[[package]]
name = "async-trait"
-version = "0.1.77"
+version = "0.1.81"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9"
+checksum = "6e0c28dcc82d7c8ead5cb13beb15405b57b8546e93215673ff8ca0349a028107"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.48",
+ "syn 2.0.76",
]
[[package]]
@@ -102,32 +107,28 @@ dependencies = [
]
[[package]]
-name = "atomic-write-file"
-version = "0.1.2"
+name = "atomic-waker"
+version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "edcdbedc2236483ab103a53415653d6b4442ea6141baf1ffa85df29635e88436"
-dependencies = [
- "nix",
- "rand",
-]
+checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
[[package]]
name = "autocfg"
-version = "1.1.0"
+version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
+checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0"
[[package]]
name = "backtrace"
-version = "0.3.69"
+version = "0.3.73"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837"
+checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a"
dependencies = [
"addr2line",
"cc",
"cfg-if",
"libc",
- "miniz_oxide",
+ "miniz_oxide 0.7.4",
"object",
"rustc-demangle",
]
@@ -144,12 +145,32 @@ 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 = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b"
+[[package]]
+name = "bigdecimal"
+version = "0.4.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "51d712318a27c7150326677b321a5fa91b55f6d9034ffd67f20319e147d40cee"
+dependencies = [
+ "autocfg",
+ "libm",
+ "num-bigint",
+ "num-integer",
+ "num-traits",
+ "serde",
+]
+
[[package]]
name = "bitflags"
version = "1.3.2"
@@ -158,9 +179,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "bitflags"
-version = "2.4.1"
+version = "2.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07"
+checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de"
dependencies = [
"serde",
]
@@ -176,9 +197,9 @@ dependencies = [
[[package]]
name = "bumpalo"
-version = "3.14.0"
+version = "3.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec"
+checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c"
[[package]]
name = "byteorder"
@@ -188,17 +209,17 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
[[package]]
name = "bytes"
-version = "1.5.0"
+version = "1.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223"
+checksum = "8318a53db07bb3f8dca91a600466bdb3f2eaadeedfdbcf02e1accbad9271ba50"
[[package]]
name = "cc"
-version = "1.0.83"
+version = "1.1.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0"
+checksum = "50d2eb3cd3d1bf4529e31c215ee6f93ec5a3d536d9f578f93d9d33ee19562932"
dependencies = [
- "libc",
+ "shlex",
]
[[package]]
@@ -207,38 +228,46 @@ version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
+[[package]]
+name = "cfg_aliases"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724"
+
[[package]]
name = "chorus"
version = "0.15.0"
dependencies = [
"async-trait",
"base64 0.21.7",
- "bitflags 2.4.1",
+ "bitflags 2.6.0",
"chorus-macros",
"chrono",
"crypto_secretbox",
"custom_error",
"discortp",
+ "flate2",
"futures-util",
"getrandom",
"hostname",
- "http",
+ "http 0.2.12",
"jsonwebtoken",
"lazy_static",
"log",
- "native-tls",
"poem",
+ "pubserve",
"rand",
"regex",
"reqwest",
- "rustls",
- "rustls-native-certs",
+ "rustls 0.21.12",
"serde",
"serde-aux",
"serde_json",
"serde_repr",
"serde_with",
+ "simple_logger",
"sqlx",
+ "sqlx-pg-uint",
"thiserror",
"tokio",
"tokio-tungstenite",
@@ -247,25 +276,24 @@ dependencies = [
"wasm-bindgen-futures",
"wasm-bindgen-test",
"wasmtimer",
+ "webpki-roots 0.26.3",
"ws_stream_wasm",
]
[[package]]
name = "chorus-macros"
-version = "0.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a81545a60b926f815517dadbbd40cd502294ae2baea25fa8194d854d607512b0"
+version = "0.5.0"
dependencies = [
"async-trait",
"quote",
- "syn 2.0.48",
+ "syn 2.0.76",
]
[[package]]
name = "chrono"
-version = "0.4.31"
+version = "0.4.38"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38"
+checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401"
dependencies = [
"android-tzdata",
"iana-time-zone",
@@ -273,7 +301,7 @@ dependencies = [
"num-traits",
"serde",
"wasm-bindgen",
- "windows-targets 0.48.5",
+ "windows-targets 0.52.6",
]
[[package]]
@@ -287,6 +315,15 @@ dependencies = [
"zeroize",
]
+[[package]]
+name = "concurrent-queue"
+version = "2.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973"
+dependencies = [
+ "crossbeam-utils",
+]
+
[[package]]
name = "console_error_panic_hook"
version = "0.1.7"
@@ -315,24 +352,24 @@ dependencies = [
[[package]]
name = "core-foundation-sys"
-version = "0.8.6"
+version = "0.8.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f"
+checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b"
[[package]]
name = "cpufeatures"
-version = "0.2.12"
+version = "0.2.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504"
+checksum = "51e852e6dc9a5bed1fae92dd2375037bf2b768725bf3be87811edee3249d09ad"
dependencies = [
"libc",
]
[[package]]
name = "crc"
-version = "3.0.1"
+version = "3.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "86ec7a15cbe22e59248fc7eadb1907dab5ba09372595da4d73dd805ed4417dfe"
+checksum = "69e6e4d7b33a94f0991c26729976b10ebde1d34c3ee82408fb536164fa10d636"
dependencies = [
"crc-catalog",
]
@@ -343,6 +380,15 @@ version = "2.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5"
+[[package]]
+name = "crc32fast"
+version = "1.4.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3"
+dependencies = [
+ "cfg-if",
+]
+
[[package]]
name = "crossbeam-queue"
version = "0.3.11"
@@ -354,9 +400,9 @@ dependencies = [
[[package]]
name = "crossbeam-utils"
-version = "0.8.19"
+version = "0.8.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345"
+checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80"
[[package]]
name = "crypto-common"
@@ -392,9 +438,9 @@ checksum = "4f8a51dd197fa6ba5b4dc98a990a43cc13693c23eb0089ebb0fcc1f04152bca6"
[[package]]
name = "darling"
-version = "0.20.3"
+version = "0.20.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0209d94da627ab5605dcccf08bb18afa5009cfbef48d8a8b7d7bdbc79be25c5e"
+checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989"
dependencies = [
"darling_core",
"darling_macro",
@@ -402,40 +448,40 @@ dependencies = [
[[package]]
name = "darling_core"
-version = "0.20.3"
+version = "0.20.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "177e3443818124b357d8e76f53be906d60937f0d3a90773a664fa63fa253e621"
+checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5"
dependencies = [
"fnv",
"ident_case",
"proc-macro2",
"quote",
"strsim",
- "syn 2.0.48",
+ "syn 2.0.76",
]
[[package]]
name = "darling_macro"
-version = "0.20.3"
+version = "0.20.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5"
+checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806"
dependencies = [
"darling_core",
"quote",
- "syn 2.0.48",
+ "syn 2.0.76",
]
[[package]]
name = "data-encoding"
-version = "2.5.0"
+version = "2.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7e962a19be5cfc3f3bf6dd8f61eb50107f356ad6270fbb3ed41476571db78be5"
+checksum = "e8566979429cf69b49a5c740c60791108e86440e8be149bbea4fe54d2c32d6e2"
[[package]]
name = "der"
-version = "0.7.8"
+version = "0.7.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fffa369a668c8af7dbf8b5e56c9f744fbd399949ed171606040001947de40b1c"
+checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0"
dependencies = [
"const-oid",
"pem-rfc7468",
@@ -482,18 +528,18 @@ checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b"
[[package]]
name = "either"
-version = "1.9.0"
+version = "1.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07"
+checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0"
dependencies = [
"serde",
]
[[package]]
name = "encoding_rs"
-version = "0.8.33"
+version = "0.8.34"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1"
+checksum = "b45de904aa0b010bce2ab45264d0631681847fa7b6f2eaa7dab7619943bc4f59"
dependencies = [
"cfg-if",
]
@@ -506,9 +552,9 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
[[package]]
name = "errno"
-version = "0.3.8"
+version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245"
+checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba"
dependencies = [
"libc",
"windows-sys 0.52.0",
@@ -527,21 +573,30 @@ dependencies = [
[[package]]
name = "event-listener"
-version = "2.5.3"
+version = "5.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0"
+checksum = "6032be9bd27023a771701cc49f9f053c751055f71efb2e0ae5c15809093675ba"
+dependencies = [
+ "concurrent-queue",
+ "parking",
+ "pin-project-lite",
+]
[[package]]
name = "fastrand"
-version = "2.0.1"
+version = "2.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5"
+checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6"
[[package]]
-name = "finl_unicode"
-version = "1.2.0"
+name = "flate2"
+version = "1.0.33"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8fcfdc7a0362c9f4444381a9e697c79d435fe65b52a37466fc2c1184cee9edc6"
+checksum = "324a1be68054ef05ad64b861cc9eaf1d623d2d8cb25b4bf2cb9cdd902b4bf253"
+dependencies = [
+ "crc32fast",
+ "miniz_oxide 0.8.0",
+]
[[package]]
name = "flume"
@@ -560,21 +615,6 @@ version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
-[[package]]
-name = "foreign-types"
-version = "0.3.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1"
-dependencies = [
- "foreign-types-shared",
-]
-
-[[package]]
-name = "foreign-types-shared"
-version = "0.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b"
-
[[package]]
name = "form_urlencoded"
version = "1.2.1"
@@ -651,7 +691,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.48",
+ "syn 2.0.76",
]
[[package]]
@@ -697,9 +737,9 @@ dependencies = [
[[package]]
name = "getrandom"
-version = "0.2.12"
+version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5"
+checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7"
dependencies = [
"cfg-if",
"js-sys",
@@ -710,23 +750,42 @@ dependencies = [
[[package]]
name = "gimli"
-version = "0.28.1"
+version = "0.29.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253"
+checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd"
[[package]]
name = "h2"
-version = "0.3.24"
+version = "0.3.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bb2c4422095b67ee78da96fbb51a4cc413b3b25883c7717ff7ca1ab31022c9c9"
+checksum = "81fe527a889e1532da5c525686d96d4c2e74cdd345badf8dfef9f6b39dd5f5e8"
dependencies = [
"bytes",
"fnv",
"futures-core",
"futures-sink",
"futures-util",
- "http",
- "indexmap 2.1.0",
+ "http 0.2.12",
+ "indexmap 2.4.0",
+ "slab",
+ "tokio",
+ "tokio-util",
+ "tracing",
+]
+
+[[package]]
+name = "h2"
+version = "0.4.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "524e8ac6999421f49a846c2d4411f337e53497d8ec55d67753beffa43c5d9205"
+dependencies = [
+ "atomic-waker",
+ "bytes",
+ "fnv",
+ "futures-core",
+ "futures-sink",
+ "http 1.1.0",
+ "indexmap 2.4.0",
"slab",
"tokio",
"tokio-util",
@@ -741,9 +800,9 @@ checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
[[package]]
name = "hashbrown"
-version = "0.14.3"
+version = "0.14.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604"
+checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1"
dependencies = [
"ahash",
"allocator-api2",
@@ -751,23 +810,23 @@ dependencies = [
[[package]]
name = "hashlink"
-version = "0.8.4"
+version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e8094feaf31ff591f651a2664fb9cfd92bba7a60ce3197265e9482ebe753c8f7"
+checksum = "6ba4ff7128dee98c7dc9794b6a411377e1404dba1c97deb8d1a55297bd25d8af"
dependencies = [
- "hashbrown 0.14.3",
+ "hashbrown 0.14.5",
]
[[package]]
name = "headers"
-version = "0.3.9"
+version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "06683b93020a07e3dbcf5f8c0f6d40080d725bea7936fc01ad345c01b97dc270"
+checksum = "322106e6bd0cba2d5ead589ddb8150a13d7c4217cf80d7c4f682ca994ccc6aa9"
dependencies = [
"base64 0.21.7",
"bytes",
"headers-core",
- "http",
+ "http 1.1.0",
"httpdate",
"mime",
"sha1",
@@ -775,27 +834,24 @@ dependencies = [
[[package]]
name = "headers-core"
-version = "0.2.0"
+version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e7f66481bfee273957b1f20485a4ff3362987f85b2c236580d81b4eb7a326429"
+checksum = "54b4a22553d4242c49fddb9ba998a99962b5cc6f22cb5a3482bec22522403ce4"
dependencies = [
- "http",
+ "http 1.1.0",
]
[[package]]
name = "heck"
-version = "0.4.1"
+version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
-dependencies = [
- "unicode-segmentation",
-]
+checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
[[package]]
name = "hermit-abi"
-version = "0.3.3"
+version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7"
+checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024"
[[package]]
name = "hex"
@@ -843,9 +899,20 @@ dependencies = [
[[package]]
name = "http"
-version = "0.2.11"
+version = "0.2.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8947b1a6fad4393052c7ba1f4cd97bed3e953a95c79c92ad9b051a04611d9fbb"
+checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1"
+dependencies = [
+ "bytes",
+ "fnv",
+ "itoa",
+]
+
+[[package]]
+name = "http"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258"
dependencies = [
"bytes",
"fnv",
@@ -859,15 +926,38 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2"
dependencies = [
"bytes",
- "http",
+ "http 0.2.12",
+ "pin-project-lite",
+]
+
+[[package]]
+name = "http-body"
+version = "1.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184"
+dependencies = [
+ "bytes",
+ "http 1.1.0",
+]
+
+[[package]]
+name = "http-body-util"
+version = "0.1.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f"
+dependencies = [
+ "bytes",
+ "futures-util",
+ "http 1.1.0",
+ "http-body 1.0.1",
"pin-project-lite",
]
[[package]]
name = "httparse"
-version = "1.8.0"
+version = "1.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904"
+checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9"
[[package]]
name = "httpdate"
@@ -877,17 +967,17 @@ checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9"
[[package]]
name = "hyper"
-version = "0.14.28"
+version = "0.14.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80"
+checksum = "a152ddd61dfaec7273fe8419ab357f33aee0d914c5f4efbf0d96fa749eea5ec9"
dependencies = [
"bytes",
"futures-channel",
"futures-core",
"futures-util",
- "h2",
- "http",
- "http-body",
+ "h2 0.3.26",
+ "http 0.2.12",
+ "http-body 0.4.6",
"httparse",
"httpdate",
"itoa",
@@ -900,23 +990,59 @@ dependencies = [
]
[[package]]
-name = "hyper-tls"
-version = "0.5.0"
+name = "hyper"
+version = "1.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905"
+checksum = "50dfd22e0e76d0f662d429a5f80fcaf3855009297eab6a0a9f8543834744ba05"
dependencies = [
"bytes",
- "hyper",
- "native-tls",
+ "futures-channel",
+ "futures-util",
+ "h2 0.4.6",
+ "http 1.1.0",
+ "http-body 1.0.1",
+ "httparse",
+ "httpdate",
+ "itoa",
+ "pin-project-lite",
+ "smallvec",
+ "tokio",
+]
+
+[[package]]
+name = "hyper-rustls"
+version = "0.24.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590"
+dependencies = [
+ "futures-util",
+ "http 0.2.12",
+ "hyper 0.14.30",
+ "rustls 0.21.12",
+ "tokio",
+ "tokio-rustls",
+]
+
+[[package]]
+name = "hyper-util"
+version = "0.1.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cde7055719c54e36e95e8719f95883f22072a48ede39db7fc17a4e1d5281e9b9"
+dependencies = [
+ "bytes",
+ "futures-util",
+ "http 1.1.0",
+ "http-body 1.0.1",
+ "hyper 1.4.1",
+ "pin-project-lite",
"tokio",
- "tokio-native-tls",
]
[[package]]
name = "iana-time-zone"
-version = "0.1.59"
+version = "0.1.60"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b6a67363e2aa4443928ce15e57ebae94fd8949958fd1223c4cfc0cd473ad7539"
+checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141"
dependencies = [
"android_system_properties",
"core-foundation-sys",
@@ -964,12 +1090,12 @@ dependencies = [
[[package]]
name = "indexmap"
-version = "2.1.0"
+version = "2.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f"
+checksum = "93ead53efc7ea8ed3cfb0c79fc8023fbb782a5432b52830b6518941cebe6505c"
dependencies = [
"equivalent",
- "hashbrown 0.14.3",
+ "hashbrown 0.14.5",
"serde",
]
@@ -997,26 +1123,17 @@ dependencies = [
"serde",
]
-[[package]]
-name = "itertools"
-version = "0.12.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "25db6b064527c5d482d0423354fcd07a89a2dfe07b67892e62411946db7f07b0"
-dependencies = [
- "either",
-]
-
[[package]]
name = "itoa"
-version = "1.0.10"
+version = "1.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c"
+checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b"
[[package]]
name = "js-sys"
-version = "0.3.66"
+version = "0.3.70"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cee9c64da59eae3b50095c18d3e74f8b73c0b86d2792824ff01bbce68ba229ca"
+checksum = "1868808506b929d7b0cfa8f75951347aa71bb21144b7791bae35d9bccfcfe37a"
dependencies = [
"wasm-bindgen",
]
@@ -1037,18 +1154,18 @@ dependencies = [
[[package]]
name = "lazy_static"
-version = "1.4.0"
+version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
+checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
dependencies = [
- "spin 0.5.2",
+ "spin 0.9.8",
]
[[package]]
name = "libc"
-version = "0.2.152"
+version = "0.2.158"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "13e3bf6590cbc649f4d1a3eefc9d5d6eb746f5200ffb04e5e142700b8faa56e7"
+checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439"
[[package]]
name = "libm"
@@ -1058,9 +1175,9 @@ checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058"
[[package]]
name = "libsqlite3-sys"
-version = "0.27.0"
+version = "0.30.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cf4e226dcd58b4be396f7bd3c20da8fdee2911400705297ba7d2d7cc2c30f716"
+checksum = "2e99fb7a497b1e3339bc746195567ed8d3e24945ecd636e3619d20b9de9e9149"
dependencies = [
"cc",
"pkg-config",
@@ -1069,15 +1186,15 @@ dependencies = [
[[package]]
name = "linux-raw-sys"
-version = "0.4.12"
+version = "0.4.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456"
+checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89"
[[package]]
name = "lock_api"
-version = "0.4.11"
+version = "0.4.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45"
+checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17"
dependencies = [
"autocfg",
"scopeguard",
@@ -1085,9 +1202,9 @@ dependencies = [
[[package]]
name = "log"
-version = "0.4.20"
+version = "0.4.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f"
+checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24"
[[package]]
name = "match_cfg"
@@ -1107,9 +1224,9 @@ dependencies = [
[[package]]
name = "memchr"
-version = "2.7.1"
+version = "2.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149"
+checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
[[package]]
name = "mime"
@@ -1119,14 +1236,24 @@ checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a"
[[package]]
name = "mime_guess"
-version = "2.0.4"
+version = "2.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4192263c238a5f0d0c6bfd21f336a313a4ce1c450542449ca191bb657b4642ef"
+checksum = "f7c44f8e672c00fe5308fa235f821cb4198414e1c77935c1ab6948d3fd78550e"
dependencies = [
"mime",
"unicase",
]
+[[package]]
+name = "minicov"
+version = "0.3.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5c71e683cd655513b99affab7d317deb690528255a0d5f717f1024093c12b169"
+dependencies = [
+ "cc",
+ "walkdir",
+]
+
[[package]]
name = "minimal-lexical"
version = "0.2.1"
@@ -1135,50 +1262,61 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
[[package]]
name = "miniz_oxide"
-version = "0.7.1"
+version = "0.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7"
+checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08"
dependencies = [
"adler",
]
[[package]]
-name = "mio"
-version = "0.8.11"
+name = "miniz_oxide"
+version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c"
+checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1"
dependencies = [
- "libc",
- "wasi",
- "windows-sys 0.48.0",
+ "adler2",
]
[[package]]
-name = "native-tls"
-version = "0.2.11"
+name = "mio"
+version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e"
+checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec"
dependencies = [
- "lazy_static",
+ "hermit-abi",
"libc",
- "log",
- "openssl",
- "openssl-probe",
- "openssl-sys",
- "schannel",
- "security-framework",
- "security-framework-sys",
- "tempfile",
+ "wasi",
+ "windows-sys 0.52.0",
+]
+
+[[package]]
+name = "multer"
+version = "3.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "83e87776546dc87511aa5ee218730c92b666d7264ab6ed41f9d215af9cd5224b"
+dependencies = [
+ "bytes",
+ "encoding_rs",
+ "futures-util",
+ "http 1.1.0",
+ "httparse",
+ "memchr",
+ "mime",
+ "spin 0.9.8",
+ "tokio",
+ "version_check",
]
[[package]]
name = "nix"
-version = "0.27.1"
+version = "0.29.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2eb04e9c688eff1c89d72b407f168cf79bb9e867a9d3323ed6c01519eb9cc053"
+checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46"
dependencies = [
- "bitflags 2.4.1",
+ "bitflags 2.6.0",
"cfg-if",
+ "cfg_aliases",
"libc",
]
@@ -1200,11 +1338,10 @@ dependencies = [
[[package]]
name = "num-bigint"
-version = "0.4.4"
+version = "0.4.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0"
+checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9"
dependencies = [
- "autocfg",
"num-integer",
"num-traits",
]
@@ -1227,20 +1364,25 @@ dependencies = [
]
[[package]]
-name = "num-integer"
-version = "0.1.45"
+name = "num-conv"
+version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9"
+checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9"
+
+[[package]]
+name = "num-integer"
+version = "0.1.46"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f"
dependencies = [
- "autocfg",
"num-traits",
]
[[package]]
name = "num-iter"
-version = "0.1.43"
+version = "0.1.45"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252"
+checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf"
dependencies = [
"autocfg",
"num-integer",
@@ -1249,29 +1391,19 @@ dependencies = [
[[package]]
name = "num-traits"
-version = "0.2.17"
+version = "0.2.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c"
+checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
dependencies = [
"autocfg",
"libm",
]
-[[package]]
-name = "num_cpus"
-version = "1.16.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43"
-dependencies = [
- "hermit-abi",
- "libc",
-]
-
[[package]]
name = "object"
-version = "0.32.2"
+version = "0.36.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441"
+checksum = "27b64972346851a39438c60b341ebc01bba47464ae329e55cf343eb93964efd9"
dependencies = [
"memchr",
]
@@ -1284,59 +1416,21 @@ checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
[[package]]
name = "opaque-debug"
-version = "0.3.0"
+version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5"
+checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381"
[[package]]
-name = "openssl"
-version = "0.10.62"
+name = "parking"
+version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8cde4d2d9200ad5909f8dac647e29482e07c3a35de8a13fce7c9c7747ad9f671"
-dependencies = [
- "bitflags 2.4.1",
- "cfg-if",
- "foreign-types",
- "libc",
- "once_cell",
- "openssl-macros",
- "openssl-sys",
-]
-
-[[package]]
-name = "openssl-macros"
-version = "0.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn 2.0.48",
-]
-
-[[package]]
-name = "openssl-probe"
-version = "0.1.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"
-
-[[package]]
-name = "openssl-sys"
-version = "0.9.98"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c1665caf8ab2dc9aef43d1c0023bd904633a6a05cb30b0ad59bec2ae986e57a7"
-dependencies = [
- "cc",
- "libc",
- "pkg-config",
- "vcpkg",
-]
+checksum = "bb813b8af86854136c6922af0598d719255ecb2179515e6e7730d468f05c9cae"
[[package]]
name = "parking_lot"
-version = "0.12.1"
+version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f"
+checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27"
dependencies = [
"lock_api",
"parking_lot_core",
@@ -1344,22 +1438,22 @@ dependencies = [
[[package]]
name = "parking_lot_core"
-version = "0.9.9"
+version = "0.9.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e"
+checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8"
dependencies = [
"cfg-if",
"libc",
- "redox_syscall",
+ "redox_syscall 0.5.3",
"smallvec",
- "windows-targets 0.48.5",
+ "windows-targets 0.52.6",
]
[[package]]
name = "paste"
-version = "1.0.14"
+version = "1.0.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c"
+checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a"
[[package]]
name = "pem"
@@ -1397,9 +1491,9 @@ dependencies = [
[[package]]
name = "pin-project-lite"
-version = "0.2.13"
+version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58"
+checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02"
[[package]]
name = "pin-utils"
@@ -1430,9 +1524,9 @@ dependencies = [
[[package]]
name = "pkg-config"
-version = "0.3.28"
+version = "0.3.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "69d3587f8a9e599cc7ec2c00e331f71c4e69a5f9a4b8a6efd5b07466b9736f9a"
+checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec"
[[package]]
name = "pnet_base"
@@ -1466,17 +1560,19 @@ dependencies = [
[[package]]
name = "poem"
-version = "1.3.59"
+version = "3.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "504774c97b0744c1ee108a37e5a65a9745a4725c4c06277521dabc28eb53a904"
+checksum = "f1ba1c27f8f89e1bccdda0c680f72790545a11a8d8555819472f5839d7a8ca9d"
dependencies = [
- "async-trait",
"bytes",
"futures-util",
"headers",
- "http",
- "hyper",
+ "http 1.1.0",
+ "http-body-util",
+ "hyper 1.4.1",
+ "hyper-util",
"mime",
+ "multer",
"nix",
"parking_lot",
"percent-encoding",
@@ -1488,6 +1584,7 @@ dependencies = [
"serde_json",
"serde_urlencoded",
"smallvec",
+ "sync_wrapper 1.0.1",
"thiserror",
"tokio",
"tokio-util",
@@ -1497,14 +1594,14 @@ dependencies = [
[[package]]
name = "poem-derive"
-version = "1.3.59"
+version = "3.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "42ddcf4680d8d867e1e375116203846acb088483fa2070244f90589f458bbb31"
+checksum = "a62fea1692d80a000126f9b28d865012a160b80000abb53ccf152b428222c155"
dependencies = [
"proc-macro-crate",
"proc-macro2",
"quote",
- "syn 2.0.48",
+ "syn 2.0.76",
]
[[package]]
@@ -1526,34 +1623,45 @@ checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391"
[[package]]
name = "ppv-lite86"
-version = "0.2.17"
+version = "0.2.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
+checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04"
+dependencies = [
+ "zerocopy",
+]
[[package]]
name = "proc-macro-crate"
-version = "2.0.1"
+version = "3.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "97dc5fea232fc28d2f597b37c4876b348a40e33f3b02cc975c8d006d78d94b1a"
+checksum = "6d37c51ca738a55da99dc0c4a34860fd675453b8b36209178c2249bb13651284"
dependencies = [
- "toml_datetime",
"toml_edit",
]
[[package]]
name = "proc-macro2"
-version = "1.0.76"
+version = "1.0.86"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "95fc56cda0b5c3325f5fbbd7ff9fda9e02bb00bb3dac51252d2f1bfa1cb8cc8c"
+checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77"
dependencies = [
"unicode-ident",
]
[[package]]
-name = "quote"
-version = "1.0.35"
+name = "pubserve"
+version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef"
+checksum = "6a2cf5f495fc9c61de736666ebcbc473fe28a2a1aaf7e5619e5925b13c0275a4"
+dependencies = [
+ "async-trait",
+]
+
+[[package]]
+name = "quote"
+version = "1.0.37"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af"
dependencies = [
"proc-macro2",
]
@@ -1598,10 +1706,19 @@ dependencies = [
]
[[package]]
-name = "regex"
-version = "1.10.2"
+name = "redox_syscall"
+version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343"
+checksum = "2a908a6e00f1fdd0dfd9c0eb08ce85126f6d8bbda50017e74bc4a4b7d4a926a4"
+dependencies = [
+ "bitflags 2.6.0",
+]
+
+[[package]]
+name = "regex"
+version = "1.10.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619"
dependencies = [
"aho-corasick",
"memchr",
@@ -1611,9 +1728,9 @@ dependencies = [
[[package]]
name = "regex-automata"
-version = "0.4.3"
+version = "0.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f"
+checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df"
dependencies = [
"aho-corasick",
"memchr",
@@ -1622,54 +1739,57 @@ dependencies = [
[[package]]
name = "regex-syntax"
-version = "0.8.2"
+version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f"
+checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b"
[[package]]
name = "reqwest"
-version = "0.11.23"
+version = "0.11.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "37b1ae8d9ac08420c66222fb9096fc5de435c3c48542bc5336c51892cffafb41"
+checksum = "78bf93c4af7a8bb7d879d51cebe797356ff10ae8516ace542b5182d9dcac10b2"
dependencies = [
"base64 0.21.7",
"bytes",
"encoding_rs",
"futures-core",
"futures-util",
- "h2",
- "http",
- "http-body",
- "hyper",
- "hyper-tls",
+ "h2 0.3.26",
+ "http 0.2.12",
+ "http-body 0.4.6",
+ "hyper 0.14.30",
+ "hyper-rustls",
"ipnet",
"js-sys",
"log",
"mime",
"mime_guess",
- "native-tls",
"once_cell",
"percent-encoding",
"pin-project-lite",
+ "rustls 0.21.12",
+ "rustls-pemfile 1.0.4",
"serde",
"serde_json",
"serde_urlencoded",
+ "sync_wrapper 0.1.2",
"system-configuration",
"tokio",
- "tokio-native-tls",
+ "tokio-rustls",
"tower-service",
"url",
"wasm-bindgen",
"wasm-bindgen-futures",
"web-sys",
+ "webpki-roots 0.25.4",
"winreg",
]
[[package]]
name = "rfc7239"
-version = "0.1.0"
+version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "087317b3cf7eb481f13bd9025d729324b7cd068d6f470e2d76d049e191f5ba47"
+checksum = "b106a85eeb5b0336d16d6a20eab857f92861d4fbb1eb9a239866fb98fb6a1063"
dependencies = [
"uncased",
]
@@ -1691,16 +1811,17 @@ dependencies = [
[[package]]
name = "ring"
-version = "0.17.7"
+version = "0.17.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "688c63d65483050968b2a8937f7995f443e27041a0f7700aa59b0822aedebb74"
+checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d"
dependencies = [
"cc",
+ "cfg-if",
"getrandom",
"libc",
"spin 0.9.8",
"untrusted 0.9.0",
- "windows-sys 0.48.0",
+ "windows-sys 0.52.0",
]
[[package]]
@@ -1725,9 +1846,9 @@ dependencies = [
[[package]]
name = "rustc-demangle"
-version = "0.1.23"
+version = "0.1.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76"
+checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f"
[[package]]
name = "rustc_version"
@@ -1740,11 +1861,11 @@ dependencies = [
[[package]]
name = "rustix"
-version = "0.38.28"
+version = "0.38.34"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "72e572a5e8ca657d7366229cdde4bd14c4eb5499a9573d4d366fe1b599daa316"
+checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f"
dependencies = [
- "bitflags 2.4.1",
+ "bitflags 2.6.0",
"errno",
"libc",
"linux-raw-sys",
@@ -1753,26 +1874,28 @@ dependencies = [
[[package]]
name = "rustls"
-version = "0.21.10"
+version = "0.21.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f9d5a6813c0759e4609cd494e8e725babae6a2ca7b62a5536a13daaec6fcb7ba"
+checksum = "3f56a14d1f48b391359b22f731fd4bd7e43c97f3c50eee276f3aa09c94784d3e"
dependencies = [
"log",
- "ring 0.17.7",
- "rustls-webpki",
+ "ring 0.17.8",
+ "rustls-webpki 0.101.7",
"sct",
]
[[package]]
-name = "rustls-native-certs"
-version = "0.6.3"
+name = "rustls"
+version = "0.23.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a9aace74cb666635c918e9c12bc0d348266037aa8eb599b5cba565709a8dff00"
+checksum = "c58f8c84392efc0a126acce10fa59ff7b3d2ac06ab451a33f2741989b806b044"
dependencies = [
- "openssl-probe",
- "rustls-pemfile",
- "schannel",
- "security-framework",
+ "once_cell",
+ "ring 0.17.8",
+ "rustls-pki-types",
+ "rustls-webpki 0.102.6",
+ "subtle",
+ "zeroize",
]
[[package]]
@@ -1784,21 +1907,48 @@ dependencies = [
"base64 0.21.7",
]
+[[package]]
+name = "rustls-pemfile"
+version = "2.1.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "196fe16b00e106300d3e45ecfcb764fa292a535d7326a29a5875c579c7417425"
+dependencies = [
+ "base64 0.22.1",
+ "rustls-pki-types",
+]
+
+[[package]]
+name = "rustls-pki-types"
+version = "1.8.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fc0a2ce646f8655401bb81e7927b812614bd5d91dbc968696be50603510fcaf0"
+
[[package]]
name = "rustls-webpki"
version = "0.101.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765"
dependencies = [
- "ring 0.17.7",
+ "ring 0.17.8",
+ "untrusted 0.9.0",
+]
+
+[[package]]
+name = "rustls-webpki"
+version = "0.102.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8e6b52d4fda176fd835fdc55a835d4a89b8499cad995885a21149d5ad62f852e"
+dependencies = [
+ "ring 0.17.8",
+ "rustls-pki-types",
"untrusted 0.9.0",
]
[[package]]
name = "ryu"
-version = "1.0.16"
+version = "1.0.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c"
+checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f"
[[package]]
name = "salsa20"
@@ -1810,12 +1960,12 @@ dependencies = [
]
[[package]]
-name = "schannel"
-version = "0.1.23"
+name = "same-file"
+version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534"
+checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502"
dependencies = [
- "windows-sys 0.52.0",
+ "winapi-util",
]
[[package]]
@@ -1836,38 +1986,15 @@ version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414"
dependencies = [
- "ring 0.17.7",
+ "ring 0.17.8",
"untrusted 0.9.0",
]
-[[package]]
-name = "security-framework"
-version = "2.9.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de"
-dependencies = [
- "bitflags 1.3.2",
- "core-foundation",
- "core-foundation-sys",
- "libc",
- "security-framework-sys",
-]
-
-[[package]]
-name = "security-framework-sys"
-version = "2.9.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e932934257d3b408ed8f30db49d85ea163bfe74961f017f405b025af298f0c7a"
-dependencies = [
- "core-foundation-sys",
- "libc",
-]
-
[[package]]
name = "semver"
-version = "1.0.21"
+version = "1.0.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b97ed7a9823b74f99c7742f5336af7be5ecd3eeafcb1507d1fa93347b1d589b0"
+checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b"
[[package]]
name = "send_wrapper"
@@ -1877,18 +2004,18 @@ checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73"
[[package]]
name = "serde"
-version = "1.0.195"
+version = "1.0.209"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "63261df402c67811e9ac6def069e4786148c4563f4b50fd4bf30aa370d626b02"
+checksum = "99fce0ffe7310761ca6bf9faf5115afbc19688edd00171d81b1bb1b116c63e09"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde-aux"
-version = "4.3.1"
+version = "4.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "184eba62ebddb71658697c8b08822edee89970bf318c5362189f0de27f85b498"
+checksum = "0d2e8bfba469d06512e11e3311d4d051a4a387a5b42d010404fecf3200321c95"
dependencies = [
"chrono",
"serde",
@@ -1897,35 +2024,36 @@ dependencies = [
[[package]]
name = "serde_derive"
-version = "1.0.195"
+version = "1.0.209"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "46fe8f8603d81ba86327b23a2e9cdf49e1255fb94a4c5f297f6ee0547178ea2c"
+checksum = "a5831b979fd7b5439637af1752d535ff49f4860c0f341d1baeb6faf0f4242170"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.48",
+ "syn 2.0.76",
]
[[package]]
name = "serde_json"
-version = "1.0.111"
+version = "1.0.127"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "176e46fa42316f18edd598015a5166857fc835ec732f5215eac6b7bdbf0a84f4"
+checksum = "8043c06d9f82bd7271361ed64f415fe5e12a77fdb52e573e7f06a516dea329ad"
dependencies = [
"itoa",
+ "memchr",
"ryu",
"serde",
]
[[package]]
name = "serde_repr"
-version = "0.1.18"
+version = "0.1.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0b2e6b945e9d3df726b65d6ee24060aff8e3533d431f677a9695db04eff9dfdb"
+checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.48",
+ "syn 2.0.76",
]
[[package]]
@@ -1942,16 +2070,17 @@ dependencies = [
[[package]]
name = "serde_with"
-version = "3.4.0"
+version = "3.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "64cd236ccc1b7a29e7e2739f27c0b2dd199804abc4290e32f59f3b68d6405c23"
+checksum = "69cecfa94848272156ea67b2b1a53f20fc7bc638c4a46d2f8abde08f05f4b857"
dependencies = [
- "base64 0.21.7",
+ "base64 0.22.1",
"chrono",
"hex",
"indexmap 1.9.3",
- "indexmap 2.1.0",
+ "indexmap 2.4.0",
"serde",
+ "serde_derive",
"serde_json",
"serde_with_macros",
"time",
@@ -1959,14 +2088,14 @@ dependencies = [
[[package]]
name = "serde_with_macros"
-version = "3.4.0"
+version = "3.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "93634eb5f75a2323b16de4748022ac4297f9e76b6dced2be287a099f41b5e788"
+checksum = "a8fee4991ef4f274617a51ad4af30519438dacb2f56ac773b08a1922ff743350"
dependencies = [
"darling",
"proc-macro2",
"quote",
- "syn 2.0.48",
+ "syn 2.0.76",
]
[[package]]
@@ -1991,6 +2120,12 @@ dependencies = [
"digest",
]
+[[package]]
+name = "shlex"
+version = "1.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
+
[[package]]
name = "signature"
version = "2.2.0"
@@ -2013,6 +2148,16 @@ dependencies = [
"time",
]
+[[package]]
+name = "simple_logger"
+version = "5.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e8c5dfa5e08767553704aa0ffd9d9794d527103c736aba9854773851fd7497eb"
+dependencies = [
+ "log",
+ "windows-sys 0.48.0",
+]
+
[[package]]
name = "slab"
version = "0.4.9"
@@ -2024,18 +2169,21 @@ dependencies = [
[[package]]
name = "smallvec"
-version = "1.11.2"
+version = "1.13.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970"
+checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67"
+dependencies = [
+ "serde",
+]
[[package]]
name = "socket2"
-version = "0.5.5"
+version = "0.5.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9"
+checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c"
dependencies = [
"libc",
- "windows-sys 0.48.0",
+ "windows-sys 0.52.0",
]
[[package]]
@@ -2065,20 +2213,19 @@ dependencies = [
[[package]]
name = "sqlformat"
-version = "0.2.3"
+version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ce81b7bd7c4493975347ef60d8c7e8b742d4694f4c49f93e0a12ea263938176c"
+checksum = "f895e3734318cc55f1fe66258926c9b910c124d47520339efecbb6c59cec7c1f"
dependencies = [
- "itertools",
"nom",
"unicode_categories",
]
[[package]]
name = "sqlx"
-version = "0.7.3"
+version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dba03c279da73694ef99763320dea58b51095dfe87d001b1d4b5fe78ba8763cf"
+checksum = "fcfa89bea9500db4a0d038513d7a060566bfc51d46d1c014847049a45cce85e8"
dependencies = [
"sqlx-core",
"sqlx-macros",
@@ -2089,18 +2236,17 @@ dependencies = [
[[package]]
name = "sqlx-core"
-version = "0.7.3"
+version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d84b0a3c3739e220d94b3239fd69fb1f74bc36e16643423bd99de3b43c21bfbd"
+checksum = "d06e2f2bd861719b1f3f0c7dbe1d80c30bf59e76cf019f07d9014ed7eefb8e08"
dependencies = [
- "ahash",
"atoi",
+ "bigdecimal",
"byteorder",
"bytes",
"chrono",
"crc",
"crossbeam-queue",
- "dotenvy",
"either",
"event-listener",
"futures-channel",
@@ -2108,16 +2254,18 @@ dependencies = [
"futures-intrusive",
"futures-io",
"futures-util",
+ "hashbrown 0.14.5",
"hashlink",
"hex",
- "indexmap 2.1.0",
+ "indexmap 2.4.0",
"ipnetwork",
"log",
"memchr",
- "native-tls",
"once_cell",
"paste",
"percent-encoding",
+ "rustls 0.23.12",
+ "rustls-pemfile 2.1.3",
"serde",
"serde_json",
"sha2",
@@ -2128,28 +2276,28 @@ dependencies = [
"tokio-stream",
"tracing",
"url",
+ "webpki-roots 0.26.3",
]
[[package]]
name = "sqlx-macros"
-version = "0.7.3"
+version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "89961c00dc4d7dffb7aee214964b065072bff69e36ddb9e2c107541f75e4f2a5"
+checksum = "2f998a9defdbd48ed005a89362bd40dd2117502f15294f61c8d47034107dbbdc"
dependencies = [
"proc-macro2",
"quote",
"sqlx-core",
"sqlx-macros-core",
- "syn 1.0.109",
+ "syn 2.0.76",
]
[[package]]
name = "sqlx-macros-core"
-version = "0.7.3"
+version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d0bd4519486723648186a08785143599760f7cc81c52334a55d6a83ea1e20841"
+checksum = "3d100558134176a2629d46cec0c8891ba0be8910f7896abfdb75ef4ab6f4e7ce"
dependencies = [
- "atomic-write-file",
"dotenvy",
"either",
"heck",
@@ -2164,7 +2312,7 @@ dependencies = [
"sqlx-mysql",
"sqlx-postgres",
"sqlx-sqlite",
- "syn 1.0.109",
+ "syn 2.0.76",
"tempfile",
"tokio",
"url",
@@ -2172,13 +2320,14 @@ dependencies = [
[[package]]
name = "sqlx-mysql"
-version = "0.7.3"
+version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e37195395df71fd068f6e2082247891bc11e3289624bbc776a0cdfa1ca7f1ea4"
+checksum = "936cac0ab331b14cb3921c62156d913e4c15b74fb6ec0f3146bd4ef6e4fb3c12"
dependencies = [
"atoi",
- "base64 0.21.7",
- "bitflags 2.4.1",
+ "base64 0.22.1",
+ "bigdecimal",
+ "bitflags 2.6.0",
"byteorder",
"bytes",
"chrono",
@@ -2214,14 +2363,38 @@ dependencies = [
]
[[package]]
-name = "sqlx-postgres"
-version = "0.7.3"
+name = "sqlx-pg-uint"
+version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d6ac0ac3b7ccd10cc96c7ab29791a7dd236bd94021f31eec7ba3d46a74aa1c24"
+checksum = "ae1cfe6c40c1cd0053b9029a41729a533ceb32093052df626aa8bfbba45e45f6"
+dependencies = [
+ "bigdecimal",
+ "serde",
+ "sqlx",
+ "sqlx-pg-uint-macros",
+ "thiserror",
+]
+
+[[package]]
+name = "sqlx-pg-uint-macros"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0ae3447aced07f8bc71d73dc8dd1c6d25c2f4d10ea62a22ceabc12af8410d7e2"
+dependencies = [
+ "quote",
+ "syn 2.0.76",
+]
+
+[[package]]
+name = "sqlx-postgres"
+version = "0.8.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9734dbce698c67ecf67c442f768a5e90a49b2a4d61a9f1d59f73874bd4cf0710"
dependencies = [
"atoi",
- "base64 0.21.7",
- "bitflags 2.4.1",
+ "base64 0.22.1",
+ "bigdecimal",
+ "bitflags 2.6.0",
"byteorder",
"chrono",
"crc",
@@ -2240,11 +2413,11 @@ dependencies = [
"log",
"md-5",
"memchr",
+ "num-bigint",
"once_cell",
"rand",
"serde",
"serde_json",
- "sha1",
"sha2",
"smallvec",
"sqlx-core",
@@ -2256,9 +2429,9 @@ dependencies = [
[[package]]
name = "sqlx-sqlite"
-version = "0.7.3"
+version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "210976b7d948c7ba9fced8ca835b11cbb2d677c59c79de41ac0d397e14547490"
+checksum = "a75b419c3c1b1697833dd927bdc4c6545a620bc1bbafabd44e1efbe9afcd337e"
dependencies = [
"atoi",
"chrono",
@@ -2272,34 +2445,34 @@ dependencies = [
"log",
"percent-encoding",
"serde",
+ "serde_urlencoded",
"sqlx-core",
"tracing",
"url",
- "urlencoding",
]
[[package]]
name = "stringprep"
-version = "0.1.4"
+version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bb41d74e231a107a1b4ee36bd1214b11285b77768d2e3824aedafa988fd36ee6"
+checksum = "7b4df3d392d81bd458a8a621b8bffbd2302a12ffe288a9d931670948749463b1"
dependencies = [
- "finl_unicode",
"unicode-bidi",
"unicode-normalization",
+ "unicode-properties",
]
[[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.5.0"
+version = "2.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc"
+checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"
[[package]]
name = "syn"
@@ -2314,15 +2487,30 @@ dependencies = [
[[package]]
name = "syn"
-version = "2.0.48"
+version = "2.0.76"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f"
+checksum = "578e081a14e0cefc3279b0472138c513f37b41a08d5a3cca9b6e4e8ceb6cd525"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
+[[package]]
+name = "sync_wrapper"
+version = "0.1.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160"
+
+[[package]]
+name = "sync_wrapper"
+version = "1.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394"
+dependencies = [
+ "futures-core",
+]
+
[[package]]
name = "system-configuration"
version = "0.5.1"
@@ -2346,45 +2534,46 @@ dependencies = [
[[package]]
name = "tempfile"
-version = "3.9.0"
+version = "3.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "01ce4141aa927a6d1bd34a041795abd0db1cccba5d5f24b009f694bdf3a1f3fa"
+checksum = "04cbcdd0c794ebb0d4cf35e88edd2f7d2c4c3e9a5a6dab322839b321c6a87a64"
dependencies = [
"cfg-if",
"fastrand",
- "redox_syscall",
+ "once_cell",
"rustix",
- "windows-sys 0.52.0",
+ "windows-sys 0.59.0",
]
[[package]]
name = "thiserror"
-version = "1.0.56"
+version = "1.0.63"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad"
+checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
-version = "1.0.56"
+version = "1.0.63"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471"
+checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.48",
+ "syn 2.0.76",
]
[[package]]
name = "time"
-version = "0.3.31"
+version = "0.3.36"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f657ba42c3f86e7680e53c8cd3af8abbe56b5491790b46e22e19c0d57463583e"
+checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885"
dependencies = [
"deranged",
"itoa",
+ "num-conv",
"powerfmt",
"serde",
"time-core",
@@ -2399,18 +2588,19 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3"
[[package]]
name = "time-macros"
-version = "0.2.16"
+version = "0.2.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "26197e33420244aeb70c3e8c78376ca46571bc4e701e4791c2cd9f57dcb3a43f"
+checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf"
dependencies = [
+ "num-conv",
"time-core",
]
[[package]]
name = "tinyvec"
-version = "1.6.0"
+version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50"
+checksum = "445e881f4f6d382d5f27c034e25eb92edd7c784ceab92a0937db7f2e9471b938"
dependencies = [
"tinyvec_macros",
]
@@ -2423,40 +2613,29 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
[[package]]
name = "tokio"
-version = "1.35.1"
+version = "1.39.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c89b4efa943be685f629b149f53829423f8f5531ea21249408e8e2f8671ec104"
+checksum = "9babc99b9923bfa4804bd74722ff02c0381021eafa4db9949217e3be8e84fff5"
dependencies = [
"backtrace",
"bytes",
"libc",
"mio",
- "num_cpus",
"pin-project-lite",
"socket2",
"tokio-macros",
- "windows-sys 0.48.0",
+ "windows-sys 0.52.0",
]
[[package]]
name = "tokio-macros"
-version = "2.2.0"
+version = "2.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b"
+checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.48",
-]
-
-[[package]]
-name = "tokio-native-tls"
-version = "0.3.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2"
-dependencies = [
- "native-tls",
- "tokio",
+ "syn 2.0.76",
]
[[package]]
@@ -2465,15 +2644,15 @@ version = "0.24.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081"
dependencies = [
- "rustls",
+ "rustls 0.21.12",
"tokio",
]
[[package]]
name = "tokio-stream"
-version = "0.1.14"
+version = "0.1.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "397c988d37662c7dda6d2208364a706264bf3d6138b11d436cbac0ad38832842"
+checksum = "267ac89e0bec6e691e5813911606935d77c476ff49024f98abcea3e7b15e37af"
dependencies = [
"futures-core",
"pin-project-lite",
@@ -2488,49 +2667,48 @@ checksum = "212d5dcb2a1ce06d81107c3d0ffa3121fe974b73f068c8282cb1c32328113b6c"
dependencies = [
"futures-util",
"log",
- "rustls",
- "rustls-native-certs",
+ "rustls 0.21.12",
"tokio",
"tokio-rustls",
"tungstenite",
+ "webpki-roots 0.25.4",
]
[[package]]
name = "tokio-util"
-version = "0.7.10"
+version = "0.7.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5419f34732d9eb6ee4c3578b7989078579b7f039cbbb9ca2c4da015749371e15"
+checksum = "9cf6b47b3771c49ac75ad09a6162f53ad4b8088b76ac60e8ec1455b31a189fe1"
dependencies = [
"bytes",
"futures-core",
"futures-sink",
"pin-project-lite",
"tokio",
- "tracing",
]
[[package]]
name = "toml_datetime"
-version = "0.6.3"
+version = "0.6.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b"
+checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41"
[[package]]
name = "toml_edit"
-version = "0.20.2"
+version = "0.21.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "396e4d48bbb2b7554c944bde63101b5ae446cff6ec4a24227428f15eb72ef338"
+checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1"
dependencies = [
- "indexmap 2.1.0",
+ "indexmap 2.4.0",
"toml_datetime",
"winnow",
]
[[package]]
name = "tower-service"
-version = "0.3.2"
+version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52"
+checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3"
[[package]]
name = "tracing"
@@ -2552,7 +2730,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.48",
+ "syn 2.0.76",
]
[[package]]
@@ -2579,11 +2757,11 @@ dependencies = [
"byteorder",
"bytes",
"data-encoding",
- "http",
+ "http 0.2.12",
"httparse",
"log",
"rand",
- "rustls",
+ "rustls 0.21.12",
"sha1",
"thiserror",
"url",
@@ -2598,9 +2776,9 @@ checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825"
[[package]]
name = "uncased"
-version = "0.9.9"
+version = "0.9.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9b9bc53168a4be7402ab86c3aad243a84dd7381d09be0eddc81280c1da95ca68"
+checksum = "e1b88fcfe09e89d3866a5c11019378088af2d24c3fbd4f0543f96b479ec90697"
dependencies = [
"version_check",
]
@@ -2616,9 +2794,9 @@ dependencies = [
[[package]]
name = "unicode-bidi"
-version = "0.3.14"
+version = "0.3.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6f2528f27a9eb2b21e69c95319b30bd0efd85d09c379741b0f78ea1d86be2416"
+checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75"
[[package]]
name = "unicode-ident"
@@ -2628,18 +2806,18 @@ 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.1"
+name = "unicode-properties"
+version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36"
+checksum = "52ea75f83c0137a9b98608359a5f1af8144876eb67bcb1ce837368e906a9f524"
[[package]]
name = "unicode_categories"
@@ -2671,21 +2849,15 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"
[[package]]
name = "url"
-version = "2.5.0"
+version = "2.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633"
+checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c"
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 = "utf-8"
version = "0.7.6"
@@ -2700,9 +2872,19 @@ checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
[[package]]
name = "version_check"
-version = "0.9.4"
+version = "0.9.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
+checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
+
+[[package]]
+name = "walkdir"
+version = "2.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b"
+dependencies = [
+ "same-file",
+ "winapi-util",
+]
[[package]]
name = "want"
@@ -2727,34 +2909,35 @@ checksum = "b8dad83b4f25e74f184f64c43b150b91efe7647395b42289f38e50566d82855b"
[[package]]
name = "wasm-bindgen"
-version = "0.2.89"
+version = "0.2.93"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0ed0d4f68a3015cc185aff4db9506a015f4b96f95303897bfa23f846db54064e"
+checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5"
dependencies = [
"cfg-if",
+ "once_cell",
"wasm-bindgen-macro",
]
[[package]]
name = "wasm-bindgen-backend"
-version = "0.2.89"
+version = "0.2.93"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1b56f625e64f3a1084ded111c4d5f477df9f8c92df113852fa5a374dbda78826"
+checksum = "9de396da306523044d3302746f1208fa71d7532227f15e347e2d93e4145dd77b"
dependencies = [
"bumpalo",
"log",
"once_cell",
"proc-macro2",
"quote",
- "syn 2.0.48",
+ "syn 2.0.76",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-futures"
-version = "0.4.39"
+version = "0.4.43"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ac36a15a220124ac510204aec1c3e5db8a22ab06fd6706d881dc6149f8ed9a12"
+checksum = "61e9300f63a621e96ed275155c108eb6f843b6a26d053f122ab69724559dc8ed"
dependencies = [
"cfg-if",
"js-sys",
@@ -2764,9 +2947,9 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro"
-version = "0.2.89"
+version = "0.2.93"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0162dbf37223cd2afce98f3d0785506dcb8d266223983e4b5b525859e6e182b2"
+checksum = "585c4c91a46b072c92e908d99cb1dcdf95c5218eeb6f3bf1efa991ee7a68cccf"
dependencies = [
"quote",
"wasm-bindgen-macro-support",
@@ -2774,31 +2957,32 @@ dependencies = [
[[package]]
name = "wasm-bindgen-macro-support"
-version = "0.2.89"
+version = "0.2.93"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283"
+checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.48",
+ "syn 2.0.76",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-shared"
-version = "0.2.89"
+version = "0.2.93"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7ab9b36309365056cd639da3134bf87fa8f3d86008abf99e612384a6eecd459f"
+checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484"
[[package]]
name = "wasm-bindgen-test"
-version = "0.3.39"
+version = "0.3.43"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2cf9242c0d27999b831eae4767b2a146feb0b27d332d553e605864acd2afd403"
+checksum = "68497a05fb21143a08a7d24fc81763384a3072ee43c44e86aad1744d6adef9d9"
dependencies = [
"console_error_panic_hook",
"js-sys",
+ "minicov",
"scoped-tls",
"wasm-bindgen",
"wasm-bindgen-futures",
@@ -2807,13 +2991,13 @@ dependencies = [
[[package]]
name = "wasm-bindgen-test-macro"
-version = "0.3.39"
+version = "0.3.43"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "794645f5408c9a039fd09f4d113cdfb2e7eba5ff1956b07bcf701cf4b394fe89"
+checksum = "4b8220be1fa9e4c889b30fd207d4906657e7e90b12e0e6b0c8b8d8709f5de021"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.48",
+ "syn 2.0.76",
]
[[package]]
@@ -2832,29 +3016,44 @@ dependencies = [
[[package]]
name = "web-sys"
-version = "0.3.66"
+version = "0.3.70"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "50c24a44ec86bb68fbecd1b3efed7e85ea5621b39b35ef2766b66cd984f8010f"
+checksum = "26fdeaafd9bd129f65e7c031593c24d62186301e0c72c8978fa1678be7d532c0"
dependencies = [
"js-sys",
"wasm-bindgen",
]
[[package]]
-name = "whoami"
-version = "1.5.0"
+name = "webpki-roots"
+version = "0.25.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0fec781d48b41f8163426ed18e8fc2864c12937df9ce54c88ede7bd47270893e"
+checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1"
+
+[[package]]
+name = "webpki-roots"
+version = "0.26.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bd7c23921eeb1713a4e851530e9b9756e4fb0e89978582942612524cf09f01cd"
dependencies = [
- "redox_syscall",
+ "rustls-pki-types",
+]
+
+[[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",
]
[[package]]
name = "wildmatch"
-version = "2.3.0"
+version = "2.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "495ec47bf3c1345005f40724f0269362c8556cbc43aed0526ed44cae1d35fceb"
+checksum = "3928939971918220fed093266b809d1ee4ec6c1a2d72692ff6876898f3b16c19"
[[package]]
name = "winapi"
@@ -2872,6 +3071,15 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
+[[package]]
+name = "winapi-util"
+version = "0.1.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb"
+dependencies = [
+ "windows-sys 0.59.0",
+]
+
[[package]]
name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"
@@ -2884,7 +3092,7 @@ version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9"
dependencies = [
- "windows-targets 0.52.0",
+ "windows-targets 0.52.6",
]
[[package]]
@@ -2902,7 +3110,16 @@ version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
dependencies = [
- "windows-targets 0.52.0",
+ "windows-targets 0.52.6",
+]
+
+[[package]]
+name = "windows-sys"
+version = "0.59.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"
+dependencies = [
+ "windows-targets 0.52.6",
]
[[package]]
@@ -2922,17 +3139,18 @@ dependencies = [
[[package]]
name = "windows-targets"
-version = "0.52.0"
+version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd"
+checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
dependencies = [
- "windows_aarch64_gnullvm 0.52.0",
- "windows_aarch64_msvc 0.52.0",
- "windows_i686_gnu 0.52.0",
- "windows_i686_msvc 0.52.0",
- "windows_x86_64_gnu 0.52.0",
- "windows_x86_64_gnullvm 0.52.0",
- "windows_x86_64_msvc 0.52.0",
+ "windows_aarch64_gnullvm 0.52.6",
+ "windows_aarch64_msvc 0.52.6",
+ "windows_i686_gnu 0.52.6",
+ "windows_i686_gnullvm",
+ "windows_i686_msvc 0.52.6",
+ "windows_x86_64_gnu 0.52.6",
+ "windows_x86_64_gnullvm 0.52.6",
+ "windows_x86_64_msvc 0.52.6",
]
[[package]]
@@ -2943,9 +3161,9 @@ checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
[[package]]
name = "windows_aarch64_gnullvm"
-version = "0.52.0"
+version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea"
+checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
[[package]]
name = "windows_aarch64_msvc"
@@ -2955,9 +3173,9 @@ checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
[[package]]
name = "windows_aarch64_msvc"
-version = "0.52.0"
+version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef"
+checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
[[package]]
name = "windows_i686_gnu"
@@ -2967,9 +3185,15 @@ checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
[[package]]
name = "windows_i686_gnu"
-version = "0.52.0"
+version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313"
+checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
+
+[[package]]
+name = "windows_i686_gnullvm"
+version = "0.52.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
[[package]]
name = "windows_i686_msvc"
@@ -2979,9 +3203,9 @@ checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
[[package]]
name = "windows_i686_msvc"
-version = "0.52.0"
+version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a"
+checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
[[package]]
name = "windows_x86_64_gnu"
@@ -2991,9 +3215,9 @@ checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
[[package]]
name = "windows_x86_64_gnu"
-version = "0.52.0"
+version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd"
+checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
[[package]]
name = "windows_x86_64_gnullvm"
@@ -3003,9 +3227,9 @@ checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
[[package]]
name = "windows_x86_64_gnullvm"
-version = "0.52.0"
+version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e"
+checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
[[package]]
name = "windows_x86_64_msvc"
@@ -3015,15 +3239,15 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
[[package]]
name = "windows_x86_64_msvc"
-version = "0.52.0"
+version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04"
+checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
[[package]]
name = "winnow"
-version = "0.5.34"
+version = "0.5.40"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b7cf47b659b318dccbd69cc4797a39ae128f533dce7902a1096044d1967b9c16"
+checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876"
dependencies = [
"memchr",
]
@@ -3059,26 +3283,27 @@ dependencies = [
[[package]]
name = "zerocopy"
-version = "0.7.32"
+version = "0.7.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be"
+checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0"
dependencies = [
+ "byteorder",
"zerocopy-derive",
]
[[package]]
name = "zerocopy-derive"
-version = "0.7.32"
+version = "0.7.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6"
+checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e"
dependencies = [
"proc-macro2",
"quote",
- "syn 2.0.48",
+ "syn 2.0.76",
]
[[package]]
name = "zeroize"
-version = "1.7.0"
+version = "1.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d"
+checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde"
diff --git a/Cargo.toml b/Cargo.toml
index 45060d4..f9a7047 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -8,73 +8,86 @@ repository = "https://github.com/polyphony-chat/chorus"
readme = "README.md"
keywords = ["spacebar", "discord", "polyphony"]
website = ["https://discord.com/invite/m3FpcapGDD"]
-rust-version = "1.67.1"
+rust-version = "1.70.0"
[features]
default = ["client", "rt-multi-thread"]
-backend = ["dep:poem", "dep:sqlx"]
+backend = ["poem", "sqlx", "sqlx-pg-uint"]
rt-multi-thread = ["tokio/rt-multi-thread"]
rt = ["tokio/rt"]
-client = []
+client = ["flate2"]
voice = ["voice_udp", "voice_gateway"]
voice_udp = ["dep:discortp", "dep:crypto_secretbox"]
voice_gateway = []
+sqlx-pg-uint = ["dep:sqlx-pg-uint", "sqlx-pg-uint/serde"]
[dependencies]
-tokio = { version = "1.35.1", features = ["macros", "sync"] }
-serde = { version = "1.0.195", features = ["derive", "rc"] }
-serde_json = { version = "1.0.111", features = ["raw_value"] }
-serde-aux = "4.3.1"
-serde_with = "3.4.0"
-serde_repr = "0.1.18"
-reqwest = { features = ["multipart", "json"], version = "0.11.23" }
-url = "2.5.0"
-chrono = { version = "0.4.31", features = ["serde"] }
-regex = "1.10.2"
+tokio = { version = "1.39.3", features = ["macros", "sync"] }
+serde = { version = "1.0.209", features = ["derive", "rc"] }
+serde_json = { version = "1.0.127", features = ["raw_value"] }
+serde-aux = "4.5.0"
+serde_with = "3.9.0"
+serde_repr = "0.1.19"
+reqwest = { features = [
+ "multipart",
+ "json",
+ "rustls-tls-webpki-roots",
+], version = "=0.11.26", default-features = false }
+url = "2.5.2"
+chrono = { version = "0.4.38", features = ["serde"] }
+regex = "1.10.6"
custom_error = "1.9.2"
futures-util = "0.3.30"
-http = "0.2.11"
+http = "0.2.12"
base64 = "0.21.7"
-bitflags = { version = "2.4.1", features = ["serde"] }
-lazy_static = "1.4.0"
-poem = { version = "1.3.59", optional = true }
-thiserror = "1.0.56"
+bitflags = { version = "2.6.0", features = ["serde"] }
+lazy_static = "1.5.0"
+poem = { version = "3.0.1", features = ["multipart"], optional = true }
+thiserror = "1.0.63"
jsonwebtoken = "8.3.0"
-log = "0.4.20"
-async-trait = "0.1.77"
-chorus-macros = "0.2.0"
-sqlx = { version = "0.7.3", features = [
- "mysql",
- "sqlite",
+log = "0.4.22"
+async-trait = "0.1.81"
+chorus-macros = { path = "./chorus-macros", version = "0" } # Note: version here is used when releasing. This will use the latest release. Make sure to republish the crate when code in macros is changed!
+sqlx = { version = "0.8.1", features = [
"json",
"chrono",
"ipnetwork",
- "runtime-tokio-native-tls",
- "any",
+ "runtime-tokio-rustls",
+ "postgres",
+ "bigdecimal",
], optional = true }
-discortp = { version = "0.5.0", optional = true, features = ["rtp", "discord", "demux"] }
+discortp = { version = "0.5.0", optional = true, features = [
+ "rtp",
+ "discord",
+ "demux",
+] }
crypto_secretbox = { version = "0.1.1", optional = true }
rand = "0.8.5"
+flate2 = { version = "1.0.33", optional = true }
+webpki-roots = "0.26.3"
+pubserve = { version = "1.1.0", features = ["async", "send"] }
+sqlx-pg-uint = { version = "0.5.0", features = ["serde"], optional = true }
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
-rustls = "0.21.10"
-rustls-native-certs = "0.6.3"
+rustls = "0.21.12"
tokio-tungstenite = { version = "0.20.1", features = [
- "rustls-tls-native-roots",
- "rustls-native-certs",
+ "rustls-tls-webpki-roots",
] }
-native-tls = "0.2.11"
hostname = "0.3.1"
-getrandom = { version = "0.2.12" }
+getrandom = { version = "0.2.15" }
[target.'cfg(target_arch = "wasm32")'.dependencies]
-getrandom = { version = "0.2.12", features = ["js"] }
+getrandom = { version = "0.2.15", features = ["js"] }
ws_stream_wasm = "0.7.4"
-wasm-bindgen-futures = "0.4.39"
+wasm-bindgen-futures = "0.4.43"
wasmtimer = "0.2.0"
[dev-dependencies]
-lazy_static = "1.4.0"
-wasm-bindgen-test = "0.3.39"
-wasm-bindgen = "0.2.89"
+lazy_static = "1.5.0"
+wasm-bindgen-test = "0.3.43"
+wasm-bindgen = "0.2.93"
+simple_logger = { version = "5.0.0", default-features = false }
+
+[lints.rust]
+unexpected_cfgs = { level = "allow", check-cfg = ['cfg(tarpaulin_include)'] }
diff --git a/README.md b/README.md
index dc49230..afed9b2 100644
--- a/README.md
+++ b/README.md
@@ -28,14 +28,15 @@
-Chorus is a Rust library which poses as an API wrapper for [Spacebar Chat](https://github.com/spacebarchat/)
-and Discord. It is designed to be easy to use, and to be compatible with both Discord and Spacebar Chat.
+Chorus is a Rust library which poses as an API wrapper for [Spacebar Chat](https://github.com/spacebarchat/),
+Discord and our own Polyphony. Its high-level API is designed to be easy to use, while still providing the
+flexibility one would expect from a library like this.
You can establish as many connections to as many servers as you want, and you can use them all at the same time.
## A Tour of Chorus
-Chorus combines all the required functionalities of a user-centric Spacebar library into one package.
+Chorus combines all the required functionalities of an API wrapper for chat services into one modular library.
The library handles various aspects on your behalf, such as rate limiting, authentication and maintaining
a WebSocket connection to the Gateway. This means that you can focus on building your application,
instead of worrying about the underlying implementation details.
@@ -44,19 +45,19 @@ To get started with Chorus, import it into your project by adding the following
```toml
[dependencies]
-chorus = "0.15.0"
+chorus = "0.16.0"
```
### Establishing a Connection
-To connect to a Spacebar compatible server, you need to create an [`Instance`](https://docs.rs/chorus/latest/chorus/instance/struct.Instance.html) like this:
+To connect to a Polyphony/Spacebar compatible server, you'll need to create an [`Instance`](https://docs.rs/chorus/latest/chorus/instance/struct.Instance.html) like this:
```rs
use chorus::instance::Instance;
#[tokio::main]
async fn main() {
- let instance = Instance::new("https://example.com")
+ let instance = Instance::new("https://example.com", None)
.await
.expect("Failed to connect to the Spacebar server");
// You can create as many instances of `Instance` as you want, but each `Instance` should likely be unique.
@@ -81,7 +82,7 @@ let login_schema = LoginSchema {
password: "Correct-Horse-Battery-Staple".to_string(),
..Default::default()
};
-// Each user connects to the Gateway. The Gateway connection lives on a separate thread. Depending on
+// Each user connects to the Gateway. Each users' Gateway connection lives on a separate thread. Depending on
// the runtime feature you choose, this can potentially take advantage of all of your computers' threads.
let user = instance
.login_account(login_schema)
@@ -97,15 +98,33 @@ All major desktop operating systems (Windows, macOS (aarch64/x86_64), Linux (aar
`wasm32-unknown-unknown` is a supported compilation target on versions `0.12.0` and up. This allows you to use
Chorus in your browser, or in any other environment that supports WebAssembly.
-We recommend checking out the examples directory, as well as the documentation for more information.
+To compile for `wasm32-unknown-unknown`, execute the following command:
+
+```sh
+cargo build --target=wasm32-unknown-unknown --no-default-features
+```
+
+The following features are supported on `wasm32-unknown-unknown`:
+
+| Feature | WASM Support |
+| ----------------- | ------------ |
+| `client` | ✅ |
+| `rt` | ✅ |
+| `rt-multi-thread` | ❌ |
+| `backend` | ❌ |
+| `voice` | ❌ |
+| `voice_udp` | ❌ |
+| `voice_gateway` | ✅ |
+
+We recommend checking out the "examples" directory, as well as the documentation for more information.
## MSRV (Minimum Supported Rust Version)
-Rust **1.67.1**. This number might change at any point while Chorus is not yet at version 1.0.0.
+Rust **1.70.0**. This number might change at any point while Chorus is not yet at version 1.0.0.
## Development Setup
-Make sure that you have at least Rust 1.67.1 installed. You can check your Rust version by running `cargo --version`
+Make sure that you have at least Rust 1.70.0 installed. You can check your Rust version by running `cargo --version`
in your terminal. To compile for `wasm32-unknown-unknown`, you need to install the `wasm32-unknown-unknown` target.
You can do this by running `rustup target add wasm32-unknown-unknown`.
@@ -130,98 +149,23 @@ This crate uses Semantic Versioning 2.0.0 as its versioning scheme. You can read
See [CONTRIBUTING.md](./CONTRIBUTING.md).
-
- Progress Tracker/Roadmap
-
- ### Core Functionality
- - [x] Rate Limiter (hint: couldn't be fully tested due to [an Issue with the Spacebar Server](https://github.com/spacebarchat/server/issues/1022))
- - [x] [Login (the conventional way)](https://github.com/polyphony-chat/chorus/issues/1)
- - [ ] [2FA](https://github.com/polyphony-chat/chorus/issues/40)
- - [x] [Registration](https://github.com/polyphony-chat/chorus/issues/1)
-
- ### Messaging
- - [x] [Sending messages](https://github.com/polyphony-chat/chorus/issues/23)
- - [x] [Events (Message, User, Channel, etc.)](https://github.com/polyphony-chat/chorus/issues/51)
- - [x] Channel creation
- - [x] Channel deletion
- - [x] [Channel management (name, description, icon, etc.)](https://github.com/polyphony-chat/chorus/issues/48)
- - [x] [Join and Leave Guilds](https://github.com/polyphony-chat/chorus/issues/45)
- - [x] [Start DMs](https://github.com/polyphony-chat/chorus/issues/45)
- - [x] [Group DM creation, deletion and member management](https://github.com/polyphony-chat/chorus/issues/89)
- - [ ] [Deleting messages](https://github.com/polyphony-chat/chorus/issues/91)
- - [ ] [Message threads](https://github.com/polyphony-chat/chorus/issues/90)
- - [x] [Reactions](https://github.com/polyphony-chat/chorus/issues/85)
- - [ ] Message Search
- - [ ] Message history
- - [ ] Emoji
- - [ ] Stickers
- - [ ] [Forum channels](https://github.com/polyphony-chat/chorus/issues/90)
-
- ### User Management
- - [ ] [User profile customization](https://github.com/polyphony-chat/chorus/issues/41)
- - [x] Gettings users and user profiles
- - [x] [Friend requests](https://github.com/polyphony-chat/chorus/issues/92)
- - [x] [Blocking users](https://github.com/polyphony-chat/chorus/issues/92)
- - [ ] User presence (online, offline, idle, etc.)
- - [ ] User status (custom status, etc.)
- - [x] Account deletion
-
- ### Additional Features
- - [ ] Server discovery
- - [ ] Server templates
-
- ### Voice and Video
- - [ ] [Voice chat support](https://github.com/polyphony-chat/chorus/issues/49)
- - [ ] [Video chat support](https://github.com/polyphony-chat/chorus/issues/49)
-
- ### Permissions and Roles
- - [x] [Role management](https://github.com/polyphony-chat/chorus/issues/46) (creation, deletion, modification)
- - [x] [Permission management](https://github.com/polyphony-chat/chorus/issues/46) (assigning and revoking permissions)
- - [x] [Channel-specific permissions](https://github.com/polyphony-chat/chorus/issues/88)
- - [x] Role-based access control
-
- ### Guild Management
- - [x] Guild creation
- - [x] Guild deletion
- - [ ] [Guild settings (name, description, icon, etc.)](https://github.com/polyphony-chat/chorus/issues/43)
- - [ ] Guild invites
-
- ### Moderation
- - [ ] Channel moderation (slow mode, etc.)
- - [ ] User sanctions (mute, kick, ban)
- - [ ] Audit logs
-
- ### Embeds and Rich Content
- - [x] Sending rich content in messages (links, images, videos)
- - [ ] Customizing embed appearance (title, description, color, fields)
-
- ### Webhooks
- - [ ] Webhook creation and management
- - [ ] Handling incoming webhook events
-
- ### Documentation and Examples
- - [ ] Comprehensive documentation
- - [ ] Example usage and code snippets
- - [ ] Tutorials and guides
-
- [Rust]: https://img.shields.io/badge/Rust-orange?style=plastic&logo=rust
- [Rust-url]: https://www.rust-lang.org/
- [build-shield]: https://img.shields.io/github/actions/workflow/status/polyphony-chat/chorus/build_and_test.yml?style=flat
- [build-url]: https://github.com/polyphony-chat/chorus/blob/main/.github/workflows/build_and_test.yml
- [clippy-shield]: https://img.shields.io/github/actions/workflow/status/polyphony-chat/chorus/clippy.yml?style=flat
- [clippy-url]: https://github.com/polyphony-chat/chorus/blob/main/.github/workflows/clippy.yml
- [contributors-shield]: https://img.shields.io/github/contributors/polyphony-chat/chorus.svg?style=flat
- [contributors-url]: https://github.com/polyphony-chat/chorus/graphs/contributors
- [coverage-shield]: https://coveralls.io/repos/github/polyphony-chat/chorus/badge.svg?branch=main
- [coverage-url]: https://coveralls.io/github/polyphony-chat/chorus?branch=main
- [forks-shield]: https://img.shields.io/github/forks/polyphony-chat/chorus.svg?style=flat
- [forks-url]: https://github.com/polyphony-chat/chorus/network/members
- [stars-shield]: https://img.shields.io/github/stars/polyphony-chat/chorus.svg?style=flat
- [stars-url]: https://github.com/polyphony-chat/chorus/stargazers
- [issues-shield]: https://img.shields.io/github/issues/polyphony-chat/chorus.svg?style=flat
- [issues-url]: https://github.com/polyphony-chat/chorus/issues
- [license-shield]: https://img.shields.io/github/license/polyphony-chat/chorus.svg?style=f;at
- [license-url]: https://github.com/polyphony-chat/chorus/blob/master/LICENSE
- [Discord]: https://dcbadge.vercel.app/api/server/m3FpcapGDD?style=flat
- [Discord-invite]: https://discord.com/invite/m3FpcapGDD
-
+[Rust]: https://img.shields.io/badge/Rust-orange?style=plastic&logo=rust
+[Rust-url]: https://www.rust-lang.org/
+[build-shield]: https://img.shields.io/github/actions/workflow/status/polyphony-chat/chorus/build_and_test.yml?style=flat
+[build-url]: https://github.com/polyphony-chat/chorus/blob/main/.github/workflows/build_and_test.yml
+[clippy-shield]: https://img.shields.io/github/actions/workflow/status/polyphony-chat/chorus/clippy.yml?style=flat
+[clippy-url]: https://github.com/polyphony-chat/chorus/blob/main/.github/workflows/clippy.yml
+[contributors-shield]: https://img.shields.io/github/contributors/polyphony-chat/chorus.svg?style=flat
+[contributors-url]: https://github.com/polyphony-chat/chorus/graphs/contributors
+[coverage-shield]: https://coveralls.io/repos/github/polyphony-chat/chorus/badge.svg?branch=main
+[coverage-url]: https://coveralls.io/github/polyphony-chat/chorus?branch=main
+[forks-shield]: https://img.shields.io/github/forks/polyphony-chat/chorus.svg?style=flat
+[forks-url]: https://github.com/polyphony-chat/chorus/network/members
+[stars-shield]: https://img.shields.io/github/stars/polyphony-chat/chorus.svg?style=flat
+[stars-url]: https://github.com/polyphony-chat/chorus/stargazers
+[issues-shield]: https://img.shields.io/github/issues/polyphony-chat/chorus.svg?style=flat
+[issues-url]: https://github.com/polyphony-chat/chorus/issues
+[license-shield]: https://img.shields.io/github/license/polyphony-chat/chorus.svg?style=f;at
+[license-url]: https://github.com/polyphony-chat/chorus/blob/master/LICENSE
+[Discord]: https://dcbadge.vercel.app/api/server/m3FpcapGDD?style=flat
+[Discord-invite]: https://discord.com/invite/m3FpcapGDD
diff --git a/build-wasm.sh b/build-wasm.sh
new file mode 100755
index 0000000..85c55c3
--- /dev/null
+++ b/build-wasm.sh
@@ -0,0 +1,6 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at https://mozilla.org/MPL/2.0/.
+#!/bin/sh
+
+cargo build --no-default-features --target=wasm32-unknown-unknown "$@"
\ No newline at end of file
diff --git a/chorus-macros/Cargo.lock b/chorus-macros/Cargo.lock
index 17404a2..e74f64c 100644
--- a/chorus-macros/Cargo.lock
+++ b/chorus-macros/Cargo.lock
@@ -15,7 +15,7 @@ dependencies = [
[[package]]
name = "chorus-macros"
-version = "0.1.0"
+version = "0.4.1"
dependencies = [
"async-trait",
"quote",
diff --git a/chorus-macros/Cargo.toml b/chorus-macros/Cargo.toml
index 272d99f..4efc372 100644
--- a/chorus-macros/Cargo.toml
+++ b/chorus-macros/Cargo.toml
@@ -1,9 +1,10 @@
[package]
name = "chorus-macros"
-version = "0.2.0"
+version = "0.5.0"
edition = "2021"
-license = "AGPL-3.0"
+license = "MPL-2.0"
description = "Macros for the chorus crate."
+repository = "https://github.com/polyphony-chat/chorus"
[lib]
proc-macro = true
diff --git a/chorus-macros/src/lib.rs b/chorus-macros/src/lib.rs
index ba8f27e..d2797e7 100644
--- a/chorus-macros/src/lib.rs
+++ b/chorus-macros/src/lib.rs
@@ -6,6 +6,18 @@ use proc_macro::TokenStream;
use quote::quote;
use syn::{parse_macro_input, Data, DeriveInput, Field, Fields, FieldsNamed};
+#[proc_macro_derive(WebSocketEvent)]
+pub fn websocket_event_macro_derive(input: TokenStream) -> TokenStream {
+ let ast: syn::DeriveInput = syn::parse(input).unwrap();
+
+ let name = &ast.ident;
+
+ quote! {
+ impl WebSocketEvent for #name {}
+ }
+ .into()
+}
+
#[proc_macro_derive(Updateable)]
pub fn updateable_macro_derive(input: TokenStream) -> TokenStream {
let ast: syn::DeriveInput = syn::parse(input).unwrap();
@@ -143,3 +155,89 @@ pub fn composite_derive(input: TokenStream) -> TokenStream {
_ => panic!("Composite derive macro only supports structs"),
}
}
+
+#[proc_macro_derive(SqlxBitFlags)]
+pub fn sqlx_bitflag_derive(input: TokenStream) -> TokenStream {
+ let ast: syn::DeriveInput = syn::parse(input).unwrap();
+
+ let name = &ast.ident;
+
+ quote!{
+ #[cfg(feature = "sqlx")]
+ impl sqlx::Type for #name {
+ fn type_info() -> sqlx::postgres::PgTypeInfo {
+ >::type_info()
+ }
+ }
+
+ #[cfg(feature = "sqlx")]
+ impl<'q> sqlx::Encode<'q, sqlx::Postgres> for #name {
+ fn encode_by_ref(&self, buf: &mut ::ArgumentBuffer<'q>) -> Result {
+ >::encode_by_ref(&self.bits().into(), buf)
+ }
+ }
+
+ #[cfg(feature = "sqlx")]
+ impl<'q> sqlx::Decode<'q, sqlx::Postgres> for #name {
+ fn decode(value: ::ValueRef<'q>) -> Result {
+ >::decode(value).map(|v| Self::from_bits_truncate(v.to_uint()))
+ }
+ }
+
+ /// Converts a [Vec] to an unsigned, 64 bit integer. The [u64] is created using [u64::from_be_bytes].
+ ///
+ /// Empty vectors will result in an output of `0_u64`. Only the first 8 values from the vector are
+ /// being processed. Any additional values will be skipped.
+ ///
+ /// Vectors holding less than 8 values will be treated as a vector holding 8 values, where the
+ /// missing values are padded with `0_u8`.
+ fn vec_u8_to_u64(vec: Vec) -> u64 {
+ let mut buf: [u8; 8] = [0; 8];
+ let mut position = 0;
+ for read in vec.iter() {
+ buf[position] = *read;
+ position += 1;
+ if position > 7 {
+ break;
+ }
+ }
+ u64::from_be_bytes(buf)
+ }
+ }
+ .into()
+}
+
+#[proc_macro_derive(SerdeBitFlags)]
+pub fn serde_bitflag_derive(input: TokenStream) -> TokenStream {
+ let ast: syn::DeriveInput = syn::parse(input).unwrap();
+
+ let name = &ast.ident;
+
+ quote! {
+ impl std::str::FromStr for #name {
+ type Err = std::num::ParseIntError;
+
+ fn from_str(s: &str) -> Result<#name, Self::Err> {
+ s.parse::().map(#name::from_bits).map(|f| f.unwrap_or(#name::empty()))
+ }
+ }
+
+ impl serde::Serialize for #name {
+ fn serialize(&self, serializer: S) -> Result {
+ serializer.serialize_str(&self.bits().to_string())
+ }
+ }
+
+ impl<'de> serde::Deserialize<'de> for #name {
+ fn deserialize(deserializer: D) -> Result<#name, D::Error> where D: serde::de::Deserializer<'de> + Sized {
+ // let s = String::deserialize(deserializer)?.parse::().map_err(serde::de::Error::custom)?;
+ let s = crate::types::serde::string_or_u64(deserializer)?;
+
+ // Note: while truncating may not be ideal, it's better than a panic if there are
+ // extra flags
+ Ok(Self::from_bits_truncate(s))
+ }
+ }
+ }
+ .into()
+}
diff --git a/examples/gateway_observers.rs b/examples/gateway_observers.rs
index 0f15759..8137179 100644
--- a/examples/gateway_observers.rs
+++ b/examples/gateway_observers.rs
@@ -3,6 +3,8 @@
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
// This example showcase how to properly use gateway observers.
+// (This assumes you have a manually created gateway, if you created
+// a ChorusUser by e.g. logging in, you can access the gateway with user.gateway)
//
// To properly run it, you will need to change the token below.
@@ -12,12 +14,12 @@ const TOKEN: &str = "";
const GATEWAY_URL: &str = "wss://gateway.old.server.spacebar.chat/";
use async_trait::async_trait;
-use chorus::gateway::Gateway;
+use chorus::gateway::{Gateway, GatewayOptions};
use chorus::{
self,
- gateway::Observer,
types::{GatewayIdentifyPayload, GatewayReady},
};
+use pubserve::Subscriber;
use std::{sync::Arc, time::Duration};
use tokio::{self};
@@ -32,11 +34,16 @@ use wasmtimer::tokio::sleep;
#[derive(Debug)]
pub struct ExampleObserver {}
-// This struct can observe GatewayReady events when subscribed, because it implements the trait Observer.
-// The Observer trait can be implemented for a struct for a given websocketevent to handle observing it
+// This struct can observe GatewayReady events when subscribed, because it implements the trait Subscriber.
+// The Subscriber trait can be implemented for a struct for a given websocketevent to handle observing it
+//
+// Note that this trait is quite generic and can be use to observe any type.
+//
+// It is just used for WebSocketEvents in chorus.
+//
// One struct can be an observer of multiple websocketevents, if needed
#[async_trait]
-impl Observer for ExampleObserver {
+impl Subscriber for ExampleObserver {
// After we subscribe to an event this function is called every time we receive it
async fn update(&self, _data: &GatewayReady) {
println!("Observed Ready!");
@@ -45,10 +52,18 @@ impl Observer for ExampleObserver {
#[tokio::main(flavor = "current_thread")]
async fn main() {
- let gateway_websocket_url = GATEWAY_URL.to_string();
+ let gateway_websocket_url = GATEWAY_URL;
+
+ // These options specify the encoding format, compression, etc
+ //
+ // For most cases the defaults should work, though some implementations
+ // might only support some formats or not support compression
+ let options = GatewayOptions::default();
// Initiate the gateway connection
- let gateway = Gateway::spawn(gateway_websocket_url).await.unwrap();
+ let gateway = Gateway::spawn(gateway_websocket_url, options)
+ .await
+ .unwrap();
// Create an instance of our observer
let observer = ExampleObserver {};
diff --git a/examples/gateway_simple.rs b/examples/gateway_simple.rs
index e8ff59a..aa6e0e0 100644
--- a/examples/gateway_simple.rs
+++ b/examples/gateway_simple.rs
@@ -3,7 +3,7 @@
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
// This example showcases how to initiate a gateway connection manually
-// (e. g. not through ChorusUser)
+// (e. g. not through ChorusUser or Instance)
//
// To properly run it, you will need to modify the token below.
@@ -14,7 +14,7 @@ const GATEWAY_URL: &str = "wss://gateway.old.server.spacebar.chat/";
use std::time::Duration;
-use chorus::gateway::Gateway;
+use chorus::gateway::{Gateway, GatewayOptions};
use chorus::{self, types::GatewayIdentifyPayload};
#[cfg(not(target_arch = "wasm32"))]
@@ -25,10 +25,18 @@ use wasmtimer::tokio::sleep;
/// This example creates a simple gateway connection and a session with an Identify event
#[tokio::main(flavor = "current_thread")]
async fn main() {
- let gateway_websocket_url = GATEWAY_URL.to_string();
+ let gateway_websocket_url = GATEWAY_URL;
+
+ // These options specify the encoding format, compression, etc
+ //
+ // For most cases the defaults should work, though some implementations
+ // might only support some formats or not support compression
+ let options = GatewayOptions::default();
// Initiate the gateway connection, starting a listener in one thread and a heartbeat handler in another
- let gateway = Gateway::spawn(gateway_websocket_url).await.unwrap();
+ let gateway = Gateway::spawn(gateway_websocket_url, options)
+ .await
+ .unwrap();
// At this point, we are connected to the server and are sending heartbeats, however we still haven't authenticated
diff --git a/examples/instance.rs b/examples/instance.rs
index 0bbdc17..5f685f9 100644
--- a/examples/instance.rs
+++ b/examples/instance.rs
@@ -6,7 +6,7 @@ use chorus::instance::Instance;
#[tokio::main(flavor = "current_thread")]
async fn main() {
- let instance = Instance::new("https://example.com/")
+ let instance = Instance::new("https://example.com/", None)
.await
.expect("Failed to connect to the Spacebar server");
dbg!(instance.instance_info);
diff --git a/examples/login.rs b/examples/login.rs
index e89d8d2..f9ebcf0 100644
--- a/examples/login.rs
+++ b/examples/login.rs
@@ -7,7 +7,7 @@ use chorus::types::LoginSchema;
#[tokio::main(flavor = "current_thread")]
async fn main() {
- let mut instance = Instance::new("https://example.com/")
+ let mut instance = Instance::new("https://example.com/", None)
.await
.expect("Failed to connect to the Spacebar server");
// Assume, you already have an account created on this instance. Registering an account works
diff --git a/examples/voice_simple/src/main.rs b/examples/voice_simple/src/main.rs
index a6f77db..f0f5f8f 100644
--- a/examples/voice_simple/src/main.rs
+++ b/examples/voice_simple/src/main.rs
@@ -22,11 +22,9 @@ use simplelog::{TermLogger, Config, WriteLogger};
use std::{net::SocketAddrV4, sync::Arc, fs::File, time::Duration};
use chorus::{
- gateway::{Observer, Gateway},
+ gateway::{Gateway, GatewayOptions, Observer},
types::{
- GatewayReady, SelectProtocol, SelectProtocolData, SessionDescription, Snowflake, Speaking,
- SpeakingBitflags, SsrcDefinition, VoiceEncryptionMode, VoiceIdentify, VoiceProtocol,
- VoiceReady, VoiceServerUpdate, GatewayIdentifyPayload, UpdateVoiceState,
+ GatewayIdentifyPayload, GatewayReady, SelectProtocol, SelectProtocolData, SessionDescription, Snowflake, Speaking, SpeakingBitflags, SsrcDefinition, UpdateVoiceState, VoiceEncryptionMode, VoiceIdentify, VoiceProtocol, VoiceReady, VoiceServerUpdate
},
voice::{
gateway::{VoiceGateway, VoiceGatewayHandle},
@@ -219,7 +217,7 @@ impl Observer for VoiceHandler {
println!(
"Received Speaking! (SRRC: {}, flags: {:?})",
data.ssrc,
- SpeakingBitflags::from_bits(data.speaking).unwrap()
+ SpeakingBitflags::from_bits(data.speaking.into()).unwrap()
);
}
}
@@ -253,7 +251,7 @@ async fn main() {
])
.unwrap();
- let gateway = Gateway::spawn(GATEWAY_URL.to_string())
+ let gateway = Gateway::spawn(GATEWAY_URL.to_string(), GatewayOptions::default())
.await
.unwrap();
@@ -281,7 +279,7 @@ async fn main() {
.session
.ready
.subscribe(voice_handler.clone());
-
+
// Data which channel to update the local user to be joined into.
//
// guild_id and channel_id can be some to join guild voice channels
diff --git a/semver_release_checks.yml b/semver_release_checks.yml
new file mode 100644
index 0000000..12dd718
--- /dev/null
+++ b/semver_release_checks.yml
@@ -0,0 +1,18 @@
+name: Semver release checks
+
+on:
+ pull_request:
+ branches: ["main"]
+
+env:
+ CARGO_TERM_COLOR: always
+
+jobs:
+ semver-checks:
+
+ runs-on: ubuntu-latest
+ timeout-minutes: 60
+
+ steps:
+ - uses: actions/checkout@v4
+ - uses: obi1kenobi/cargo-semver-checks-action@v2
diff --git a/src/api/auth/login.rs b/src/api/auth/login.rs
index 7689af7..3a9a9ee 100644
--- a/src/api/auth/login.rs
+++ b/src/api/auth/login.rs
@@ -11,7 +11,7 @@ use crate::errors::ChorusResult;
use crate::gateway::Gateway;
use crate::instance::{ChorusUser, Instance};
use crate::ratelimiter::ChorusRequest;
-use crate::types::{GatewayIdentifyPayload, LimitType, LoginResult, LoginSchema};
+use crate::types::{GatewayIdentifyPayload, LimitType, LoginResult, LoginSchema, User};
impl Instance {
/// Logs into an existing account on the spacebar server.
@@ -30,27 +30,21 @@ impl Instance {
// We do not have a user yet, and the UserRateLimits will not be affected by a login
// request (since login is an instance wide limit), which is why we are just cloning the
// instances' limits to pass them on as user_rate_limits later.
- let mut shell =
- ChorusUser::shell(Arc::new(RwLock::new(self.clone())), "None".to_string()).await;
+ let mut user = ChorusUser::shell(Arc::new(RwLock::new(self.clone())), "None").await;
+
let login_result = chorus_request
- .deserialize_response::(&mut shell)
+ .deserialize_response::(&mut user)
.await?;
- let object = self.get_user(login_result.token.clone(), None).await?;
- if self.limits_information.is_some() {
- self.limits_information.as_mut().unwrap().ratelimits = shell.limits.clone().unwrap();
- }
+ user.set_token(&login_result.token);
+ user.settings = login_result.settings;
+
+ let object = User::get(&mut user, None).await?;
+ *user.object.write().unwrap() = object;
+
let mut identify = GatewayIdentifyPayload::common();
- let gateway = Gateway::spawn(self.urls.wss.clone()).await.unwrap();
- identify.token = login_result.token.clone();
- gateway.send_identify(identify).await;
- let user = ChorusUser::new(
- Arc::new(RwLock::new(self.clone())),
- login_result.token,
- self.clone_limits_if_some(),
- login_result.settings,
- Arc::new(RwLock::new(object)),
- gateway,
- );
+ identify.token = user.token();
+ user.gateway.send_identify(identify).await;
+
Ok(user)
}
}
diff --git a/src/api/auth/mod.rs b/src/api/auth/mod.rs
index 5bd539f..b9050e1 100644
--- a/src/api/auth/mod.rs
+++ b/src/api/auth/mod.rs
@@ -22,27 +22,19 @@ pub mod register;
impl Instance {
/// Logs into an existing account on the spacebar server, using only a token.
- pub async fn login_with_token(&mut self, token: String) -> ChorusResult {
- let object_result = self.get_user(token.clone(), None).await;
- if let Err(e) = object_result {
- return Result::Err(e);
- }
+ pub async fn login_with_token(&mut self, token: &str) -> ChorusResult {
+ let mut user = ChorusUser::shell(Arc::new(RwLock::new(self.clone())), token).await;
+
+ let object = User::get(&mut user, None).await?;
+ let settings = User::get_settings(&mut user).await?;
+
+ *user.object.write().unwrap() = object;
+ *user.settings.write().unwrap() = settings;
- let user_settings = User::get_settings(&token, &self.urls.api, &mut self.clone())
- .await
- .unwrap();
let mut identify = GatewayIdentifyPayload::common();
- let gateway = Gateway::spawn(self.urls.wss.clone()).await.unwrap();
- identify.token = token.clone();
- gateway.send_identify(identify).await;
- let user = ChorusUser::new(
- Arc::new(RwLock::new(self.clone())),
- token.clone(),
- self.clone_limits_if_some(),
- Arc::new(RwLock::new(user_settings)),
- Arc::new(RwLock::new(object_result.unwrap())),
- gateway,
- );
+ identify.token = user.token();
+ user.gateway.send_identify(identify).await;
+
Ok(user)
}
}
diff --git a/src/api/auth/register.rs b/src/api/auth/register.rs
index deece4d..821a52f 100644
--- a/src/api/auth/register.rs
+++ b/src/api/auth/register.rs
@@ -8,7 +8,7 @@ use reqwest::Client;
use serde_json::to_string;
use crate::gateway::{Gateway, GatewayHandle};
-use crate::types::GatewayIdentifyPayload;
+use crate::types::{GatewayIdentifyPayload, User};
use crate::{
errors::ChorusResult,
instance::{ChorusUser, Instance, Token},
@@ -37,29 +37,24 @@ impl Instance {
// We do not have a user yet, and the UserRateLimits will not be affected by a login
// request (since register is an instance wide limit), which is why we are just cloning
// the instances' limits to pass them on as user_rate_limits later.
- let mut shell =
- ChorusUser::shell(Arc::new(RwLock::new(self.clone())), "None".to_string()).await;
+ let mut user = ChorusUser::shell(Arc::new(RwLock::new(self.clone())), "None").await;
+
let token = chorus_request
- .deserialize_response::(&mut shell)
+ .deserialize_response::(&mut user)
.await?
.token;
- if self.limits_information.is_some() {
- self.limits_information.as_mut().unwrap().ratelimits = shell.limits.unwrap();
- }
- let user_object = self.get_user(token.clone(), None).await.unwrap();
- let settings = ChorusUser::get_settings(&token, &self.urls.api.clone(), self).await?;
+ user.set_token(&token);
+
+ let object = User::get(&mut user, None).await?;
+ let settings = User::get_settings(&mut user).await?;
+
+ *user.object.write().unwrap() = object;
+ *user.settings.write().unwrap() = settings;
+
let mut identify = GatewayIdentifyPayload::common();
- let gateway: GatewayHandle = Gateway::spawn(self.urls.wss.clone()).await.unwrap();
- identify.token = token.clone();
- gateway.send_identify(identify).await;
- let user = ChorusUser::new(
- Arc::new(RwLock::new(self.clone())),
- token.clone(),
- self.clone_limits_if_some(),
- Arc::new(RwLock::new(settings)),
- Arc::new(RwLock::new(user_object)),
- gateway,
- );
+ identify.token = user.token();
+ user.gateway.send_identify(identify).await;
+
Ok(user)
}
}
diff --git a/src/api/channels/messages.rs b/src/api/channels/messages.rs
index feabc37..a682c21 100644
--- a/src/api/channels/messages.rs
+++ b/src/api/channels/messages.rs
@@ -16,6 +16,7 @@ use crate::types::{
};
impl Message {
+ #[allow(clippy::useless_conversion)]
/// Sends a message in the channel with the provided channel_id.
/// Returns the sent message.
///
@@ -40,7 +41,7 @@ impl Message {
chorus_request.deserialize_response::(user).await
} else {
for (index, attachment) in message.attachments.iter_mut().enumerate() {
- attachment.get_mut(index).unwrap().id = Some(index as i16);
+ attachment.get_mut(index).unwrap().id = Some((index as u64).into());
}
let mut form = reqwest::multipart::Form::new();
let payload_json = to_string(&message).unwrap();
@@ -111,7 +112,7 @@ impl Message {
let result = request.send_request(user).await?;
let result_json = result.json::().await.unwrap();
if !result_json.is_object() {
- return Err(search_error(result_json.to_string()));
+ return Err(search_error(result_json.to_string().as_str()));
}
let value_map = result_json.as_object().unwrap();
if let Some(messages) = value_map.get("messages") {
@@ -122,7 +123,7 @@ impl Message {
}
// The code below might be incorrect. We'll cross that bridge when we come to it
if !value_map.contains_key("code") || !value_map.contains_key("retry_after") {
- return Err(search_error(result_json.to_string()));
+ return Err(search_error(result_json.to_string().as_str()));
}
let code = value_map.get("code").unwrap().as_u64().unwrap();
let retry_after = value_map.get("retry_after").unwrap().as_u64().unwrap();
@@ -481,7 +482,7 @@ impl Message {
}
}
-fn search_error(result_text: String) -> ChorusError {
+fn search_error(result_text: &str) -> ChorusError {
ChorusError::InvalidResponse {
error: format!(
"Got unexpected Response, or Response which is not valid JSON. Response: \n{}",
diff --git a/src/api/channels/reactions.rs b/src/api/channels/reactions.rs
index b7c42e1..f2de33d 100644
--- a/src/api/channels/reactions.rs
+++ b/src/api/channels/reactions.rs
@@ -10,7 +10,7 @@ use crate::{
};
/// Useful metadata for working with [`types::Reaction`], bundled together nicely.
-#[derive(Debug, Clone, PartialEq, Eq)]
+#[derive(Debug, Clone, PartialEq, Eq, Copy, Hash, PartialOrd, Ord)]
pub struct ReactionMeta {
pub message_id: types::Snowflake,
pub channel_id: types::Snowflake,
diff --git a/src/api/users/guilds.rs b/src/api/users/guilds.rs
index aac2f7a..46a25fb 100644
--- a/src/api/users/guilds.rs
+++ b/src/api/users/guilds.rs
@@ -44,6 +44,16 @@ impl ChorusUser {
&mut self,
query: Option,
) -> ChorusResult> {
+
+ let query_parameters = {
+ if let Some(query_some) = query {
+ query_some.to_query()
+ }
+ else {
+ Vec::new()
+ }
+ };
+
let url = format!(
"{}/users/@me/guilds",
self.belongs_to.read().unwrap().urls.api,
@@ -53,7 +63,7 @@ impl ChorusUser {
.get(url)
.header("Authorization", self.token())
.header("Content-Type", "application/json")
- .body(to_string(&query).unwrap()),
+ .query(&query_parameters),
limit_type: LimitType::Global,
};
diff --git a/src/api/users/users.rs b/src/api/users/users.rs
index b80bc1e..4f6ef57 100644
--- a/src/api/users/users.rs
+++ b/src/api/users/users.rs
@@ -30,13 +30,9 @@ impl ChorusUser {
/// Gets the user's settings.
///
/// # Notes
- /// This functions is a wrapper around [`User::get_settings`].
- pub async fn get_settings(
- token: &String,
- url_api: &String,
- instance: &mut Instance,
- ) -> ChorusResult {
- User::get_settings(token, url_api, instance).await
+ /// This function is a wrapper around [`User::get_settings`].
+ pub async fn get_settings(&mut self) -> ChorusResult {
+ User::get_settings(self).await
}
/// Modifies the current user's representation. (See [`User`])
@@ -44,12 +40,18 @@ impl ChorusUser {
/// # Reference
/// See
pub async fn modify(&mut self, modify_schema: UserModifySchema) -> ChorusResult {
- if modify_schema.new_password.is_some()
+
+ // See , note 1
+ let requires_current_password = modify_schema.username.is_some()
+ || modify_schema.discriminator.is_some()
|| modify_schema.email.is_some()
- || modify_schema.code.is_some()
- {
+ || modify_schema.date_of_birth.is_some()
+ || modify_schema.new_password.is_some();
+
+ if requires_current_password && modify_schema.current_password.is_none() {
return Err(ChorusError::PasswordRequired);
}
+
let request = Client::new()
.patch(format!(
"{}/users/@me",
@@ -118,56 +120,21 @@ impl User {
///
/// # Reference
/// See
- pub async fn get_settings(
- token: &String,
- url_api: &String,
- instance: &mut Instance,
- ) -> ChorusResult {
+ pub async fn get_settings(user: &mut ChorusUser) -> ChorusResult {
+ let url_api = user.belongs_to.read().unwrap().urls.api.clone();
let request: reqwest::RequestBuilder = Client::new()
.get(format!("{}/users/@me/settings", url_api))
- .header("Authorization", token);
- let mut user =
- ChorusUser::shell(Arc::new(RwLock::new(instance.clone())), token.clone()).await;
+ .header("Authorization", user.token());
let chorus_request = ChorusRequest {
request,
limit_type: LimitType::Global,
};
- let result = match chorus_request.send_request(&mut user).await {
- Ok(result) => Ok(serde_json::from_str(&result.text().await.unwrap()).unwrap()),
+ match chorus_request.send_request(user).await {
+ Ok(result) => {
+ let result_text = result.text().await.unwrap();
+ Ok(serde_json::from_str(&result_text).unwrap())
+ }
Err(e) => Err(e),
- };
- if instance.limits_information.is_some() {
- instance.limits_information.as_mut().unwrap().ratelimits = user
- .belongs_to
- .read()
- .unwrap()
- .clone_limits_if_some()
- .unwrap();
}
- result
- }
-}
-
-impl Instance {
- /// Gets a user by id, or if the id is None, gets the current user.
- ///
- /// # Notes
- /// This function is a wrapper around [`User::get`].
- ///
- /// # Reference
- /// See and
- ///
- pub async fn get_user(&mut self, token: String, id: Option<&String>) -> ChorusResult {
- let mut user = ChorusUser::shell(Arc::new(RwLock::new(self.clone())), token).await;
- let result = User::get(&mut user, id).await;
- if self.limits_information.is_some() {
- self.limits_information.as_mut().unwrap().ratelimits = user
- .belongs_to
- .read()
- .unwrap()
- .clone_limits_if_some()
- .unwrap();
- }
- result
}
}
diff --git a/src/errors.rs b/src/errors.rs
index a2f174d..0d130dd 100644
--- a/src/errors.rs
+++ b/src/errors.rs
@@ -6,6 +6,7 @@
use custom_error::custom_error;
use crate::types::WebSocketEvent;
+use chorus_macros::WebSocketEvent;
custom_error! {
#[derive(PartialEq, Eq, Clone, Hash)]
@@ -72,7 +73,7 @@ custom_error! {
/// Supposed to be sent as numbers, though they are sent as string most of the time?
///
/// Also includes errors when initiating a connection and unexpected opcodes
- #[derive(PartialEq, Eq, Default, Clone)]
+ #[derive(PartialEq, Eq, Default, Clone, WebSocketEvent)]
pub GatewayError
// Errors we have received from the gateway
#[default]
@@ -92,22 +93,20 @@ custom_error! {
DisallowedIntents = "You sent a disallowed intent. You may have tried to specify an intent that you have not enabled or are not approved for",
// Errors when initiating a gateway connection
- CannotConnect{error: String} = "Cannot connect due to a tungstenite error: {error}",
+ CannotConnect{error: String} = "Cannot connect due to a websocket error: {error}",
NonHelloOnInitiate{opcode: u8} = "Received non hello on initial gateway connection ({opcode}), something is definitely wrong",
// Other misc errors
UnexpectedOpcodeReceived{opcode: u8} = "Received an opcode we weren't expecting to receive: {opcode}",
}
-impl WebSocketEvent for GatewayError {}
-
custom_error! {
/// Voice Gateway errors
///
/// Similar to [GatewayError].
///
/// See ;
- #[derive(Clone, Default, PartialEq, Eq)]
+ #[derive(Clone, Default, PartialEq, Eq, WebSocketEvent)]
pub VoiceGatewayError
// Errors we receive
#[default]
@@ -125,18 +124,16 @@ custom_error! {
UnknownEncryptionMode = "Server failed to decrypt data",
// Errors when initiating a gateway connection
- CannotConnect{error: String} = "Cannot connect due to a tungstenite error: {error}",
+ CannotConnect{error: String} = "Cannot connect due to a websocket error: {error}",
NonHelloOnInitiate{opcode: u8} = "Received non hello on initial gateway connection ({opcode}), something is definitely wrong",
// Other misc errors
UnexpectedOpcodeReceived{opcode: u8} = "Received an opcode we weren't expecting to receive: {opcode}",
}
-impl WebSocketEvent for VoiceGatewayError {}
-
custom_error! {
/// Voice UDP errors.
- #[derive(Clone, PartialEq, Eq)]
+ #[derive(Clone, PartialEq, Eq, WebSocketEvent)]
pub VoiceUdpError
// General errors
@@ -155,4 +152,3 @@ custom_error! {
CannotConnect{error: String} = "Cannot connect due to a UDP error: {error}",
}
-impl WebSocketEvent for VoiceUdpError {}
diff --git a/src/gateway/backends/tungstenite.rs b/src/gateway/backends/tungstenite.rs
index a9f9f64..4464f8d 100644
--- a/src/gateway/backends/tungstenite.rs
+++ b/src/gateway/backends/tungstenite.rs
@@ -2,19 +2,21 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+use custom_error::custom_error;
use futures_util::{
stream::{SplitSink, SplitStream},
StreamExt,
};
use tokio::net::TcpStream;
use tokio_tungstenite::{
- connect_async_tls_with_config, tungstenite, Connector, MaybeTlsStream, WebSocketStream,
+ connect_async_tls_with_config, connect_async_with_config, tungstenite, Connector,
+ MaybeTlsStream, WebSocketStream,
};
+use url::Url;
-use crate::errors::GatewayError;
-use crate::gateway::GatewayMessage;
+use crate::gateway::{GatewayMessage, RawGatewayMessage};
-#[derive(Debug, Clone)]
+#[derive(Debug, Clone, Copy)]
pub struct TungsteniteBackend;
// These could be made into inherent associated types when that's stabilized
@@ -22,46 +24,70 @@ pub type TungsteniteSink =
SplitSink>, tungstenite::Message>;
pub type TungsteniteStream = SplitStream>>;
+custom_error! {
+ pub TungsteniteBackendError
+ FailedToLoadCerts{error: std::io::Error} = "failed to load platform native certs: {error}",
+ TungsteniteError{error: tungstenite::error::Error} = "encountered a tungstenite error: {error}",
+}
+
impl TungsteniteBackend {
pub async fn connect(
websocket_url: &str,
- ) -> Result<(TungsteniteSink, TungsteniteStream), crate::errors::GatewayError> {
- let mut roots = rustls::RootCertStore::empty();
- let certs = rustls_native_certs::load_native_certs();
+ ) -> Result<(TungsteniteSink, TungsteniteStream), TungsteniteBackendError> {
+ let websocket_url_parsed =
+ Url::parse(websocket_url).map_err(|_| TungsteniteBackendError::TungsteniteError {
+ error: tungstenite::error::Error::Url(
+ tungstenite::error::UrlError::UnsupportedUrlScheme,
+ ),
+ })?;
+ if websocket_url_parsed.scheme() == "ws" {
+ let (websocket_stream, _) =
+ match connect_async_with_config(websocket_url, None, false).await {
+ Ok(websocket_stream) => websocket_stream,
+ Err(e) => return Err(TungsteniteBackendError::TungsteniteError { error: e }),
+ };
- if let Err(e) = certs {
- log::error!("Failed to load platform native certs! {:?}", e);
- return Err(GatewayError::CannotConnect {
- error: format!("{:?}", e),
- });
+ Ok(websocket_stream.split())
+ } else if websocket_url_parsed.scheme() == "wss" {
+ let certs = webpki_roots::TLS_SERVER_ROOTS;
+ let roots = rustls::RootCertStore {
+ roots: certs
+ .iter()
+ .map(|cert| {
+ rustls::OwnedTrustAnchor::from_subject_spki_name_constraints(
+ cert.subject.to_vec(),
+ cert.subject_public_key_info.to_vec(),
+ cert.name_constraints.as_ref().map(|der| der.to_vec()),
+ )
+ })
+ .collect(),
+ };
+ let (websocket_stream, _) = match connect_async_tls_with_config(
+ websocket_url,
+ None,
+ false,
+ Some(Connector::Rustls(
+ rustls::ClientConfig::builder()
+ .with_safe_defaults()
+ .with_root_certificates(roots)
+ .with_no_client_auth()
+ .into(),
+ )),
+ )
+ .await
+ {
+ Ok(websocket_stream) => websocket_stream,
+ Err(e) => return Err(TungsteniteBackendError::TungsteniteError { error: e }),
+ };
+
+ Ok(websocket_stream.split())
+ } else {
+ Err(TungsteniteBackendError::TungsteniteError {
+ error: tungstenite::error::Error::Url(
+ tungstenite::error::UrlError::UnsupportedUrlScheme,
+ ),
+ })
}
-
- for cert in certs.unwrap() {
- roots.add(&rustls::Certificate(cert.0)).unwrap();
- }
- let (websocket_stream, _) = match connect_async_tls_with_config(
- websocket_url,
- None,
- false,
- Some(Connector::Rustls(
- rustls::ClientConfig::builder()
- .with_safe_defaults()
- .with_root_certificates(roots)
- .with_no_client_auth()
- .into(),
- )),
- )
- .await
- {
- Ok(websocket_stream) => websocket_stream,
- Err(e) => {
- return Err(GatewayError::CannotConnect {
- error: e.to_string(),
- })
- }
- };
-
- Ok(websocket_stream.split())
}
}
@@ -76,3 +102,22 @@ impl From for GatewayMessage {
Self(value.to_string())
}
}
+
+impl From for tungstenite::Message {
+ fn from(message: RawGatewayMessage) -> Self {
+ match message {
+ RawGatewayMessage::Text(text) => tungstenite::Message::Text(text),
+ RawGatewayMessage::Bytes(bytes) => tungstenite::Message::Binary(bytes),
+ }
+ }
+}
+
+impl From for RawGatewayMessage {
+ fn from(value: tungstenite::Message) -> Self {
+ match value {
+ tungstenite::Message::Binary(bytes) => RawGatewayMessage::Bytes(bytes),
+ tungstenite::Message::Text(text) => RawGatewayMessage::Text(text),
+ _ => RawGatewayMessage::Text(value.to_string()),
+ }
+ }
+}
diff --git a/src/gateway/backends/wasm.rs b/src/gateway/backends/wasm.rs
index 83f4b37..e0fd9c6 100644
--- a/src/gateway/backends/wasm.rs
+++ b/src/gateway/backends/wasm.rs
@@ -9,8 +9,7 @@ use futures_util::{
use ws_stream_wasm::*;
-use crate::errors::GatewayError;
-use crate::gateway::GatewayMessage;
+use crate::gateway::{GatewayMessage, RawGatewayMessage};
#[derive(Debug, Clone)]
pub struct WasmBackend;
@@ -22,13 +21,8 @@ pub type WasmStream = SplitStream;
impl WasmBackend {
pub async fn connect(
websocket_url: &str,
- ) -> Result<(WasmSink, WasmStream), crate::errors::GatewayError> {
- let (_, websocket_stream) = match WsMeta::connect(websocket_url, None).await {
- Ok(stream) => Ok(stream),
- Err(e) => Err(GatewayError::CannotConnect {
- error: e.to_string(),
- }),
- }?;
+ ) -> Result<(WasmSink, WasmStream), ws_stream_wasm::WsErr> {
+ let (_, websocket_stream) = WsMeta::connect(websocket_url, None).await?;
Ok(websocket_stream.split())
}
@@ -52,3 +46,21 @@ impl From for GatewayMessage {
}
}
}
+
+impl From for WsMessage {
+ fn from(message: RawGatewayMessage) -> Self {
+ match message {
+ RawGatewayMessage::Text(text) => WsMessage::Text(text),
+ RawGatewayMessage::Bytes(bytes) => WsMessage::Binary(bytes),
+ }
+ }
+}
+
+impl From for RawGatewayMessage {
+ fn from(value: WsMessage) -> Self {
+ match value {
+ WsMessage::Binary(bytes) => RawGatewayMessage::Bytes(bytes),
+ WsMessage::Text(text) => RawGatewayMessage::Text(text),
+ }
+ }
+}
diff --git a/src/gateway/events.rs b/src/gateway/events.rs
index 8d38cca..049434b 100644
--- a/src/gateway/events.rs
+++ b/src/gateway/events.rs
@@ -2,6 +2,8 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+use pubserve::Publisher;
+
use super::*;
use crate::types;
@@ -23,144 +25,144 @@ pub struct Events {
pub call: Call,
pub voice: Voice,
pub webhooks: Webhooks,
- pub gateway_identify_payload: GatewayEvent,
- pub gateway_resume: GatewayEvent,
- pub error: GatewayEvent,
+ pub gateway_identify_payload: Publisher,
+ pub gateway_resume: Publisher,
+ pub error: Publisher,
}
#[derive(Default, Debug)]
pub struct Application {
- pub command_permissions_update: GatewayEvent,
+ pub command_permissions_update: Publisher,
}
#[derive(Default, Debug)]
pub struct AutoModeration {
- pub rule_create: GatewayEvent,
- pub rule_update: GatewayEvent,
- pub rule_delete: GatewayEvent,
- pub action_execution: GatewayEvent,
+ pub rule_create: Publisher,
+ pub rule_update: Publisher,
+ pub rule_delete: Publisher,
+ pub action_execution: Publisher,
}
#[derive(Default, Debug)]
pub struct Session {
- pub ready: GatewayEvent,
- pub ready_supplemental: GatewayEvent,
- pub replace: GatewayEvent,
- pub reconnect: GatewayEvent,
- pub invalid: GatewayEvent,
+ pub ready: Publisher,
+ pub ready_supplemental: Publisher,
+ pub replace: Publisher,
+ pub reconnect: Publisher,
+ pub invalid: Publisher,
}
#[derive(Default, Debug)]
pub struct StageInstance {
- pub create: GatewayEvent,
- pub update: GatewayEvent,
- pub delete: GatewayEvent,
+ pub create: Publisher,
+ pub update: Publisher,
+ pub delete: Publisher,
}
#[derive(Default, Debug)]
pub struct Message {
- pub create: GatewayEvent,
- pub update: GatewayEvent,
- pub delete: GatewayEvent,
- pub delete_bulk: GatewayEvent,
- pub reaction_add: GatewayEvent,
- pub reaction_remove: GatewayEvent,
- pub reaction_remove_all: GatewayEvent,
- pub reaction_remove_emoji: GatewayEvent,
- pub ack: GatewayEvent,
+ pub create: Publisher,
+ pub update: Publisher,
+ pub delete: Publisher,
+ pub delete_bulk: Publisher,
+ pub reaction_add: Publisher,
+ pub reaction_remove: Publisher,
+ pub reaction_remove_all: Publisher,
+ pub reaction_remove_emoji: Publisher,
+ pub ack: Publisher,
}
#[derive(Default, Debug)]
pub struct User {
- pub update: GatewayEvent,
- pub guild_settings_update: GatewayEvent,
- pub presence_update: GatewayEvent,
- pub typing_start: GatewayEvent,
+ pub update: Publisher,
+ pub guild_settings_update: Publisher,
+ pub presence_update: Publisher,
+ pub typing_start: Publisher,
}
#[derive(Default, Debug)]
pub struct Relationship {
- pub add: GatewayEvent,
- pub remove: GatewayEvent,
+ pub add: Publisher,
+ pub remove: Publisher,
}
#[derive(Default, Debug)]
pub struct Channel {
- pub create: GatewayEvent,
- pub update: GatewayEvent,
- pub unread_update: GatewayEvent,
- pub delete: GatewayEvent,
- pub pins_update: GatewayEvent,
+ pub create: Publisher,
+ pub update: Publisher,
+ pub unread_update: Publisher,
+ pub delete: Publisher,
+ pub pins_update: Publisher,
}
#[derive(Default, Debug)]
pub struct Thread {
- pub create: GatewayEvent,
- pub update: GatewayEvent,
- pub delete: GatewayEvent,
- pub list_sync: GatewayEvent,
- pub member_update: GatewayEvent,
- pub members_update: GatewayEvent,
+ pub create: Publisher,
+ pub update: Publisher,
+ pub delete: Publisher,
+ pub list_sync: Publisher,
+ pub member_update: Publisher,
+ pub members_update: Publisher,
}
#[derive(Default, Debug)]
pub struct Guild {
- pub create: GatewayEvent,
- pub update: GatewayEvent,
- pub delete: GatewayEvent,
- pub audit_log_entry_create: GatewayEvent,
- pub ban_add: GatewayEvent,
- pub ban_remove: GatewayEvent,
- pub emojis_update: GatewayEvent,
- pub stickers_update: GatewayEvent,
- pub integrations_update: GatewayEvent,
- pub member_add: GatewayEvent,
- pub member_remove: GatewayEvent,
- pub member_update: GatewayEvent,
- pub members_chunk: GatewayEvent,
- pub role_create: GatewayEvent,
- pub role_update: GatewayEvent,
- pub role_delete: GatewayEvent,
- pub role_scheduled_event_create: GatewayEvent,
- pub role_scheduled_event_update: GatewayEvent,
- pub role_scheduled_event_delete: GatewayEvent,
- pub role_scheduled_event_user_add: GatewayEvent,
- pub role_scheduled_event_user_remove: GatewayEvent,
- pub passive_update_v1: GatewayEvent,
+ pub create: Publisher,
+ pub update: Publisher,
+ pub delete: Publisher,
+ pub audit_log_entry_create: Publisher,
+ pub ban_add: Publisher,
+ pub ban_remove: Publisher,
+ pub emojis_update: Publisher,
+ pub stickers_update: Publisher,
+ pub integrations_update: Publisher,
+ pub member_add: Publisher,
+ pub member_remove: Publisher,
+ pub member_update: Publisher,
+ pub members_chunk: Publisher,
+ pub role_create: Publisher,
+ pub role_update: Publisher,
+ pub role_delete: Publisher,
+ pub role_scheduled_event_create: Publisher,
+ pub role_scheduled_event_update: Publisher,
+ pub role_scheduled_event_delete: Publisher,
+ pub role_scheduled_event_user_add: Publisher,
+ pub role_scheduled_event_user_remove: Publisher,
+ pub passive_update_v1: Publisher,
}
#[derive(Default, Debug)]
pub struct Invite {
- pub create: GatewayEvent,
- pub delete: GatewayEvent,
+ pub create: Publisher,
+ pub delete: Publisher,
}
#[derive(Default, Debug)]
pub struct Integration {
- pub create: GatewayEvent,
- pub update: GatewayEvent,
- pub delete: GatewayEvent,
+ pub create: Publisher,
+ pub update: Publisher,
+ pub delete: Publisher,
}
#[derive(Default, Debug)]
pub struct Interaction {
- pub create: GatewayEvent,
+ pub create: Publisher,
}
#[derive(Default, Debug)]
pub struct Call {
- pub create: GatewayEvent,
- pub update: GatewayEvent,
- pub delete: GatewayEvent,
+ pub create: Publisher,
+ pub update: Publisher,
+ pub delete: Publisher,
}
#[derive(Default, Debug)]
pub struct Voice {
- pub state_update: GatewayEvent,
- pub server_update: GatewayEvent,
+ pub state_update: Publisher,
+ pub server_update: Publisher,
}
#[derive(Default, Debug)]
pub struct Webhooks {
- pub update: GatewayEvent,
+ pub update: Publisher,
}
diff --git a/src/gateway/gateway.rs b/src/gateway/gateway.rs
index dabfeb6..976769d 100644
--- a/src/gateway/gateway.rs
+++ b/src/gateway/gateway.rs
@@ -4,8 +4,10 @@
use std::time::Duration;
+use flate2::Decompress;
use futures_util::{SinkExt, StreamExt};
use log::*;
+use pubserve::Publisher;
#[cfg(not(target_arch = "wasm32"))]
use tokio::task;
@@ -19,6 +21,9 @@ use crate::types::{
WebSocketEvent,
};
+/// Tells us we have received enough of the buffer to decompress it
+const ZLIB_SUFFIX: [u8; 4] = [0, 0, 255, 255];
+
#[derive(Debug)]
pub struct Gateway {
events: Arc>,
@@ -28,14 +33,36 @@ pub struct Gateway {
kill_send: tokio::sync::broadcast::Sender<()>,
kill_receive: tokio::sync::broadcast::Receiver<()>,
store: Arc>>>>,
+ /// Url which was used to initialize the gateway
url: String,
+ /// Options which were used to initialize the gateway
+ options: GatewayOptions,
+ zlib_inflate: Option,
+ zlib_buffer: Option>,
}
impl Gateway {
#[allow(clippy::new_ret_no_self)]
- pub async fn spawn(websocket_url: String) -> Result {
- let (websocket_send, mut websocket_receive) =
- WebSocketBackend::connect(&websocket_url).await?;
+ /// Creates / opens a new gateway connection.
+ ///
+ /// # Note
+ /// The websocket url should begin with the prefix wss:// or ws:// (for unsecure connections)
+ pub async fn spawn(
+ websocket_url: &str,
+ options: GatewayOptions,
+ ) -> Result {
+ let url = options.add_to_url(websocket_url);
+
+ debug!("GW: Connecting to {}", url);
+
+ let (websocket_send, mut websocket_receive) = match WebSocketBackend::connect(&url).await {
+ Ok(streams) => streams,
+ Err(e) => {
+ return Err(GatewayError::CannotConnect {
+ error: format!("{:?}", e),
+ });
+ }
+ };
let shared_websocket_send = Arc::new(Mutex::new(websocket_send));
@@ -45,10 +72,34 @@ impl Gateway {
// Wait for the first hello and then spawn both tasks so we avoid nested tasks
// This automatically spawns the heartbeat task, but from the main thread
#[cfg(not(target_arch = "wasm32"))]
- let msg: GatewayMessage = websocket_receive.next().await.unwrap().unwrap().into();
+ let received: RawGatewayMessage = websocket_receive.next().await.unwrap().unwrap().into();
#[cfg(target_arch = "wasm32")]
- let msg: GatewayMessage = websocket_receive.next().await.unwrap().into();
- let gateway_payload: types::GatewayReceivePayload = serde_json::from_str(&msg.0).unwrap();
+ let received: RawGatewayMessage = websocket_receive.next().await.unwrap().into();
+
+ let message: GatewayMessage;
+
+ let zlib_buffer;
+ let zlib_inflate;
+
+ match options.transport_compression {
+ GatewayTransportCompression::None => {
+ zlib_buffer = None;
+ zlib_inflate = None;
+ message = GatewayMessage::from_raw_json_message(received).unwrap();
+ }
+ GatewayTransportCompression::ZLibStream => {
+ zlib_buffer = Some(Vec::new());
+ let mut inflate = Decompress::new(true);
+
+ message =
+ GatewayMessage::from_zlib_stream_json_message(received, &mut inflate).unwrap();
+
+ zlib_inflate = Some(inflate);
+ }
+ }
+
+ let gateway_payload: types::GatewayReceivePayload =
+ serde_json::from_str(&message.0).unwrap();
if gateway_payload.op_code != GATEWAY_HELLO {
return Err(GatewayError::NonHelloOnInitiate {
@@ -78,7 +129,10 @@ impl Gateway {
kill_send: kill_send.clone(),
kill_receive: kill_send.subscribe(),
store: store.clone(),
- url: websocket_url.clone(),
+ url: url.clone(),
+ options,
+ zlib_inflate,
+ zlib_buffer,
};
// Now we can continuously check for messages in a different task, since we aren't going to receive another hello
@@ -92,7 +146,7 @@ impl Gateway {
});
Ok(GatewayHandle {
- url: websocket_url.clone(),
+ url: url.clone(),
events: shared_events,
websocket_send: shared_websocket_send.clone(),
kill_send: kill_send.clone(),
@@ -101,7 +155,7 @@ impl Gateway {
}
/// The main gateway listener task;
- pub async fn gateway_listen_task(&mut self) {
+ async fn gateway_listen_task(&mut self) {
loop {
let msg;
@@ -118,12 +172,12 @@ impl Gateway {
// PRETTYFYME: Remove inline conditional compiling
#[cfg(not(target_arch = "wasm32"))]
if let Some(Ok(message)) = msg {
- self.handle_message(message.into()).await;
+ self.handle_raw_message(message.into()).await;
continue;
}
#[cfg(target_arch = "wasm32")]
if let Some(message) = msg {
- self.handle_message(message.into()).await;
+ self.handle_raw_message(message.into()).await;
continue;
}
@@ -144,7 +198,7 @@ impl Gateway {
#[allow(dead_code)] // TODO: Remove this allow annotation
async fn handle_event<'a, T: WebSocketEvent + serde::Deserialize<'a>>(
data: &'a str,
- event: &mut GatewayEvent,
+ event: &mut Publisher,
) -> Result<(), serde_json::Error> {
let data_deserialize_result: Result = serde_json::from_str(data);
@@ -152,12 +206,46 @@ impl Gateway {
return Err(data_deserialize_result.err().unwrap());
}
- event.notify(data_deserialize_result.unwrap()).await;
+ event.publish(data_deserialize_result.unwrap()).await;
Ok(())
}
+ /// Takes a [RawGatewayMessage], converts it to [GatewayMessage] based
+ /// of connection options and calls handle_message
+ async fn handle_raw_message(&mut self, raw_message: RawGatewayMessage) {
+ let message;
+
+ match self.options.transport_compression {
+ GatewayTransportCompression::None => {
+ message = GatewayMessage::from_raw_json_message(raw_message).unwrap()
+ }
+ GatewayTransportCompression::ZLibStream => {
+ let message_bytes = raw_message.into_bytes();
+
+ let can_decompress = message_bytes.len() > 4
+ && message_bytes[message_bytes.len() - 4..] == ZLIB_SUFFIX;
+
+ let zlib_buffer = self.zlib_buffer.as_mut().unwrap();
+ zlib_buffer.extend(message_bytes.clone());
+
+ if !can_decompress {
+ return;
+ }
+
+ let zlib_buffer = self.zlib_buffer.as_ref().unwrap();
+ let inflate = self.zlib_inflate.as_mut().unwrap();
+
+ message =
+ GatewayMessage::from_zlib_stream_json_bytes(zlib_buffer, inflate).unwrap();
+ self.zlib_buffer = Some(Vec::new());
+ }
+ };
+
+ self.handle_message(message).await;
+ }
+
/// This handles a message as a websocket event and updates its events along with the events' observers
- pub async fn handle_message(&mut self, msg: GatewayMessage) {
+ async fn handle_message(&mut self, msg: GatewayMessage) {
if msg.0.is_empty() {
return;
}
@@ -166,7 +254,7 @@ impl Gateway {
if let Some(error) = msg.error() {
warn!("GW: Received error {:?}, connection will close..", error);
self.close().await;
- self.events.lock().await.error.notify(error).await;
+ self.events.lock().await.error.publish(error).await;
} else {
warn!(
"Message unrecognised: {:?}, please open an issue on the chorus github",
@@ -194,7 +282,10 @@ impl Gateway {
let event = &mut self.events.lock().await.$($path).+;
let json = gateway_payload.event_data.unwrap().get();
match serde_json::from_str(json) {
- Err(err) => warn!("Failed to parse gateway event {event_name} ({err})"),
+ Err(err) => {
+ warn!("Failed to parse gateway event {event_name} ({err})");
+ trace!("Event data: {json}");
+ },
Ok(message) => {
$(
let mut message: $message_type = message;
@@ -202,7 +293,7 @@ impl Gateway {
let id = if message.id().is_some() {
message.id().unwrap()
} else {
- event.notify(message).await;
+ event.publish(message).await;
return;
};
if let Some(to_update) = store.get(&id) {
@@ -224,25 +315,22 @@ impl Gateway {
}
}
)?
- event.notify(message).await;
+ event.publish(message).await;
}
}
},)*
"RESUMED" => (),
"SESSIONS_REPLACE" => {
- let result: Result, serde_json::Error> =
- serde_json::from_str(gateway_payload.event_data.unwrap().get());
+ let json = gateway_payload.event_data.unwrap().get();
+ let result: Result, serde_json::Error> = serde_json::from_str(json);
match result {
Err(err) => {
- warn!(
- "Failed to parse gateway event {} ({})",
- event_name,
- err
- );
+ warn!("Failed to parse gateway event {event_name} ({err})");
+ trace!("Event data: {json}");
return;
}
Ok(sessions) => {
- self.events.lock().await.session.replace.notify(
+ self.events.lock().await.session.replace.publish(
types::SessionsReplace {sessions}
).await;
}
@@ -250,6 +338,7 @@ impl Gateway {
},
_ => {
warn!("Received unrecognized gateway event ({event_name})! Please open an issue on the chorus github so we can implement it");
+ trace!("Event data: {}", gateway_payload.event_data.unwrap().get());
}
}
};
@@ -358,7 +447,7 @@ impl Gateway {
.await
.session
.reconnect
- .notify(reconnect)
+ .publish(reconnect)
.await;
}
GATEWAY_INVALID_SESSION => {
@@ -383,7 +472,7 @@ impl Gateway {
.await
.session
.invalid
- .notify(invalid_session)
+ .publish(invalid_session)
.await;
}
// Starts our heartbeat
diff --git a/src/gateway/handle.rs b/src/gateway/handle.rs
index 6af5f0d..6bcdba8 100644
--- a/src/gateway/handle.rs
+++ b/src/gateway/handle.rs
@@ -8,7 +8,7 @@ use log::*;
use std::fmt::Debug;
use super::{events::Events, *};
-use crate::types::{self, Composite};
+use crate::types::{self, Composite, Shared};
/// Represents a handle to a Gateway connection. A Gateway connection will create observable
/// [`GatewayEvents`](GatewayEvent), which you can subscribe to. Gateway events include all currently
@@ -154,7 +154,7 @@ impl GatewayHandle {
/// Sends a call sync to the server
pub async fn send_call_sync(&self, to_send: types::CallSync) {
- let to_send_value = serde_json::to_value(&to_send).unwrap();
+ let to_send_value = serde_json::to_value(to_send).unwrap();
trace!("GW: Sending Call Sync..");
diff --git a/src/gateway/message.rs b/src/gateway/message.rs
index 44d912e..7d44af6 100644
--- a/src/gateway/message.rs
+++ b/src/gateway/message.rs
@@ -2,11 +2,41 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+use std::string::FromUtf8Error;
+
use crate::types;
use super::*;
-/// Represents a message received from the gateway. This will be either a [types::GatewayReceivePayload], containing events, or a [GatewayError].
+/// Defines a raw gateway message, being either string json or bytes
+///
+/// This is used as an intermediary type between types from different websocket implementations
+#[derive(Clone, Debug, PartialEq, Eq)]
+pub(crate) enum RawGatewayMessage {
+ Text(String),
+ Bytes(Vec),
+}
+
+impl RawGatewayMessage {
+ /// Attempt to consume the message into a String, will try to convert binary to utf8
+ pub fn into_text(self) -> Result {
+ match self {
+ RawGatewayMessage::Text(text) => Ok(text),
+ RawGatewayMessage::Bytes(bytes) => String::from_utf8(bytes),
+ }
+ }
+
+ /// Consume the message into bytes, will convert text to binary
+ pub fn into_bytes(self) -> Vec {
+ match self {
+ RawGatewayMessage::Text(text) => text.as_bytes().to_vec(),
+ RawGatewayMessage::Bytes(bytes) => bytes,
+ }
+ }
+}
+
+/// Represents a json message received from the gateway.
+/// This will be either a [types::GatewayReceivePayload], containing events, or a [GatewayError].
/// This struct is used internally when handling messages.
#[derive(Clone, Debug)]
pub struct GatewayMessage(pub String);
@@ -44,4 +74,48 @@ impl GatewayMessage {
pub fn payload(&self) -> Result {
serde_json::from_str(&self.0)
}
+
+ /// Create self from an uncompressed json [RawGatewayMessage]
+ pub(crate) fn from_raw_json_message(
+ message: RawGatewayMessage,
+ ) -> Result {
+ let text = message.into_text()?;
+ Ok(GatewayMessage(text))
+ }
+
+ /// Attempt to create self by decompressing zlib-stream bytes
+ // Thanks to , their
+ // code helped a lot with the stream implementation
+ pub(crate) fn from_zlib_stream_json_bytes(
+ bytes: &[u8],
+ inflate: &mut flate2::Decompress,
+ ) -> Result {
+
+ // Note: is there a better way to handle the size of this output buffer?
+ //
+ // This used to be 10, I measured it at 11.5, so a safe bet feels like 20
+ //
+ // ^ - This dude is naive. apparently not even 20x is okay. Measured at 47.9x!!!!
+ // If it is >100x ever, I will literally explode
+ //
+ // About an hour later, you ^ will literally explode.
+ // 133 vs 13994 -- 105.21805x ratio
+ // Let's hope it doesn't go above 200??
+ let mut output = Vec::with_capacity(bytes.len() * 200);
+ let _status = inflate.decompress_vec(bytes, &mut output, flate2::FlushDecompress::Sync)?;
+
+ output.shrink_to_fit();
+
+ let string = String::from_utf8(output).unwrap();
+
+ Ok(GatewayMessage(string))
+ }
+
+ /// Attempt to create self by decompressing a zlib-stream bytes raw message
+ pub(crate) fn from_zlib_stream_json_message(
+ message: RawGatewayMessage,
+ inflate: &mut flate2::Decompress,
+ ) -> Result {
+ Self::from_zlib_stream_json_bytes(&message.into_bytes(), inflate)
+ }
}
diff --git a/src/gateway/mod.rs b/src/gateway/mod.rs
index 5a5881a..6ee0678 100644
--- a/src/gateway/mod.rs
+++ b/src/gateway/mod.rs
@@ -2,7 +2,6 @@
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
-use async_trait::async_trait;
pub mod backends;
pub mod events;
@@ -10,15 +9,17 @@ pub mod gateway;
pub mod handle;
pub mod heartbeat;
pub mod message;
+pub mod options;
pub use backends::*;
pub use gateway::*;
pub use handle::*;
use heartbeat::*;
pub use message::*;
+pub use options::*;
use crate::errors::GatewayError;
-use crate::types::{Snowflake, WebSocketEvent};
+use crate::types::Snowflake;
use std::any::Any;
use std::collections::HashMap;
@@ -76,67 +77,11 @@ const GATEWAY_LAZY_REQUEST: u8 = 14;
pub type ObservableObject = dyn Send + Sync + Any;
+/// Note: this is a reexport of [pubserve::Subscriber],
+/// exported not to break the public api and make development easier
+pub use pubserve::Subscriber as Observer;
+
/// An entity type which is supposed to be updateable via the Gateway. This is implemented for all such types chorus supports, implementing it for your own types is likely a mistake.
pub trait Updateable: 'static + Send + Sync {
fn id(&self) -> Snowflake;
}
-
-/// Trait which defines the behavior of an Observer. An Observer is an object which is subscribed to
-/// an Observable. The Observer is notified when the Observable's data changes.
-/// In this case, the Observable is a [`GatewayEvent`], which is a wrapper around a WebSocketEvent.
-/// Note that `Debug` is used to tell `Observer`s apart when unsubscribing.
-#[async_trait]
-pub trait Observer: Sync + Send + std::fmt::Debug {
- async fn update(&self, data: &T);
-}
-
-/// GatewayEvent is a wrapper around a WebSocketEvent. It is used to notify the observers of a
-/// change in the WebSocketEvent. GatewayEvents are observable.
-#[derive(Default, Debug)]
-pub struct GatewayEvent {
- observers: Vec>>,
-}
-
-impl GatewayEvent {
- pub fn new() -> Self {
- Self {
- observers: Vec::new(),
- }
- }
-
- /// Returns true if the GatewayEvent is observed by at least one Observer.
- pub fn is_observed(&self) -> bool {
- !self.observers.is_empty()
- }
-
- /// Subscribes an Observer to the GatewayEvent.
- pub fn subscribe(&mut self, observable: Arc>) {
- self.observers.push(observable);
- }
-
- /// Unsubscribes an Observer from the GatewayEvent.
- pub fn unsubscribe(&mut self, observable: &dyn Observer) {
- // .retain()'s closure retains only those elements of the vector, which have a different
- // pointer value than observable.
- // The usage of the debug format to compare the generic T of observers is quite stupid, but the only thing to compare between them is T and if T == T they are the same
- // anddd there is no way to do that without using format
- let to_remove = format!("{:?}", observable);
- self.observers
- .retain(|obs| format!("{:?}", obs) != to_remove);
- }
-
- /// Notifies the observers of the GatewayEvent.
- pub(crate) async fn notify(&self, new_event_data: T) {
- for observer in &self.observers {
- observer.update(&new_event_data).await;
- }
- }
-}
-
-/// A type alias for [`Arc>`], used to make the public facing API concerned with
-/// Composite structs more ergonomic.
-/// ## Note
-///
-/// While `T` does not have to implement `Composite` to be used with `Shared`,
-/// the primary use of `Shared` is with types that implement `Composite`.
-pub type Shared = Arc>;
diff --git a/src/gateway/options.rs b/src/gateway/options.rs
new file mode 100644
index 0000000..4ff6178
--- /dev/null
+++ b/src/gateway/options.rs
@@ -0,0 +1,116 @@
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#[derive(Clone, PartialEq, Eq, Ord, PartialOrd, Debug, Default, Copy)]
+/// Options passed when initializing the gateway connection.
+///
+/// E.g. compression
+///
+/// # Note
+///
+/// Discord allows specifying the api version (v10, v9, ...) as well, but chorus is built upon one
+/// main version (v9).
+///
+/// Similarly, discord also supports etf encoding, while chorus does not (yet).
+/// We are looking into supporting it as an option, since it is faster and more lightweight.
+///
+/// See
+pub struct GatewayOptions {
+ pub encoding: GatewayEncoding,
+ pub transport_compression: GatewayTransportCompression,
+}
+
+impl GatewayOptions {
+ /// Adds the options to an existing gateway url
+ ///
+ /// Returns the new url
+ pub(crate) fn add_to_url(&self, url: &str) -> String {
+ let mut url = url.to_string();
+
+ let mut parameters = Vec::with_capacity(2);
+
+ let encoding = self.encoding.to_url_parameter();
+ parameters.push(encoding);
+
+ let compression = self.transport_compression.to_url_parameter();
+ if let Some(some_compression) = compression {
+ parameters.push(some_compression);
+ }
+
+ let mut has_parameters = url.contains('?') && url.contains('=');
+
+ if !has_parameters {
+ // Insure it ends in a /, so we don't get a 400 error
+ if !url.ends_with('/') {
+ url.push('/');
+ }
+
+ // Lets hope that if it already has parameters the person knew to add '/'
+ }
+
+ for parameter in parameters {
+ if !has_parameters {
+ url = format!("{}?{}", url, parameter);
+ has_parameters = true;
+ } else {
+ url = format!("{}&{}", url, parameter);
+ }
+ }
+
+ url
+ }
+}
+
+#[derive(Clone, Copy, PartialEq, Eq, Ord, PartialOrd, Debug, Default)]
+/// Possible transport compression options for the gateway.
+///
+/// See
+pub enum GatewayTransportCompression {
+ /// Do not transport compress packets
+ None,
+ /// Transport compress using zlib stream
+ #[default]
+ ZLibStream,
+}
+
+impl GatewayTransportCompression {
+ /// Returns the option as a url parameter.
+ ///
+ /// If set to [GatewayTransportCompression::None] returns [None].
+ ///
+ /// If set to anything else, returns a string like "compress=zlib-stream"
+ pub(crate) fn to_url_parameter(self) -> Option {
+ match self {
+ Self::None => None,
+ Self::ZLibStream => Some(String::from("compress=zlib-stream")),
+ }
+ }
+}
+
+#[derive(Clone, Copy, PartialEq, Eq, Ord, PartialOrd, Debug, Default)]
+/// See
+pub enum GatewayEncoding {
+ /// Javascript object notation, a standard for websocket connections,
+ /// but contains a lot of overhead
+ #[default]
+ Json,
+ /// A binary format originating from Erlang
+ ///
+ /// Should be lighter and faster than json.
+ ///
+ /// !! Chorus does not implement ETF yet !!
+ ETF,
+}
+
+impl GatewayEncoding {
+ /// Returns the option as a url parameter.
+ ///
+ /// Returns a string like "encoding=json"
+ pub(crate) fn to_url_parameter(self) -> String {
+ match self {
+ Self::Json => String::from("encoding=json"),
+ Self::ETF => String::from("encoding=etf"),
+ }
+ }
+}
diff --git a/src/instance.rs b/src/instance.rs
index 1661042..a8671e0 100644
--- a/src/instance.rs
+++ b/src/instance.rs
@@ -13,11 +13,11 @@ use reqwest::Client;
use serde::{Deserialize, Serialize};
use crate::errors::ChorusResult;
-use crate::gateway::{Gateway, GatewayHandle, Shared};
+use crate::gateway::{Gateway, GatewayHandle, GatewayOptions};
use crate::ratelimiter::ChorusRequest;
use crate::types::types::subconfigs::limits::rates::RateLimits;
use crate::types::{
- GeneralConfiguration, Limit, LimitType, LimitsConfiguration, User, UserSettings,
+ GeneralConfiguration, Limit, LimitType, LimitsConfiguration, Shared, User, UserSettings,
};
use crate::UrlBundle;
@@ -31,24 +31,8 @@ pub struct Instance {
pub limits_information: Option,
#[serde(skip)]
pub client: Client,
-}
-
-impl PartialEq for Instance {
- fn eq(&self, other: &Self) -> bool {
- self.urls == other.urls
- && self.instance_info == other.instance_info
- && self.limits_information == other.limits_information
- }
-}
-
-impl std::hash::Hash for Instance {
- fn hash(&self, state: &mut H) {
- self.urls.hash(state);
- self.instance_info.hash(state);
- if let Some(inf) = &self.limits_information {
- inf.hash(state);
- }
- }
+ #[serde(skip)]
+ pub gateway_options: GatewayOptions,
}
#[derive(Debug, Clone, Serialize, Deserialize, Default, Eq)]
@@ -67,6 +51,7 @@ impl std::hash::Hash for LimitsInformation {
}
}
+#[cfg(not(tarpaulin_include))]
impl PartialEq for LimitsInformation {
fn eq(&self, other: &Self) -> bool {
self.ratelimits.iter().eq(other.ratelimits.iter())
@@ -84,8 +69,13 @@ impl Instance {
/// Creates a new [`Instance`] from the [relevant instance urls](UrlBundle).
///
+ /// If `options` is `None`, the default [`GatewayOptions`] will be used.
+ ///
/// To create an Instance from one singular url, use [`Instance::new()`].
- pub async fn from_url_bundle(urls: UrlBundle) -> ChorusResult {
+ pub async fn from_url_bundle(
+ urls: UrlBundle,
+ options: Option,
+ ) -> ChorusResult {
let is_limited: Option = Instance::is_limited(&urls.api).await?;
let limit_information;
@@ -104,6 +94,7 @@ impl Instance {
instance_info: GeneralConfiguration::default(),
limits_information: limit_information,
client: Client::new(),
+ gateway_options: options.unwrap_or_default(),
};
instance.instance_info = match instance.general_configuration_schema().await {
Ok(schema) => schema,
@@ -117,14 +108,16 @@ impl Instance {
/// Creates a new [`Instance`] by trying to get the [relevant instance urls](UrlBundle) from a root url.
///
+ /// If `options` is `None`, the default [`GatewayOptions`] will be used.
+ ///
/// Shorthand for `Instance::from_url_bundle(UrlBundle::from_root_domain(root_domain).await?)`.
- pub async fn new(root_url: &str) -> ChorusResult {
+ pub async fn new(root_url: &str, options: Option) -> ChorusResult {
let urls = UrlBundle::from_root_url(root_url).await?;
- Instance::from_url_bundle(urls).await
+ Instance::from_url_bundle(urls, options).await
}
pub async fn is_limited(api_url: &str) -> ChorusResult