From bc4ccae26a2437c8c594502c5dab9f42ce8f4caf Mon Sep 17 00:00:00 2001 From: Aumetra Weisman Date: Sun, 1 Dec 2024 22:40:21 +0000 Subject: [PATCH] Use cargo workspace deps more (#616) * move to workspace deps * fix unmaintained advisory * fix diesel features, deduplicate tokio * move more dependencies into workspace * fix service file * more workspace deps * more * get rid of pin-project * add package override * add some more vscode settings * up js stuff * more * more * more * finish * update json schema snap * what? --- .vscode/settings.json | 11 +- Cargo.lock | 241 ++---- Cargo.toml | 268 +++++- contrib/kitsune.service | 2 +- crates/kitsune-activitypub/Cargo.toml | 37 +- crates/kitsune-cache/Cargo.toml | 10 +- crates/kitsune-cache/src/redis.rs | 16 +- crates/kitsune-captcha/Cargo.toml | 12 +- crates/kitsune-config/Cargo.toml | 14 +- crates/kitsune-core/Cargo.toml | 14 +- crates/kitsune-db/Cargo.toml | 40 +- crates/kitsune-db/src/lib.rs | 3 - crates/kitsune-derive/Cargo.toml | 2 +- crates/kitsune-derive/impl/Cargo.toml | 6 +- crates/kitsune-email/Cargo.toml | 17 +- crates/kitsune-embed/Cargo.toml | 6 +- crates/kitsune-error/Cargo.toml | 10 +- crates/kitsune-federation-filter/Cargo.toml | 4 +- crates/kitsune-federation/Cargo.toml | 2 +- crates/kitsune-http-client/Cargo.toml | 50 +- crates/kitsune-http-client/src/body.rs | 58 +- crates/kitsune-jobs/Cargo.toml | 10 +- crates/kitsune-language/Cargo.toml | 12 +- crates/kitsune-mastodon/Cargo.toml | 12 +- crates/kitsune-observability/Cargo.toml | 35 +- crates/kitsune-oidc/Cargo.toml | 23 +- crates/kitsune-oidc/src/lib.rs | 2 +- crates/kitsune-oidc/src/state/store/redis.rs | 6 +- crates/kitsune-s3/Cargo.toml | 16 +- crates/kitsune-s3/src/lib.rs | 10 +- crates/kitsune-search/Cargo.toml | 19 +- .../src/meilisearch/http_client.rs | 4 +- crates/kitsune-service/Cargo.toml | 54 +- crates/kitsune-service/src/post/resolver.rs | 2 +- crates/kitsune-service/src/prepare.rs | 11 +- crates/kitsune-storage/Cargo.toml | 16 +- crates/kitsune-storage/src/fs.rs | 13 +- crates/kitsune-test/Cargo.toml | 21 +- crates/kitsune-test/src/lib.rs | 7 +- crates/kitsune-test/src/redis.rs | 27 +- crates/kitsune-type/Cargo.toml | 19 +- crates/kitsune-url/Cargo.toml | 2 +- crates/kitsune-util/Cargo.toml | 11 +- crates/kitsune-wasm-mrf/Cargo.toml | 56 +- .../kitsune-wasm-mrf/example-mrf/Cargo.toml | 4 +- .../kitsune-wasm-mrf/src/kv_storage/redis.rs | 6 +- crates/kitsune-wasm-mrf/src/lib.rs | 64 +- crates/kitsune-webfinger/Cargo.toml | 19 +- crates/kitsune-webfinger/src/lib.rs | 14 +- kitsune-cli/Cargo.toml | 8 +- kitsune-fe/package.json | 14 +- kitsune-job-runner/Cargo.toml | 10 +- kitsune-job-runner/src/lib.rs | 9 +- kitsune/Cargo.toml | 92 +- .../src/http/handler/well_known/webfinger.rs | 4 +- lib/athena/Cargo.toml | 34 +- lib/athena/examples/basic_queue.rs | 6 +- lib/athena/src/error.rs | 2 +- lib/athena/src/redis/mod.rs | 37 +- lib/athena/src/redis/scheduled.rs | 6 +- lib/athena/tests/redis.rs | 2 +- lib/blowocking/Cargo.toml | 8 +- lib/cursiv/Cargo.toml | 26 +- lib/fast-cjson/Cargo.toml | 18 +- lib/fast-cjson/tests/proptest.rs | 31 - lib/geomjeungja/Cargo.toml | 20 +- lib/http-signatures-cli/Cargo.toml | 4 +- lib/http-signatures/Cargo.toml | 30 +- lib/just-retry/Cargo.toml | 6 +- lib/masto-id-convert/Cargo.toml | 14 +- lib/mrf-manifest/Cargo.toml | 18 +- lib/mrf-manifest/src/lib.rs | 4 +- .../snapshot_schema__json_schema.snap | 803 +----------------- lib/mrf-tool/Cargo.toml | 14 +- lib/post-process/Cargo.toml | 10 +- lib/schaber/Cargo.toml | 4 +- lib/speedy-uuid/Cargo.toml | 21 +- lib/speedy-uuid/src/lib.rs | 24 +- lib/speedy-uuid/tests/redis.rs | 12 +- lib/tick-tock-mock/Cargo.toml | 2 +- lib/tower-http-digest/Cargo.toml | 31 +- lib/tower-http-digest/src/lib.rs | 6 +- lib/tower-http-digest/tests/digest.rs | 3 +- lib/tower-stop-using-brave/Cargo.toml | 13 +- lib/tower-stop-using-brave/src/lib.rs | 3 +- lib/tower-x-clacks-overhead/Cargo.toml | 11 +- lib/tower-x-clacks-overhead/src/lib.rs | 6 +- lib/trials/Cargo.toml | 2 +- package.json | 7 + pnpm-lock.yaml | 675 +++++++-------- website/package.json | 4 +- xtask/Cargo.toml | 13 +- 92 files changed, 1334 insertions(+), 2051 deletions(-) delete mode 100644 lib/fast-cjson/tests/proptest.rs create mode 100644 package.json diff --git a/.vscode/settings.json b/.vscode/settings.json index 6f00f5d62..07d787b02 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -5,5 +5,14 @@ "rust-analyzer.showUnlinkedFileNotification": false, "rust-analyzer.cargo.features": [ "oidc" - ] + ], + + "search.exclude": { + // Avoid polluting search results with lockfile content + "pnpm-lock.yaml": true, + "Cargo.lock": true + }, + // Ensure VSCode uses pnpm instead of npm + "eslint.packageManager": "pnpm", + "npm.packageManager": "pnpm", } \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index bad5fe373..2838ee7ac 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -101,9 +101,9 @@ dependencies = [ [[package]] name = "allocator-api2" -version = "0.2.20" +version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45862d1c77f2228b9e10bc609d5bc203d86ebc9b87ad8d5d5167a6c9abf739d9" +checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" [[package]] name = "ambient-authority" @@ -283,7 +283,7 @@ dependencies = [ "futures-util", "handlebars", "http", - "indexmap 2.6.0", + "indexmap 2.7.0", "mime", "multer", "num-traits", @@ -356,7 +356,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ef5ec94176a12a8cbe985cd73f2e54dc9c702c88c766bdef12f1f3a67cedbee1" dependencies = [ "bytes", - "indexmap 2.6.0", + "indexmap 2.7.0", "serde", "serde_json", ] @@ -1096,18 +1096,6 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf0a07a401f374238ab8e2f11a104d2851bf9ce711ec69804834de8af45c7af" -[[package]] -name = "console" -version = "0.15.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e1f83fc076bd6dd27517eacdf25fef6c4dfe5f1d7448bafaaf3a26f13b5e4eb" -dependencies = [ - "encode_unicode", - "lazy_static", - "libc", - "windows-sys 0.52.0", -] - [[package]] name = "const-oid" version = "0.9.6" @@ -1197,16 +1185,6 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "396de984970346b0d9e93d1415082923c679e5ae5c3ee3dcbd104f5610af126b" -[[package]] -name = "core-foundation" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" -dependencies = [ - "core-foundation-sys", - "libc", -] - [[package]] name = "core-foundation" version = "0.10.0" @@ -1382,15 +1360,6 @@ dependencies = [ "crossbeam-utils", ] -[[package]] -name = "crossbeam-queue" -version = "0.3.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df0346b5d5e76ac2fe4e327c5fd1118d6be7c51dfb18f9b7922923f287471e35" -dependencies = [ - "crossbeam-utils", -] - [[package]] name = "crossbeam-utils" version = "0.8.20" @@ -1899,12 +1868,6 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d" -[[package]] -name = "encode_unicode" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" - [[package]] name = "encoding_rs" version = "0.8.35" @@ -2034,8 +1997,6 @@ dependencies = [ "memchr", "mimalloc", "olpc-cjson", - "proptest", - "proptest-derive", "serde", "serde_json", "sonic-rs", @@ -2124,9 +2085,9 @@ dependencies = [ [[package]] name = "float-cmp" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98de4bbd547a563b716d8dfa9aad1cb19bfab00f4fa09a6a4ed21dbcf44ce9c4" +checksum = "b09cf3155332e944990140d967ff5eceb70df778b34f77d8075db46e4704e6d8" dependencies = [ "num-traits", ] @@ -2154,15 +2115,14 @@ dependencies = [ [[package]] name = "fred" -version = "9.4.0" +version = "10.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cdd5378252ea124b712e0ac55147d26ae3af575883b34b8423091a4c719606b" +checksum = "9dfdd0e46d87d0e8fc1e6636a5dd3b9a5c708722e9662df289ba62a8c198a721" dependencies = [ "arc-swap", "async-trait", "bytes", "bytes-utils", - "crossbeam-queue", "float-cmp", "fred-macros", "futures", @@ -2171,7 +2131,7 @@ dependencies = [ "rand 0.8.5", "redis-protocol", "rustls", - "rustls-native-certs 0.7.3", + "rustls-native-certs", "semver", "sha-1", "socket2", @@ -2440,7 +2400,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" dependencies = [ "fallible-iterator 0.3.0", - "indexmap 2.6.0", + "indexmap 2.7.0", "stable_deref_trait", ] @@ -2506,7 +2466,7 @@ dependencies = [ "futures-core", "futures-sink", "http", - "indexmap 2.6.0", + "indexmap 2.7.0", "slab", "tokio", "tokio-util", @@ -2634,7 +2594,7 @@ dependencies = [ "once_cell", "rand 0.8.5", "rustls", - "rustls-native-certs 0.8.1", + "rustls-native-certs", "thiserror 2.0.3", "tinyvec", "tokio", @@ -2657,7 +2617,7 @@ dependencies = [ "parking_lot", "rand 0.8.5", "rustls", - "rustls-native-certs 0.8.1", + "rustls-native-certs", "smallvec", "thiserror 2.0.3", "tokio", @@ -2838,7 +2798,7 @@ dependencies = [ "hyper-util", "log", "rustls", - "rustls-native-certs 0.8.1", + "rustls-native-certs", "rustls-pki-types", "tokio", "tokio-rustls", @@ -3081,9 +3041,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.6.0" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" +checksum = "62f822373a4fe84d4bb149bf54e584a7f4abec90e072ed49cda0edea5b95471f" dependencies = [ "equivalent", "hashbrown 0.15.2", @@ -3116,7 +3076,6 @@ version = "1.41.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7e9ffc4d4892617c50a928c52b2961cb5174b6fc6ebf252b2fac9d21955c48b8" dependencies = [ - "console", "globset", "lazy_static", "linked-hash-map", @@ -3125,15 +3084,6 @@ dependencies = [ "walkdir", ] -[[package]] -name = "instant" -version = "0.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0242819d153cba4b4b05a5a8f2a7e9bbf97b6055b2a002b395c96b5ff3c0222" -dependencies = [ - "cfg-if", -] - [[package]] name = "inventory" version = "0.3.15" @@ -3537,7 +3487,7 @@ dependencies = [ "num-derive", "num-traits", "rustls", - "rustls-native-certs 0.8.1", + "rustls-native-certs", "serde", "sonic-rs", "speedy-uuid", @@ -3545,7 +3495,6 @@ dependencies = [ "tokio-postgres", "tokio-postgres-rustls", "tracing", - "tracing-log", "trials", "typed-builder", ] @@ -3666,7 +3615,7 @@ dependencies = [ "hyper-util", "kitsune-core", "kitsune-type", - "pin-project", + "pin-project-lite", "serde", "simdutf8", "sonic-rs", @@ -3831,7 +3780,6 @@ dependencies = [ "diesel-async", "diesel_full_text_search", "enum_dispatch", - "futures-io", "futures-util", "http", "kitsune-config", @@ -3936,7 +3884,6 @@ dependencies = [ "bytes", "diesel-async", "fred", - "futures-util", "http", "http-body-util", "isolang", @@ -4032,7 +3979,6 @@ version = "0.0.1-pre.6" dependencies = [ "async-trait", "fred", - "futures-util", "http", "http-body-util", "hyper", @@ -4549,7 +4495,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a5fb21b06edad8397bd7e0e6dcef12013b33e979e3ae14f126899ba524f491e" dependencies = [ "enum-as-inner", - "indexmap 2.6.0", + "indexmap 2.7.0", "itertools 0.13.0", "rustc-hash", "thiserror 1.0.69", @@ -4630,10 +4576,9 @@ dependencies = [ [[package]] name = "notify-types" version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7393c226621f817964ffb3dc5704f9509e107a8b024b489cc2c1b217378785df" +source = "git+https://github.com/notify-rs/notify.git?rev=aacd41642345cb66b327d4eb2cdc15ba4016daaa#aacd41642345cb66b327d4eb2cdc15ba4016daaa" dependencies = [ - "instant", + "web-time", ] [[package]] @@ -4746,7 +4691,7 @@ checksum = "aedf0a2d09c573ed1d8d85b30c119153926a2b36dce0ab28322c09a117a4683e" dependencies = [ "crc32fast", "hashbrown 0.15.2", - "indexmap 2.6.0", + "indexmap 2.7.0", "memchr", ] @@ -5339,33 +5284,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "proptest" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4c2511913b88df1637da85cc8d96ec8e43a3f8bb8ccb71ee1ac240d6f3df58d" -dependencies = [ - "bitflags 2.6.0", - "lazy_static", - "num-traits", - "rand 0.8.5", - "rand_chacha 0.3.1", - "rand_xorshift", - "regex-syntax", - "unarray", -] - -[[package]] -name = "proptest-derive" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ff7ff745a347b87471d859a377a9a404361e7efc2a971d73424a6d183c0fc77" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.90", -] - [[package]] name = "prost" version = "0.13.3" @@ -5608,9 +5526,9 @@ dependencies = [ [[package]] name = "redis-protocol" -version = "5.0.1" +version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65deb7c9501fbb2b6f812a30d59c0253779480853545153a51d8e9e444ddc99f" +checksum = "9cdba59219406899220fc4cdfd17a95191ba9c9afb719b5fa5a083d63109a9f1" dependencies = [ "bytes", "bytes-utils", @@ -5629,6 +5547,26 @@ dependencies = [ "bitflags 2.6.0", ] +[[package]] +name = "ref-cast" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf0a6f84d5f1d581da8b41b47ec8600871962f2a528115b542b362d4b744931" +dependencies = [ + "ref-cast-impl", +] + +[[package]] +name = "ref-cast-impl" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bcc303e793d3734489387d205e9b186fac9c6cfacedd98cbb2e8a5943595f3e6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.90", +] + [[package]] name = "regalloc2" version = "0.10.2" @@ -5883,19 +5821,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "rustls-native-certs" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5bfb394eeed242e909609f56089eecfe5fda225042e8b171791b9c95f5931e5" -dependencies = [ - "openssl-probe", - "rustls-pemfile", - "rustls-pki-types", - "schannel", - "security-framework 2.11.1", -] - [[package]] name = "rustls-native-certs" version = "0.8.1" @@ -5905,7 +5830,7 @@ dependencies = [ "openssl-probe", "rustls-pki-types", "schannel", - "security-framework 3.0.1", + "security-framework", ] [[package]] @@ -6029,11 +5954,12 @@ dependencies = [ [[package]] name = "schemars" -version = "0.8.21" +version = "1.0.0-alpha.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09c024468a378b7e36765cd36702b7a90cc3cba11654f6685c8f233408e89e92" +checksum = "8e467e37661682d17a6db96cf0526f8a2ccf3a642d94624a9ba9a61a1f5ed729" dependencies = [ "dyn-clone", + "ref-cast", "schemars_derive", "semver", "serde", @@ -6042,9 +5968,9 @@ dependencies = [ [[package]] name = "schemars_derive" -version = "0.8.21" +version = "1.0.0-alpha.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1eee588578aff73f856ab961cd2f79e36bc45d7ded33a7562adba4667aecc0e" +checksum = "e2af93b12c2850cd3231ca5194ffbfcbaa8a1c7e2bb550e5e8a3a77bcdb3ebec" dependencies = [ "proc-macro2", "quote", @@ -6081,19 +6007,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "security-framework" -version = "2.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" -dependencies = [ - "bitflags 2.6.0", - "core-foundation 0.9.4", - "core-foundation-sys", - "libc", - "security-framework-sys", -] - [[package]] name = "security-framework" version = "3.0.1" @@ -6101,7 +6014,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e1415a607e92bec364ea2cf9264646dcce0f91e6d65281bd6f2819cca3bf39c8" dependencies = [ "bitflags 2.6.0", - "core-foundation 0.10.0", + "core-foundation", "core-foundation-sys", "libc", "security-framework-sys", @@ -6200,7 +6113,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8de514ef58196f1fc96dcaef80fe6170a1ce6215df9687a93fe8300e773fefc5" dependencies = [ "form_urlencoded", - "indexmap 2.6.0", + "indexmap 2.7.0", "itoa 1.0.14", "ryu", "serde", @@ -6288,7 +6201,7 @@ dependencies = [ "chrono", "hex", "indexmap 1.9.3", - "indexmap 2.6.0", + "indexmap 2.7.0", "serde", "serde_derive", "serde_json", @@ -6349,16 +6262,6 @@ dependencies = [ "cfg-if", "cpufeatures", "digest", - "sha2-asm", -] - -[[package]] -name = "sha2-asm" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b845214d6175804686b2bd482bcffe96651bb2d1200742b712003504a2dac1ab" -dependencies = [ - "cc", ] [[package]] @@ -7081,7 +6984,7 @@ version = "0.22.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" dependencies = [ - "indexmap 2.6.0", + "indexmap 2.7.0", "serde", "serde_spanned", "toml_datetime", @@ -7109,7 +7012,7 @@ dependencies = [ "percent-encoding", "pin-project", "prost", - "rustls-native-certs 0.8.1", + "rustls-native-certs", "rustls-pemfile", "socket2", "tokio", @@ -7203,8 +7106,6 @@ dependencies = [ "sha2", "subtle", "tower 0.5.1", - "tower-layer", - "tower-service", "tracing", ] @@ -7229,8 +7130,6 @@ dependencies = [ "http", "regex", "tower 0.5.1", - "tower-layer", - "tower-service", ] [[package]] @@ -7242,8 +7141,6 @@ dependencies = [ "itertools 0.13.0", "pin-project-lite", "tower 0.5.1", - "tower-layer", - "tower-service", "triomphe", ] @@ -7448,12 +7345,6 @@ version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" -[[package]] -name = "unarray" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" - [[package]] name = "unicase" version = "2.8.0" @@ -7776,7 +7667,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f3e5f5920c5abfc45573c89b07b38efdaae1515ef86f83dad12d60e50ecd62b" dependencies = [ "anyhow", - "indexmap 2.6.0", + "indexmap 2.7.0", "serde", "serde_derive", "serde_json", @@ -7794,7 +7685,7 @@ dependencies = [ "ahash", "bitflags 2.6.0", "hashbrown 0.14.5", - "indexmap 2.6.0", + "indexmap 2.7.0", "semver", "serde", ] @@ -7808,7 +7699,7 @@ dependencies = [ "ahash", "bitflags 2.6.0", "hashbrown 0.14.5", - "indexmap 2.6.0", + "indexmap 2.7.0", "semver", ] @@ -7820,7 +7711,7 @@ checksum = "8659e755615170cfe20da468865c989da78c5da16d8652e69a75acda02406a92" dependencies = [ "bitflags 2.6.0", "hashbrown 0.15.2", - "indexmap 2.6.0", + "indexmap 2.7.0", "semver", "serde", ] @@ -7852,7 +7743,7 @@ dependencies = [ "encoding_rs", "gimli 0.31.1", "hashbrown 0.14.5", - "indexmap 2.6.0", + "indexmap 2.7.0", "libc", "libm", "log", @@ -7951,7 +7842,7 @@ dependencies = [ "cranelift-bitset", "cranelift-entity", "gimli 0.31.1", - "indexmap 2.6.0", + "indexmap 2.7.0", "log", "object 0.36.5", "postcard", @@ -8064,7 +7955,7 @@ checksum = "bf3963c9c29df91564d8bd181eb00d0dbaeafa1b2a01e15952bb7391166b704e" dependencies = [ "anyhow", "heck", - "indexmap 2.6.0", + "indexmap 2.7.0", "wit-parser 0.219.1", ] @@ -8352,7 +8243,7 @@ checksum = "4329de4186ee30e2ef30a0533f9b3c123c019a237a7c82d692807bf1b3ee2697" dependencies = [ "anyhow", "heck", - "indexmap 2.6.0", + "indexmap 2.7.0", "prettyplease", "syn 2.0.90", "wasm-metadata", @@ -8383,7 +8274,7 @@ checksum = "73ccedf54cc65f287da268d64d2bf4f7530d2cfb2296ffbe3ad5f65567e4cf53" dependencies = [ "anyhow", "bitflags 2.6.0", - "indexmap 2.6.0", + "indexmap 2.7.0", "log", "serde", "serde_derive", @@ -8402,7 +8293,7 @@ checksum = "4a86f669283257e8e424b9a4fc3518e3ade0b95deb9fbc0f93a1876be3eda598" dependencies = [ "anyhow", "id-arena", - "indexmap 2.6.0", + "indexmap 2.7.0", "log", "semver", "serde", @@ -8420,7 +8311,7 @@ checksum = "5b7117ce3adc0b4354b46dc1cf3190b00b333e65243d244c613ffcc58bdec84d" dependencies = [ "anyhow", "id-arena", - "indexmap 2.6.0", + "indexmap 2.7.0", "log", "semver", "serde", diff --git a/Cargo.toml b/Cargo.toml index ebc9161ea..2a0fa914c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -79,10 +79,47 @@ members = [ resolver = "2" [workspace.dependencies] +ahash = "0.8.11" +aliri_braid = "0.4.0" +arc-swap = "1.7.1" +argh = "0.1.12" +argon2 = { version = "0.5.3", features = ["std"] } +async-graphql = { version = "7.0.11", default-features = false, features = [ + "graphiql", + "tempfile", + "time", + "tracing", + "uuid", +] } +async-graphql-axum = "7.0.11" asynk-strim = "0.1.2" +async-trait = "0.1.83" +axum = { version = "0.7.9", features = ["macros", "multipart"] } +axum-core = "0.4.5" +axum-extra = { version = "0.9.6", features = [ + "cookie", + "cookie-signed", + "query", + "typed-header", +] } +axum-flash = "0.8.0" +base64-simd = "0.8.0" +blake3 = "1.5.5" +bubble-bath = "0.2.1" +bytes = "1.9.0" +chrono = { version = "0.4.38", default-features = false } clap = { version = "4.5.21", features = ["derive", "wrap_help"] } +color-eyre = "0.6.3" +colored_json = "5.0.0" +const_format = "0.2.33" +const-oid = { version = "0.9.6", features = ["db"] } +cookie = { version = "0.18.1", features = ["percent-encode"] } +derive_builder = "0.20.2" +derive_more = { version = "1.0.0", features = ["from"] } diesel = { version = "2.2.5", default-features = false, features = [ "32-column-tables", + "postgres_backend", + "uuid", "with-deprecated", ] } diesel-async = { version = "0.5.2", features = [ @@ -92,13 +129,23 @@ diesel-async = { version = "0.5.2", features = [ "tokio", ] } diesel_full_text_search = { version = "2.2.0", default-features = false } -fred = { version = "9.4.0", features = [ +diesel_migrations = "2.2.0" +divan = "0.1.16" +either = { version = "1.13.0", default-features = false } +enum_dispatch = "0.3.13" +eyre = "0.6.12" +fred = { version = "10.0.0", features = [ "enable-rustls-ring", "full-tracing", "i-scripts", "sha-1", "unix-sockets", ] } +futures-executor = "0.3.31" +futures-test = "0.3.31" +futures-util = { version = "0.3.31", default-features = false, features = [ + "alloc", +] } garde = { version = "0.20.0", features = [ "derive", "email", @@ -106,26 +153,223 @@ garde = { version = "0.20.0", features = [ "regex", "serde", ] } +git-version = "0.3.9" +globset = "0.4.15" +headers = "0.4.0" +hex-simd = "0.8.0" hickory-resolver = { version = "0.25.0-alpha.4", default-features = false, features = [ "dns-over-rustls", "native-certs", "tokio-runtime", ] } -iso8601-timestamp = "0.3.1" +http = "1.1.0" +http-body = "1.0.1" +http-body-util = "0.1.2" +httpdate = "1.0.3" +human-size = { version = "0.4.3", features = ["serde"] } +hyper = "1.5.1" +hyper-util = { version = "0.1.10", features = [ + "client-legacy", + "http1", + "http2", + "tokio", +] } +hyper-rustls = { version = "0.27.3", default-features = false, features = [ + "http1", + "http2", + "logging", + "native-tokio", + "ring", + "tls12", +] } +icu_normalizer = "1.5.0" +img-parts = "0.3.1" +insta = { version = "1.41.1", default-features = false, features = [ + "glob", + "json", +] } +iso8601-timestamp = { version = "0.3.1", features = ["diesel-pg"] } +isolang = { version = "2.4.0", features = [ + "english_names", + "list_languages", + "serde", +] } itertools = { version = "0.13.0", default-features = false } +lantern-client-sdk = { package = "client-sdk", git = "https://github.com/Lantern-chat/client-sdk-rs.git", rev = "efb4288d9b107b48609802193d57b29f7ae395a1", default-features = false } +leb128 = "0.2.5" +lettre = { version = "0.11.10", default-features = false, features = [ + "builder", + "hostname", + "pool", + "smtp-transport", + "tokio1", + "tokio1-rustls-tls", + "tracing", +] } +lexical-parse-integer = { version = "1.0.2", default-features = false } +logos = "0.14.2" +lol_html = "2.0.0" +memchr = "2.7.4" +miette = { version = "7.4.0", features = ["fancy"] } +mimalloc = "0.1.43" +mime = "0.3.17" +mime_guess = { version = "2.0.5", default-features = false } minijinja = { version = "2.5.0", features = ["loader"] } moka = { version = "=0.12.7", features = ["sync"] } +mrml = { version = "4.0.1", default-features = false, features = [ + "parse", + "render", +] } +nanorand = { version = "0.7.0", default-features = false, features = [ + "wyrand", +] } +notify-debouncer-full = "0.4.0" +num-derive = "0.4.2" +num-traits = "0.2.19" +oauth2 = { version = "5.0.0-rc.1", default-features = false } +olpc-cjson = "0.1.4" +openidconnect = { version = "4.0.0-rc.1", default-features = false, features = [ + # Accept these two, per specification invalid, cases to increase compatibility + "accept-rfc3339-timestamps", + "accept-string-booleans", + "timing-resistant-secret-traits", +] } +opentelemetry = { version = "0.27.1", default-features = false, features = [ + "trace", +] } +opentelemetry-http = "0.27.0" +opentelemetry-otlp = { version = "0.27.0", default-features = false, features = [ + "grpc-tonic", + "http-json", + "http-proto", + "tls", + "tls-roots", + "trace", +] } +opentelemetry_sdk = { version = "0.27.1", default-features = false, features = [ + "rt-tokio", +] } +owo-colors = { version = "4.1.0", features = ["supports-colors"] } +oxide-auth = "0.6.1" +oxide-auth-async = "0.2.1" +oxide-auth-axum = "0.5.0" +password-hash = { version = "0.5.0", features = ["std"] } +paste = "1.0.15" +pin-project-lite = "0.2.15" +pkcs8 = { version = "0.10.2", features = ["pem", "std"] } +postcard = { version = "1.1.1", default-features = false, features = ["alloc"] } +pretty_assertions = "1.4.1" +proc-macro2 = "1.0.92" +pulldown-cmark = { version = "0.12.2", default-features = false, features = [ + "html", + "simd", +] } +quick-xml = { version = "0.37.1", features = ["serialize"] } +quote = "1.0.37" +rand = "0.8.5" +rand_xorshift = "0.3.0" +rayon = "1.10.0" +redb = { version = "2.2.0", features = ["logging"] } +regex = "1.11.1" +retry-policies = "0.4.0" +ring = { version = "0.17.8", features = ["std"] } +rsa = "0.9.7" +rstest = { version = "0.23.0", default-features = false } +rust-embed = { version = "8.5.0", features = ["include-exclude"] } +rustc-hash = "2.1.0" +rustls = { version = "0.23.19", default-features = false, features = [ + "logging", + "ring", + "std", + "tls12", +] } +rustls-native-certs = "0.8.1" +rusty-s3 = "0.5.0" sailfish = { version = "0.9.0", default-features = false, features = [ "derive", "perf-inline", ] } +schemars = { version = "1.0.0-alpha.16", features = ["semver1"] } +scoped-futures = { version = "0.1.4", default-features = false } +semver = { version = "1.0.23", features = ["serde"] } +serde = { version = "1.0.215", features = ["derive"] } +serde_json = "1.0.133" +serde_test = "1.0.177" +serde_urlencoded = "0.7.1" +serde_with = { version = "3.11.0", default-features = false, features = [ + "alloc", + "macros", +] } +sha2 = "0.10.8" simdutf8 = { version = "0.1.5", features = ["aarch64_neon"] } +slab = "0.4.9" +smol_str = { version = "0.3.2", features = ["serde"] } sonic-rs = "=0.3.14" -tokio = "1.41.1" +strum = { version = "0.26.3", features = ["derive"] } +subtle = "2.6.1" +syn = { version = "2.0.90", features = ["full"] } +sync_wrapper = "1.0.2" +tempfile = "3.14.0" +thiserror = "2.0.3" +time = "0.3.36" +tokio = { version = "1.41.1", features = ["full"] } +tokio-postgres = "0.7.12" +tokio-postgres-rustls = "0.13.0" +tokio-util = { version = "0.7.12", features = ["io", "rt"] } +toml = { version = "0.8.19", default-features = false, features = ["parse"] } +tower = { version = "0.5.1", default-features = false, features = ["util"] } +tower-http = { version = "0.6.2", features = [ + "catch-panic", + "cors", + + # Explicitly exclude `zstd` + # It's not widely adopted and takes a long time to build + "decompression-br", + "decompression-deflate", + "decompression-gzip", + + "follow-redirect", + "fs", + "map-response-body", + "request-id", + "timeout", + "trace", +] } +tracing = "0.1.41" +tracing-error = "0.2.1" +tracing-opentelemetry = { version = "0.28.0", default-features = false } +tracing-subscriber = "0.3.19" triomphe = { version = "0.1.14", default-features = false, features = [ "arc-swap", "unsize", ] } +typed-builder = "0.20.0" +typetag = "0.2.18" +unsize = "1.1.0" +ureq = "2.11.0" +url = "2.5.4" +urlencoding = "2.1.3" +uuid = { version = "1.11.0", features = ["fast-rng", "v7"] } +uuid-simd = { version = "0.8.0", features = ["uuid"] } +walkdir = "2.5.0" +wasm-encoder = "0.221.0" +wasmparser = "0.221.0" +wasmtime = { version = "27.0.0", default-features = false, features = [ + "addr2line", + "async", + "component-model", + "cranelift", + "parallel-compilation", + "pooling-allocator", + "runtime", +] } +wasmtime-wasi = { version = "27.0.0", default-features = false } +wat = "1.221.0" +whatlang = "0.16.4" +whichlang = "0.1.0" +wit-bindgen = "0.36.0" +zeroize = { version = "1.8.1", features = ["derive"] } +zxcvbn = { version = "3.1.0", default-features = false } # Local workspace dependencies (crate directory) kitsune-activitypub = { path = "crates/kitsune-activitypub" } @@ -162,17 +406,25 @@ kitsune-job-runner = { path = "kitsune-job-runner" } # Local workspace dependences (lib directory) athena = { path = "lib/athena", features = ["redis"] } -blowocking = { path = "lib/blowocking", default-features = false } -cursiv = { path = "lib/cursiv" } +blowocking = { path = "lib/blowocking" } +cursiv = { path = "lib/cursiv", features = ["axum"] } fast-cjson = { path = "lib/fast-cjson" } geomjeungja = { path = "lib/geomjeungja" } http-signatures = { path = "lib/http-signatures" } just-retry = { path = "lib/just-retry" } masto-id-convert = { path = "lib/masto-id-convert" } -mrf-manifest = { path = "lib/mrf-manifest" } +mrf-manifest = { path = "lib/mrf-manifest", features = [ + "decode", + "encode", + "serialise", +] } post-process = { path = "lib/post-process" } schaber = { path = "lib/schaber" } -speedy-uuid = { path = "lib/speedy-uuid", features = ["serde"] } +speedy-uuid = { path = "lib/speedy-uuid", features = [ + "diesel", + "redis", + "serde", +] } tick-tock-mock = { path = "lib/tick-tock-mock" } tower-http-digest = { path = "lib/tower-http-digest" } tower-stop-using-brave = { path = "lib/tower-stop-using-brave" } @@ -205,5 +457,7 @@ version = "0.0.1-pre.6" license = "AGPL-3.0-or-later" [patch.crates-io] +# Fix unmaintained advisory +notify-types = { git = "https://github.com/notify-rs/notify.git", rev = "aacd41642345cb66b327d4eb2cdc15ba4016daaa" } # SIMD runtime detection and generic I/O wrapper sonic-rs = { git = "https://github.com/aumetra/sonic-rs.git", rev = "12df930a57ff9f07eb16111a3da1feff3dc8e5ad" } diff --git a/contrib/kitsune.service b/contrib/kitsune.service index bb573e873..dd5f62163 100644 --- a/contrib/kitsune.service +++ b/contrib/kitsune.service @@ -10,7 +10,7 @@ Type=simple User=kitsune Environment="RUST_LOG=debug" WorkingDirectory=/path-to-kitsune-root-folder -ExecStart=/path-to-kitsune-executable /path-to-kitsune-config +ExecStart=/path-to-kitsune-executable -c /path-to-kitsune-config Restart=on-failure [Install] diff --git a/crates/kitsune-activitypub/Cargo.toml b/crates/kitsune-activitypub/Cargo.toml index 5dcd9c979..3a2216d37 100644 --- a/crates/kitsune-activitypub/Cargo.toml +++ b/crates/kitsune-activitypub/Cargo.toml @@ -6,13 +6,13 @@ version.workspace = true license.workspace = true [dependencies] -async-trait = "0.1.83" -base64-simd = "0.8.0" +async-trait.workspace = true +base64-simd.workspace = true diesel.workspace = true diesel-async.workspace = true -futures-util = "0.3.31" -headers = "0.4.0" -http = "1.1.0" +futures-util.workspace = true +headers.workspace = true +http.workspace = true iso8601-timestamp.workspace = true kitsune-cache.workspace = true kitsune-config.workspace = true @@ -29,29 +29,26 @@ kitsune-type.workspace = true kitsune-url.workspace = true kitsune-util.workspace = true kitsune-wasm-mrf.workspace = true -mime = "0.3.17" -mime_guess = { version = "2.0.5", default-features = false } -serde = "1.0.215" -sha2 = "0.10.8" +mime.workspace = true +mime_guess.workspace = true +serde.workspace = true +sha2.workspace = true sonic-rs.workspace = true speedy-uuid.workspace = true -tracing = "0.1.41" +tracing.workspace = true triomphe.workspace = true -typed-builder = "0.20.0" -url = "2.5.4" - -[target.'cfg(not(target_env = "msvc"))'.dependencies] -sha2 = { version = "0.10.8", features = ["asm"] } +typed-builder.workspace = true +url.workspace = true [dev-dependencies] -http-body-util = "0.1.2" -hyper = "1.5.1" +http-body-util.workspace = true +hyper.workspace = true kitsune-config.workspace = true kitsune-test.workspace = true kitsune-webfinger.workspace = true -pretty_assertions = "1.4.1" -tokio = { workspace = true, features = ["macros"] } -tower = { version = "0.5.1", default-features = false, features = ["util"] } +pretty_assertions.workspace = true +tokio.workspace = true +tower.workspace = true [lints] workspace = true diff --git a/crates/kitsune-cache/Cargo.toml b/crates/kitsune-cache/Cargo.toml index a96f1ce3a..ed381d9d8 100644 --- a/crates/kitsune-cache/Cargo.toml +++ b/crates/kitsune-cache/Cargo.toml @@ -6,18 +6,18 @@ version.workspace = true license.workspace = true [dependencies] -enum_dispatch = "0.3.13" +enum_dispatch.workspace = true fred.workspace = true kitsune-error.workspace = true moka.workspace = true -serde = "1.0.215" +serde.workspace = true sonic-rs.workspace = true -tracing = "0.1.41" +tracing.workspace = true triomphe.workspace = true -typed-builder = "0.20.0" +typed-builder.workspace = true [dev-dependencies] -tokio = { workspace = true, features = ["macros", "rt"] } +tokio.workspace = true [lints] workspace = true diff --git a/crates/kitsune-cache/src/redis.rs b/crates/kitsune-cache/src/redis.rs index c30353bf4..4a9c35220 100644 --- a/crates/kitsune-cache/src/redis.rs +++ b/crates/kitsune-cache/src/redis.rs @@ -1,5 +1,5 @@ use super::CacheBackend; -use fred::{clients::RedisPool, interfaces::KeysInterface, types::Expiration}; +use fred::{clients::Pool, interfaces::KeysInterface, types::Expiration}; use kitsune_error::Result; use serde::{de::DeserializeOwned, Serialize}; use std::{fmt::Display, marker::PhantomData, time::Duration}; @@ -10,11 +10,11 @@ pub struct Redis where K: ?Sized, { + conn_pool: Pool, #[builder(default = "DEFAULT-REDIS-CACHER".into())] namespace: String, #[builder(setter(into))] prefix: String, - redis_conn: RedisPool, ttl: Duration, // Type phantom data @@ -28,12 +28,12 @@ impl Redis where K: ?Sized, { - pub fn new

(redis_conn: RedisPool, prefix: P, ttl: Duration) -> Self + pub fn new

(conn_pool: Pool, prefix: P, ttl: Duration) -> Self where P: Into, { Self::builder() - .redis_conn(redis_conn) + .conn_pool(conn_pool) .prefix(prefix) .ttl(ttl) .build() @@ -54,7 +54,7 @@ where let key = self.compute_key(key); debug!(%key, "Deleting cache entry"); - let () = self.redis_conn.del(key).await?; + let () = self.conn_pool.del(key).await?; Ok(()) } @@ -64,7 +64,7 @@ where let key = self.compute_key(key); debug!(%key, "Fetching cache entry"); - if let Some(serialised) = self.redis_conn.get::, _>(&key).await? { + if let Some(serialised) = self.conn_pool.get::, _>(&key).await? { let deserialised = sonic_rs::from_slice(serialised.as_bytes())?; Ok(Some(deserialised)) } else { @@ -79,7 +79,7 @@ where debug!(%key, ttl = ?self.ttl, "Setting cache entry"); let () = self - .redis_conn + .conn_pool .set( key, serialised, @@ -101,7 +101,7 @@ where Self { namespace: self.namespace.clone(), prefix: self.prefix.clone(), - redis_conn: self.redis_conn.clone(), + conn_pool: self.conn_pool.clone(), ttl: self.ttl, _key: PhantomData, _value: PhantomData, diff --git a/crates/kitsune-captcha/Cargo.toml b/crates/kitsune-captcha/Cargo.toml index 3d603c71a..15a737874 100644 --- a/crates/kitsune-captcha/Cargo.toml +++ b/crates/kitsune-captcha/Cargo.toml @@ -6,15 +6,15 @@ edition.workspace = true license.workspace = true [dependencies] -enum_dispatch = "0.3.13" -http = "1.1.0" +enum_dispatch.workspace = true +http.workspace = true kitsune-error.workspace = true kitsune-http-client.workspace = true -serde = { version = "1.0.215", features = ["derive"] } -serde_urlencoded = "0.7.1" +serde.workspace = true +serde_urlencoded.workspace = true sonic-rs.workspace = true -strum = { version = "0.26.3", features = ["derive"] } -typed-builder = "0.20.0" +strum.workspace = true +typed-builder.workspace = true [lints] workspace = true diff --git a/crates/kitsune-config/Cargo.toml b/crates/kitsune-config/Cargo.toml index c4c02fd22..ea44043b6 100644 --- a/crates/kitsune-config/Cargo.toml +++ b/crates/kitsune-config/Cargo.toml @@ -6,13 +6,13 @@ version.workspace = true license.workspace = true [dependencies] -eyre = "0.6.12" -human-size = { version = "0.4.3", features = ["serde"] } -isolang = { version = "2.4.0", features = ["serde"] } -serde = { version = "1.0.215", features = ["derive"] } -smol_str = { version = "0.3.2", features = ["serde"] } -tokio = { workspace = true, features = ["fs"] } -toml = { version = "0.8.19", default-features = false, features = ["parse"] } +eyre.workspace = true +human-size.workspace = true +isolang.workspace = true +serde.workspace = true +smol_str.workspace = true +tokio.workspace = true +toml.workspace = true [lints] workspace = true diff --git a/crates/kitsune-core/Cargo.toml b/crates/kitsune-core/Cargo.toml index ccafe8349..b700fcf49 100644 --- a/crates/kitsune-core/Cargo.toml +++ b/crates/kitsune-core/Cargo.toml @@ -6,16 +6,16 @@ version.workspace = true license.workspace = true [dependencies] -async-trait = "0.1.83" -const_format = "0.2.33" -git-version = "0.3.9" +async-trait.workspace = true +const_format.workspace = true +git-version.workspace = true kitsune-db.workspace = true kitsune-error.workspace = true -paste = "1.0.15" -serde = { version = "1.0.215", features = ["derive"] } +paste.workspace = true +serde.workspace = true triomphe.workspace = true -typed-builder = "0.20.0" -unsize = "1.1.0" +typed-builder.workspace = true +unsize.workspace = true [lints] workspace = true diff --git a/crates/kitsune-db/Cargo.toml b/crates/kitsune-db/Cargo.toml index 18b7ffd25..1e67dffe0 100644 --- a/crates/kitsune-db/Cargo.toml +++ b/crates/kitsune-db/Cargo.toml @@ -7,42 +7,34 @@ license.workspace = true build = "build.rs" [dependencies] -blowocking = { workspace = true, features = ["io"] } +blowocking.workspace = true diesel.workspace = true diesel-async.workspace = true diesel_full_text_search.workspace = true -diesel_migrations = "2.2.0" -futures-util = { version = "0.3.31", default-features = false, features = [ - "alloc", -] } -iso8601-timestamp = { workspace = true, features = ["diesel-pg"] } +diesel_migrations.workspace = true +futures-util.workspace = true +iso8601-timestamp.workspace = true kitsune-config.workspace = true kitsune-error.workspace = true kitsune-language.workspace = true kitsune-type.workspace = true -num-derive = "0.4.2" -num-traits = "0.2.19" -rustls = { version = "0.23.19", default-features = false, features = [ - "logging", - "ring", - "std", - "tls12", -] } -rustls-native-certs = "0.8.1" -serde = { version = "1.0.215", features = ["derive"] } +num-derive.workspace = true +num-traits.workspace = true +rustls.workspace = true +rustls-native-certs.workspace = true +serde.workspace = true sonic-rs.workspace = true -speedy-uuid = { workspace = true, features = ["diesel"] } -tokio = { workspace = true, features = ["rt"] } -tokio-postgres = "0.7.12" -tokio-postgres-rustls = "0.13.0" -tracing = "0.1.41" -tracing-log = "0.2.0" +speedy-uuid.workspace = true +tokio.workspace = true +tokio-postgres.workspace = true +tokio-postgres-rustls.workspace = true +tracing.workspace = true trials.workspace = true -typed-builder = "0.20.0" +typed-builder.workspace = true [dev-dependencies] kitsune-test.workspace = true -tokio = { workspace = true, features = ["macros"] } +tokio.workspace = true [lints] workspace = true diff --git a/crates/kitsune-db/src/lib.rs b/crates/kitsune-db/src/lib.rs index 59bd46094..11ccf244c 100644 --- a/crates/kitsune-db/src/lib.rs +++ b/crates/kitsune-db/src/lib.rs @@ -10,7 +10,6 @@ use diesel_async::{ use diesel_migrations::{embed_migrations, EmbeddedMigrations, MigrationHarness}; use kitsune_config::database::Configuration as DatabaseConfig; use kitsune_error::{Error, Result}; -use tracing_log::LogTracer; pub type PgPool = Pool; @@ -34,8 +33,6 @@ pub const MIGRATIONS: EmbeddedMigrations = embed_migrations!(); /// Connect to the database and run any pending migrations pub async fn connect(config: &DatabaseConfig) -> Result { - LogTracer::init().ok(); - blowocking::io({ let conn_str = config.url.clone(); diff --git a/crates/kitsune-derive/Cargo.toml b/crates/kitsune-derive/Cargo.toml index 7be3dac34..d972ea8c3 100644 --- a/crates/kitsune-derive/Cargo.toml +++ b/crates/kitsune-derive/Cargo.toml @@ -8,7 +8,7 @@ license.workspace = true [dependencies] kitsune-derive-impl = { path = "impl" } triomphe.workspace = true -typed-builder = "0.20.0" +typed-builder.workspace = true [lints] workspace = true diff --git a/crates/kitsune-derive/impl/Cargo.toml b/crates/kitsune-derive/impl/Cargo.toml index 0cb1b9191..c26348e6b 100644 --- a/crates/kitsune-derive/impl/Cargo.toml +++ b/crates/kitsune-derive/impl/Cargo.toml @@ -9,9 +9,9 @@ license.workspace = true proc-macro = true [dependencies] -proc-macro2 = "1.0.92" -quote = "1.0.37" -syn = { version = "2.0.90", features = ["full"] } +proc-macro2.workspace = true +quote.workspace = true +syn.workspace = true [lints] workspace = true diff --git a/crates/kitsune-email/Cargo.toml b/crates/kitsune-email/Cargo.toml index b9c93ad33..4b8108fcd 100644 --- a/crates/kitsune-email/Cargo.toml +++ b/crates/kitsune-email/Cargo.toml @@ -12,23 +12,12 @@ kitsune-db.workspace = true kitsune-derive.workspace = true kitsune-error.workspace = true kitsune-url.workspace = true -lettre = { version = "0.11.10", default-features = false, features = [ - "builder", - "hostname", - "pool", - "smtp-transport", - "tokio1", - "tokio1-rustls-tls", - "tracing", -] } -mrml = { version = "4.0.1", default-features = false, features = [ - "parse", - "render", -] } +lettre.workspace = true +mrml.workspace = true sailfish.workspace = true speedy-uuid.workspace = true triomphe.workspace = true -typed-builder = "0.20.0" +typed-builder.workspace = true [lints] workspace = true diff --git a/crates/kitsune-embed/Cargo.toml b/crates/kitsune-embed/Cargo.toml index ea161a403..414412a69 100644 --- a/crates/kitsune-embed/Cargo.toml +++ b/crates/kitsune-embed/Cargo.toml @@ -8,15 +8,15 @@ license.workspace = true [dependencies] diesel.workspace = true diesel-async.workspace = true -http = "1.1.0" +http.workspace = true iso8601-timestamp.workspace = true kitsune-db.workspace = true kitsune-derive.workspace = true kitsune-error.workspace = true kitsune-http-client.workspace = true -lantern-client-sdk = { package = "client-sdk", git = "https://github.com/Lantern-chat/client-sdk-rs.git", rev = "efb4288d9b107b48609802193d57b29f7ae395a1", default-features = false } +lantern-client-sdk.workspace = true schaber.workspace = true -smol_str = "0.3.2" +smol_str.workspace = true [lints] workspace = true diff --git a/crates/kitsune-error/Cargo.toml b/crates/kitsune-error/Cargo.toml index 92829f043..a047f5dc1 100644 --- a/crates/kitsune-error/Cargo.toml +++ b/crates/kitsune-error/Cargo.toml @@ -6,13 +6,13 @@ version.workspace = true license.workspace = true [dependencies] -axum-core = "0.4.5" -eyre = "0.6.12" +axum-core.workspace = true +eyre.workspace = true garde.workspace = true -http = "1.1.0" +http.workspace = true sonic-rs.workspace = true -sync_wrapper = "1.0.2" -tracing = "0.1.41" +sync_wrapper.workspace = true +tracing.workspace = true [lints] workspace = true diff --git a/crates/kitsune-federation-filter/Cargo.toml b/crates/kitsune-federation-filter/Cargo.toml index 252bd87e3..bbd4d0bae 100644 --- a/crates/kitsune-federation-filter/Cargo.toml +++ b/crates/kitsune-federation-filter/Cargo.toml @@ -6,12 +6,12 @@ version.workspace = true license.workspace = true [dependencies] -globset = "0.4.15" +globset.workspace = true kitsune-config.workspace = true kitsune-derive.workspace = true kitsune-error.workspace = true kitsune-type.workspace = true -url = "2.5.4" +url.workspace = true [lints] workspace = true diff --git a/crates/kitsune-federation/Cargo.toml b/crates/kitsune-federation/Cargo.toml index a21eff5dd..7d40cfb2a 100644 --- a/crates/kitsune-federation/Cargo.toml +++ b/crates/kitsune-federation/Cargo.toml @@ -20,7 +20,7 @@ kitsune-url.workspace = true kitsune-wasm-mrf.workspace = true kitsune-webfinger.workspace = true triomphe.workspace = true -typed-builder = "0.20.0" +typed-builder.workspace = true [lints] workspace = true diff --git a/crates/kitsune-http-client/Cargo.toml b/crates/kitsune-http-client/Cargo.toml index b6aba487d..ddef92a56 100644 --- a/crates/kitsune-http-client/Cargo.toml +++ b/crates/kitsune-http-client/Cargo.toml @@ -7,51 +7,27 @@ license.workspace = true [dependencies] asynk-strim.workspace = true -bytes = "1.9.0" -futures-util = { version = "0.3.31", default-features = false, features = [ - "alloc", -] } +bytes.workspace = true +futures-util.workspace = true hickory-resolver.workspace = true -http = "1.1.0" -http-body = "1.0.1" -http-body-util = "0.1.2" +http.workspace = true +http-body.workspace = true +http-body-util.workspace = true http-signatures.workspace = true -hyper = "1.5.1" -hyper-util = { version = "0.1.10", features = [ - "client-legacy", - "http1", - "http2", - "tokio", -] } -hyper-rustls = { version = "0.27.3", default-features = false, features = [ - "http1", - "http2", - "logging", - "native-tokio", - "ring", - "tls12", -] } +hyper.workspace = true +hyper-util.workspace = true +hyper-rustls.workspace = true kitsune-core.workspace = true kitsune-type.workspace = true -pin-project = "1.1.7" -serde = "1.0.215" +pin-project-lite.workspace = true +serde.workspace = true simdutf8.workspace = true sonic-rs.workspace = true -tower = { version = "0.5.1", features = ["util"] } -tower-http = { version = "0.6.2", features = [ - # Explicitly exclude `zstd` - # It's not widely adopted and takes a long time to build - "decompression-br", - "decompression-deflate", - "decompression-gzip", - - "follow-redirect", - "map-response-body", - "timeout", -] } +tower.workspace = true +tower-http.workspace = true [dev-dependencies] -tokio = { workspace = true, features = ["macros", "rt"] } +tokio.workspace = true [lints] workspace = true diff --git a/crates/kitsune-http-client/src/body.rs b/crates/kitsune-http-client/src/body.rs index 62f7c2cf9..9ed508156 100644 --- a/crates/kitsune-http-client/src/body.rs +++ b/crates/kitsune-http-client/src/body.rs @@ -1,8 +1,7 @@ use bytes::Bytes; -use futures_util::{stream::BoxStream, StreamExt, TryStream, TryStreamExt}; +use futures_util::{StreamExt, TryStream, TryStreamExt}; use http_body::Frame; use http_body_util::StreamBody; -use pin_project::pin_project; use std::{ borrow::Cow, fmt::{self, Debug}, @@ -11,19 +10,40 @@ use std::{ }; use tower::BoxError; -/// Body on a budget -#[derive(Default)] -#[pin_project(project = BodyProj)] -pub enum Body { - /// Empty body - #[default] - Empty, +mod body_def { + #![allow(missing_docs)] + + use super::{BoxError, Bytes, Frame, StreamBody}; + use futures_util::stream::BoxStream; + use pin_project_lite::pin_project; + + pin_project! { + #[project = BodyProj] + // Body on a budget + pub enum Body { + // Empty body + Empty, + + // Body consisting of a single chunk + Full { data: Option }, + + // Body backed by a `StreamBody` + Stream { + #[pin] + stream: StreamBody, BoxError>>> + }, + } + } +} - /// Body consisting of a single chunk - Full(Option), +pub use self::body_def::Body; +use self::body_def::BodyProj; - /// Body backed by a `StreamBody` - Stream(#[pin] StreamBody, BoxError>>>), +impl Default for Body { + #[inline] + fn default() -> Self { + Self::empty() + } } impl Body { @@ -40,7 +60,9 @@ impl Body { where D: Into, { - Self::Full(Some(data.into())) + Self::Full { + data: Some(data.into()), + } } /// Stream body @@ -56,7 +78,9 @@ impl Body { .map_err(Into::into) .boxed(); - Self::Stream(StreamBody::new(stream)) + Self::Stream { + stream: StreamBody::new(stream), + } } } @@ -107,8 +131,8 @@ impl http_body::Body for Body { ) -> Poll, Self::Error>>> { match self.project() { BodyProj::Empty => Poll::Ready(None), - BodyProj::Full(data) => Poll::Ready(data.take().map(|data| Ok(Frame::data(data)))), - BodyProj::Stream(stream) => stream.poll_frame(cx), + BodyProj::Full { data } => Poll::Ready(data.take().map(|data| Ok(Frame::data(data)))), + BodyProj::Stream { stream } => stream.poll_frame(cx), } } } diff --git a/crates/kitsune-jobs/Cargo.toml b/crates/kitsune-jobs/Cargo.toml index 196dfa18b..846179c38 100644 --- a/crates/kitsune-jobs/Cargo.toml +++ b/crates/kitsune-jobs/Cargo.toml @@ -7,18 +7,18 @@ license.workspace = true [dependencies] athena.workspace = true -derive_more = { version = "1.0.0", features = ["from"] } +derive_more.workspace = true diesel.workspace = true diesel-async.workspace = true -futures-util = "0.3.31" +futures-util.workspace = true kitsune-core.workspace = true kitsune-db.workspace = true kitsune-email.workspace = true kitsune-error.workspace = true -serde = { version = "1.0.215", features = ["derive"] } +serde.workspace = true speedy-uuid.workspace = true -tracing = "0.1.41" -typed-builder = "0.20.0" +tracing.workspace = true +typed-builder.workspace = true [lints] workspace = true diff --git a/crates/kitsune-language/Cargo.toml b/crates/kitsune-language/Cargo.toml index 975dfc441..4c1916992 100644 --- a/crates/kitsune-language/Cargo.toml +++ b/crates/kitsune-language/Cargo.toml @@ -9,14 +9,10 @@ license.workspace = true diesel.workspace = true diesel-async.workspace = true kitsune-config.workspace = true -isolang = { version = "2.4.0", features = [ - "english_names", - "list_languages", - "serde", -] } -rustc-hash = "2.1.0" -whatlang = "0.16.4" -whichlang = "0.1.0" +isolang.workspace = true +rustc-hash.workspace = true +whatlang.workspace = true +whichlang.workspace = true [lints] workspace = true diff --git a/crates/kitsune-mastodon/Cargo.toml b/crates/kitsune-mastodon/Cargo.toml index 712f72633..ae4e6752a 100644 --- a/crates/kitsune-mastodon/Cargo.toml +++ b/crates/kitsune-mastodon/Cargo.toml @@ -8,7 +8,7 @@ license.workspace = true [dependencies] diesel.workspace = true diesel-async.workspace = true -futures-util = "0.3.31" +futures-util.workspace = true iso8601-timestamp.workspace = true kitsune-cache.workspace = true kitsune-db.workspace = true @@ -18,13 +18,13 @@ kitsune-service.workspace = true kitsune-type.workspace = true kitsune-url.workspace = true kitsune-util.workspace = true -mime = "0.3.17" -serde = "1.0.215" -smol_str = "0.3.2" +mime.workspace = true +serde.workspace = true +smol_str.workspace = true sonic-rs.workspace = true speedy-uuid.workspace = true -tracing = "0.1.41" -typed-builder = "0.20.0" +tracing.workspace = true +typed-builder.workspace = true [lints] workspace = true diff --git a/crates/kitsune-observability/Cargo.toml b/crates/kitsune-observability/Cargo.toml index 468e73078..d4aae4927 100644 --- a/crates/kitsune-observability/Cargo.toml +++ b/crates/kitsune-observability/Cargo.toml @@ -6,32 +6,21 @@ version.workspace = true license.workspace = true [dependencies] -async-trait = "0.1.83" -eyre = "0.6.12" -http-body-util = "0.1.2" -hyper = { version = "1.5.1", default-features = false } +async-trait.workspace = true +eyre.workspace = true +http-body-util.workspace = true +hyper.workspace = true kitsune-config.workspace = true kitsune-core.workspace = true kitsune-http-client.workspace = true -opentelemetry = { version = "0.27.1", default-features = false, features = [ - "trace", -] } -opentelemetry-http = "0.27.0" -opentelemetry-otlp = { version = "0.27.0", default-features = false, features = [ - "grpc-tonic", - "http-json", - "http-proto", - "tls", - "tls-roots", - "trace", -] } -opentelemetry_sdk = { version = "0.27.1", default-features = false, features = [ - "rt-tokio", -] } -tracing = "0.1.41" -tracing-error = "0.2.1" -tracing-opentelemetry = { version = "0.28.0", default-features = false } -tracing-subscriber = "0.3.19" +opentelemetry.workspace = true +opentelemetry-http.workspace = true +opentelemetry-otlp.workspace = true +opentelemetry_sdk.workspace = true +tracing.workspace = true +tracing-error.workspace = true +tracing-opentelemetry.workspace = true +tracing-subscriber.workspace = true [lints] workspace = true diff --git a/crates/kitsune-oidc/Cargo.toml b/crates/kitsune-oidc/Cargo.toml index 494bd8f83..aa32aa02b 100644 --- a/crates/kitsune-oidc/Cargo.toml +++ b/crates/kitsune-oidc/Cargo.toml @@ -6,29 +6,24 @@ version.workspace = true license.workspace = true [dependencies] -enum_dispatch = "0.3.13" +enum_dispatch.workspace = true fred.workspace = true -http-body-util = "0.1.2" +http-body-util.workspace = true kitsune-config.workspace = true kitsune-derive.workspace = true kitsune-error.workspace = true kitsune-http-client.workspace = true -moka = { workspace = true, features = ["sync"] } -oauth2 = { version = "5.0.0-rc.1", default-features = false } -openidconnect = { version = "4.0.0-rc.1", default-features = false, features = [ - # Accept these two, per specification invalid, cases to increase compatibility - "accept-rfc3339-timestamps", - "accept-string-booleans", - "timing-resistant-secret-traits", -] } -serde = { version = "1.0.215", features = ["derive"] } +moka.workspace = true +oauth2.workspace = true +openidconnect.workspace = true +serde.workspace = true sonic-rs.workspace = true speedy-uuid.workspace = true -thiserror = "2.0.3" -url = "2.5.4" +thiserror.workspace = true +url.workspace = true [dev-dependencies] -tokio = { version = "1.41.1", features = ["macros", "rt"] } +tokio.workspace = true [lints] workspace = true diff --git a/crates/kitsune-oidc/src/lib.rs b/crates/kitsune-oidc/src/lib.rs index 91416e7d8..e741a670d 100644 --- a/crates/kitsune-oidc/src/lib.rs +++ b/crates/kitsune-oidc/src/lib.rs @@ -2,7 +2,7 @@ use crate::state::{ store::{InMemory as InMemoryStore, Redis as RedisStore}, LoginState, OAuth2LoginState, Store, }; -use fred::{clients::RedisPool, types::RedisConfig}; +use fred::{clients::Pool as RedisPool, types::config::Config as RedisConfig}; use kitsune_config::oidc::{Configuration, StoreConfiguration}; use kitsune_derive::kitsune_service; use kitsune_error::{bail, kitsune_error, Result}; diff --git a/crates/kitsune-oidc/src/state/store/redis.rs b/crates/kitsune-oidc/src/state/store/redis.rs index ceb53668d..a8638fa4d 100644 --- a/crates/kitsune-oidc/src/state/store/redis.rs +++ b/crates/kitsune-oidc/src/state/store/redis.rs @@ -1,17 +1,17 @@ use super::Store; use crate::state::LoginState; -use fred::{clients::RedisPool, interfaces::KeysInterface}; +use fred::{clients::Pool, interfaces::KeysInterface}; use kitsune_error::Result; const REDIS_PREFIX: &str = "OIDC-LOGIN-STATE"; #[derive(Clone)] pub struct Redis { - pool: RedisPool, + pool: Pool, } impl Redis { - pub fn new(pool: RedisPool) -> Self { + pub fn new(pool: Pool) -> Self { Self { pool } } diff --git a/crates/kitsune-s3/Cargo.toml b/crates/kitsune-s3/Cargo.toml index dee09ec74..7acbb99b6 100644 --- a/crates/kitsune-s3/Cargo.toml +++ b/crates/kitsune-s3/Cargo.toml @@ -6,19 +6,19 @@ version.workspace = true license.workspace = true [dependencies] -bytes = "1.9.0" -futures-util = { version = "0.3.31", default-features = false } -http = "1.1.0" +bytes.workspace = true +futures-util.workspace = true +http.workspace = true kitsune-error.workspace = true kitsune-http-client.workspace = true -quick-xml = { version = "0.37.1", features = ["serialize"] } -rusty-s3 = "0.5.0" -serde = { version = "1.0.215", features = ["derive"] } -typed-builder = "0.20.0" +quick-xml.workspace = true +rusty-s3.workspace = true +serde.workspace = true +typed-builder.workspace = true [dev-dependencies] kitsune-test.workspace = true -tokio = { workspace = true, features = ["macros", "rt"] } +tokio.workspace = true [lints] workspace = true diff --git a/crates/kitsune-s3/src/lib.rs b/crates/kitsune-s3/src/lib.rs index 566579590..ddffc075c 100644 --- a/crates/kitsune-s3/src/lib.rs +++ b/crates/kitsune-s3/src/lib.rs @@ -259,13 +259,11 @@ mod test { .await .unwrap(); - let data = client - .get_object("good song") - .await - .unwrap() - .try_fold(Vec::new(), |mut acc, chunk| async move { + let data_stream = client.get_object("good song").await.unwrap(); + let data = data_stream + .try_fold(Vec::new(), |mut acc, chunk| { acc.extend_from_slice(&chunk); - Ok(acc) + future::ok(acc) }) .await .unwrap(); diff --git a/crates/kitsune-search/Cargo.toml b/crates/kitsune-search/Cargo.toml index a1c9dbc1c..4728af2a3 100644 --- a/crates/kitsune-search/Cargo.toml +++ b/crates/kitsune-search/Cargo.toml @@ -6,15 +6,14 @@ version.workspace = true license.workspace = true [dependencies] -async-trait = "0.1.83" -bytes = "1.9.0" +async-trait.workspace = true +bytes.workspace = true diesel.workspace = true diesel-async.workspace = true diesel_full_text_search.workspace = true -enum_dispatch = "0.3.13" -futures-io = "0.3.31" -futures-util = "0.3.31" -http = "1.1.0" +enum_dispatch.workspace = true +futures-util.workspace = true +http.workspace = true kitsune-config.workspace = true kitsune-db.workspace = true kitsune-derive.workspace = true @@ -22,12 +21,12 @@ kitsune-error.workspace = true kitsune-http-client.workspace = true kitsune-language.workspace = true meilisearch-sdk = { version = "0.27.1", default-features = false } -pin-project-lite = "0.2.15" -serde = { version = "1.0.215", features = ["derive"] } +pin-project-lite.workspace = true +serde.workspace = true serde_urlencoded = "0.7.1" speedy-uuid.workspace = true -strum = { version = "0.26.3", features = ["derive"] } -tracing = "0.1.41" +strum.workspace = true +tracing.workspace = true [lints] workspace = true diff --git a/crates/kitsune-search/src/meilisearch/http_client.rs b/crates/kitsune-search/src/meilisearch/http_client.rs index df3997e46..38628a737 100644 --- a/crates/kitsune-search/src/meilisearch/http_client.rs +++ b/crates/kitsune-search/src/meilisearch/http_client.rs @@ -33,7 +33,7 @@ impl AsyncReadBridge { impl Stream for AsyncReadBridge where - R: futures_io::AsyncRead, + R: futures_util::AsyncRead, { type Item = io::Result; @@ -62,7 +62,7 @@ pub struct HttpClient { impl meilisearch_sdk::request::HttpClient for HttpClient { async fn stream_request< Query: Serialize + Send + Sync, - Body: futures_io::AsyncRead + Send + Sync + 'static, + Body: futures_util::AsyncRead + Send + Sync + 'static, Output: DeserializeOwned + 'static, >( &self, diff --git a/crates/kitsune-service/Cargo.toml b/crates/kitsune-service/Cargo.toml index 4f1763482..771104e6e 100644 --- a/crates/kitsune-service/Cargo.toml +++ b/crates/kitsune-service/Cargo.toml @@ -6,21 +6,21 @@ version.workspace = true license.workspace = true [dependencies] -ahash = "0.8.11" -argon2 = "0.5.3" +ahash.workspace = true +argon2.workspace = true asynk-strim.workspace = true athena.workspace = true blowocking.workspace = true -bytes = "1.9.0" -derive_builder = "0.20.2" +bytes.workspace = true +derive_builder.workspace = true diesel.workspace = true diesel-async.workspace = true -eyre = "0.6.12" +eyre.workspace = true fred.workspace = true -futures-util = "0.3.31" +futures-util.workspace = true garde.workspace = true -http = "1.1.0" -img-parts = "0.3.1" +http.workspace = true +img-parts.workspace = true iso8601-timestamp.workspace = true kitsune-cache.workspace = true kitsune-captcha.workspace = true @@ -38,36 +38,36 @@ kitsune-search.workspace = true kitsune-storage.workspace = true kitsune-url.workspace = true kitsune-util.workspace = true -mime = "0.3.17" -password-hash = { version = "0.5.0", features = ["std"] } -pkcs8 = "0.10.2" +mime.workspace = true +password-hash.workspace = true +pkcs8.workspace = true post-process.workspace = true -rand = "0.8.5" -rsa = "0.9.7" -rusty-s3 = { version = "0.5.0", default-features = false } -serde = "1.0.215" -smol_str = "0.3.2" +rand.workspace = true +rsa.workspace = true +rusty-s3.workspace = true +serde.workspace = true +smol_str.workspace = true speedy-uuid.workspace = true -tokio = { workspace = true, features = ["macros", "sync"] } -tracing = "0.1.41" +tokio.workspace = true +tracing.workspace = true triomphe.workspace = true -typed-builder = "0.20.0" -url = "2.5.4" -zxcvbn = { version = "3.1.0", default-features = false } +typed-builder.workspace = true +url.workspace = true +zxcvbn.workspace = true [dev-dependencies] -hex-simd = "0.8.0" -http-body-util = "0.1.2" -hyper = "1.5.1" +hex-simd.workspace = true +http-body-util.workspace = true +hyper.workspace = true kitsune-activitypub.workspace = true kitsune-config.workspace = true kitsune-federation-filter.workspace = true kitsune-jobs.workspace = true kitsune-test.workspace = true kitsune-webfinger.workspace = true -pretty_assertions = "1.4.1" -tempfile = "3.14.0" -tower = { version = "0.5.1", default-features = false, features = ["util"] } +pretty_assertions.workspace = true +tempfile.workspace = true +tower.workspace = true [lints] workspace = true diff --git a/crates/kitsune-service/src/post/resolver.rs b/crates/kitsune-service/src/post/resolver.rs index 4d430bb3d..a6cac722d 100644 --- a/crates/kitsune-service/src/post/resolver.rs +++ b/crates/kitsune-service/src/post/resolver.rs @@ -186,9 +186,9 @@ mod test { let context_repo = KitsuneContextRepo::builder().db_pool(db_pool.clone()).build(); let job_queue = RedisJobQueue::builder() + .conn_pool(redis_pool) .context_repository(context_repo) .queue_name("parse_mentions_test") - .redis_pool(redis_pool) .build(); let job_service = JobService::builder().job_queue(Arc::new(job_queue).coerce()).build(); diff --git a/crates/kitsune-service/src/prepare.rs b/crates/kitsune-service/src/prepare.rs index 550696c10..bdf464b4e 100644 --- a/crates/kitsune-service/src/prepare.rs +++ b/crates/kitsune-service/src/prepare.rs @@ -1,10 +1,9 @@ use eyre::WrapErr; -use fred::clients::RedisPool; -use fred::interfaces::ClientLike; -use fred::types::RedisConfig; +use fred::{ + clients::Pool as RedisPool, interfaces::ClientLike, types::config::Config as RedisConfig, +}; use kitsune_cache::{ArcCache, InMemoryCache, NoopCache, RedisCache}; -use kitsune_captcha::AnyCaptcha; -use kitsune_captcha::{hcaptcha::Captcha as HCaptcha, mcaptcha::Captcha as MCaptcha}; +use kitsune_captcha::{hcaptcha::Captcha as HCaptcha, mcaptcha::Captcha as MCaptcha, AnyCaptcha}; use kitsune_config::{cache, captcha, email, language_detection, search, storage}; use kitsune_db::PgPool; use kitsune_email::{ @@ -43,8 +42,8 @@ where .await?; RedisCache::builder() + .conn_pool(pool.clone()) .prefix(cache_name) - .redis_conn(pool.clone()) .ttl(Duration::from_secs(60)) // TODO: Parameterise this .build() .into() diff --git a/crates/kitsune-storage/Cargo.toml b/crates/kitsune-storage/Cargo.toml index ab68171a4..a32e2f1f7 100644 --- a/crates/kitsune-storage/Cargo.toml +++ b/crates/kitsune-storage/Cargo.toml @@ -6,19 +6,19 @@ edition.workspace = true license.workspace = true [dependencies] -bytes = "1.9.0" -derive_more = { version = "1.0.0", features = ["from"] } -futures-util = "0.3.31" +bytes.workspace = true +derive_more.workspace = true +futures-util.workspace = true kitsune-error.workspace = true kitsune-s3.workspace = true -rusty-s3 = { version = "0.5.0", default-features = false } -tokio = { workspace = true, features = ["fs", "io-util"] } -tokio-util = { version = "0.7.12", features = ["io"] } +rusty-s3.workspace = true +tokio.workspace = true +tokio-util.workspace = true triomphe.workspace = true [dev-dependencies] -tempfile = "3.14.0" -tokio = { workspace = true, features = ["macros", "rt"] } +tempfile.workspace = true +tokio.workspace = true [lints] workspace = true diff --git a/crates/kitsune-storage/src/fs.rs b/crates/kitsune-storage/src/fs.rs index c1f89df24..dd78aded3 100644 --- a/crates/kitsune-storage/src/fs.rs +++ b/crates/kitsune-storage/src/fs.rs @@ -4,10 +4,9 @@ use crate::StorageBackend; use bytes::Bytes; -use futures_util::{Stream, StreamExt, TryStreamExt}; +use futures_util::{Stream, TryStreamExt}; use kitsune_error::Result; -use std::path::PathBuf; -use std::pin::pin; +use std::{path::PathBuf, pin::pin}; use tokio::{ fs::{self, File}, io::AsyncWriteExt, @@ -47,7 +46,7 @@ impl StorageBackend for Storage { { let mut input_stream = pin!(input_stream); let mut file = File::create(self.storage_dir.join(path)).await?; - while let Some(chunk) = input_stream.next().await.transpose()? { + while let Some(chunk) = input_stream.try_next().await? { file.write_all(&chunk).await?; } file.flush().await?; @@ -111,10 +110,8 @@ mod test { .await .unwrap(); - let data = storage - .get("hello-world") - .await - .unwrap() + let data_stream = storage.get("hello-world").await.unwrap(); + let data = data_stream .try_fold(BytesMut::new(), |mut acc, chunk| { acc.put(chunk); future::ok(acc) diff --git a/crates/kitsune-test/Cargo.toml b/crates/kitsune-test/Cargo.toml index 59c8a10c0..0fb2d803d 100644 --- a/crates/kitsune-test/Cargo.toml +++ b/crates/kitsune-test/Cargo.toml @@ -6,23 +6,22 @@ version.workspace = true license.workspace = true [dependencies] -bytes = "1.9.0" +bytes.workspace = true diesel-async.workspace = true fred.workspace = true -futures-util = "0.3.31" -http = "1.1.0" -http-body-util = "0.1.2" -isolang = "2.4.0" +http.workspace = true +http-body-util.workspace = true +isolang.workspace = true kitsune-config.workspace = true kitsune-db.workspace = true kitsune-s3.workspace = true -pin-project-lite = "0.2.15" -rand = "0.8.5" -rusty-s3 = { version = "0.5.0", default-features = false } -tokio = { workspace = true, features = ["time"] } +pin-project-lite.workspace = true +rand.workspace = true +rusty-s3.workspace = true +tokio.workspace = true triomphe.workspace = true -url = "2.5.4" -uuid = { version = "1.11.0", features = ["fast-rng", "v4"] } +url.workspace = true +uuid.workspace = true [lints] workspace = true diff --git a/crates/kitsune-test/src/lib.rs b/crates/kitsune-test/src/lib.rs index b7b2aa7f0..f1653a7f9 100644 --- a/crates/kitsune-test/src/lib.rs +++ b/crates/kitsune-test/src/lib.rs @@ -1,7 +1,8 @@ use bytes::Bytes; use diesel_async::{AsyncConnection, AsyncPgConnection, SimpleAsyncConnection}; -use fred::{clients::RedisPool, interfaces::ClientLike, types::RedisConfig}; -use futures_util::Future; +use fred::{ + clients::Pool as RedisPool, interfaces::ClientLike, types::config::Config as RedisConfig, +}; use http::header::CONTENT_TYPE; use http_body_util::Full; use isolang::Language; @@ -11,7 +12,7 @@ use kitsune_config::{ }; use kitsune_db::PgPool; use resource::provide_resource; -use std::env; +use std::{env, future::Future}; use triomphe::Arc; use url::Url; use uuid::Uuid; diff --git a/crates/kitsune-test/src/redis.rs b/crates/kitsune-test/src/redis.rs index 84631ef08..70118f36d 100644 --- a/crates/kitsune-test/src/redis.rs +++ b/crates/kitsune-test/src/redis.rs @@ -1,7 +1,8 @@ use fred::{ - clients::RedisClient, - interfaces::{ClientLike, KeysInterface, RedisResult, ServerInterface}, - types::{PerformanceConfig, RedisConfig, RedisValue, SetOptions}, + clients::Client, + error::Error, + interfaces::{ClientLike, KeysInterface, ServerInterface}, + types::{config::Config, SetOptions, Value}, }; use rand::Rng; use std::{ops::RangeInclusive, time::Duration}; @@ -11,13 +12,13 @@ const LOCK_KEY: &str = "_TEST_LOCK"; const LOCK_VALUE: &str = "LOCKED"; const SLEEP_DURATION: Duration = Duration::from_millis(100); -async fn switch_and_try_lock(conn: &RedisClient, id: u8) -> bool { - conn.select(id).await.unwrap(); +async fn switch_and_try_lock(conn: &Client, id: u8) -> bool { + conn.select(Value::Integer(id.into())).await.unwrap(); try_lock(conn).await } -async fn try_lock(conn: &RedisClient) -> bool { - let Ok(value): RedisResult = conn +async fn try_lock(conn: &Client) -> bool { + let Ok(value): Result = conn .set(LOCK_KEY, LOCK_VALUE, None, Some(SetOptions::NX), false) .await else { @@ -28,16 +29,8 @@ async fn try_lock(conn: &RedisClient) -> bool { } /// Find and claim one of the 16 database slots on the Redis instance -pub async fn find_unused_database(config: &RedisConfig) -> u8 { - let connection = RedisClient::new( - config.clone(), - Some(PerformanceConfig { - auto_pipeline: false, - ..PerformanceConfig::default() - }), - None, - None, - ); +pub async fn find_unused_database(config: &Config) -> u8 { + let connection = Client::new(config.clone(), None, None, None); connection.init().await.unwrap(); for i in DATABASE_RANGE { diff --git a/crates/kitsune-type/Cargo.toml b/crates/kitsune-type/Cargo.toml index c258cf5e0..8c12bea01 100644 --- a/crates/kitsune-type/Cargo.toml +++ b/crates/kitsune-type/Cargo.toml @@ -7,20 +7,17 @@ license.workspace = true [dependencies] iso8601-timestamp.workspace = true -serde = { version = "1.0.215", features = ["derive"] } -serde_with = { version = "3.11.0", default-features = false, features = [ - "alloc", - "macros", -] } -smol_str = { version = "0.3.2", features = ["serde"] } +serde.workspace = true +serde_with.workspace = true +smol_str.workspace = true sonic-rs.workspace = true -speedy-uuid = { workspace = true, features = ["diesel"] } -strum = { version = "0.26.3", features = ["derive"] } +speedy-uuid.workspace = true +strum.workspace = true [dev-dependencies] -pretty_assertions = "1.4.1" -rstest = { version = "0.23.0", default-features = false } -serde_test = "1" +pretty_assertions.workspace = true +rstest.workspace = true +serde_test.workspace = true [lints] workspace = true diff --git a/crates/kitsune-url/Cargo.toml b/crates/kitsune-url/Cargo.toml index 9167e72bf..0c3be7836 100644 --- a/crates/kitsune-url/Cargo.toml +++ b/crates/kitsune-url/Cargo.toml @@ -7,7 +7,7 @@ license.workspace = true [dependencies] kitsune-derive.workspace = true -smol_str = "0.3.2" +smol_str.workspace = true speedy-uuid.workspace = true [lints] diff --git a/crates/kitsune-util/Cargo.toml b/crates/kitsune-util/Cargo.toml index 1e1bc4b5e..8b152cdb0 100644 --- a/crates/kitsune-util/Cargo.toml +++ b/crates/kitsune-util/Cargo.toml @@ -6,16 +6,13 @@ version.workspace = true license.workspace = true [dependencies] -bubble-bath = "0.2.1" +bubble-bath.workspace = true iso8601-timestamp.workspace = true kitsune-type.workspace = true -pulldown-cmark = { version = "0.12.2", default-features = false, features = [ - "html", - "simd", -] } -rand = "0.8.5" +pulldown-cmark.workspace = true +rand.workspace = true speedy-uuid.workspace = true -tokio = { workspace = true, features = ["macros"] } +tokio.workspace = true [lints] workspace = true diff --git a/crates/kitsune-wasm-mrf/Cargo.toml b/crates/kitsune-wasm-mrf/Cargo.toml index 988880c3c..e84f1bdc2 100644 --- a/crates/kitsune-wasm-mrf/Cargo.toml +++ b/crates/kitsune-wasm-mrf/Cargo.toml @@ -7,49 +7,39 @@ license.workspace = true build = "build.rs" [dependencies] -async-trait = "0.1.83" -blake3 = "1.5.5" -color-eyre = "0.6.3" -derive_more = { version = "1.0.0", features = ["from"] } -enum_dispatch = "0.3.13" +async-trait.workspace = true +blake3.workspace = true +color-eyre.workspace = true +derive_more.workspace = true +enum_dispatch.workspace = true fred.workspace = true -futures-util = { version = "0.3.31", default-features = false, features = [ - "alloc", -] } -http = "1.1.0" -http-body-util = "0.1.2" +futures-util.workspace = true +http.workspace = true +http-body-util.workspace = true kitsune-config.workspace = true kitsune-derive.workspace = true kitsune-error.workspace = true kitsune-http-client.workspace = true kitsune-type.workspace = true -mrf-manifest = { workspace = true, features = ["decode"] } -redb = { version = "2.2.0", features = ["logging"] } -slab = "0.4.9" -smol_str = "0.3.2" +mrf-manifest.workspace = true +redb.workspace = true +slab.workspace = true +smol_str.workspace = true sonic-rs.workspace = true -tokio = { workspace = true, features = ["fs"] } -tracing = "0.1.41" +tokio.workspace = true +tracing.workspace = true triomphe.workspace = true -walkdir = "2.5.0" -wasmtime = { version = "27.0.0", default-features = false, features = [ - "addr2line", - "async", - "component-model", - "cranelift", - "parallel-compilation", - "pooling-allocator", - "runtime", -] } -wasmtime-wasi = { version = "27.0.0", default-features = false } +walkdir.workspace = true +wasmtime.workspace = true +wasmtime-wasi.workspace = true [dev-dependencies] -bytes = "1.9.0" -tempfile = "3.14.0" -tokio = { workspace = true, features = ["macros", "rt"] } -tower = "0.5.1" -tracing-subscriber = "0.3.19" -wat = "1.221.0" +bytes.workspace = true +tempfile.workspace = true +tokio.workspace = true +tower.workspace = true +tracing-subscriber.workspace = true +wat.workspace = true [lints] workspace = true diff --git a/crates/kitsune-wasm-mrf/example-mrf/Cargo.toml b/crates/kitsune-wasm-mrf/example-mrf/Cargo.toml index fce195c07..d250790f7 100644 --- a/crates/kitsune-wasm-mrf/example-mrf/Cargo.toml +++ b/crates/kitsune-wasm-mrf/example-mrf/Cargo.toml @@ -10,8 +10,8 @@ build = "build.rs" crate-type = ["cdylib"] [dependencies] -rand = "0.8.5" -wit-bindgen = "0.36.0" +rand.workspace = true +wit-bindgen.workspace = true [lints] workspace = true diff --git a/crates/kitsune-wasm-mrf/src/kv_storage/redis.rs b/crates/kitsune-wasm-mrf/src/kv_storage/redis.rs index 2c1433248..b09596165 100644 --- a/crates/kitsune-wasm-mrf/src/kv_storage/redis.rs +++ b/crates/kitsune-wasm-mrf/src/kv_storage/redis.rs @@ -1,12 +1,12 @@ use color_eyre::eyre; -use fred::{clients::RedisPool, interfaces::HashesInterface}; +use fred::{clients::Pool, interfaces::HashesInterface}; use kitsune_derive::typed_builder::TypedBuilder; const REDIS_NAMESPACE: &str = "MRF-KV-STORE"; #[derive(TypedBuilder)] pub struct RedisBackend { - pool: RedisPool, + pool: Pool, } impl super::Backend for RedisBackend { @@ -22,7 +22,7 @@ impl super::Backend for RedisBackend { pub struct RedisBucketBackend { name: String, - pool: RedisPool, + pool: Pool, } impl super::BucketBackend for RedisBucketBackend { diff --git a/crates/kitsune-wasm-mrf/src/lib.rs b/crates/kitsune-wasm-mrf/src/lib.rs index ec0b0301a..a5e8baeeb 100644 --- a/crates/kitsune-wasm-mrf/src/lib.rs +++ b/crates/kitsune-wasm-mrf/src/lib.rs @@ -7,8 +7,10 @@ use self::{ mrf_wit::v1::fep::mrf::types::{Direction, Error as MrfError}, }; use color_eyre::{eyre, Section}; -use fred::{clients::RedisPool, interfaces::ClientLike, types::RedisConfig}; -use futures_util::{stream::FuturesUnordered, Stream, TryFutureExt, TryStreamExt}; +use fred::{ + clients::Pool as RedisPool, interfaces::ClientLike, types::config::Config as RedisConfig, +}; +use futures_util::{stream, StreamExt, TryStreamExt}; use kitsune_config::mrf::{ AllocationStrategy, Configuration as MrfConfiguration, FsKvStorage, KvStorage, RedisKvStorage, }; @@ -42,24 +44,36 @@ mod mrf_wit; pub mod kv_storage; #[inline] -fn find_mrf_modules

(dir: P) -> impl Stream), io::Error>> +async fn find_mrf_modules

(dir: P) -> Result)>, io::Error> where P: AsRef, { // Read all the `.wasm` files from the disk // Recursively traverse the entire directory tree doing so and follow all symlinks - // Also run the I/O operations inside a `FuturesUnordered` to enable concurrent reading - WalkDir::new(dir) - .follow_links(true) - .into_iter() - .filter_map(|entry| { - let entry = entry.ok()?; - (entry.path().is_file() && entry.path().extension() == Some("wasm".as_ref())) - .then(|| entry.into_path()) - }) - .inspect(|path| debug!(?path, "discovered WASM module")) - .map(|path| fs::read(path.clone()).map_ok(|data| (path, data))) - .collect::>() + let entries = WalkDir::new(dir).follow_links(true); + + let mut acc = Vec::new(); + for entry in entries { + let entry = match entry { + Ok(entry) => entry, + Err(error) => { + debug!(?error, "failed to get file entry info"); + continue; + } + }; + + if !entry.path().is_file() || entry.path().extension() != Some("wasm".as_ref()) { + continue; + } + + let path = entry.into_path(); + debug!(?path, "discovered WASM module"); + + let data = fs::read(path.clone()).await?; + acc.push((path, data)); + } + + Ok(acc) } #[inline] @@ -192,18 +206,22 @@ impl MrfService { .wasm_component_model(true); let engine = Engine::new(&engine_config).map_err(eyre::Report::msg)?; - let mut wasm_data_stream = find_mrf_modules(config.module_dir.as_str()) - .map_err(eyre::Report::from) - .and_then(|(module_path, wasm_data)| { - let cache = cache.as_ref(); - let engine = &engine; - async move { load_mrf_module(cache, engine, &module_path, &wasm_data) } - }); + let wasm_modules = find_mrf_modules(config.module_dir.as_str()).await?; + let mut wasm_data_stream = stream::iter(wasm_modules).map(|(module_path, wasm_data)| { + let cache = cache.as_ref(); + let engine = &engine; + + load_mrf_module(cache, engine, &module_path, &wasm_data) + }); let mut wasm_data_stream = pin!(wasm_data_stream); let mut modules = Vec::new(); - while let Some((manifest, component)) = wasm_data_stream.try_next().await?.flatten() { + while let Some(maybe_module) = wasm_data_stream.try_next().await? { + let Some((manifest, component)) = maybe_module else { + continue; + }; + // TODO: permission grants, etc. let span = info_span!( diff --git a/crates/kitsune-webfinger/Cargo.toml b/crates/kitsune-webfinger/Cargo.toml index af3d85369..297e133ab 100644 --- a/crates/kitsune-webfinger/Cargo.toml +++ b/crates/kitsune-webfinger/Cargo.toml @@ -6,27 +6,26 @@ version.workspace = true license.workspace = true [dependencies] -async-trait = "0.1.83" +async-trait.workspace = true fred.workspace = true -futures-util = "0.3.31" -http = "1.1.0" +http.workspace = true kitsune-cache.workspace = true kitsune-core.workspace = true kitsune-error.workspace = true kitsune-http-client.workspace = true kitsune-type.workspace = true kitsune-util.workspace = true -tracing = "0.1.41" +tracing.workspace = true triomphe.workspace = true -urlencoding = "2.1.3" +urlencoding.workspace = true [dev-dependencies] -http-body-util = "0.1.2" -hyper = "1.5.1" -pretty_assertions = "1.4.1" +http-body-util.workspace = true +hyper.workspace = true +pretty_assertions.workspace = true sonic-rs.workspace = true -tokio = { workspace = true, features = ["macros"] } -tower = { version = "0.5.1", default-features = false, features = ["util"] } +tokio.workspace = true +tower.workspace = true [lints] workspace = true diff --git a/crates/kitsune-webfinger/src/lib.rs b/crates/kitsune-webfinger/src/lib.rs index 97be41ae8..345af2ce2 100644 --- a/crates/kitsune-webfinger/src/lib.rs +++ b/crates/kitsune-webfinger/src/lib.rs @@ -2,8 +2,7 @@ extern crate tracing; use async_trait::async_trait; -use fred::clients::RedisPool; -use futures_util::future::{FutureExt, OptionFuture}; +use fred::clients::Pool as RedisPool; use http::{header::ACCEPT, HeaderValue, Request, StatusCode}; use kitsune_cache::{ArcCache, CacheBackend, RedisCache}; use kitsune_core::traits::{resolver::AccountResource, Resolver}; @@ -137,9 +136,14 @@ impl Resolver for Webfinger { }; let cache_original_key_fut = self.cache.set(&original_acct, &ret); - let cache_resolved_key_fut = - OptionFuture::from((acct != original_acct).then(|| self.cache.set(acct, &ret))) - .map(Option::transpose); + let cache_resolved_key_fut = async { + if acct == original_acct { + None + } else { + Some(self.cache.set(acct, &ret).await) + } + .transpose() + }; try_join!(cache_original_key_fut, cache_resolved_key_fut)?; diff --git a/kitsune-cli/Cargo.toml b/kitsune-cli/Cargo.toml index 65cf86f09..c4b9ff380 100644 --- a/kitsune-cli/Cargo.toml +++ b/kitsune-cli/Cargo.toml @@ -13,7 +13,7 @@ eula = false [dependencies] clap.workspace = true -color-eyre = "0.6.3" +color-eyre.workspace = true diesel.workspace = true diesel-async.workspace = true dotenvy = "0.15.7" @@ -22,10 +22,10 @@ kitsune-config.workspace = true kitsune-core.workspace = true kitsune-db.workspace = true kitsune-error.workspace = true -serde = { version = "1.0.215", features = ["derive"] } +serde.workspace = true speedy-uuid.workspace = true -tokio = { workspace = true, features = ["full"] } -tracing-subscriber = "0.3.19" +tokio.workspace = true +tracing-subscriber.workspace = true [lints] workspace = true diff --git a/kitsune-fe/package.json b/kitsune-fe/package.json index d55a15699..3840cd39c 100644 --- a/kitsune-fe/package.json +++ b/kitsune-fe/package.json @@ -18,30 +18,30 @@ "devDependencies": { "@iconify-json/eos-icons": "^1.2.1", "@sveltejs/adapter-static": "^3.0.6", - "@sveltejs/kit": "^2.8.4", + "@sveltejs/kit": "^2.9.0", "@sveltejs/vite-plugin-svelte": "5.0.1", "@tailwindcss/forms": "^0.5.9", "@tailwindcss/typography": "^0.5.15", "@trivago/prettier-plugin-sort-imports": "^4.3.0", "@types/eslint": "^9.6.1", "autoprefixer": "^10.4.20", - "eslint": "^9.15.0", + "eslint": "^9.16.0", "eslint-config-prettier": "^9.1.0", - "eslint-plugin-svelte": "^2.46.0", - "globals": "^15.12.0", + "eslint-plugin-svelte": "^2.46.1", + "globals": "^15.13.0", "houdini": "1.3.1", "houdini-svelte": "2.0.1", "prettier": "^3.4.1", "prettier-plugin-css-order": "^2.1.2", "prettier-plugin-svelte": "^3.3.2", "prettier-plugin-tailwindcss": "^0.6.9", - "svelte": "^5.2.9", + "svelte": "^5.3.0", "svelte-check": "^4.1.0", "tailwindcss": "^3.4.15", "typescript": "^5.7.2", "typescript-eslint": "^8.16.0", - "unplugin-icons": "^0.20.1", - "vite": "^6.0.0", + "unplugin-icons": "^0.20.2", + "vite": "^6.0.1", "vitest": "^2.1.6", "zod": "^3.23.8" } diff --git a/kitsune-job-runner/Cargo.toml b/kitsune-job-runner/Cargo.toml index 42b5d43d8..10a3bd74c 100644 --- a/kitsune-job-runner/Cargo.toml +++ b/kitsune-job-runner/Cargo.toml @@ -14,7 +14,7 @@ eula = false [dependencies] athena.workspace = true clap.workspace = true -color-eyre = "0.6.3" +color-eyre.workspace = true fred.workspace = true just-retry.workspace = true kitsune-config.workspace = true @@ -30,11 +30,11 @@ kitsune-observability.workspace = true kitsune-service.workspace = true kitsune-url.workspace = true kitsune-wasm-mrf.workspace = true -mimalloc = "0.1.43" -tokio = { workspace = true, features = ["full"] } -tracing = "0.1.41" +mimalloc.workspace = true +tokio.workspace = true +tracing.workspace = true triomphe.workspace = true -typed-builder = "0.20.0" +typed-builder.workspace = true [features] diff --git a/kitsune-job-runner/src/lib.rs b/kitsune-job-runner/src/lib.rs index 8c2476c7a..b64fcd891 100644 --- a/kitsune-job-runner/src/lib.rs +++ b/kitsune-job-runner/src/lib.rs @@ -2,10 +2,9 @@ extern crate tracing; use athena::{Coerce, JobContextRepository, JobQueue, RedisJobQueue, TaskTracker}; +use color_eyre::eyre; use fred::{ - clients::RedisPool, - interfaces::{ClientLike, RedisResult}, - types::RedisConfig, + clients::Pool as RedisPool, interfaces::ClientLike, types::config::Config as RedisConfig, }; use just_retry::RetryExt; use kitsune_config::job_queue::Configuration; @@ -41,7 +40,7 @@ pub struct JobDispatcherState { pub async fn prepare_job_queue( db_pool: PgPool, config: &Configuration, -) -> RedisResult>> { +) -> eyre::Result>> { let context_repo = KitsuneContextRepo::builder().db_pool(db_pool).build(); let config = RedisConfig::from_url(config.redis_url.as_str())?; @@ -50,9 +49,9 @@ pub async fn prepare_job_queue( redis_pool.init().await?; let queue = RedisJobQueue::builder() + .conn_pool(redis_pool) .context_repository(context_repo) .queue_name("kitsune-jobs") - .redis_pool(redis_pool) .build(); Ok(Arc::new(queue).coerce()) diff --git a/kitsune/Cargo.toml b/kitsune/Cargo.toml index 800fdc2a5..84ea8f68c 100644 --- a/kitsune/Cargo.toml +++ b/kitsune/Cargo.toml @@ -16,29 +16,24 @@ eula = false [dependencies] athena.workspace = true -arc-swap = "1.7.1" -argon2 = { version = "0.5.3", features = ["std"] } -async-trait = "0.1.83" -axum = { version = "0.7.9", features = ["macros", "multipart"] } -axum-extra = { version = "0.9.6", features = [ - "cookie", - "cookie-signed", - "query", - "typed-header", -] } -axum-flash = "0.8.0" +arc-swap.workspace = true +argon2.workspace = true +async-trait.workspace = true +axum.workspace = true +axum-extra.workspace = true +axum-flash.workspace = true blowocking.workspace = true -bytes = "1.9.0" -chrono = { version = "0.4.38", default-features = false } +bytes.workspace = true +chrono.workspace = true clap.workspace = true -color-eyre = "0.6.3" -cursiv = { workspace = true, features = ["axum"] } +color-eyre.workspace = true +cursiv.workspace = true diesel.workspace = true diesel-async.workspace = true -futures-util = "0.3.31" -headers = "0.4.0" -http = "1.1.0" -http-body-util = "0.1.2" +futures-util.workspace = true +headers.workspace = true +http.workspace = true +http-body-util.workspace = true http-signatures.workspace = true iso8601-timestamp.workspace = true itertools.workspace = true @@ -67,55 +62,42 @@ kitsune-url.workspace = true kitsune-util.workspace = true kitsune-wasm-mrf.workspace = true kitsune-webfinger.workspace = true -mimalloc = "0.1.43" -mime = "0.3.17" -mime_guess = { version = "2.0.5", default-features = false } +mimalloc.workspace = true +mime.workspace = true +mime_guess.workspace = true minijinja.workspace = true -notify-debouncer-full = "0.4.0" -oxide-auth = "0.6.1" -oxide-auth-async = "0.2.1" -oxide-auth-axum = "0.5.0" -rust-embed = { version = "8.5.0", features = ["include-exclude"] } -scoped-futures = "0.1.4" -serde = { version = "1.0.215", features = ["derive"] } -serde_urlencoded = "0.7.1" +notify-debouncer-full.workspace = true +oxide-auth.workspace = true +oxide-auth-async.workspace = true +oxide-auth-axum.workspace = true +rust-embed.workspace = true +scoped-futures.workspace = true +serde.workspace = true +serde_urlencoded.workspace = true sonic-rs.workspace = true simdutf8.workspace = true speedy-uuid.workspace = true -strum = { version = "0.26.3", features = ["derive"] } -tempfile = "3.14.0" -time = "0.3.36" -tokio = { workspace = true, features = ["full"] } -tokio-util = { version = "0.7.12", features = ["io"] } -tower = { version = "0.5.1", features = ["util"] } +strum.workspace = true +tempfile.workspace = true +time.workspace = true +tokio.workspace = true +tokio-util.workspace = true +tower.workspace = true tower-stop-using-brave.workspace = true tower-x-clacks-overhead.workspace = true -tower-http = { version = "0.6.2", features = [ - "catch-panic", - "cors", - "fs", - "request-id", - "timeout", - "trace", -] } +tower-http.workspace = true tower-http-digest.workspace = true -tracing = "0.1.41" +tracing.workspace = true trials.workspace = true triomphe.workspace = true -typed-builder = "0.20.0" -url = "2.5.4" +typed-builder.workspace = true +url.workspace = true # --- Optional dependencies --- # "graphql" feature -async-graphql = { version = "7.0.11", default-features = false, features = [ - "graphiql", - "tempfile", - "time", - "tracing", - "uuid", -], optional = true } -async-graphql-axum = { version = "7.0.11", optional = true } +async-graphql = { workspace = true, optional = true } +async-graphql-axum = { workspace = true, optional = true } # "mastodon-api" feature kitsune-mastodon = { workspace = true, optional = true } diff --git a/kitsune/src/http/handler/well_known/webfinger.rs b/kitsune/src/http/handler/well_known/webfinger.rs index e8622c295..5c479b763 100644 --- a/kitsune/src/http/handler/well_known/webfinger.rs +++ b/kitsune/src/http/handler/well_known/webfinger.rs @@ -60,7 +60,7 @@ mod tests { use axum_extra::either::Either; use bytes::Bytes; use diesel_async::{AsyncConnection, AsyncPgConnection, RunQueryDsl}; - use fred::clients::RedisPool; + use fred::clients::Pool as RedisPool; use http::{Request, Response, StatusCode}; use http_body_util::Empty; use kitsune_activitypub::Fetcher; @@ -143,9 +143,9 @@ mod tests { .db_pool(db_pool.clone()) .build(); let job_queue = RedisJobQueue::builder() + .conn_pool(redis_pool) .context_repository(context_repo) .queue_name("webfinger_test") - .redis_pool(redis_pool) .build(); let job_service = JobService::builder() diff --git a/lib/athena/Cargo.toml b/lib/athena/Cargo.toml index ed911cb8b..0551a47d9 100644 --- a/lib/athena/Cargo.toml +++ b/lib/athena/Cargo.toml @@ -10,34 +10,34 @@ name = "basic_queue" required-features = ["redis"] [dependencies] -ahash = "0.8.11" -async-trait = "0.1.83" -either = { version = "1.13.0", default-features = false, optional = true } -futures-util = { version = "0.3.31", default-features = false } +ahash.workspace = true +async-trait.workspace = true +either = { workspace = true, optional = true } +futures-util.workspace = true iso8601-timestamp.workspace = true fred = { workspace = true, optional = true } just-retry.workspace = true -rand = { version = "0.8.5", optional = true } -serde = { version = "1.0.215", features = ["derive"] } -smol_str = "0.3.2" +rand = { workspace = true, optional = true } +serde.workspace = true +smol_str.workspace = true sonic-rs = { workspace = true, optional = true } -speedy-uuid = { workspace = true, features = ["redis"] } -thiserror = "2.0.3" -tokio = { workspace = true, features = ["macros", "rt", "sync"] } -tokio-util = { version = "0.7.12", features = ["rt"] } -tracing = "0.1.41" +speedy-uuid.workspace = true +thiserror.workspace = true +tokio.workspace = true +tokio-util.workspace = true +tracing.workspace = true triomphe.workspace = true -typed-builder = "0.20.0" -typetag = "0.2.18" -unsize = "1.1.0" +typed-builder.workspace = true +typetag.workspace = true +unsize.workspace = true [features] redis = ["dep:either", "dep:fred", "dep:rand", "dep:sonic-rs"] [dev-dependencies] kitsune-test.workspace = true -postcard = { version = "1.1.1", default-features = false, features = ["alloc"] } -tracing-subscriber = "0.3.19" +postcard.workspace = true +tracing-subscriber.workspace = true [lints] workspace = true diff --git a/lib/athena/examples/basic_queue.rs b/lib/athena/examples/basic_queue.rs index bcf3e6bab..400540aef 100644 --- a/lib/athena/examples/basic_queue.rs +++ b/lib/athena/examples/basic_queue.rs @@ -1,5 +1,7 @@ use athena::{JobContextRepository, JobDetails, JobQueue, RedisJobQueue, Runnable}; -use fred::{clients::RedisPool, interfaces::ClientLike, types::RedisConfig}; +use fred::{ + clients::Pool as RedisPool, interfaces::ClientLike, types::config::Config as RedisConfig, +}; use futures_util::{ stream::{self, BoxStream}, StreamExt, @@ -65,9 +67,9 @@ async fn main() { pool.init().await.unwrap(); let queue = RedisJobQueue::builder() + .conn_pool(pool) .context_repository(ContextRepo) .queue_name("test_queue") - .redis_pool(pool) .build(); for _ in 0..100 { diff --git a/lib/athena/src/error.rs b/lib/athena/src/error.rs index daf185a4b..c53f266d7 100644 --- a/lib/athena/src/error.rs +++ b/lib/athena/src/error.rs @@ -11,7 +11,7 @@ pub enum Error { #[cfg(feature = "redis")] #[error(transparent)] - Redis(#[from] fred::error::RedisError), + Redis(#[from] fred::error::Error), #[cfg(feature = "redis")] #[error(transparent)] diff --git a/lib/athena/src/redis/mod.rs b/lib/athena/src/redis/mod.rs index 8bda24e6d..b995c5fa8 100644 --- a/lib/athena/src/redis/mod.rs +++ b/lib/athena/src/redis/mod.rs @@ -7,9 +7,12 @@ use crate::{ use async_trait::async_trait; use either::Either; use fred::{ - clients::RedisPool, + clients::Pool, interfaces::{SortedSetsInterface, StreamsInterface}, - types::{FromRedis, RedisValue, XReadResponse, XReadValue, XID}, + types::{ + streams::{XReadResponse, XReadValue, XID}, + FromValue, Value, + }, }; use iso8601_timestamp::Timestamp; use just_retry::{ @@ -27,6 +30,7 @@ mod scheduled; #[derive(TypedBuilder)] pub struct JobQueue { + conn_pool: Pool, #[builder(default = "athena-job-runners".into(), setter(into))] consumer_group: SmolStr, #[builder(default = Uuid::now_v7().to_string().into(), setter(into))] @@ -37,7 +41,6 @@ pub struct JobQueue { max_retries: u32, #[builder(setter(into))] queue_name: SmolStr, - redis_pool: RedisPool, #[builder(default = SmolStr::from(format!("{queue_name}:scheduled")))] scheduled_queue_name: SmolStr, @@ -47,7 +50,7 @@ pub struct JobQueue { #[builder( default = ScheduledJobActor::builder() .queue_name(queue_name.clone()) - .redis_pool(redis_pool.clone()) + .conn_pool(conn_pool.clone()) .scheduled_queue_name(scheduled_queue_name.clone()) .build() .spawn(), @@ -64,7 +67,7 @@ where self.group_initialised .get_or_try_init(|| async move { let result = self - .redis_pool + .conn_pool .xgroup_create( self.queue_name.as_str(), self.consumer_group.as_str(), @@ -123,8 +126,8 @@ where None, XID::Auto, vec![ - ("job_id", RedisValue::from(job_meta.job_id)), - ("fail_count", RedisValue::from(job_meta.fail_count)), + ("job_id", Value::from(job_meta.job_id)), + ("fail_count", Value::from(job_meta.fail_count)), ], ) .await?; @@ -158,7 +161,7 @@ where .await .map_err(|err| Error::ContextRepository(err.into()))?; - self.enqueue_ops(&self.redis_pool, &job_data, job_details.run_at) + self.enqueue_ops(&self.conn_pool, &job_data, job_details.run_at) .await?; Ok(()) @@ -167,8 +170,8 @@ where async fn fetch_job_data(&self, max_jobs: usize) -> Result> { self.initialise_group().await?; - let (_start, claimed_ids): (_, Vec>) = self - .redis_pool + let (_start, claimed_ids): (_, Vec>) = self + .conn_pool .xautoclaim_values( self.queue_name.as_str(), self.consumer_group.as_str(), @@ -189,8 +192,8 @@ where BLOCK_TIME.as_millis() }; - let read_reply: XReadResponse = self - .redis_pool + let read_reply: XReadResponse = self + .conn_pool .xreadgroup_map( self.consumer_group.as_str(), self.consumer_name.as_str(), @@ -209,8 +212,8 @@ where let job_data = claimed_ids .map(|(id, mut map)| { - let mut raw_job_id = RedisValue::Null; - let mut raw_fail_count = RedisValue::Null; + let mut raw_job_id = Value::Null; + let mut raw_fail_count = Value::Null; mem::swap(map.get_mut("job_id").unwrap(), &mut raw_job_id); mem::swap(map.get_mut("fail_count").unwrap(), &mut raw_fail_count); @@ -238,7 +241,7 @@ where .get::() .expect("[Bug] Not a string in the context"); - let client = self.redis_pool.next(); + let client = self.conn_pool.next(); let pipeline = client.pipeline(); let () = pipeline @@ -298,7 +301,7 @@ where .expect("[Bug] Not a string in the context"); let () = self - .redis_pool + .conn_pool .xclaim( self.queue_name.as_str(), self.consumer_group.as_str(), @@ -320,12 +323,12 @@ where impl Clone for JobQueue { fn clone(&self) -> Self { Self { + conn_pool: self.conn_pool.clone(), consumer_group: self.consumer_group.clone(), consumer_name: self.consumer_name.clone(), context_repository: self.context_repository.clone(), max_retries: self.max_retries, queue_name: self.queue_name.clone(), - redis_pool: self.redis_pool.clone(), scheduled_queue_name: self.scheduled_queue_name.clone(), group_initialised: self.group_initialised.clone(), _scheduled_actor: (), diff --git a/lib/athena/src/redis/scheduled.rs b/lib/athena/src/redis/scheduled.rs index 4a13799c4..6b0c48aed 100644 --- a/lib/athena/src/redis/scheduled.rs +++ b/lib/athena/src/redis/scheduled.rs @@ -1,5 +1,5 @@ use crate::error::Result; -use fred::{clients::RedisPool, types::Script, util::NONE}; +use fred::{clients::Pool, types::scripts::Script, util::NONE}; use rand::Rng; use smol_str::SmolStr; use std::{ops::RangeInclusive, sync::LazyLock, time::Duration}; @@ -14,14 +14,14 @@ static SCHEDULE_SCRIPT: LazyLock