From ef0ed293f8f3f1919c9235adfd4e6b9160440b7c Mon Sep 17 00:00:00 2001 From: Aumetra Weisman Date: Wed, 22 May 2024 22:32:58 +0200 Subject: [PATCH] Miscellaneous changes (#541) * fix some things * remove utoipa * move some dependencies into workspace toml, use graphiql instead * fix deprecated * allow deprecated diesel stuff * use diesel * use workspace for member deps * automatically enable some features --- Cargo.lock | 253 ++++++++---------- Cargo.toml | 85 +++++- crates/kitsune-activitypub/Cargo.toml | 46 ++-- crates/kitsune-cache/Cargo.toml | 8 +- crates/kitsune-captcha/Cargo.toml | 6 +- crates/kitsune-core/Cargo.toml | 6 +- crates/kitsune-db/Cargo.toml | 29 +- crates/kitsune-derive/Cargo.toml | 2 +- crates/kitsune-email/Cargo.toml | 18 +- crates/kitsune-embed/Cargo.toml | 12 +- crates/kitsune-error/Cargo.toml | 4 +- crates/kitsune-federation-filter/Cargo.toml | 8 +- crates/kitsune-federation/Cargo.toml | 26 +- crates/kitsune-http-client/Cargo.toml | 8 +- crates/kitsune-jobs/Cargo.toml | 16 +- crates/kitsune-language/Cargo.toml | 6 +- crates/kitsune-mastodon/Cargo.toml | 24 +- crates/kitsune-observability/Cargo.toml | 4 +- crates/kitsune-oidc/Cargo.toml | 14 +- crates/kitsune-s3/Cargo.toml | 6 +- crates/kitsune-search/Cargo.toml | 20 +- crates/kitsune-service/Cargo.toml | 66 +++-- crates/kitsune-service/src/post/mod.rs | 22 +- crates/kitsune-storage/Cargo.toml | 6 +- crates/kitsune-test/Cargo.toml | 10 +- crates/kitsune-type/Cargo.toml | 5 +- crates/kitsune-type/src/mastodon/account.rs | 7 +- .../kitsune-type/src/mastodon/custom_emoji.rs | 3 +- crates/kitsune-type/src/mastodon/instance.rs | 7 +- .../src/mastodon/media_attachment.rs | 5 +- crates/kitsune-type/src/mastodon/mod.rs | 3 +- .../kitsune-type/src/mastodon/notification.rs | 6 +- .../kitsune-type/src/mastodon/preview_card.rs | 5 +- .../kitsune-type/src/mastodon/relationship.rs | 3 +- crates/kitsune-type/src/mastodon/search.rs | 4 +- crates/kitsune-type/src/mastodon/status.rs | 12 +- crates/kitsune-type/src/nodeinfo/two_one.rs | 20 +- .../kitsune-type/src/nodeinfo/well_known.rs | 7 +- crates/kitsune-type/src/webfinger.rs | 5 +- crates/kitsune-url/Cargo.toml | 4 +- crates/kitsune-util/Cargo.toml | 4 +- crates/kitsune-wasm-mrf/Cargo.toml | 18 +- crates/kitsune-webfinger/Cargo.toml | 16 +- kitsune-cli/Cargo.toml | 16 +- kitsune-job-runner/Cargo.toml | 32 +-- kitsune/Cargo.toml | 98 ++++--- kitsune/src/http/graphql/mod.rs | 12 +- .../mastodon/api/v1/accounts/follow.rs | 14 +- .../mastodon/api/v1/accounts/lookup.rs | 15 +- .../handler/mastodon/api/v1/accounts/mod.rs | 8 - .../mastodon/api/v1/accounts/relationships.rs | 15 +- .../mastodon/api/v1/accounts/statuses.rs | 15 +- .../api/v1/accounts/update_credentials.rs | 10 - .../api/v1/accounts/verify_credentials.rs | 11 - .../src/http/handler/mastodon/api/v1/apps.rs | 11 +- .../handler/mastodon/api/v1/custom_emojis.rs | 10 - .../mastodon/api/v1/follow_requests/accept.rs | 11 - .../mastodon/api/v1/follow_requests/mod.rs | 14 +- .../mastodon/api/v1/follow_requests/reject.rs | 11 - .../http/handler/mastodon/api/v1/instance.rs | 7 - .../src/http/handler/mastodon/api/v1/media.rs | 41 +-- .../mastodon/api/v1/notifications/clear.rs | 10 - .../mastodon/api/v1/notifications/dismiss.rs | 10 - .../mastodon/api/v1/notifications/mod.rs | 24 +- .../mastodon/api/v1/statuses/context.rs | 12 - .../mastodon/api/v1/statuses/favourite.rs | 10 - .../mastodon/api/v1/statuses/favourited_by.rs | 14 +- .../handler/mastodon/api/v1/statuses/mod.rs | 50 +--- .../mastodon/api/v1/statuses/reblog.rs | 14 +- .../mastodon/api/v1/statuses/reblogged_by.rs | 14 +- .../mastodon/api/v1/statuses/source.rs | 10 - .../mastodon/api/v1/statuses/unfavourite.rs | 10 - .../mastodon/api/v1/statuses/unreblog.rs | 11 - .../handler/mastodon/api/v1/timelines/home.rs | 14 +- .../mastodon/api/v1/timelines/public.rs | 11 +- .../http/handler/mastodon/api/v2/search.rs | 16 +- kitsune/src/http/handler/nodeinfo/two_one.rs | 7 - kitsune/src/http/handler/oauth/token.rs | 1 - .../src/http/handler/well_known/nodeinfo.rs | 7 - .../src/http/handler/well_known/webfinger.rs | 12 +- kitsune/src/http/mod.rs | 14 +- kitsune/src/http/openapi.rs | 138 ---------- lib/athena/Cargo.toml | 10 +- lib/athena/src/redis/mod.rs | 30 ++- lib/cursiv/Cargo.toml | 2 +- lib/geomjeungja/Cargo.toml | 4 +- lib/http-signatures/Cargo.toml | 6 +- lib/mrf-tool/Cargo.toml | 4 +- lib/speedy-uuid/Cargo.toml | 2 +- lib/speedy-uuid/src/lib.rs | 5 +- lib/tower-x-clacks-overhead/Cargo.toml | 4 +- 91 files changed, 570 insertions(+), 1096 deletions(-) delete mode 100644 kitsune/src/http/openapi.rs diff --git a/Cargo.lock b/Cargo.lock index 785336274..db8edc755 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -328,6 +328,7 @@ dependencies = [ "bytes", "fnv", "futures-util", + "handlebars", "http", "indexmap 2.2.6", "mime", @@ -496,8 +497,7 @@ checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "axum" version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a6c9af12842a67734c9a2e355436e5d03b22383ed60cf13cd0c18fbfe3dcbcf" +source = "git+https://github.com/tokio-rs/axum.git?rev=8d0c5c05eb75eb779591c8000705e785123868a0#8d0c5c05eb75eb779591c8000705e785123868a0" dependencies = [ "async-trait", "axum-core", @@ -523,7 +523,7 @@ dependencies = [ "serde_path_to_error", "serde_urlencoded", "sha1", - "sync_wrapper 1.0.1", + "sync_wrapper", "tokio", "tokio-tungstenite", "tower", @@ -535,8 +535,7 @@ dependencies = [ [[package]] name = "axum-core" version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a15c63fd72d41492dc4f497196f5da1fb04fb7529e631d73630d1b491e47a2e3" +source = "git+https://github.com/tokio-rs/axum.git?rev=8d0c5c05eb75eb779591c8000705e785123868a0#8d0c5c05eb75eb779591c8000705e785123868a0" dependencies = [ "async-trait", "bytes", @@ -547,7 +546,7 @@ dependencies = [ "mime", "pin-project-lite", "rustversion", - "sync_wrapper 0.1.2", + "sync_wrapper", "tower-layer", "tower-service", "tracing", @@ -599,8 +598,7 @@ dependencies = [ [[package]] name = "axum-macros" version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00c055ee2d014ae5981ce1016374e8213682aa14d9bf40e48ab48b5f3ef20eaa" +source = "git+https://github.com/tokio-rs/axum.git?rev=8d0c5c05eb75eb779591c8000705e785123868a0#8d0c5c05eb75eb779591c8000705e785123868a0" dependencies = [ "heck 0.4.1", "proc-macro2", @@ -1264,18 +1262,18 @@ dependencies = [ [[package]] name = "cranelift-bforest" -version = "0.108.0" +version = "0.108.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f75f0946f5e307e5dbf22e8bc0bd9bc5336a4f0240a4af4751c007a0cbf84917" +checksum = "29daf137addc15da6bab6eae2c4a11e274b1d270bf2759508e62f6145e863ef6" dependencies = [ "cranelift-entity", ] [[package]] name = "cranelift-codegen" -version = "0.108.0" +version = "0.108.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6b0a01705ef466bbc64e10af820f935f77256bcb14a40dde1e10b7a0969ce11" +checksum = "de619867d5de4c644b7fd9904d6e3295269c93d8a71013df796ab338681222d4" dependencies = [ "bumpalo", "cranelift-bforest", @@ -1295,33 +1293,33 @@ dependencies = [ [[package]] name = "cranelift-codegen-meta" -version = "0.108.0" +version = "0.108.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cdaeff01606190dcccd13cf3d80b8d5f1f197812ba7bba1196ae08bd8e82592" +checksum = "29f5cf277490037d8dae9513d35e0ee8134670ae4a964a5ed5b198d4249d7c10" dependencies = [ "cranelift-codegen-shared", ] [[package]] name = "cranelift-codegen-shared" -version = "0.108.0" +version = "0.108.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cefa0243350ce9667f3320579c8a2c3dd3d1f9943e8ab2eb1d4ca533ccc1db57" +checksum = "8c3e22ecad1123343a3c09ac6ecc532bb5c184b6fcb7888df0ea953727f79924" [[package]] name = "cranelift-control" -version = "0.108.0" +version = "0.108.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa46a2d3331aa33cbd399665d6ea0f431f726a55fb69fdf897035cf5fe0a3301" +checksum = "53ca3ec6d30bce84ccf59c81fead4d16381a3ef0ef75e8403bc1e7385980da09" dependencies = [ "arbitrary", ] [[package]] name = "cranelift-entity" -version = "0.108.0" +version = "0.108.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e8f7cc083e6d01d656283f293ec361ce7bae05eca896f3a932d42dad1850578" +checksum = "7eabb8d36b0ca8906bec93c78ea516741cac2d7e6b266fa7b0ffddcc09004990" dependencies = [ "serde", "serde_derive", @@ -1329,9 +1327,9 @@ dependencies = [ [[package]] name = "cranelift-frontend" -version = "0.108.0" +version = "0.108.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8490d83b85eeec14ebf3b4c0b0ebc33600f1943514b1406a7b99b85d8b80e4c0" +checksum = "44b42630229e49a8cfcae90bdc43c8c4c08f7a7aa4618b67f79265cd2f996dd2" dependencies = [ "cranelift-codegen", "log", @@ -1341,15 +1339,15 @@ dependencies = [ [[package]] name = "cranelift-isle" -version = "0.108.0" +version = "0.108.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e617871f2347ca078a31d61acaf7de961852447e6009afa5be6e4df6d5785dd4" +checksum = "918d1e36361805dfe0b6cdfd5a5ffdb5d03fa796170c5717d2727cbe623b93a0" [[package]] name = "cranelift-native" -version = "0.108.0" +version = "0.108.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "add05ee8162778fd7b545e0935f4a5c0c95afdac003362e040ef0229227ae967" +checksum = "75aea85a0d7e1800b14ce9d3f53adf8ad4d1ee8a9e23b0269bdc50285e93b9b3" dependencies = [ "cranelift-codegen", "libc", @@ -1358,9 +1356,9 @@ dependencies = [ [[package]] name = "cranelift-wasm" -version = "0.108.0" +version = "0.108.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "318b671ce0a174347dcbc4a5e8b8fe292864fd63fdb0c91324239245c3d4caa2" +checksum = "dac491fd3473944781f0cf9528c90cc899d18ad438da21961a839a3a44d57dfb" dependencies = [ "cranelift-codegen", "cranelift-entity", @@ -2483,6 +2481,20 @@ dependencies = [ "serde", ] +[[package]] +name = "handlebars" +version = "5.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d08485b96a0e6393e9e4d1b8d48cf74ad6c063cd905eb33f42c1ce3f0377539b" +dependencies = [ + "log", + "pest", + "pest_derive", + "serde", + "serde_json", + "thiserror", +] + [[package]] name = "hashbrown" version = "0.12.3" @@ -3217,8 +3229,6 @@ dependencies = [ "triomphe", "typed-builder", "url", - "utoipa", - "utoipa-swagger-ui", ] [[package]] @@ -3444,7 +3454,7 @@ dependencies = [ "garde", "http", "simd-json", - "sync_wrapper 1.0.1", + "sync_wrapper", "tracing", ] @@ -3800,7 +3810,6 @@ dependencies = [ "smol_str", "speedy-uuid", "strum", - "utoipa", ] [[package]] @@ -4982,6 +4991,40 @@ dependencies = [ "ucd-trie", ] +[[package]] +name = "pest_derive" +version = "2.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26293c9193fbca7b1a3bf9b79dc1e388e927e6cacaa78b4a3ab705a1d3d41459" +dependencies = [ + "pest", + "pest_generator", +] + +[[package]] +name = "pest_generator" +version = "2.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ec22af7d3fb470a85dd2ca96b7c577a1eb4ef6f1683a9fe9a8c16e136c04687" +dependencies = [ + "pest", + "pest_meta", + "proc-macro2", + "quote", + "syn 2.0.65", +] + +[[package]] +name = "pest_meta" +version = "2.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7a240022f37c361ec1878d646fc5b7d7c4d28d5946e1a80ad5a7a4f4ca0bdcd" +dependencies = [ + "once_cell", + "pest", + "sha2", +] + [[package]] name = "phf" version = "0.8.0" @@ -5298,30 +5341,6 @@ dependencies = [ "toml_edit 0.21.1", ] -[[package]] -name = "proc-macro-error" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" -dependencies = [ - "proc-macro-error-attr", - "proc-macro2", - "quote", - "syn 1.0.109", - "version_check", -] - -[[package]] -name = "proc-macro-error-attr" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" -dependencies = [ - "proc-macro2", - "quote", - "version_check", -] - [[package]] name = "proc-macro-hack" version = "0.5.20+deprecated" @@ -6732,12 +6751,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "sync_wrapper" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" - [[package]] name = "sync_wrapper" version = "1.0.1" @@ -7412,8 +7425,6 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "859eb650cfee7434994602c3a68b25d77ad9e68c8a6cd491616ef86661382eb3" dependencies = [ - "serde", - "stable_deref_trait", "unsize", ] @@ -7603,48 +7614,6 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" -[[package]] -name = "utoipa" -version = "4.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5afb1a60e207dca502682537fefcfd9921e71d0b83e9576060f09abc6efab23" -dependencies = [ - "indexmap 2.2.6", - "serde", - "serde_json", - "utoipa-gen", -] - -[[package]] -name = "utoipa-gen" -version = "4.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7bf0e16c02bc4bf5322ab65f10ab1149bdbcaa782cba66dc7057370a3f8190be" -dependencies = [ - "proc-macro-error", - "proc-macro2", - "quote", - "regex", - "syn 2.0.65", - "uuid", -] - -[[package]] -name = "utoipa-swagger-ui" -version = "6.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b39868d43c011961e04b41623e050aedf2cc93652562ff7935ce0f819aaf2da" -dependencies = [ - "axum", - "mime_guess", - "regex", - "rust-embed", - "serde", - "serde_json", - "utoipa", - "zip", -] - [[package]] name = "uuid" version = "1.8.0" @@ -7887,9 +7856,9 @@ dependencies = [ [[package]] name = "wasmtime" -version = "21.0.0" +version = "21.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fe2db63de4669214120414ae6d86afb6bb011748bf942836aba2d45f011972b" +checksum = "f92a1370c66a0022e6d92dcc277e2c84f5dece19569670b8ce7db8162560d8b6" dependencies = [ "addr2line", "anyhow", @@ -7936,18 +7905,18 @@ dependencies = [ [[package]] name = "wasmtime-asm-macros" -version = "21.0.0" +version = "21.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "821f87828a6508995bf1243fda9dafd1b671a49b3bf998394c7b73f0f5d9eb5f" +checksum = "6dee8679c974a7f258c03d60d3c747c426ed219945b6d08cbc77fd2eab15b2d1" dependencies = [ "cfg-if", ] [[package]] name = "wasmtime-component-macro" -version = "21.0.0" +version = "21.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aab7a588beec0116e99488768395eee70a1dc53869aae111d006f8928a16ed46" +checksum = "32cae30035f1cf97dcc6657c979cf39f99ce6be93583675eddf4aeaa5548509c" dependencies = [ "anyhow", "proc-macro2", @@ -7960,15 +7929,15 @@ dependencies = [ [[package]] name = "wasmtime-component-util" -version = "21.0.0" +version = "21.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52cc81977f24da3071f3f4b32f40ef6d8fb4f14e12f0bc4c68163935d6694ded" +checksum = "f7ae611f08cea620c67330925be28a96115bf01f8f393a6cbdf4856a86087134" [[package]] name = "wasmtime-cranelift" -version = "21.0.0" +version = "21.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e45cc4915c2b37b4d8b49aaab29d6e2612b393eabb01ae3a410d95e372c22d13" +checksum = "b2909406a6007e28be964067167890bca4574bd48a9ff18f1fa9f4856d89ea40" dependencies = [ "anyhow", "cfg-if", @@ -7990,9 +7959,9 @@ dependencies = [ [[package]] name = "wasmtime-environ" -version = "21.0.0" +version = "21.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bba5317f774e37197d588deadb794289438866b72bc1531c593506a004d6cfe0" +checksum = "40e227f9ed2f5421473723d6c0352b5986e6e6044fde5410a274a394d726108f" dependencies = [ "anyhow", "cranelift-entity", @@ -8013,9 +7982,9 @@ dependencies = [ [[package]] name = "wasmtime-fiber" -version = "21.0.0" +version = "21.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89ecb5dd1253786c4809588b722a5990367ad0b730f53e676ea8edd2962a6834" +checksum = "42edb392586d07038c1638e854382db916b6ca7845a2e6a7f8dc49e08907acdd" dependencies = [ "anyhow", "cc", @@ -8028,9 +7997,9 @@ dependencies = [ [[package]] name = "wasmtime-jit-icache-coherence" -version = "21.0.0" +version = "21.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6ce46bf24b027e1ede83d14ed544c736d7e939a849c4429551eb27842356c77" +checksum = "afe088f9b56bb353adaf837bf7e10f1c2e1676719dd5be4cac8e37f2ba1ee5bc" dependencies = [ "anyhow", "cfg-if", @@ -8040,15 +8009,15 @@ dependencies = [ [[package]] name = "wasmtime-slab" -version = "21.0.0" +version = "21.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90814f57c64afa02324829c3a8f88616ce3a75f1b2ce9728d34827d21329a836" +checksum = "4ff75cafffe47b04b036385ce3710f209153525b0ed19d57b0cf44a22d446460" [[package]] name = "wasmtime-types" -version = "21.0.0" +version = "21.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "629bdcf8b1f7590834c1ad6cd043e93e1d57e80b776adb84109eed203fb74d38" +checksum = "2f2fa462bfea3220711c84e2b549f147e4df89eeb49b8a2a3d89148f6cc4a8b1" dependencies = [ "cranelift-entity", "serde", @@ -8059,9 +8028,9 @@ dependencies = [ [[package]] name = "wasmtime-versioned-export-macros" -version = "21.0.0" +version = "21.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89b3438cb56868e235825c7026e85fe8a6c4b5437b5786ad010948e5c6eff0d4" +checksum = "d4cedc5bfef3db2a85522ee38564b47ef3b7fc7c92e94cacbce99808e63cdd47" dependencies = [ "proc-macro2", "quote", @@ -8070,9 +8039,9 @@ dependencies = [ [[package]] name = "wasmtime-wasi" -version = "21.0.0" +version = "21.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82e7931e19286a853fb5cae7790f9be473f7ab763043c659f1fa0a2a8eada10b" +checksum = "bdbbe94245904d4c96c7c5f7b55bad896cc27908644efd9442063c0748b631fc" dependencies = [ "anyhow", "async-trait", @@ -8100,9 +8069,9 @@ dependencies = [ [[package]] name = "wasmtime-winch" -version = "21.0.0" +version = "21.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd04ad4f7bbcf7925455cec6420481b972071284e611e105cc16b847fc6415e8" +checksum = "97b27054fed6be4f3800aba5766f7ef435d4220ce290788f021a08d4fa573108" dependencies = [ "anyhow", "cranelift-codegen", @@ -8117,9 +8086,9 @@ dependencies = [ [[package]] name = "wasmtime-wit-bindgen" -version = "21.0.0" +version = "21.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50c5e4fc265a4d78c334b9fcd846ffd94859bf821ee34a77bc68035526d455ee" +checksum = "c936a52ce69c28de2aa3b5fb4f2dbbb2966df304f04cccb7aca4ba56d915fda0" dependencies = [ "anyhow", "heck 0.4.1", @@ -8244,9 +8213,9 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "winch-codegen" -version = "0.19.0" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48691637c874363258ea7295497afdcfd426e5608fa36f62ab6bd0b9cac2bcb8" +checksum = "1dc69899ccb2da7daa4df31426dcfd284b104d1a85e1dae35806df0c46187f87" dependencies = [ "anyhow", "cranelift-codegen", @@ -8663,18 +8632,6 @@ dependencies = [ "syn 2.0.65", ] -[[package]] -name = "zip" -version = "0.6.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "760394e246e4c28189f19d488c058bf16f564016aefac5d32bb1f3b51d5e9261" -dependencies = [ - "byteorder", - "crc32fast", - "crossbeam-utils", - "flate2", -] - [[package]] name = "zxcvbn" version = "2.2.2" diff --git a/Cargo.toml b/Cargo.toml index 8aa28c606..418492ccb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -75,12 +75,91 @@ members = [ resolver = "2" [workspace.dependencies] +askama = { version = "0.12.1", default-features = false, features = [ + "with-axum", +] } +clap = { version = "4.5.4", features = ["derive", "wrap_help"] } +diesel = { version = "2.1.6", default-features = false, features = [ + "32-column-tables", + "with-deprecated", +] } +diesel-async = { version = "0.4.1", features = [ + "async-connection-wrapper", + "bb8", + "postgres", + "tokio", +] } +diesel_full_text_search = { version = "2.1.1", default-features = false } fred = { version = "9.0.3", features = [ "enable-rustls-ring", + "full-tracing", "i-scripts", - "partial-tracing", "sha-1", ] } +garde = { version = "0.18.0", default-features = false, features = [ + "derive", + "email", + "email-idna", + "regex", + "serde", +] } +itertools = { version = "0.13.0", default-features = false } +moka = { version = "0.12.7", features = ["sync"] } +simd-json = "0.13.10" +simdutf8 = { version = "0.1.4", features = ["aarch64_neon"] } +triomphe = { version = "0.1.11", default-features = false, features = [ + "unsize", +] } + +# Local workspace dependencies (crate directory) +kitsune-activitypub = { path = "crates/kitsune-activitypub" } +kitsune-cache = { path = "crates/kitsune-cache" } +kitsune-captcha = { path = "crates/kitsune-captcha" } +kitsune-config = { path = "crates/kitsune-config" } +kitsune-core = { path = "crates/kitsune-core" } +kitsune-db = { path = "crates/kitsune-db" } +kitsune-derive = { path = "crates/kitsune-derive" } +kitsune-email = { path = "crates/kitsune-email" } +kitsune-embed = { path = "crates/kitsune-embed" } +kitsune-error = { path = "crates/kitsune-error" } +kitsune-federation = { path = "crates/kitsune-federation" } +kitsune-federation-filter = { path = "crates/kitsune-federation-filter" } +kitsune-http-client = { path = "crates/kitsune-http-client" } +kitsune-jobs = { path = "crates/kitsune-jobs" } +kitsune-language = { path = "crates/kitsune-language" } +kitsune-mastodon = { path = "crates/kitsune-mastodon" } +kitsune-observability = { path = "crates/kitsune-observability" } +kitsune-oidc = { path = "crates/kitsune-oidc" } +kitsune-s3 = { path = "crates/kitsune-s3" } +kitsune-scss-compiler = { path = "crates/kitsune-scss-compiler" } +kitsune-search = { path = "crates/kitsune-search" } +kitsune-service = { path = "crates/kitsune-service" } +kitsune-storage = { path = "crates/kitsune-storage" } +kitsune-test = { path = "crates/kitsune-test" } +kitsune-type = { path = "crates/kitsune-type" } +kitsune-url = { path = "crates/kitsune-url" } +kitsune-util = { path = "crates/kitsune-util" } +kitsune-wasm-mrf = { path = "crates/kitsune-wasm-mrf" } +kitsune-webfinger = { path = "crates/kitsune-webfinger" } +kitsune = { path = "kitsune" } +kitsune-job-runner = { path = "kitsune-job-runner" } + +# Local workspace dependences (lib directory) +athena = { path = "lib/athena", features = ["redis"] } +blowocking = { path = "lib/blowocking" } +cursiv = { path = "lib/cursiv" } +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" } +post-process = { path = "lib/post-process" } +speedy-uuid = { path = "lib/speedy-uuid", features = ["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" } +tower-x-clacks-overhead = { path = "lib/tower-x-clacks-overhead" } +trials = { path = "lib/trials" } [workspace.lints.clippy] all = "warn" @@ -133,6 +212,10 @@ diesel-async = { git = "https://github.com/weiznich/diesel_async.git", rev = "d0 scraper = { git = "https://github.com/causal-agent/scraper.git", rev = "d67111f5cc0b7da6e6ff10e4549d87cf09ba3e5b" } tokio-postgres-rustls = { git = "https://github.com/jbg/tokio-postgres-rustls.git", rev = "b16c1bc0f5d4f91324174fd1bd839d743a70f86a" } +# TCP nodelay for `axum::serve` +axum = { git = "https://github.com/tokio-rs/axum.git", rev = "8d0c5c05eb75eb779591c8000705e785123868a0" } +axum-core = { git = "https://github.com/tokio-rs/axum.git", rev = "8d0c5c05eb75eb779591c8000705e785123868a0" } + # Patch to make OpenTelemetry with with hyper 1 opentelemetry = { git = "https://github.com/open-telemetry/opentelemetry-rust.git", rev = "40fb924215c84d6e3818351b2c0e3d2ba01a7db9" } opentelemetry-http = { git = "https://github.com/open-telemetry/opentelemetry-rust.git", rev = "40fb924215c84d6e3818351b2c0e3d2ba01a7db9" } diff --git a/crates/kitsune-activitypub/Cargo.toml b/crates/kitsune-activitypub/Cargo.toml index 823ef6dde..57de79250 100644 --- a/crates/kitsune-activitypub/Cargo.toml +++ b/crates/kitsune-activitypub/Cargo.toml @@ -8,35 +8,35 @@ license.workspace = true [dependencies] async-trait = "0.1.80" base64-simd = "0.8.0" -diesel = "2.1.6" -diesel-async = "0.4.1" +diesel = { workspace = true } +diesel-async = { workspace = true } futures-util = "0.3.30" headers = "0.4.0" http = "1.1.0" iso8601-timestamp = "0.2.17" -kitsune-cache = { path = "../kitsune-cache" } -kitsune-config = { path = "../kitsune-config" } -kitsune-core = { path = "../kitsune-core" } -kitsune-db = { path = "../kitsune-db" } -kitsune-embed = { path = "../kitsune-embed" } -kitsune-error = { path = "../kitsune-error" } -kitsune-federation-filter = { path = "../kitsune-federation-filter" } -kitsune-http-client = { path = "../kitsune-http-client" } -kitsune-language = { path = "../kitsune-language" } -kitsune-search = { path = "../kitsune-search" } -kitsune-service = { path = "../kitsune-service" } -kitsune-type = { path = "../kitsune-type" } -kitsune-url = { path = "../kitsune-url" } -kitsune-util = { path = "../kitsune-util" } -kitsune-wasm-mrf = { path = "../kitsune-wasm-mrf" } +kitsune-cache = { workspace = true } +kitsune-config = { workspace = true } +kitsune-core = { workspace = true } +kitsune-db = { workspace = true } +kitsune-embed = { workspace = true } +kitsune-error = { workspace = true } +kitsune-federation-filter = { workspace = true } +kitsune-http-client = { workspace = true } +kitsune-language = { workspace = true } +kitsune-search = { workspace = true } +kitsune-service = { workspace = true } +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.4", default-features = false } serde = "1.0.202" sha2 = "0.10.8" -simd-json = "0.13.10" -speedy-uuid = { path = "../../lib/speedy-uuid" } +simd-json = { workspace = true } +speedy-uuid = { workspace = true } tracing = "0.1.40" -triomphe = "0.1.11" +triomphe = { workspace = true } typed-builder = "0.18.2" url = "2.5.0" @@ -46,9 +46,9 @@ sha2 = { version = "0.10.8", features = ["asm"] } [dev-dependencies] http-body-util = "0.1.1" hyper = "1.3.1" -kitsune-config = { path = "../kitsune-config" } -kitsune-test = { path = "../kitsune-test" } -kitsune-webfinger = { path = "../kitsune-webfinger" } +kitsune-config = { workspace = true } +kitsune-test = { workspace = true } +kitsune-webfinger = { workspace = true } pretty_assertions = "1.4.0" tokio = { version = "1.37.0", features = ["macros"] } tower = { version = "0.4.13", default-features = false, features = ["util"] } diff --git a/crates/kitsune-cache/Cargo.toml b/crates/kitsune-cache/Cargo.toml index c48a4ee76..4a2236167 100644 --- a/crates/kitsune-cache/Cargo.toml +++ b/crates/kitsune-cache/Cargo.toml @@ -8,12 +8,12 @@ license.workspace = true [dependencies] enum_dispatch = "0.3.13" fred = { workspace = true } -kitsune-error = { path = "../kitsune-error" } -moka = { version = "0.12.7", features = ["sync"] } +kitsune-error = { workspace = true } +moka = { workspace = true } serde = "1.0.202" -simd-json = "0.13.10" +simd-json = { workspace = true } tracing = "0.1.40" -triomphe = "0.1.11" +triomphe = { workspace = true } typed-builder = "0.18.2" [dev-dependencies] diff --git a/crates/kitsune-captcha/Cargo.toml b/crates/kitsune-captcha/Cargo.toml index b941c004e..ca05c8da8 100644 --- a/crates/kitsune-captcha/Cargo.toml +++ b/crates/kitsune-captcha/Cargo.toml @@ -8,11 +8,11 @@ license.workspace = true [dependencies] enum_dispatch = "0.3.13" http = "1.1.0" -kitsune-error = { path = "../kitsune-error" } -kitsune-http-client = { path = "../kitsune-http-client" } +kitsune-error = { workspace = true } +kitsune-http-client = { workspace = true } serde = { version = "1.0.202", features = ["derive"] } serde_urlencoded = "0.7.1" -simd-json = "0.13.10" +simd-json = { workspace = true } strum = { version = "0.26.2", features = ["derive"] } typed-builder = "0.18.2" diff --git a/crates/kitsune-core/Cargo.toml b/crates/kitsune-core/Cargo.toml index 0ab3259d5..01d881b05 100644 --- a/crates/kitsune-core/Cargo.toml +++ b/crates/kitsune-core/Cargo.toml @@ -9,11 +9,11 @@ build = "build.rs" [dependencies] async-trait = "0.1.80" const_format = "0.2.32" -kitsune-db = { path = "../kitsune-db" } -kitsune-error = { path = "../kitsune-error" } +kitsune-db = { workspace = true } +kitsune-error = { workspace = true } paste = "1.0.15" serde = { version = "1.0.202", features = ["derive"] } -triomphe = { version = "0.1.11", features = ["unsize"] } +triomphe = { workspace = true } typed-builder = "0.18.2" unsize = "1.1.0" diff --git a/crates/kitsune-db/Cargo.toml b/crates/kitsune-db/Cargo.toml index d73c95ca1..84149be9c 100644 --- a/crates/kitsune-db/Cargo.toml +++ b/crates/kitsune-db/Cargo.toml @@ -7,24 +7,19 @@ license.workspace = true build = "build.rs" [dependencies] -blowocking = { path = "../../lib/blowocking" } -diesel = { version = "2.1.6", features = ["uuid"] } -diesel-async = { version = "0.4.1", features = [ - "async-connection-wrapper", - "bb8", - "postgres", - "tokio", -] } -diesel_full_text_search = { version = "2.1.1", default-features = false } +blowocking = { workspace = true } +diesel = { workspace = true } +diesel-async = { workspace = true } +diesel_full_text_search = { workspace = true } diesel_migrations = "2.1.0" futures-util = { version = "0.3.30", default-features = false, features = [ "alloc", ] } iso8601-timestamp = { version = "0.2.17", features = ["diesel-pg"] } -kitsune-config = { path = "../kitsune-config" } -kitsune-error = { path = "../kitsune-error" } -kitsune-language = { path = "../kitsune-language" } -kitsune-type = { path = "../kitsune-type" } +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.7", default-features = false, features = [ @@ -35,18 +30,18 @@ rustls = { version = "0.23.7", default-features = false, features = [ ] } rustls-native-certs = "0.7.0" serde = { version = "1.0.202", features = ["derive"] } -simd-json = "0.13.10" -speedy-uuid = { path = "../../lib/speedy-uuid", features = ["diesel"] } +simd-json = { workspace = true } +speedy-uuid = { workspace = true, features = ["diesel"] } tokio = { version = "1.37.0", features = ["rt"] } tokio-postgres = "0.7.10" tokio-postgres-rustls = "0.12.0" tracing = "0.1.40" tracing-log = "0.2.0" -trials = { path = "../../lib/trials" } +trials = { workspace = true } typed-builder = "0.18.2" [dev-dependencies] -kitsune-test = { path = "../kitsune-test" } +kitsune-test = { workspace = true } tokio = { version = "1.37.0", features = ["macros"] } [lints] diff --git a/crates/kitsune-derive/Cargo.toml b/crates/kitsune-derive/Cargo.toml index 742d07bc4..97e09937b 100644 --- a/crates/kitsune-derive/Cargo.toml +++ b/crates/kitsune-derive/Cargo.toml @@ -7,7 +7,7 @@ license.workspace = true [dependencies] kitsune-derive-impl = { path = "impl" } -triomphe = "0.1.11" +triomphe = { workspace = true } typed-builder = "0.18.2" [lints] diff --git a/crates/kitsune-email/Cargo.toml b/crates/kitsune-email/Cargo.toml index 1abecc912..ce6fdd090 100644 --- a/crates/kitsune-email/Cargo.toml +++ b/crates/kitsune-email/Cargo.toml @@ -9,14 +9,14 @@ license.workspace = true ignored = ["askama_axum"] # See reason below. [dependencies] -askama = "0.12.1" +askama = { workspace = true } askama_axum = "0.4.0" # Damn it, cargo. Because "kitsune" uses "askama" with the axum feature, we have to have the crate available here as well.. -diesel = "2.1.6" -diesel-async = "0.4.1" -kitsune-db = { path = "../kitsune-db" } -kitsune-derive = { path = "../kitsune-derive" } -kitsune-error = { path = "../kitsune-error" } -kitsune-url = { path = "../kitsune-url" } +diesel = { workspace = true } +diesel-async = { workspace = true } +kitsune-db = { workspace = true } +kitsune-derive = { workspace = true } +kitsune-error = { workspace = true } +kitsune-url = { workspace = true } lettre = { version = "0.11.7", default-features = false, features = [ "builder", "hostname", @@ -31,8 +31,8 @@ mrml = { version = "3.1.5", default-features = false, features = [ "parse", "render", ] } -speedy-uuid = { path = "../../lib/speedy-uuid" } -triomphe = "0.1.11" +speedy-uuid = { workspace = true } +triomphe = { workspace = true } typed-builder = "0.18.2" [lints] diff --git a/crates/kitsune-embed/Cargo.toml b/crates/kitsune-embed/Cargo.toml index 861d57624..7c146d9be 100644 --- a/crates/kitsune-embed/Cargo.toml +++ b/crates/kitsune-embed/Cargo.toml @@ -6,15 +6,15 @@ version.workspace = true license.workspace = true [dependencies] -diesel = "2.1.6" -diesel-async = "0.4.1" +diesel = { workspace = true } +diesel-async = { workspace = true } embed-sdk = { git = "https://github.com/Lantern-chat/embed-service.git", rev = "f46ea95ca89775a6c35d0d5cef9172cbc931258a" } http = "1.1.0" iso8601-timestamp = "0.2.17" -kitsune-db = { path = "../kitsune-db" } -kitsune-derive = { path = "../kitsune-derive" } -kitsune-error = { path = "../kitsune-error" } -kitsune-http-client = { path = "../kitsune-http-client" } +kitsune-db = { workspace = true } +kitsune-derive = { workspace = true } +kitsune-error = { workspace = true } +kitsune-http-client = { workspace = true } once_cell = "1.19.0" scraper = { version = "0.19.0", default-features = false } smol_str = "0.2.2" diff --git a/crates/kitsune-error/Cargo.toml b/crates/kitsune-error/Cargo.toml index f15a53b84..574b32ec8 100644 --- a/crates/kitsune-error/Cargo.toml +++ b/crates/kitsune-error/Cargo.toml @@ -8,9 +8,9 @@ license.workspace = true [dependencies] axum-core = "0.4.3" eyre = "0.6.12" -garde = { version = "0.18.0", default-features = false, features = ["serde"] } +garde = { workspace = true } http = "1.1.0" -simd-json = "0.13.10" +simd-json = { workspace = true } sync_wrapper = "1.0.1" tracing = "0.1.40" diff --git a/crates/kitsune-federation-filter/Cargo.toml b/crates/kitsune-federation-filter/Cargo.toml index 06d8d4cd7..778604a7d 100644 --- a/crates/kitsune-federation-filter/Cargo.toml +++ b/crates/kitsune-federation-filter/Cargo.toml @@ -7,10 +7,10 @@ license.workspace = true [dependencies] globset = "0.4.14" -kitsune-config = { path = "../kitsune-config" } -kitsune-derive = { path = "../kitsune-derive" } -kitsune-error = { path = "../kitsune-error" } -kitsune-type = { path = "../kitsune-type" } +kitsune-config = { workspace = true } +kitsune-derive = { workspace = true } +kitsune-error = { workspace = true } +kitsune-type = { workspace = true } url = "2.5.0" [lints] diff --git a/crates/kitsune-federation/Cargo.toml b/crates/kitsune-federation/Cargo.toml index b8ae36e89..e8f049a59 100644 --- a/crates/kitsune-federation/Cargo.toml +++ b/crates/kitsune-federation/Cargo.toml @@ -6,19 +6,19 @@ version.workspace = true license.workspace = true [dependencies] -kitsune-activitypub = { path = "../kitsune-activitypub" } -kitsune-cache = { path = "../kitsune-cache" } -kitsune-config = { path = "../kitsune-config" } -kitsune-core = { path = "../kitsune-core" } -kitsune-db = { path = "../kitsune-db" } -kitsune-embed = { path = "../kitsune-embed" } -kitsune-federation-filter = { path = "../kitsune-federation-filter" } -kitsune-search = { path = "../kitsune-search" } -kitsune-service = { path = "../kitsune-service" } -kitsune-url = { path = "../kitsune-url" } -kitsune-wasm-mrf = { path = "../kitsune-wasm-mrf" } -kitsune-webfinger = { path = "../kitsune-webfinger" } -triomphe = "0.1.11" +kitsune-activitypub = { workspace = true } +kitsune-cache = { workspace = true } +kitsune-config = { workspace = true } +kitsune-core = { workspace = true } +kitsune-db = { workspace = true } +kitsune-embed = { workspace = true } +kitsune-federation-filter = { workspace = true } +kitsune-search = { workspace = true } +kitsune-service = { workspace = true } +kitsune-url = { workspace = true } +kitsune-wasm-mrf = { workspace = true } +kitsune-webfinger = { workspace = true } +triomphe = { workspace = true } typed-builder = "0.18.2" [lints] diff --git a/crates/kitsune-http-client/Cargo.toml b/crates/kitsune-http-client/Cargo.toml index a55d44632..8b9c34a0f 100644 --- a/crates/kitsune-http-client/Cargo.toml +++ b/crates/kitsune-http-client/Cargo.toml @@ -13,7 +13,7 @@ futures-util = { version = "0.3.30", default-features = false, features = [ ] } http-body = "1.0.0" http-body-util = "0.1.1" -http-signatures = { path = "../../lib/http-signatures" } +http-signatures = { workspace = true } hyper = "1.3.1" hyper-util = { version = "0.1.3", features = [ "client-legacy", @@ -29,11 +29,11 @@ hyper-rustls = { version = "0.27.1", default-features = false, features = [ "ring", "tls12", ] } -kitsune-type = { path = "../kitsune-type" } +kitsune-type = { workspace = true } pin-project = "1.1.5" serde = "1.0.202" -simdutf8 = { version = "0.1.4", features = ["aarch64_neon"] } -simd-json = "0.13.10" +simdutf8 = { workspace = true } +simd-json = { workspace = true } tower = { version = "0.4.13", features = ["util"] } tower-http = { version = "0.5.2", features = [ # Explicitly exclude `zstd` diff --git a/crates/kitsune-jobs/Cargo.toml b/crates/kitsune-jobs/Cargo.toml index e28f645a0..0832537ea 100644 --- a/crates/kitsune-jobs/Cargo.toml +++ b/crates/kitsune-jobs/Cargo.toml @@ -6,17 +6,17 @@ version.workspace = true license.workspace = true [dependencies] -athena = { path = "../../lib/athena" } +athena = { workspace = true } derive_more = { version = "1.0.0-beta.6", features = ["from"] } -diesel = "2.1.6" -diesel-async = "0.4.1" +diesel = { workspace = true } +diesel-async = { workspace = true } futures-util = "0.3.30" -kitsune-core = { path = "../kitsune-core" } -kitsune-db = { path = "../kitsune-db" } -kitsune-email = { path = "../kitsune-email" } -kitsune-error = { path = "../kitsune-error" } +kitsune-core = { workspace = true } +kitsune-db = { workspace = true } +kitsune-email = { workspace = true } +kitsune-error = { workspace = true } serde = { version = "1.0.202", features = ["derive"] } -speedy-uuid = { path = "../../lib/speedy-uuid" } +speedy-uuid = { workspace = true } tracing = "0.1.40" typed-builder = "0.18.2" diff --git a/crates/kitsune-language/Cargo.toml b/crates/kitsune-language/Cargo.toml index ea1df141a..8b9a821f6 100644 --- a/crates/kitsune-language/Cargo.toml +++ b/crates/kitsune-language/Cargo.toml @@ -6,9 +6,9 @@ version.workspace = true license.workspace = true [dependencies] -diesel = "2.1.6" -diesel-async = { version = "0.4.1", features = ["postgres"] } -kitsune-config = { path = "../kitsune-config" } +diesel = { workspace = true } +diesel-async = { workspace = true } +kitsune-config = { workspace = true } isolang = { version = "2.4.0", features = [ "english_names", "list_languages", diff --git a/crates/kitsune-mastodon/Cargo.toml b/crates/kitsune-mastodon/Cargo.toml index b734c4373..205570880 100644 --- a/crates/kitsune-mastodon/Cargo.toml +++ b/crates/kitsune-mastodon/Cargo.toml @@ -6,23 +6,23 @@ version.workspace = true license.workspace = true [dependencies] -diesel = "2.1.6" -diesel-async = "0.4.1" +diesel = { workspace = true } +diesel-async = { workspace = true } futures-util = "0.3.30" iso8601-timestamp = "0.2.17" -kitsune-cache = { path = "../kitsune-cache" } -kitsune-db = { path = "../kitsune-db" } -kitsune-embed = { path = "../kitsune-embed" } -kitsune-error = { path = "../kitsune-error" } -kitsune-service = { path = "../kitsune-service" } -kitsune-type = { path = "../kitsune-type" } -kitsune-url = { path = "../kitsune-url" } -kitsune-util = { path = "../kitsune-util" } +kitsune-cache = { workspace = true } +kitsune-db = { workspace = true } +kitsune-embed = { workspace = true } +kitsune-error = { workspace = true } +kitsune-service = { workspace = true } +kitsune-type = { workspace = true } +kitsune-url = { workspace = true } +kitsune-util = { workspace = true } mime = "0.3.17" serde = "1.0.202" -simd-json = "0.13.10" +simd-json = { workspace = true } smol_str = "0.2.2" -speedy-uuid = { path = "../../lib/speedy-uuid" } +speedy-uuid = { workspace = true } tracing = "0.1.40" typed-builder = "0.18.2" diff --git a/crates/kitsune-observability/Cargo.toml b/crates/kitsune-observability/Cargo.toml index f6cb87b69..88c843c10 100644 --- a/crates/kitsune-observability/Cargo.toml +++ b/crates/kitsune-observability/Cargo.toml @@ -10,8 +10,8 @@ async-trait = "0.1.80" eyre = "0.6.12" http-body-util = "0.1.1" hyper = { version = "1.3.1", default-features = false } -kitsune-config = { path = "../kitsune-config" } -kitsune-http-client = { path = "../kitsune-http-client" } +kitsune-config = { workspace = true } +kitsune-http-client = { workspace = true } opentelemetry = { version = "0.23.0", default-features = false, features = [ "trace", ] } diff --git a/crates/kitsune-oidc/Cargo.toml b/crates/kitsune-oidc/Cargo.toml index b32bf6c8b..0f42dc7fa 100644 --- a/crates/kitsune-oidc/Cargo.toml +++ b/crates/kitsune-oidc/Cargo.toml @@ -10,11 +10,11 @@ enum_dispatch = "0.3.13" fred = { workspace = true } http = "1.1.0" http-body-util = "0.1.1" -kitsune-config = { path = "../kitsune-config" } -kitsune-derive = { path = "../kitsune-derive" } -kitsune-error = { path = "../kitsune-error" } -kitsune-http-client = { path = "../kitsune-http-client" } -moka = { version = "0.12.7", features = ["sync"] } +kitsune-config = { workspace = true } +kitsune-derive = { workspace = true } +kitsune-error = { workspace = true } +kitsune-http-client = { workspace = true } +moka = { workspace = true } oauth2 = { version = "5.0.0-alpha.4", default-features = false } once_cell = "1.19.0" openidconnect = { version = "4.0.0-alpha.1", default-features = false, features = [ @@ -23,8 +23,8 @@ openidconnect = { version = "4.0.0-alpha.1", default-features = false, features "accept-string-booleans", ] } serde = { version = "1.0.202", features = ["derive"] } -simd-json = "0.13.10" -speedy-uuid = { path = "../../lib/speedy-uuid", features = ["serde"] } +simd-json = { workspace = true } +speedy-uuid = { workspace = true } url = "2.5.0" [lints] diff --git a/crates/kitsune-s3/Cargo.toml b/crates/kitsune-s3/Cargo.toml index 5461d9f4d..d40a34a3e 100644 --- a/crates/kitsune-s3/Cargo.toml +++ b/crates/kitsune-s3/Cargo.toml @@ -9,15 +9,15 @@ license.workspace = true bytes = "1.6.0" futures-util = { version = "0.3.30", default-features = false } http = "1.1.0" -kitsune-error = { path = "../kitsune-error" } -kitsune-http-client = { path = "../kitsune-http-client" } +kitsune-error = { workspace = true } +kitsune-http-client = { workspace = true } quick-xml = { version = "0.31.0", features = ["serialize"] } rusty-s3 = "0.5.0" serde = { version = "1.0.202", features = ["derive"] } typed-builder = "0.18.2" [dev-dependencies] -kitsune-test = { path = "../kitsune-test" } +kitsune-test = { workspace = true } tokio = { version = "1.37.0", features = ["macros", "rt"] } [lints] diff --git a/crates/kitsune-search/Cargo.toml b/crates/kitsune-search/Cargo.toml index 9e247865f..4b003bc88 100644 --- a/crates/kitsune-search/Cargo.toml +++ b/crates/kitsune-search/Cargo.toml @@ -8,24 +8,24 @@ license.workspace = true [dependencies] async-trait = "0.1.80" bytes = "1.6.0" -diesel = "2.1.6" -diesel-async = "0.4.1" -diesel_full_text_search = { version = "2.1.1", default-features = false } +diesel = { workspace = true } +diesel-async = { workspace = true } +diesel_full_text_search = { workspace = true } enum_dispatch = "0.3.13" futures-io = "0.3.30" futures-util = "0.3.30" http = "1.1.0" -kitsune-config = { path = "../kitsune-config" } -kitsune-db = { path = "../kitsune-db" } -kitsune-derive = { path = "../kitsune-derive" } -kitsune-error = { path = "../kitsune-error" } -kitsune-http-client = { path = "../kitsune-http-client" } -kitsune-language = { path = "../kitsune-language" } +kitsune-config = { workspace = true } +kitsune-db = { workspace = true } +kitsune-derive = { workspace = true } +kitsune-error = { workspace = true } +kitsune-http-client = { workspace = true } +kitsune-language = { workspace = true } meilisearch-sdk = { version = "0.26.1", default-features = false } pin-project-lite = "0.2.14" serde = { version = "1.0.202", features = ["derive"] } serde_urlencoded = "0.7.1" -speedy-uuid = { path = "../../lib/speedy-uuid" } +speedy-uuid = { workspace = true } strum = { version = "0.26.2", features = ["derive"] } tracing = "0.1.40" diff --git a/crates/kitsune-service/Cargo.toml b/crates/kitsune-service/Cargo.toml index d647af811..5fa9a1d84 100644 --- a/crates/kitsune-service/Cargo.toml +++ b/crates/kitsune-service/Cargo.toml @@ -9,54 +9,48 @@ license.workspace = true ahash = "0.8.11" argon2 = "0.5.3" async-stream = "0.3.5" -athena = { path = "../../lib/athena" } -blowocking = { path = "../../lib/blowocking" } +athena = { workspace = true } +blowocking = { workspace = true } bytes = "1.6.0" derive_builder = "0.20.0" -diesel = "2.1.6" -diesel-async = "0.4.1" +diesel = { workspace = true } +diesel-async = { workspace = true } eyre = "0.6.12" fred = { workspace = true } futures-util = "0.3.30" -garde = { version = "0.18.0", default-features = false, features = [ - "derive", - "email", - "email-idna", - "regex", - "serde", -] } +garde = { workspace = true } http = "1.1.0" img-parts = "0.3.0" iso8601-timestamp = "0.2.17" -kitsune-cache = { path = "../kitsune-cache" } -kitsune-captcha = { path = "../kitsune-captcha" } -kitsune-config = { path = "../kitsune-config" } -kitsune-core = { path = "../kitsune-core" } -kitsune-db = { path = "../kitsune-db" } -kitsune-derive = { path = "../kitsune-derive" } -kitsune-email = { path = "../kitsune-email" } -kitsune-embed = { path = "../kitsune-embed" } -kitsune-error = { path = "../kitsune-error" } -kitsune-http-client = { path = "../kitsune-http-client" } -kitsune-jobs = { path = "../kitsune-jobs" } -kitsune-language = { path = "../kitsune-language" } -kitsune-search = { path = "../kitsune-search" } -kitsune-storage = { path = "../kitsune-storage" } -kitsune-url = { path = "../kitsune-url" } -kitsune-util = { path = "../kitsune-util" } +kitsune-cache = { workspace = true } +kitsune-captcha = { workspace = true } +kitsune-config = { workspace = true } +kitsune-core = { workspace = true } +kitsune-db = { workspace = true } +kitsune-derive = { workspace = true } +kitsune-email = { workspace = true } +kitsune-embed = { workspace = true } +kitsune-error = { workspace = true } +kitsune-http-client = { workspace = true } +kitsune-jobs = { workspace = true } +kitsune-language = { workspace = true } +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" -post-process = { path = "../../lib/post-process" } +post-process = { workspace = true } rand = "0.8.5" rsa = "0.9.6" rusty-s3 = { version = "0.5.0", default-features = false } serde = "1.0.202" smol_str = "0.2.2" -speedy-uuid = { path = "../../lib/speedy-uuid" } +speedy-uuid = { workspace = true } tokio = { version = "1.37.0", features = ["macros", "sync"] } tracing = "0.1.40" -triomphe = "0.1.11" +triomphe = { workspace = true } typed-builder = "0.18.2" url = "2.5.0" zxcvbn = { version = "2.2.2", default-features = false } @@ -65,12 +59,12 @@ zxcvbn = { version = "2.2.2", default-features = false } hex-simd = "0.8.0" http-body-util = "0.1.1" hyper = "1.3.1" -kitsune-activitypub = { path = "../kitsune-activitypub" } -kitsune-config = { path = "../kitsune-config" } -kitsune-federation-filter = { path = "../kitsune-federation-filter" } -kitsune-jobs = { path = "../kitsune-jobs" } -kitsune-test = { path = "../kitsune-test" } -kitsune-webfinger = { path = "../kitsune-webfinger" } +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.0" tempfile = "3.10.1" tower = { version = "0.4.13", default-features = false, features = ["util"] } diff --git a/crates/kitsune-service/src/post/mod.rs b/crates/kitsune-service/src/post/mod.rs index daff6bd92..4258e8b21 100644 --- a/crates/kitsune-service/src/post/mod.rs +++ b/crates/kitsune-service/src/post/mod.rs @@ -53,6 +53,7 @@ use typed_builder::TypedBuilder; mod resolver; pub use self::resolver::PostResolver; +use self::resolver::ResolvedPost; macro_rules! min_character_limit { ($self:ident) => {{ @@ -442,16 +443,22 @@ impl PostService { character_limit: self.instance_service.character_limit(), })?; + let content_source = create_post.content.clone(); let subject = create_post.subject.map(|mut subject| { subject.clean_html(); subject }); - let content_source = create_post.content.clone(); + let ResolvedPost { + mentioned_accounts, + custom_emojis, + content, + } = self.post_resolver.resolve(&create_post.content).await?; + let mut content = if create_post.process_markdown { - process::markdown(&create_post.content) + process::markdown(&content) } else { - create_post.content + content }; content.clean_html(); @@ -463,7 +470,6 @@ impl PostService { |lang| Language::from_639_1(&lang).unwrap_or_else(|| detect_language(&content)), ); - let resolved = self.post_resolver.resolve(&content).await?; let link_preview_url = if let Some(ref embed_client) = self.embed_client { embed_client .fetch_embed_for_fragment(&content) @@ -496,7 +502,7 @@ impl PostService { in_reply_to_id, reposted_post_id: None, subject: subject.as_deref(), - content: resolved.content.as_str(), + content: content.as_str(), content_source: content_source.as_str(), content_lang: content_lang.into(), link_preview_url: link_preview_url.as_deref(), @@ -510,10 +516,10 @@ impl PostService { .get_result(tx) .await?; - Self::process_mentions(tx, post.account_id, post.id, resolved.mentioned_accounts) - .await?; - Self::process_custom_emojis(tx, post.id, resolved.custom_emojis).await?; + Self::process_mentions(tx, post.account_id, post.id, mentioned_accounts).await?; + Self::process_custom_emojis(tx, post.id, custom_emojis).await?; Self::process_media_attachments(tx, post.id, &create_post.media_ids).await?; + NotificationService::notify_on_new_post(tx, post.account_id, post.id).await?; Ok::<_, Error>(post) diff --git a/crates/kitsune-storage/Cargo.toml b/crates/kitsune-storage/Cargo.toml index 7bd7a35a9..4089346f4 100644 --- a/crates/kitsune-storage/Cargo.toml +++ b/crates/kitsune-storage/Cargo.toml @@ -9,12 +9,12 @@ license.workspace = true bytes = "1.6.0" derive_more = { version = "1.0.0-beta.6", features = ["from"] } futures-util = "0.3.30" -kitsune-error = { path = "../kitsune-error" } -kitsune-s3 = { path = "../kitsune-s3" } +kitsune-error = { workspace = true } +kitsune-s3 = { workspace = true } rusty-s3 = { version = "0.5.0", default-features = false } tokio = { version = "1.37.0", features = ["fs", "io-util"] } tokio-util = { version = "0.7.11", features = ["io"] } -triomphe = "0.1.11" +triomphe = { workspace = true } [dev-dependencies] tempfile = "3.10.1" diff --git a/crates/kitsune-test/Cargo.toml b/crates/kitsune-test/Cargo.toml index 3d7eec741..bd7e4a5b0 100644 --- a/crates/kitsune-test/Cargo.toml +++ b/crates/kitsune-test/Cargo.toml @@ -7,20 +7,20 @@ license.workspace = true [dependencies] bytes = "1.6.0" -diesel-async = "0.4.1" +diesel-async = { workspace = true } fred = { workspace = true } futures-util = "0.3.30" http = "1.1.0" http-body-util = "0.1.1" isolang = "2.4.0" -kitsune-config = { path = "../kitsune-config" } -kitsune-db = { path = "../kitsune-db" } -kitsune-s3 = { path = "../kitsune-s3" } +kitsune-config = { workspace = true } +kitsune-db = { workspace = true } +kitsune-s3 = { workspace = true } pin-project-lite = "0.2.14" rand = "0.8.5" rusty-s3 = { version = "0.5.0", default-features = false } tokio = { version = "1.37.0", features = ["time"] } -triomphe = "0.1.11" +triomphe = { workspace = true } url = "2.5.0" uuid = { version = "1.8.0", features = ["fast-rng", "v4"] } diff --git a/crates/kitsune-type/Cargo.toml b/crates/kitsune-type/Cargo.toml index 8ca25e0dd..0e76447a6 100644 --- a/crates/kitsune-type/Cargo.toml +++ b/crates/kitsune-type/Cargo.toml @@ -8,11 +8,10 @@ license.workspace = true [dependencies] iso8601-timestamp = "0.2.17" serde = { version = "1.0.202", features = ["derive"] } -simd-json = "0.13.10" +simd-json = { workspace = true } smol_str = { version = "0.2.2", features = ["serde"] } -speedy-uuid = { path = "../../lib/speedy-uuid", features = ["serde"] } +speedy-uuid = { workspace = true, features = ["diesel"] } strum = { version = "0.26.2", features = ["derive"] } -utoipa = { version = "4.2.3", features = ["chrono", "uuid"] } [dev-dependencies] pretty_assertions = "1.4.0" diff --git a/crates/kitsune-type/src/mastodon/account.rs b/crates/kitsune-type/src/mastodon/account.rs index 4be6a0105..a7e91c347 100644 --- a/crates/kitsune-type/src/mastodon/account.rs +++ b/crates/kitsune-type/src/mastodon/account.rs @@ -1,16 +1,15 @@ use iso8601_timestamp::Timestamp; use serde::{Deserialize, Serialize}; use speedy_uuid::Uuid; -use utoipa::ToSchema; -#[derive(Clone, Deserialize, Serialize, ToSchema)] +#[derive(Clone, Deserialize, Serialize)] pub struct Field { pub name: String, pub value: String, pub verified_at: Option, } -#[derive(Clone, Deserialize, Serialize, ToSchema)] +#[derive(Clone, Deserialize, Serialize)] pub struct Source { pub privacy: String, pub sensitive: bool, @@ -19,7 +18,7 @@ pub struct Source { pub fields: Vec, } -#[derive(Clone, Deserialize, Serialize, ToSchema)] +#[derive(Clone, Deserialize, Serialize)] pub struct Account { pub id: Uuid, pub acct: String, diff --git a/crates/kitsune-type/src/mastodon/custom_emoji.rs b/crates/kitsune-type/src/mastodon/custom_emoji.rs index 654e602df..21038b8b9 100644 --- a/crates/kitsune-type/src/mastodon/custom_emoji.rs +++ b/crates/kitsune-type/src/mastodon/custom_emoji.rs @@ -1,7 +1,6 @@ use serde::{Deserialize, Serialize}; -use utoipa::ToSchema; -#[derive(Clone, Deserialize, Serialize, ToSchema)] +#[derive(Clone, Deserialize, Serialize)] pub struct CustomEmoji { pub shortcode: String, pub url: String, diff --git a/crates/kitsune-type/src/mastodon/instance.rs b/crates/kitsune-type/src/mastodon/instance.rs index bb43c9140..0ad7d8a4e 100644 --- a/crates/kitsune-type/src/mastodon/instance.rs +++ b/crates/kitsune-type/src/mastodon/instance.rs @@ -1,19 +1,18 @@ use serde::{Deserialize, Serialize}; -use utoipa::ToSchema; -#[derive(Deserialize, Serialize, ToSchema)] +#[derive(Deserialize, Serialize)] pub struct Stats { pub user_count: u64, pub status_count: u64, pub domain_count: u64, } -#[derive(Deserialize, Serialize, ToSchema)] +#[derive(Deserialize, Serialize)] pub struct Urls { pub streaming_api: String, } -#[derive(Deserialize, Serialize, ToSchema)] +#[derive(Deserialize, Serialize)] pub struct Instance { pub uri: String, pub title: String, diff --git a/crates/kitsune-type/src/mastodon/media_attachment.rs b/crates/kitsune-type/src/mastodon/media_attachment.rs index 5e3e2cd70..7c442332f 100644 --- a/crates/kitsune-type/src/mastodon/media_attachment.rs +++ b/crates/kitsune-type/src/mastodon/media_attachment.rs @@ -1,8 +1,7 @@ use serde::{Deserialize, Serialize}; use speedy_uuid::Uuid; -use utoipa::ToSchema; -#[derive(Clone, Copy, Deserialize, Serialize, ToSchema)] +#[derive(Clone, Copy, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub enum MediaType { Unknown, @@ -12,7 +11,7 @@ pub enum MediaType { Audio, } -#[derive(Clone, Deserialize, Serialize, ToSchema)] +#[derive(Clone, Deserialize, Serialize)] pub struct MediaAttachment { pub id: Uuid, pub r#type: MediaType, diff --git a/crates/kitsune-type/src/mastodon/mod.rs b/crates/kitsune-type/src/mastodon/mod.rs index 1bc7e4425..84e4086b2 100644 --- a/crates/kitsune-type/src/mastodon/mod.rs +++ b/crates/kitsune-type/src/mastodon/mod.rs @@ -1,6 +1,5 @@ use serde::{Deserialize, Serialize}; use speedy_uuid::Uuid; -use utoipa::ToSchema; pub mod account; pub mod custom_emoji; @@ -21,7 +20,7 @@ pub use self::preview_card::PreviewCard; pub use self::search::SearchResult; pub use self::status::Status; -#[derive(Deserialize, Serialize, ToSchema)] +#[derive(Deserialize, Serialize)] pub struct App { pub id: Uuid, pub name: String, diff --git a/crates/kitsune-type/src/mastodon/notification.rs b/crates/kitsune-type/src/mastodon/notification.rs index e2f0db93d..e7c764ea4 100644 --- a/crates/kitsune-type/src/mastodon/notification.rs +++ b/crates/kitsune-type/src/mastodon/notification.rs @@ -1,9 +1,7 @@ +use super::{Account, Status}; use iso8601_timestamp::Timestamp; use serde::{Deserialize, Serialize}; use speedy_uuid::Uuid; -use utoipa::ToSchema; - -use super::{Account, Status}; #[derive(Copy, Clone, Deserialize, Serialize)] #[serde(rename_all = "snake_case")] @@ -17,7 +15,7 @@ pub enum NotificationType { Update, } -#[derive(Clone, Deserialize, Serialize, ToSchema)] +#[derive(Clone, Deserialize, Serialize)] pub struct Notification { pub id: Uuid, pub r#type: NotificationType, diff --git a/crates/kitsune-type/src/mastodon/preview_card.rs b/crates/kitsune-type/src/mastodon/preview_card.rs index 3f6d0822f..7f48600e2 100644 --- a/crates/kitsune-type/src/mastodon/preview_card.rs +++ b/crates/kitsune-type/src/mastodon/preview_card.rs @@ -1,8 +1,7 @@ use serde::{Deserialize, Serialize}; use smol_str::SmolStr; -use utoipa::ToSchema; -#[derive(Clone, Copy, Deserialize, Serialize, ToSchema)] +#[derive(Clone, Copy, Deserialize, Serialize)] #[serde(rename_all = "lowercase")] pub enum PreviewType { Link, @@ -10,7 +9,7 @@ pub enum PreviewType { Video, } -#[derive(Clone, Deserialize, Serialize, ToSchema)] +#[derive(Clone, Deserialize, Serialize)] pub struct PreviewCard { pub url: String, pub title: SmolStr, diff --git a/crates/kitsune-type/src/mastodon/relationship.rs b/crates/kitsune-type/src/mastodon/relationship.rs index 26ac5ff0f..d087b52bf 100644 --- a/crates/kitsune-type/src/mastodon/relationship.rs +++ b/crates/kitsune-type/src/mastodon/relationship.rs @@ -1,8 +1,7 @@ use serde::{Deserialize, Serialize}; use speedy_uuid::Uuid; -use utoipa::ToSchema; -#[derive(Clone, Debug, Deserialize, Eq, Ord, PartialEq, PartialOrd, Serialize, ToSchema)] +#[derive(Clone, Debug, Deserialize, Eq, Ord, PartialEq, PartialOrd, Serialize)] #[allow(clippy::struct_excessive_bools)] pub struct Relationship { pub id: Uuid, diff --git a/crates/kitsune-type/src/mastodon/search.rs b/crates/kitsune-type/src/mastodon/search.rs index e9768268c..22a7a0dcf 100644 --- a/crates/kitsune-type/src/mastodon/search.rs +++ b/crates/kitsune-type/src/mastodon/search.rs @@ -1,12 +1,10 @@ use super::{Account, Status}; use serde::{Deserialize, Serialize}; use simd_json::OwnedValue; -use utoipa::ToSchema; -#[derive(Default, Deserialize, Serialize, ToSchema)] +#[derive(Default, Deserialize, Serialize)] pub struct SearchResult { pub accounts: Vec, - #[schema(value_type = Object)] pub hashtags: Vec, // Placeholder pub statuses: Vec, } diff --git a/crates/kitsune-type/src/mastodon/status.rs b/crates/kitsune-type/src/mastodon/status.rs index ea2406a3b..6b94b5bfd 100644 --- a/crates/kitsune-type/src/mastodon/status.rs +++ b/crates/kitsune-type/src/mastodon/status.rs @@ -3,16 +3,14 @@ use iso8601_timestamp::Timestamp; use serde::{Deserialize, Serialize}; use speedy_uuid::Uuid; use std::collections::VecDeque; -use utoipa::ToSchema; -#[derive(Deserialize, Serialize, ToSchema)] +#[derive(Deserialize, Serialize)] pub struct Context { - #[schema(value_type = Vec)] pub ancestors: VecDeque, pub descendants: Vec, } -#[derive(Clone, Deserialize, Serialize, ToSchema)] +#[derive(Clone, Deserialize, Serialize)] pub struct Mention { pub id: Uuid, pub username: String, @@ -20,7 +18,7 @@ pub struct Mention { pub acct: String, } -#[derive(Clone, Copy, Default, Deserialize, Serialize, ToSchema)] +#[derive(Clone, Copy, Default, Deserialize, Serialize)] #[serde(rename_all = "lowercase")] pub enum Visibility { #[default] @@ -30,7 +28,7 @@ pub enum Visibility { Direct, } -#[derive(Clone, Deserialize, Serialize, ToSchema)] +#[derive(Clone, Deserialize, Serialize)] pub struct Status { pub id: Uuid, pub created_at: Timestamp, @@ -56,7 +54,7 @@ pub struct Status { pub card: Option, } -#[derive(Clone, Deserialize, Serialize, ToSchema)] +#[derive(Clone, Deserialize, Serialize)] pub struct StatusSource { pub id: Uuid, pub text: String, diff --git a/crates/kitsune-type/src/nodeinfo/two_one.rs b/crates/kitsune-type/src/nodeinfo/two_one.rs index d9ae13e3b..82d8029e3 100644 --- a/crates/kitsune-type/src/nodeinfo/two_one.rs +++ b/crates/kitsune-type/src/nodeinfo/two_one.rs @@ -1,8 +1,7 @@ use serde::{Deserialize, Serialize}; use simd_json::OwnedValue; -use utoipa::ToSchema; -#[derive(Debug, Deserialize, Eq, Ord, PartialEq, PartialOrd, Serialize, ToSchema)] +#[derive(Debug, Deserialize, Eq, Ord, PartialEq, PartialOrd, Serialize)] #[serde(rename_all = "lowercase")] pub enum Protocol { ActivityPub, @@ -17,7 +16,7 @@ pub enum Protocol { Zot, } -#[derive(Debug, Deserialize, Eq, Ord, PartialEq, PartialOrd, Serialize, ToSchema)] +#[derive(Debug, Deserialize, Eq, Ord, PartialEq, PartialOrd, Serialize)] #[serde(rename_all = "lowercase")] pub enum InboundService { #[serde(rename = "atom1.0")] @@ -32,7 +31,7 @@ pub enum InboundService { Twitter, } -#[derive(Debug, Deserialize, Eq, Ord, PartialEq, PartialOrd, Serialize, ToSchema)] +#[derive(Debug, Deserialize, Eq, Ord, PartialEq, PartialOrd, Serialize)] #[serde(rename_all = "lowercase")] pub enum OutboundService { #[serde(rename = "atom1.0")] @@ -67,13 +66,13 @@ pub enum OutboundService { Xmpp, } -#[derive(Debug, Deserialize, Eq, Ord, PartialEq, PartialOrd, Serialize, ToSchema)] +#[derive(Debug, Deserialize, Eq, Ord, PartialEq, PartialOrd, Serialize)] pub enum Version { #[serde(rename = "2.1")] TwoOne, } -#[derive(Debug, Deserialize, Eq, Ord, PartialEq, PartialOrd, Serialize, ToSchema)] +#[derive(Debug, Deserialize, Eq, Ord, PartialEq, PartialOrd, Serialize)] #[serde(rename_all = "camelCase")] pub struct Software { pub name: String, @@ -82,14 +81,14 @@ pub struct Software { pub homepage: Option, } -#[derive(Debug, Deserialize, Eq, Ord, PartialEq, PartialOrd, Serialize, ToSchema)] +#[derive(Debug, Deserialize, Eq, Ord, PartialEq, PartialOrd, Serialize)] #[serde(rename_all = "camelCase")] pub struct Services { pub inbound: Vec, pub outbound: Vec, } -#[derive(Debug, Deserialize, Eq, Ord, PartialEq, PartialOrd, Serialize, ToSchema)] +#[derive(Debug, Deserialize, Eq, Ord, PartialEq, PartialOrd, Serialize)] #[serde(rename_all = "camelCase")] pub struct UsageUsers { pub total: u64, @@ -97,7 +96,7 @@ pub struct UsageUsers { pub active_month: Option, } -#[derive(Debug, Deserialize, Eq, Ord, PartialEq, PartialOrd, Serialize, ToSchema)] +#[derive(Debug, Deserialize, Eq, Ord, PartialEq, PartialOrd, Serialize)] #[serde(rename_all = "camelCase")] pub struct Usage { pub users: UsageUsers, @@ -105,7 +104,7 @@ pub struct Usage { pub local_comments: Option, } -#[derive(Debug, Deserialize, PartialEq, Serialize, ToSchema)] +#[derive(Debug, Deserialize, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] /// Definitions of Nodeinfo 2.1 pub struct TwoOne { @@ -115,7 +114,6 @@ pub struct TwoOne { pub services: Services, pub open_registrations: bool, pub usage: Usage, - #[schema(value_type = Object)] pub metadata: OwnedValue, } diff --git a/crates/kitsune-type/src/nodeinfo/well_known.rs b/crates/kitsune-type/src/nodeinfo/well_known.rs index a82554b18..48002cdba 100644 --- a/crates/kitsune-type/src/nodeinfo/well_known.rs +++ b/crates/kitsune-type/src/nodeinfo/well_known.rs @@ -1,19 +1,18 @@ use serde::Serialize; -use utoipa::ToSchema; -#[derive(Debug, Serialize, ToSchema)] +#[derive(Debug, Serialize)] pub enum Rel { #[serde(rename = "http://nodeinfo.diaspora.software/ns/schema/2.1")] TwoOne, } -#[derive(Debug, Serialize, ToSchema)] +#[derive(Debug, Serialize)] pub struct Link { pub rel: Rel, pub href: String, } -#[derive(Debug, Serialize, ToSchema)] +#[derive(Debug, Serialize)] pub struct WellKnown { pub links: Vec, } diff --git a/crates/kitsune-type/src/webfinger.rs b/crates/kitsune-type/src/webfinger.rs index a6b678ca0..5d25406d8 100644 --- a/crates/kitsune-type/src/webfinger.rs +++ b/crates/kitsune-type/src/webfinger.rs @@ -1,14 +1,13 @@ use serde::{Deserialize, Serialize}; -use utoipa::ToSchema; -#[derive(Clone, Debug, Deserialize, Serialize, ToSchema)] +#[derive(Clone, Debug, Deserialize, Serialize)] pub struct Link { pub rel: String, pub r#type: Option, pub href: Option, } -#[derive(Clone, Deserialize, Serialize, ToSchema)] +#[derive(Clone, Deserialize, Serialize)] pub struct Resource { pub subject: String, #[serde(default)] diff --git a/crates/kitsune-url/Cargo.toml b/crates/kitsune-url/Cargo.toml index fa2ea7493..34d95c964 100644 --- a/crates/kitsune-url/Cargo.toml +++ b/crates/kitsune-url/Cargo.toml @@ -6,9 +6,9 @@ version.workspace = true license.workspace = true [dependencies] -kitsune-derive = { path = "../kitsune-derive" } +kitsune-derive = { workspace = true } smol_str = "0.2.2" -speedy-uuid = { path = "../../lib/speedy-uuid" } +speedy-uuid = { workspace = true } [lints] workspace = true diff --git a/crates/kitsune-util/Cargo.toml b/crates/kitsune-util/Cargo.toml index 7a7e8ff58..1160c9b87 100644 --- a/crates/kitsune-util/Cargo.toml +++ b/crates/kitsune-util/Cargo.toml @@ -8,14 +8,14 @@ license.workspace = true [dependencies] bubble-bath = "0.1.3" iso8601-timestamp = "0.2.17" -kitsune-type = { path = "../kitsune-type" } +kitsune-type = { workspace = true } once_cell = "1.19.0" pulldown-cmark = { version = "0.11.0", default-features = false, features = [ "html", "simd", ] } rand = "0.8.5" -speedy-uuid = { path = "../../lib/speedy-uuid" } +speedy-uuid = { workspace = true } tokio = { version = "1.37.0", features = ["macros"] } [lints] diff --git a/crates/kitsune-wasm-mrf/Cargo.toml b/crates/kitsune-wasm-mrf/Cargo.toml index f2c3b983b..6f1d0a2da 100644 --- a/crates/kitsune-wasm-mrf/Cargo.toml +++ b/crates/kitsune-wasm-mrf/Cargo.toml @@ -16,20 +16,20 @@ fred = { workspace = true } futures-util = { version = "0.3.30", default-features = false, features = [ "alloc", ] } -kitsune-config = { path = "../kitsune-config" } -kitsune-derive = { path = "../kitsune-derive" } -kitsune-error = { path = "../kitsune-error" } -kitsune-type = { path = "../kitsune-type" } -mrf-manifest = { path = "../../lib/mrf-manifest", features = ["decode"] } -simd-json = "0.13.10" +kitsune-config = { workspace = true } +kitsune-derive = { workspace = true } +kitsune-error = { workspace = true } +kitsune-type = { workspace = true } +mrf-manifest = { workspace = true, features = ["decode"] } +simd-json = { workspace = true } slab = "0.4.9" sled = "0.34.7" smol_str = "0.2.2" tokio = { version = "1.37.0", features = ["fs"] } tracing = "0.1.40" -triomphe = "0.1.11" +triomphe = { workspace = true } walkdir = "2.5.0" -wasmtime = { version = "21.0.0", default-features = false, features = [ +wasmtime = { version = "21.0.1", default-features = false, features = [ "addr2line", "async", "component-model", @@ -38,7 +38,7 @@ wasmtime = { version = "21.0.0", default-features = false, features = [ "pooling-allocator", "runtime", ] } -wasmtime-wasi = { version = "21.0.0", default-features = false } +wasmtime-wasi = { version = "21.0.1", default-features = false } [dev-dependencies] tempfile = "3.10.1" diff --git a/crates/kitsune-webfinger/Cargo.toml b/crates/kitsune-webfinger/Cargo.toml index 44333a57b..1bcb4d2c0 100644 --- a/crates/kitsune-webfinger/Cargo.toml +++ b/crates/kitsune-webfinger/Cargo.toml @@ -10,21 +10,21 @@ async-trait = "0.1.80" fred = { workspace = true } futures-util = "0.3.30" http = "1.1.0" -kitsune-cache = { path = "../kitsune-cache" } -kitsune-core = { path = "../kitsune-core" } -kitsune-error = { path = "../kitsune-error" } -kitsune-http-client = { path = "../kitsune-http-client" } -kitsune-type = { path = "../kitsune-type" } -kitsune-util = { path = "../kitsune-util" } +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.40" -triomphe = "0.1.11" +triomphe = { workspace = true } urlencoding = "2.1.3" [dev-dependencies] http-body-util = "0.1.1" hyper = "1.3.1" pretty_assertions = "1.4.0" -simd-json = "0.13.10" +simd-json = { workspace = true } tokio = { version = "1.37.0", features = ["macros"] } tower = { version = "0.4.13", default-features = false, features = ["util"] } diff --git a/kitsune-cli/Cargo.toml b/kitsune-cli/Cargo.toml index 3edade15c..418857fe1 100644 --- a/kitsune-cli/Cargo.toml +++ b/kitsune-cli/Cargo.toml @@ -12,18 +12,18 @@ license = false eula = false [dependencies] -clap = { version = "4.5.4", features = ["derive", "wrap_help"] } +clap = { workspace = true } color-eyre = "0.6.3" -diesel = "2.1.6" -diesel-async = "0.4.1" +diesel = { workspace = true } +diesel-async = { workspace = true } dotenvy = "0.15.7" envy = "0.4.2" -kitsune-config = { path = "../crates/kitsune-config" } -kitsune-core = { version = "0.0.1-pre.6", path = "../crates/kitsune-core" } -kitsune-db = { path = "../crates/kitsune-db" } -kitsune-error = { path = "../crates/kitsune-error" } +kitsune-config = { workspace = true } +kitsune-core = { workspace = true } +kitsune-db = { workspace = true } +kitsune-error = { workspace = true } serde = { version = "1.0.202", features = ["derive"] } -speedy-uuid = { path = "../lib/speedy-uuid" } +speedy-uuid = { workspace = true } tokio = { version = "1.37.0", features = ["full"] } tracing-subscriber = "0.3.18" diff --git a/kitsune-job-runner/Cargo.toml b/kitsune-job-runner/Cargo.toml index 0c070e55d..9a17502bc 100644 --- a/kitsune-job-runner/Cargo.toml +++ b/kitsune-job-runner/Cargo.toml @@ -12,27 +12,27 @@ license = false eula = false [dependencies] -athena = { path = "../lib/athena", features = ["redis"] } -clap = { version = "4.5.4", features = ["derive", "wrap_help"] } +athena = { workspace = true } +clap = { workspace = true } color-eyre = "0.6.3" fred = { workspace = true } -just-retry = { path = "../lib/just-retry" } -kitsune-config = { path = "../crates/kitsune-config" } -kitsune-core = { path = "../crates/kitsune-core" } -kitsune-db = { path = "../crates/kitsune-db" } -kitsune-email = { path = "../crates/kitsune-email" } -kitsune-error = { path = "../crates/kitsune-error" } -kitsune-federation = { path = "../crates/kitsune-federation" } -kitsune-federation-filter = { path = "../crates/kitsune-federation-filter" } -kitsune-jobs = { path = "../crates/kitsune-jobs" } -kitsune-observability = { path = "../crates/kitsune-observability" } -kitsune-service = { path = "../crates/kitsune-service" } -kitsune-url = { path = "../crates/kitsune-url" } -kitsune-wasm-mrf = { path = "../crates/kitsune-wasm-mrf" } +just-retry = { workspace = true } +kitsune-config = { workspace = true } +kitsune-core = { workspace = true } +kitsune-db = { workspace = true } +kitsune-email = { workspace = true } +kitsune-error = { workspace = true } +kitsune-federation = { workspace = true } +kitsune-federation-filter = { workspace = true } +kitsune-jobs = { workspace = true } +kitsune-observability = { workspace = true } +kitsune-service = { workspace = true } +kitsune-url = { workspace = true } +kitsune-wasm-mrf = { workspace = true } mimalloc = "0.1.42" tokio = { version = "1.37.0", features = ["full"] } tracing = "0.1.40" -triomphe = "0.1.11" +triomphe = { workspace = true } typed-builder = "0.18.2" [features] diff --git a/kitsune/Cargo.toml b/kitsune/Cargo.toml index 777ad9fb5..03bc9b74e 100644 --- a/kitsune/Cargo.toml +++ b/kitsune/Cargo.toml @@ -15,11 +15,9 @@ license = false eula = false [dependencies] -athena = { path = "../lib/athena", features = ["redis"] } +athena = { workspace = true } argon2 = { version = "0.5.3", features = ["std"] } -askama = { version = "0.12.1", features = [ - "with-axum", -], default-features = false } +askama = { workspace = true } askama_axum = "0.4.0" async-trait = "0.1.80" axum = { version = "0.7.5", features = ["macros", "multipart"] } @@ -30,45 +28,45 @@ axum-extra = { version = "0.9.3", features = [ "typed-header", ] } axum-flash = "0.8.0" -blowocking = { path = "../lib/blowocking" } +blowocking = { workspace = true } bytes = "1.6.0" chrono = { version = "0.4.38", default-features = false } -clap = { version = "4.5.4", features = ["derive", "wrap_help"] } +clap = { workspace = true } color-eyre = "0.6.3" -cursiv = { path = "../lib/cursiv", features = ["axum"] } -diesel = "2.1.6" -diesel-async = "0.4.1" +cursiv = { workspace = true, features = ["axum"] } +diesel = { workspace = true } +diesel-async = { workspace = true } futures-util = "0.3.30" headers = "0.4.0" http = "1.1.0" http-body-util = "0.1.1" -http-signatures = { path = "../lib/http-signatures" } +http-signatures = { workspace = true } iso8601-timestamp = "0.2.17" -itertools = { version = "0.13.0", default-features = false } -kitsune-activitypub = { path = "../crates/kitsune-activitypub" } -kitsune-cache = { path = "../crates/kitsune-cache" } -kitsune-captcha = { path = "../crates/kitsune-captcha" } -kitsune-config = { path = "../crates/kitsune-config" } -kitsune-core = { path = "../crates/kitsune-core" } -kitsune-db = { path = "../crates/kitsune-db" } -kitsune-derive = { path = "../crates/kitsune-derive" } -kitsune-email = { path = "../crates/kitsune-email" } -kitsune-embed = { path = "../crates/kitsune-embed" } -kitsune-error = { path = "../crates/kitsune-error" } -kitsune-federation = { path = "../crates/kitsune-federation" } -kitsune-federation-filter = { path = "../crates/kitsune-federation-filter" } -kitsune-job-runner = { path = "../kitsune-job-runner" } -kitsune-jobs = { path = "../crates/kitsune-jobs" } -kitsune-language = { path = "../crates/kitsune-language" } -kitsune-observability = { path = "../crates/kitsune-observability" } -kitsune-search = { path = "../crates/kitsune-search" } -kitsune-service = { path = "../crates/kitsune-service" } -kitsune-storage = { path = "../crates/kitsune-storage" } -kitsune-type = { path = "../crates/kitsune-type" } -kitsune-url = { path = "../crates/kitsune-url" } -kitsune-util = { path = "../crates/kitsune-util" } -kitsune-wasm-mrf = { path = "../crates/kitsune-wasm-mrf" } -kitsune-webfinger = { path = "../crates/kitsune-webfinger" } +itertools = { workspace = true } +kitsune-activitypub = { workspace = true } +kitsune-cache = { workspace = true } +kitsune-captcha = { workspace = true } +kitsune-config = { workspace = true } +kitsune-core = { workspace = true } +kitsune-db = { workspace = true } +kitsune-derive = { workspace = true } +kitsune-email = { workspace = true } +kitsune-embed = { workspace = true } +kitsune-error = { workspace = true } +kitsune-federation = { workspace = true } +kitsune-federation-filter = { workspace = true } +kitsune-job-runner = { workspace = true } +kitsune-jobs = { workspace = true } +kitsune-language = { workspace = true } +kitsune-observability = { workspace = true } +kitsune-search = { workspace = true } +kitsune-service = { workspace = true } +kitsune-storage = { workspace = true } +kitsune-type = { workspace = true } +kitsune-url = { workspace = true } +kitsune-util = { workspace = true } +kitsune-wasm-mrf = { workspace = true } +kitsune-webfinger = { workspace = true } mimalloc = "0.1.42" mime = "0.3.17" mime_guess = { version = "2.0.4", default-features = false } @@ -79,17 +77,17 @@ rust-embed = { version = "8.4.0", features = ["include-exclude"] } scoped-futures = "0.1.3" serde = { version = "1.0.202", features = ["derive"] } serde_urlencoded = "0.7.1" -simd-json = "0.13.10" -simdutf8 = { version = "0.1.4", features = ["aarch64_neon"] } -speedy-uuid = { path = "../lib/speedy-uuid" } +simd-json = { workspace = true } +simdutf8 = { workspace = true } +speedy-uuid = { workspace = true } strum = { version = "0.26.2", features = ["derive", "phf"] } tempfile = "3.10.1" time = "0.3.36" tokio = { version = "1.37.0", features = ["full"] } tokio-util = { version = "0.7.11", features = ["io"] } tower = { version = "0.4.13", features = ["util"] } -tower-stop-using-brave = { path = "../lib/tower-stop-using-brave" } -tower-x-clacks-overhead = { path = "../lib/tower-x-clacks-overhead" } +tower-stop-using-brave = { workspace = true } +tower-x-clacks-overhead = { workspace = true } tower-http = { version = "0.5.2", features = [ "catch-panic", "cors", @@ -98,20 +96,18 @@ tower-http = { version = "0.5.2", features = [ "timeout", "trace", ] } -tower-http-digest = { path = "../lib/tower-http-digest" } +tower-http-digest = { workspace = true } tracing = "0.1.40" -trials = { path = "../lib/trials" } -triomphe = "0.1.11" +trials = { workspace = true } +triomphe = { workspace = true } typed-builder = "0.18.2" url = "2.5.0" -utoipa = { version = "4.2.3", features = ["axum_extras", "uuid"] } -utoipa-swagger-ui = { version = "=6.0.0", features = ["axum"] } # --- Optional dependencies --- # "graphql" feature async-graphql = { version = "7.0.5", default-features = false, features = [ - "playground", + "graphiql", "tempfile", "time", "tracing", @@ -120,19 +116,19 @@ async-graphql = { version = "7.0.5", default-features = false, features = [ async-graphql-axum = { version = "7.0.5", optional = true } # "mastodon-api" feature -kitsune-mastodon = { path = "../crates/kitsune-mastodon", optional = true } +kitsune-mastodon = { workspace = true, optional = true } # "oidc" feature -kitsune-oidc = { path = "../crates/kitsune-oidc", optional = true } +kitsune-oidc = { workspace = true, optional = true } [build-dependencies] camino = "1.1.7" fs_extra = "1.3.0" -kitsune-scss-compiler = { path = "../crates/kitsune-scss-compiler" } +kitsune-scss-compiler = { workspace = true } [dev-dependencies] -kitsune-http-client = { path = "../crates/kitsune-http-client" } -kitsune-test = { path = "../crates/kitsune-test" } +kitsune-http-client = { workspace = true } +kitsune-test = { workspace = true } pretty_assertions = "1.4.0" fred = { workspace = true } diff --git a/kitsune/src/http/graphql/mod.rs b/kitsune/src/http/graphql/mod.rs index d1b1ff0b1..aae5f7c26 100644 --- a/kitsune/src/http/graphql/mod.rs +++ b/kitsune/src/http/graphql/mod.rs @@ -2,9 +2,7 @@ use self::{mutation::RootMutation, query::RootQuery}; use super::extractor::{AuthExtractor, UserData}; use crate::state::Zustand; use async_graphql::{ - extensions::Tracing, - http::{playground_source, GraphQLPlaygroundConfig}, - Context, EmptySubscription, Error, Result, Schema, + extensions::Tracing, http::GraphiQLSource, Context, EmptySubscription, Error, Result, Schema, }; use async_graphql_axum::{GraphQLBatchRequest, GraphQLResponse}; use axum::{ @@ -52,10 +50,12 @@ async fn graphql_route( #[allow(clippy::unused_async)] async fn graphiql_route() -> Html { - let config = GraphQLPlaygroundConfig::new("/graphql") - .title(concat!(env!("CARGO_PKG_NAME"), " - GraphiQL")); + let source = GraphiQLSource::build() + .endpoint("/graphql") + .title(concat!(env!("CARGO_PKG_NAME"), " - GraphiQL")) + .finish(); - Html(playground_source(config)) + Html(source) } pub fn routes(state: Zustand) -> Router { diff --git a/kitsune/src/http/handler/mastodon/api/v1/accounts/follow.rs b/kitsune/src/http/handler/mastodon/api/v1/accounts/follow.rs index 36cb59b3f..0a9ccdc26 100644 --- a/kitsune/src/http/handler/mastodon/api/v1/accounts/follow.rs +++ b/kitsune/src/http/handler/mastodon/api/v1/accounts/follow.rs @@ -10,26 +10,14 @@ use kitsune_service::account::{AccountService, Follow}; use kitsune_type::mastodon::relationship::Relationship; use serde::Deserialize; use speedy_uuid::Uuid; -use utoipa::ToSchema; -#[derive(Deserialize, ToSchema)] +#[derive(Deserialize)] pub struct FollowBody { #[serde(default)] notify: bool, } #[debug_handler(state = crate::state::Zustand)] -#[utoipa::path( - post, - path = "/api/v1/accounts/{id}/follow", - security( - ("oauth_token" = []) - ), - request_body = FollowBody, - responses( - (status = 200, description = "Followed user successfully", body = Relationship) - ), -)] pub async fn post( State(account_service): State, State(mastodon_mapper): State, diff --git a/kitsune/src/http/handler/mastodon/api/v1/accounts/lookup.rs b/kitsune/src/http/handler/mastodon/api/v1/accounts/lookup.rs index 43d3936b1..c20cf7671 100644 --- a/kitsune/src/http/handler/mastodon/api/v1/accounts/lookup.rs +++ b/kitsune/src/http/handler/mastodon/api/v1/accounts/lookup.rs @@ -9,26 +9,13 @@ use kitsune_mastodon::MastodonMapper; use kitsune_service::account::{AccountService, GetUser}; use kitsune_type::mastodon::Account; use serde::Deserialize; -use utoipa::IntoParams; -#[derive(Deserialize, IntoParams)] +#[derive(Deserialize)] pub struct LookupQuery { acct: String, } #[debug_handler(state = crate::state::Zustand)] -#[utoipa::path( - get, - path = "/api/v1/accounts/lookup", - security( - ("oauth_token" = []) - ), - params(LookupQuery), - responses( - (status = 200, description = "Return the account that goes by the acct structure", body = Account), - (status = 404, description = "The account isn't known and has to be looked up via Webfinger"), - ), -)] pub async fn get( State(account_service): State, State(mastodon_mapper): State, diff --git a/kitsune/src/http/handler/mastodon/api/v1/accounts/mod.rs b/kitsune/src/http/handler/mastodon/api/v1/accounts/mod.rs index 39299fe7f..3decad346 100644 --- a/kitsune/src/http/handler/mastodon/api/v1/accounts/mod.rs +++ b/kitsune/src/http/handler/mastodon/api/v1/accounts/mod.rs @@ -17,14 +17,6 @@ pub mod unfollow; pub mod update_credentials; pub mod verify_credentials; -#[utoipa::path( - get, - path = "/api/v1/accounts/{id}", - responses( - (status = 200, description = "Account information", body = Account), - (status = StatusCode::NOT_FOUND, description = "No account with that ID exists"), - ) -)] async fn get( State(account_service): State, State(mastodon_mapper): State, diff --git a/kitsune/src/http/handler/mastodon/api/v1/accounts/relationships.rs b/kitsune/src/http/handler/mastodon/api/v1/accounts/relationships.rs index 30fa92cf5..2655a2d0c 100644 --- a/kitsune/src/http/handler/mastodon/api/v1/accounts/relationships.rs +++ b/kitsune/src/http/handler/mastodon/api/v1/accounts/relationships.rs @@ -10,26 +10,13 @@ use kitsune_mastodon::MastodonMapper; use kitsune_type::mastodon::relationship::Relationship; use serde::Deserialize; use speedy_uuid::Uuid; -use utoipa::IntoParams; -#[derive(Deserialize, IntoParams)] +#[derive(Deserialize)] pub struct RelationshipQuery { id: Vec, } #[debug_handler(state = crate::state::Zustand)] -#[utoipa::path( - get, - path = "/api/v1/accounts/relationships", - security( - ("oauth_token" = []) - ), - params(RelationshipQuery), - responses( - (status = 200, description = "Relationship between you and the other accounts", body = Vec), - (status = 400, description = "One of the account IDs you input isn't known"), - ), -)] pub async fn get( AuthExtractor(user_data): MastodonAuthExtractor, State(db_pool): State, diff --git a/kitsune/src/http/handler/mastodon/api/v1/accounts/statuses.rs b/kitsune/src/http/handler/mastodon/api/v1/accounts/statuses.rs index a9802bb8f..d26d9fd0d 100644 --- a/kitsune/src/http/handler/mastodon/api/v1/accounts/statuses.rs +++ b/kitsune/src/http/handler/mastodon/api/v1/accounts/statuses.rs @@ -17,9 +17,8 @@ use kitsune_type::mastodon::Status; use kitsune_url::UrlService; use serde::Deserialize; use speedy_uuid::Uuid; -use utoipa::IntoParams; -#[derive(Deserialize, IntoParams)] +#[derive(Deserialize)] pub struct GetQuery { max_id: Option, since_id: Option, @@ -28,18 +27,6 @@ pub struct GetQuery { limit: usize, } -#[utoipa::path( - get, - path = "/api/v1/accounts/{id}/statuses", - security( - (), - ("oauth_token" = []) - ), - params(GetQuery), - responses( - (status = 200, description = "Statuses by the user", body = Vec), - ) -)] pub async fn get( State(account): State, State(mastodon_mapper): State, diff --git a/kitsune/src/http/handler/mastodon/api/v1/accounts/update_credentials.rs b/kitsune/src/http/handler/mastodon/api/v1/accounts/update_credentials.rs index 687caf532..a60779430 100644 --- a/kitsune/src/http/handler/mastodon/api/v1/accounts/update_credentials.rs +++ b/kitsune/src/http/handler/mastodon/api/v1/accounts/update_credentials.rs @@ -14,16 +14,6 @@ use kitsune_service::{ }; use kitsune_type::mastodon::Account; -#[utoipa::path( - patch, - path = "/api/v1/accounts/update_credentials", - security( - ("oauth_token" = []) - ), - responses( - (status = 200, description = "Updated account of the user", body = Account), - ) -)] pub async fn patch( State(account_service): State, State(mastodon_mapper): State, diff --git a/kitsune/src/http/handler/mastodon/api/v1/accounts/verify_credentials.rs b/kitsune/src/http/handler/mastodon/api/v1/accounts/verify_credentials.rs index 1e967beaa..df9dd2601 100644 --- a/kitsune/src/http/handler/mastodon/api/v1/accounts/verify_credentials.rs +++ b/kitsune/src/http/handler/mastodon/api/v1/accounts/verify_credentials.rs @@ -4,17 +4,6 @@ use kitsune_error::Result; use kitsune_mastodon::MastodonMapper; use kitsune_type::mastodon::Account; -#[utoipa::path( - get, - path = "/api/v1/accounts/verify_credentials", - security( - ("oauth_token" = []) - ), - responses( - (status = 200, description = "Account of the logged in user", body = Account), - (status = StatusCode::BAD_REQUEST, description = "The request was invalid"), - ) -)] pub async fn get( State(mastodon_mapper): State, AuthExtractor(user): MastodonAuthExtractor, diff --git a/kitsune/src/http/handler/mastodon/api/v1/apps.rs b/kitsune/src/http/handler/mastodon/api/v1/apps.rs index 15e9f4541..60013f712 100644 --- a/kitsune/src/http/handler/mastodon/api/v1/apps.rs +++ b/kitsune/src/http/handler/mastodon/api/v1/apps.rs @@ -7,22 +7,13 @@ use axum::{extract::State, routing, Json, Router}; use kitsune_error::Result; use kitsune_type::mastodon::App; use serde::Deserialize; -use utoipa::ToSchema; -#[derive(Deserialize, ToSchema)] +#[derive(Deserialize)] pub struct AppForm { client_name: String, redirect_uris: String, } -#[utoipa::path( - post, - path = "/api/v1/apps", - request_body = AppForm, - responses( - (status = 200, description = "Newly created application", body = App), - ), -)] async fn post( State(oauth2): State, AgnosticForm(form): AgnosticForm, diff --git a/kitsune/src/http/handler/mastodon/api/v1/custom_emojis.rs b/kitsune/src/http/handler/mastodon/api/v1/custom_emojis.rs index d9ef601d4..994803cc7 100644 --- a/kitsune/src/http/handler/mastodon/api/v1/custom_emojis.rs +++ b/kitsune/src/http/handler/mastodon/api/v1/custom_emojis.rs @@ -7,16 +7,6 @@ use kitsune_service::custom_emoji::{CustomEmojiService, GetEmojiList}; use kitsune_type::mastodon::CustomEmoji; #[debug_handler(state = crate::state::Zustand)] -#[utoipa::path( - get, - path = "/api/v1/custom_emojis", - security( - ("oauth_token" = []) - ), - responses( - (status = 200, description = "List of custom emojis available on the server", body = Vec) - ), -)] pub async fn get( State(custom_emoji_service): State, State(mastodon_mapper): State, diff --git a/kitsune/src/http/handler/mastodon/api/v1/follow_requests/accept.rs b/kitsune/src/http/handler/mastodon/api/v1/follow_requests/accept.rs index d37760662..05429c199 100644 --- a/kitsune/src/http/handler/mastodon/api/v1/follow_requests/accept.rs +++ b/kitsune/src/http/handler/mastodon/api/v1/follow_requests/accept.rs @@ -11,17 +11,6 @@ use kitsune_type::mastodon::relationship::Relationship; use speedy_uuid::Uuid; #[debug_handler(state = crate::state::Zustand)] -#[utoipa::path( - post, - path = "/api/v1/follow_requests/{id}/authorize", - security( - ("oauth_token" = []) - ), - responses( - (status = 200, description = "Follow request accepted", body = Relationship), - (status = 404, description = "No pending follow request from that account ID") - ), -)] pub async fn post( State(account_service): State, State(mastodon_mapper): State, diff --git a/kitsune/src/http/handler/mastodon/api/v1/follow_requests/mod.rs b/kitsune/src/http/handler/mastodon/api/v1/follow_requests/mod.rs index 91519fce5..7c17228ea 100644 --- a/kitsune/src/http/handler/mastodon/api/v1/follow_requests/mod.rs +++ b/kitsune/src/http/handler/mastodon/api/v1/follow_requests/mod.rs @@ -20,12 +20,11 @@ use kitsune_type::mastodon::Account; use kitsune_url::UrlService; use serde::Deserialize; use speedy_uuid::Uuid; -use utoipa::IntoParams; pub mod accept; pub mod reject; -#[derive(Deserialize, IntoParams)] +#[derive(Deserialize)] pub struct GetQuery { max_id: Option, since_id: Option, @@ -34,17 +33,6 @@ pub struct GetQuery { } #[debug_handler(state = crate::state::Zustand)] -#[utoipa::path( - get, - path = "/api/v1/follow_requests", - security( - ("oauth_token" = []) - ), - params(GetQuery), - responses( - (status = 200, description = "List of accounts requesting a follow", body = Vec) - ), -)] pub async fn get( State(account_service): State, State(mastodon_mapper): State, diff --git a/kitsune/src/http/handler/mastodon/api/v1/follow_requests/reject.rs b/kitsune/src/http/handler/mastodon/api/v1/follow_requests/reject.rs index b387f09ba..3e82b8b70 100644 --- a/kitsune/src/http/handler/mastodon/api/v1/follow_requests/reject.rs +++ b/kitsune/src/http/handler/mastodon/api/v1/follow_requests/reject.rs @@ -11,17 +11,6 @@ use kitsune_type::mastodon::relationship::Relationship; use speedy_uuid::Uuid; #[debug_handler(state = crate::state::Zustand)] -#[utoipa::path( - post, - path = "/api/v1/follow_requests/{id}/reject", - security( - ("oauth_token" = []) - ), - responses( - (status = 200, description = "Follow request rejected", body = Relationship), - (status = 404, description = "No pending follow request from that account ID") - ), -)] pub async fn post( State(account_service): State, State(mastodon_mapper): State, diff --git a/kitsune/src/http/handler/mastodon/api/v1/instance.rs b/kitsune/src/http/handler/mastodon/api/v1/instance.rs index b7d15fdd0..af690a464 100644 --- a/kitsune/src/http/handler/mastodon/api/v1/instance.rs +++ b/kitsune/src/http/handler/mastodon/api/v1/instance.rs @@ -9,13 +9,6 @@ use kitsune_type::mastodon::{ }; use kitsune_url::UrlService; -#[utoipa::path( - get, - path = "/api/v1/instance", - responses( - (status = 200, description = "Instance metadata", body = Instance), - ), -)] async fn get( State(instance_service): State, State(url_service): State, diff --git a/kitsune/src/http/handler/mastodon/api/v1/media.rs b/kitsune/src/http/handler/mastodon/api/v1/media.rs index b7dd8b267..a9fdde9de 100644 --- a/kitsune/src/http/handler/mastodon/api/v1/media.rs +++ b/kitsune/src/http/handler/mastodon/api/v1/media.rs @@ -17,29 +17,12 @@ use kitsune_service::attachment::{AttachmentService, Update, Upload}; use kitsune_type::mastodon::MediaAttachment; use serde::Deserialize; use speedy_uuid::Uuid; -use utoipa::ToSchema; -#[allow(dead_code)] -#[derive(ToSchema)] -pub struct CreateAttachment { - pub description: Option, - #[schema(value_type = String, format = Binary)] - pub file: (), -} - -#[derive(Deserialize, ToSchema)] +#[derive(Deserialize)] pub struct UpdateAttachment { description: String, } -#[utoipa::path( - get, - path = "/api/v1/media/{id}", - responses( - (status = 200, description = "Media attachment", body = MediaAttachment), - (status = 404, description = "Media attachment doesn't exist"), - ), -)] pub async fn get( State(attachment_service): State, State(mapper): State, @@ -50,17 +33,6 @@ pub async fn get( )) } -#[utoipa::path( - post, - path = "/api/v1/media", - security( - ("oauth_token" = []) - ), - request_body(content = MediaAttachmentBody, content_type = "multipart/form-data"), - responses( - (status = 200, description = "New media attachment", body = MediaAttachment), - ), -)] pub async fn post( State(attachment_service): State, State(mastodon_mapper): State, @@ -99,17 +71,6 @@ pub async fn post( } #[debug_handler(state = Zustand)] -#[utoipa::path( - put, - path = "/api/v1/media/{id}", - security( - ("oauth_token" = []) - ), - request_body = UpdateAttachment, - responses( - (status = 200, description = "Updated media attachment", body = MediaAttachment), - ), -)] pub async fn put( State(attachment_service): State, State(mastodon_mapper): State, diff --git a/kitsune/src/http/handler/mastodon/api/v1/notifications/clear.rs b/kitsune/src/http/handler/mastodon/api/v1/notifications/clear.rs index 6d94a1d95..6efeb03ee 100644 --- a/kitsune/src/http/handler/mastodon/api/v1/notifications/clear.rs +++ b/kitsune/src/http/handler/mastodon/api/v1/notifications/clear.rs @@ -5,16 +5,6 @@ use kitsune_error::Result; use kitsune_service::notification::NotificationService; #[debug_handler(state = crate::state::Zustand)] -#[utoipa::path( - post, - path = "/api/v1/notifications/clear", - security( - ("oauth_token" = []) - ), - responses( - (status = StatusCode::OK, description = "All notifications have been dismissed"), - ) -)] pub async fn post( State(notification_service): State, AuthExtractor(user_data): MastodonAuthExtractor, diff --git a/kitsune/src/http/handler/mastodon/api/v1/notifications/dismiss.rs b/kitsune/src/http/handler/mastodon/api/v1/notifications/dismiss.rs index 6bb537041..78f1f62a5 100644 --- a/kitsune/src/http/handler/mastodon/api/v1/notifications/dismiss.rs +++ b/kitsune/src/http/handler/mastodon/api/v1/notifications/dismiss.rs @@ -9,16 +9,6 @@ use kitsune_service::notification::NotificationService; use speedy_uuid::Uuid; #[debug_handler(state = crate::state::Zustand)] -#[utoipa::path( - post, - path = "/api/v1/notifications/{id}/dismiss", - security( - ("oauth_token" = []) - ), - responses( - (status = StatusCode::OK, description = "Notification has been dismissed"), - ) -)] pub async fn post( State(notification_service): State, AuthExtractor(user_data): MastodonAuthExtractor, diff --git a/kitsune/src/http/handler/mastodon/api/v1/notifications/mod.rs b/kitsune/src/http/handler/mastodon/api/v1/notifications/mod.rs index e059c5df7..cdcf8658c 100644 --- a/kitsune/src/http/handler/mastodon/api/v1/notifications/mod.rs +++ b/kitsune/src/http/handler/mastodon/api/v1/notifications/mod.rs @@ -20,12 +20,11 @@ use kitsune_type::mastodon::{notification::NotificationType, Notification}; use kitsune_url::UrlService; use serde::Deserialize; use speedy_uuid::Uuid; -use utoipa::IntoParams; pub mod clear; pub mod dismiss; -#[derive(Deserialize, IntoParams)] +#[derive(Deserialize)] pub struct GetQuery { #[serde(default)] max_id: Option, @@ -44,17 +43,6 @@ pub struct GetQuery { } #[debug_handler(state = Zustand)] -#[utoipa::path( - get, - path = "/api/v1/notifications", - security( - ("oauth_token" = []) - ), - params(GetQuery), - responses( - (status = StatusCode::OK, description = "List of notifications concerning the user", body = Vec) - ), -)] pub async fn get( State(notification_service): State, State(mastodon_mapper): State, @@ -101,16 +89,6 @@ pub async fn get( } #[debug_handler(state = Zustand)] -#[utoipa::path( - get, - path = "/api/v1/notifications/{id}", - security( - ("oauth_token" = []) - ), - responses( - (status = StatusCode::OK, description = "A single notification", body = Notification) - ), -)] pub async fn get_by_id( State(notification_service): State, State(mastodon_mapper): State, diff --git a/kitsune/src/http/handler/mastodon/api/v1/statuses/context.rs b/kitsune/src/http/handler/mastodon/api/v1/statuses/context.rs index 9df69d470..c00ce5bd0 100644 --- a/kitsune/src/http/handler/mastodon/api/v1/statuses/context.rs +++ b/kitsune/src/http/handler/mastodon/api/v1/statuses/context.rs @@ -13,18 +13,6 @@ use speedy_uuid::Uuid; use std::collections::VecDeque; #[debug_handler(state = crate::state::Zustand)] -#[utoipa::path( - get, - path = "/api/v1/statuses/{id}/context", - security( - (), - ("oauth_token" = []) - ), - responses( - (status = 200, description = "Ancestor and descendant statuses in the thread", body = Context), - (status = 404, description = "Status doesn't exist"), - ) -)] pub async fn get( State(mastodon_mapper): State, State(post): State, diff --git a/kitsune/src/http/handler/mastodon/api/v1/statuses/favourite.rs b/kitsune/src/http/handler/mastodon/api/v1/statuses/favourite.rs index ab3b9c848..8993e171b 100644 --- a/kitsune/src/http/handler/mastodon/api/v1/statuses/favourite.rs +++ b/kitsune/src/http/handler/mastodon/api/v1/statuses/favourite.rs @@ -11,16 +11,6 @@ use kitsune_type::mastodon::Status; use speedy_uuid::Uuid; #[debug_handler(state = crate::state::Zustand)] -#[utoipa::path( - post, - path = "/api/v1/statuses/{id}/favourite", - security( - ("oauth_token" = []) - ), - responses( - (status = 200, description = "The status with updated information regarding like status"), - ) -)] pub async fn post( State(mastodon_mapper): State, State(post): State, diff --git a/kitsune/src/http/handler/mastodon/api/v1/statuses/favourited_by.rs b/kitsune/src/http/handler/mastodon/api/v1/statuses/favourited_by.rs index e0f43048b..282d04a1a 100644 --- a/kitsune/src/http/handler/mastodon/api/v1/statuses/favourited_by.rs +++ b/kitsune/src/http/handler/mastodon/api/v1/statuses/favourited_by.rs @@ -19,9 +19,8 @@ use kitsune_type::mastodon::Account; use kitsune_url::UrlService; use serde::Deserialize; use speedy_uuid::Uuid; -use utoipa::IntoParams; -#[derive(Deserialize, IntoParams)] +#[derive(Deserialize)] pub struct GetQuery { min_id: Option, max_id: Option, @@ -31,17 +30,6 @@ pub struct GetQuery { } #[debug_handler(state = crate::state::Zustand)] -#[utoipa::path( - get, - path = "/api/v1/statuses/{id}/favourited_by", - security( - ("oauth_token" = []) - ), - params(GetQuery), - responses( - (status = 200, description = "List of accounts that favourited the status", body = Vec) - ), -)] pub async fn get( State(post_service): State, State(mastodon_mapper): State, diff --git a/kitsune/src/http/handler/mastodon/api/v1/statuses/mod.rs b/kitsune/src/http/handler/mastodon/api/v1/statuses/mod.rs index af5f28e25..8275a9074 100644 --- a/kitsune/src/http/handler/mastodon/api/v1/statuses/mod.rs +++ b/kitsune/src/http/handler/mastodon/api/v1/statuses/mod.rs @@ -14,7 +14,6 @@ use kitsune_service::post::{CreatePost, DeletePost, PostService, UpdatePost}; use kitsune_type::mastodon::{status::Visibility, Status}; use serde::Deserialize; use speedy_uuid::Uuid; -use utoipa::ToSchema; pub mod context; pub mod favourite; @@ -25,7 +24,7 @@ pub mod source; pub mod unfavourite; pub mod unreblog; -#[derive(Deserialize, ToSchema)] +#[derive(Deserialize)] pub struct CreateForm { #[serde(default)] media_ids: Vec, @@ -38,7 +37,7 @@ pub struct CreateForm { visibility: Visibility, } -#[derive(Deserialize, ToSchema)] +#[derive(Deserialize)] pub struct UpdateForm { #[serde(default)] media_ids: Vec, @@ -51,16 +50,6 @@ pub struct UpdateForm { } #[debug_handler(state = Zustand)] -#[utoipa::path( - delete, - path = "/api/v1/statuses/{id}", - security( - ("oauth_token" = []) - ), - responses( - (status = StatusCode::OK, description = "Status was deleted"), - ) -)] async fn delete( State(post): State, AuthExtractor(user_data): MastodonAuthExtractor, @@ -78,18 +67,6 @@ async fn delete( } #[debug_handler(state = Zustand)] -#[utoipa::path( - get, - path = "/api/v1/statuses/{id}", - security( - (), - ("oauth_token" = []) - ), - responses( - (status = 200, description = "The requested status", body = Status), - (status = 404, description = "Requested status doesn't exist"), - ) -)] async fn get( State(mastodon_mapper): State, State(post): State, @@ -109,17 +86,6 @@ async fn get( } #[debug_handler(state = Zustand)] -#[utoipa::path( - post, - path = "/api/v1/statuses", - security( - ("oauth_token" = []) - ), - request_body = CreateForm, - responses( - (status = 200, description = "Newly created post", body = Status), - ) -)] async fn post( State(mastodon_mapper): State, State(post_service): State, @@ -142,18 +108,6 @@ async fn post( } #[debug_handler(state = Zustand)] -#[utoipa::path( - put, - path = "/api/v1/statuses/{id}", - security( - ("oauth_token" = []) - ), - request_body = UpdateForm, - responses( - (status = StatusCode::OK, description = "Status has been successfully edited", body = Status), - (status = StatusCode::NOT_FOUND, description = "Requested status doesn't exist"), - ) -)] async fn put( State(mastodon_mapper): State, State(post): State, diff --git a/kitsune/src/http/handler/mastodon/api/v1/statuses/reblog.rs b/kitsune/src/http/handler/mastodon/api/v1/statuses/reblog.rs index fc3d49253..97355aa19 100644 --- a/kitsune/src/http/handler/mastodon/api/v1/statuses/reblog.rs +++ b/kitsune/src/http/handler/mastodon/api/v1/statuses/reblog.rs @@ -10,26 +10,14 @@ use kitsune_service::post::{PostService, RepostPost}; use kitsune_type::mastodon::{status::Visibility, Status}; use serde::Deserialize; use speedy_uuid::Uuid; -use utoipa::ToSchema; -#[derive(Deserialize, ToSchema)] +#[derive(Deserialize)] pub struct RepostBody { #[serde(default)] visibility: Visibility, } #[debug_handler(state = crate::state::Zustand)] -#[utoipa::path( - post, - path = "/api/v1/statuses/{id}/reblog", - security( - ("oauth_token" = []) - ), - responses( - (status = StatusCode::OK, description = "The new status referencing the reblog", body = Status), - (status = StatusCode::NOT_FOUND, description = "Requested status doesn't exist"), - ) -)] pub async fn post( State(mastodon_mapper): State, State(post): State, diff --git a/kitsune/src/http/handler/mastodon/api/v1/statuses/reblogged_by.rs b/kitsune/src/http/handler/mastodon/api/v1/statuses/reblogged_by.rs index da0682df2..b3b37a04d 100644 --- a/kitsune/src/http/handler/mastodon/api/v1/statuses/reblogged_by.rs +++ b/kitsune/src/http/handler/mastodon/api/v1/statuses/reblogged_by.rs @@ -19,9 +19,8 @@ use kitsune_type::mastodon::Account; use kitsune_url::UrlService; use serde::Deserialize; use speedy_uuid::Uuid; -use utoipa::IntoParams; -#[derive(Deserialize, IntoParams)] +#[derive(Deserialize)] pub struct GetQuery { min_id: Option, max_id: Option, @@ -31,17 +30,6 @@ pub struct GetQuery { } #[debug_handler(state = crate::state::Zustand)] -#[utoipa::path( - get, - path = "/api/v1/statuses/{id}/reblogged_by", - security( - ("oauth_token" = []) - ), - params(GetQuery), - responses( - (status = 200, description = "List of accounts that reblogged the status", body = Vec) - ), -)] pub async fn get( State(post_service): State, State(mastodon_mapper): State, diff --git a/kitsune/src/http/handler/mastodon/api/v1/statuses/source.rs b/kitsune/src/http/handler/mastodon/api/v1/statuses/source.rs index b56e05bed..e91654c8b 100644 --- a/kitsune/src/http/handler/mastodon/api/v1/statuses/source.rs +++ b/kitsune/src/http/handler/mastodon/api/v1/statuses/source.rs @@ -10,16 +10,6 @@ use kitsune_type::mastodon::status::StatusSource; use speedy_uuid::Uuid; #[debug_handler(state = crate::state::Zustand)] -#[utoipa::path( - get, - path = "/api/v1/statuses/{id}/source", - security( - ("oauth_token" = []) - ), - responses( - (status = StatusCode::OK, description = "Source of the status", body = StatusSource), - ) -)] pub async fn get( State(mastodon_mapper): State, State(post_service): State, diff --git a/kitsune/src/http/handler/mastodon/api/v1/statuses/unfavourite.rs b/kitsune/src/http/handler/mastodon/api/v1/statuses/unfavourite.rs index a7f0ba012..47aba8adf 100644 --- a/kitsune/src/http/handler/mastodon/api/v1/statuses/unfavourite.rs +++ b/kitsune/src/http/handler/mastodon/api/v1/statuses/unfavourite.rs @@ -11,16 +11,6 @@ use kitsune_type::mastodon::Status; use speedy_uuid::Uuid; #[debug_handler(state = crate::state::Zustand)] -#[utoipa::path( - post, - path = "/api/v1/statuses/{id}/unfavourite", - security( - ("oauth_token" = []) - ), - responses( - (status = 200, description = "The status with updated information regarding like status"), - ) -)] pub async fn post( State(mastodon_mapper): State, State(post): State, diff --git a/kitsune/src/http/handler/mastodon/api/v1/statuses/unreblog.rs b/kitsune/src/http/handler/mastodon/api/v1/statuses/unreblog.rs index 6bab52630..68eccf99e 100644 --- a/kitsune/src/http/handler/mastodon/api/v1/statuses/unreblog.rs +++ b/kitsune/src/http/handler/mastodon/api/v1/statuses/unreblog.rs @@ -11,17 +11,6 @@ use kitsune_type::mastodon::Status; use speedy_uuid::Uuid; #[debug_handler(state = crate::state::Zustand)] -#[utoipa::path( - delete, - path = "/api/v1/statuses/{id}/unreblog", - security( - ("oauth_token" = []) - ), - responses( - (status = StatusCode::OK, description = "Status was unboosted or was already not boosted", body = Status), - (status = StatusCode::NOT_FOUND, description = "Status does not exist or is private") - ) -)] pub async fn post( State(mastodon_mapper): State, State(post): State, diff --git a/kitsune/src/http/handler/mastodon/api/v1/timelines/home.rs b/kitsune/src/http/handler/mastodon/api/v1/timelines/home.rs index 8f5545364..ae9469f1f 100644 --- a/kitsune/src/http/handler/mastodon/api/v1/timelines/home.rs +++ b/kitsune/src/http/handler/mastodon/api/v1/timelines/home.rs @@ -17,9 +17,8 @@ use kitsune_type::mastodon::Status; use kitsune_url::UrlService; use serde::Deserialize; use speedy_uuid::Uuid; -use utoipa::IntoParams; -#[derive(Deserialize, IntoParams)] +#[derive(Deserialize)] pub struct GetQuery { max_id: Option, since_id: Option, @@ -28,17 +27,6 @@ pub struct GetQuery { limit: usize, } -#[utoipa::path( - get, - path = "/api/v1/timelines/home", - security( - ("oauth_token" = []) - ), - params(GetQuery), - responses( - (status = 200, description = "Current home timeline", body = Vec), - ), -)] pub async fn get( State(mastodon_mapper): State, State(timeline): State, diff --git a/kitsune/src/http/handler/mastodon/api/v1/timelines/public.rs b/kitsune/src/http/handler/mastodon/api/v1/timelines/public.rs index f203a2ef2..f43783039 100644 --- a/kitsune/src/http/handler/mastodon/api/v1/timelines/public.rs +++ b/kitsune/src/http/handler/mastodon/api/v1/timelines/public.rs @@ -17,9 +17,8 @@ use kitsune_type::mastodon::Status; use kitsune_url::UrlService; use serde::Deserialize; use speedy_uuid::Uuid; -use utoipa::IntoParams; -#[derive(Deserialize, IntoParams)] +#[derive(Deserialize)] pub struct GetQuery { #[serde(default)] local: bool, @@ -32,14 +31,6 @@ pub struct GetQuery { limit: usize, } -#[utoipa::path( - get, - path = "/api/v1/timelines/public", - params(GetQuery), - responses( - (status = 200, description = "Current public timeline", body = Vec), - ), -)] pub async fn get( State(mastodon_mapper): State, State(timeline): State, diff --git a/kitsune/src/http/handler/mastodon/api/v2/search.rs b/kitsune/src/http/handler/mastodon/api/v2/search.rs index 681595e68..94be57ef2 100644 --- a/kitsune/src/http/handler/mastodon/api/v2/search.rs +++ b/kitsune/src/http/handler/mastodon/api/v2/search.rs @@ -15,9 +15,8 @@ use kitsune_type::mastodon::SearchResult as MastodonSearchResult; use serde::Deserialize; use speedy_uuid::Uuid; use std::cmp::min; -use utoipa::{IntoParams, ToSchema}; -#[derive(Deserialize, ToSchema)] +#[derive(Deserialize)] #[serde(rename_all = "camelCase")] pub enum SearchType { Accounts, @@ -25,7 +24,7 @@ pub enum SearchType { Statuses, } -#[derive(Deserialize, IntoParams)] +#[derive(Deserialize)] struct SearchQuery { #[serde(rename = "q")] query: String, @@ -41,17 +40,6 @@ struct SearchQuery { } #[debug_handler(state = Zustand)] -#[utoipa::path( - get, - path = "/api/v2/search", - security( - ("oauth_token" = []) - ), - params(SearchQuery), - responses( - (status = 200, description = "Search results", body = SearchResult), - ), -)] async fn get( State(search_service): State, State(mastodon_mapper): State, diff --git a/kitsune/src/http/handler/nodeinfo/two_one.rs b/kitsune/src/http/handler/nodeinfo/two_one.rs index b9b6b647a..b484bf720 100644 --- a/kitsune/src/http/handler/nodeinfo/two_one.rs +++ b/kitsune/src/http/handler/nodeinfo/two_one.rs @@ -16,13 +16,6 @@ use kitsune_util::try_join; use simd_json::{OwnedValue, ValueBuilder}; #[debug_handler(state = crate::state::Zustand)] -#[utoipa::path( - get, - path = "/nodeinfo/2.1", - responses( - (status = 200, description = "Get response following the Nodeinfo 2.1 schema", body = TwoOne) - ), -)] async fn get( State(db_pool): State, State(user_service): State, diff --git a/kitsune/src/http/handler/oauth/token.rs b/kitsune/src/http/handler/oauth/token.rs index 7c8392676..c338ba215 100644 --- a/kitsune/src/http/handler/oauth/token.rs +++ b/kitsune/src/http/handler/oauth/token.rs @@ -8,7 +8,6 @@ use oxide_auth_async::endpoint::{ use oxide_auth_axum::{OAuthRequest, OAuthResponse}; #[debug_handler(state = crate::state::Zustand)] -#[utoipa::path(post, path = "/oauth/token")] pub async fn post( State(oauth_endpoint): State, oauth_req: OAuthRequest, diff --git a/kitsune/src/http/handler/well_known/nodeinfo.rs b/kitsune/src/http/handler/well_known/nodeinfo.rs index 99d568136..1653f169b 100644 --- a/kitsune/src/http/handler/well_known/nodeinfo.rs +++ b/kitsune/src/http/handler/well_known/nodeinfo.rs @@ -4,13 +4,6 @@ use kitsune_type::nodeinfo::well_known::{Link, WellKnown}; use kitsune_url::UrlService; #[allow(clippy::unused_async)] -#[utoipa::path( - get, - path = "/.well-known/nodeinfo", - responses( - (status = 200, description = "Response with the location of the nodeinfo endpoints", body = WellKnown) - ) -)] async fn get(State(url_service): State) -> Json { let href = format!("{}/nodeinfo/2.1", url_service.base_url()); diff --git a/kitsune/src/http/handler/well_known/webfinger.rs b/kitsune/src/http/handler/well_known/webfinger.rs index cc4a1c3c5..fb7b4c556 100644 --- a/kitsune/src/http/handler/well_known/webfinger.rs +++ b/kitsune/src/http/handler/well_known/webfinger.rs @@ -10,22 +10,12 @@ use kitsune_service::account::{AccountService, GetUser}; use kitsune_type::webfinger::{Link, Resource}; use kitsune_url::UrlService; use serde::Deserialize; -use utoipa::IntoParams; -#[derive(Deserialize, IntoParams)] +#[derive(Deserialize)] struct WebfingerQuery { resource: String, } -#[utoipa::path( - get, - path = "/.well-known/webfinger", - params(WebfingerQuery), - responses( - (status = 200, description = "Response with the location of the user's profile", body = Resource), - (status = StatusCode::NOT_FOUND, description = "The service doesn't know this user"), - ) -)] async fn get( State(account_service): State, State(url_service): State, diff --git a/kitsune/src/http/mod.rs b/kitsune/src/http/mod.rs index 8a113524c..08ab0c108 100644 --- a/kitsune/src/http/mod.rs +++ b/kitsune/src/http/mod.rs @@ -1,8 +1,5 @@ -use self::{ - handler::{ - confirm_account, custom_emojis, media, nodeinfo, oauth, posts, public, users, well_known, - }, - openapi::api_docs, +use self::handler::{ + confirm_account, custom_emojis, media, nodeinfo, oauth, posts, public, users, well_known, }; use crate::state::Zustand; use axum::{ @@ -30,7 +27,6 @@ use tower_http::{ }; use tower_stop_using_brave::StopUsingBraveLayer; use tower_x_clacks_overhead::XClacksOverheadLayer; -use utoipa_swagger_ui::SwaggerUi; const FALLBACK_FALLBACK_INDEX: &str = include_str!("../../templates/fallback-fallback.html"); @@ -40,7 +36,6 @@ static X_REQUEST_ID: HeaderName = HeaderName::from_static("x-request-id"); mod graphql; mod handler; mod middleware; -mod openapi; #[cfg(feature = "mastodon-api")] mod pagination; mod responder; @@ -133,9 +128,7 @@ pub fn create_router( router = router.merge(handler::mastodon::routes()); } - router = router - .merge(SwaggerUi::new("/swagger-ui").url("/api-doc/openapi.json", api_docs())) - .fallback_service(serve_frontend(server_config)); + router = router.fallback_service(serve_frontend(server_config)); if !server_config.clacks_overhead.is_empty() { let clacks_overhead_layer = @@ -178,6 +171,7 @@ pub async fn run( let listener = TcpListener::bind(("0.0.0.0", server_config.port)).await?; axum::serve(listener, router) + .tcp_nodelay(true) .with_graceful_shutdown(shutdown_signal.wait()) .await?; diff --git a/kitsune/src/http/openapi.rs b/kitsune/src/http/openapi.rs deleted file mode 100644 index fb4ff14ce..000000000 --- a/kitsune/src/http/openapi.rs +++ /dev/null @@ -1,138 +0,0 @@ -use crate::http::handler::{nodeinfo, well_known}; -use kitsune_type::{ - mastodon as mastodon_type, nodeinfo as nodeinfo_type, webfinger as webfinger_type, -}; -use utoipa::{ - openapi::{ - security::{AuthorizationCode, Flow, OAuth2, Scopes, SecurityScheme}, - OpenApi as OpenApiStruct, - }, - Modify, OpenApi, ToSchema, -}; - -#[cfg(feature = "mastodon-api")] -use crate::http::handler::mastodon; - -struct SecurityAddon; - -impl Modify for SecurityAddon { - fn modify(&self, openapi: &mut utoipa::openapi::OpenApi) { - if let Some(components) = openapi.components.as_mut() { - components.add_security_scheme( - "oauth_token", - SecurityScheme::OAuth2(OAuth2::new([Flow::AuthorizationCode( - AuthorizationCode::new("/oauth/authorize", "/oauth/token", Scopes::new()), - )])), - ); - } - } -} - -#[derive(ToSchema)] -#[schema(as = SmolStr)] -#[allow(dead_code)] // Otherwise `utoipa::ToSchema` can't correctly infer the type -struct SmolStrPolyfill(String); - -#[derive(ToSchema)] -#[schema(as = Timestamp)] -#[allow(dead_code)] // Otherwise `utoipa::ToSchema` can't correctly infer the type -struct TimestampPolyfill(String); - -#[derive(OpenApi)] -#[openapi( - components(schemas( - SmolStrPolyfill, - TimestampPolyfill, - mastodon_type::App, - mastodon_type::account::Account, - mastodon_type::account::Field, - mastodon_type::account::Source, - mastodon_type::instance::Stats, - mastodon_type::instance::Urls, - mastodon_type::instance::Instance, - mastodon_type::media_attachment::MediaType, - mastodon_type::media_attachment::MediaAttachment, - mastodon_type::preview_card::PreviewCard, - mastodon_type::preview_card::PreviewType, - mastodon_type::relationship::Relationship, - mastodon_type::search::SearchResult, - mastodon_type::status::Context, - mastodon_type::status::Mention, - mastodon_type::status::Visibility, - mastodon_type::status::Status, - mastodon_type::status::StatusSource, - nodeinfo_type::two_one::TwoOne, - nodeinfo_type::two_one::Protocol, - nodeinfo_type::two_one::InboundService, - nodeinfo_type::two_one::OutboundService, - nodeinfo_type::two_one::Version, - nodeinfo_type::two_one::Software, - nodeinfo_type::two_one::Services, - nodeinfo_type::two_one::UsageUsers, - nodeinfo_type::two_one::Usage, - nodeinfo_type::well_known::Rel, - nodeinfo_type::well_known::Link, - nodeinfo_type::well_known::WellKnown, - webfinger_type::Link, - webfinger_type::Resource, - )), - modifiers(&SecurityAddon), - paths( - nodeinfo::two_one::get, - well_known::nodeinfo::get, - well_known::webfinger::get, - ), -)] -struct CommonApiDocs; - -#[cfg(feature = "mastodon-api")] -#[derive(OpenApi)] -#[openapi( - components(schemas( - mastodon::api::v1::apps::AppForm, - mastodon::api::v1::media::CreateAttachment, - mastodon::api::v1::media::UpdateAttachment, - mastodon::api::v1::statuses::CreateForm, - mastodon::api::v2::search::SearchType, - )), - modifiers(&SecurityAddon), - paths( - mastodon::api::v1::accounts::get, - mastodon::api::v1::accounts::lookup::get, - mastodon::api::v1::accounts::relationships::get, - mastodon::api::v1::accounts::statuses::get, - mastodon::api::v1::accounts::update_credentials::patch, - mastodon::api::v1::accounts::verify_credentials::get, - mastodon::api::v1::apps::post, - mastodon::api::v1::follow_requests::get, - mastodon::api::v1::follow_requests::accept::post, - mastodon::api::v1::follow_requests::reject::post, - mastodon::api::v1::instance::get, - mastodon::api::v1::media::post, - mastodon::api::v1::media::put, - mastodon::api::v1::statuses::delete, - mastodon::api::v1::statuses::get, - mastodon::api::v1::statuses::post, - mastodon::api::v1::statuses::put, - mastodon::api::v1::statuses::context::get, - mastodon::api::v1::statuses::favourite::post, - mastodon::api::v1::statuses::favourited_by::get, - mastodon::api::v1::statuses::reblog::post, - mastodon::api::v1::statuses::reblogged_by::get, - mastodon::api::v1::statuses::source::get, - mastodon::api::v1::statuses::unfavourite::post, - mastodon::api::v1::statuses::unreblog::post, - mastodon::api::v1::timelines::home::get, - mastodon::api::v1::timelines::public::get, - mastodon::api::v2::search::get, - ) -)] -struct MastodonApiDocs; - -pub fn api_docs() -> OpenApiStruct { - #[allow(unused_mut)] - let mut api_docs = CommonApiDocs::openapi(); - #[cfg(feature = "mastodon-api")] - api_docs.merge(MastodonApiDocs::openapi()); - api_docs -} diff --git a/lib/athena/Cargo.toml b/lib/athena/Cargo.toml index 6072d046d..ae558353b 100644 --- a/lib/athena/Cargo.toml +++ b/lib/athena/Cargo.toml @@ -16,18 +16,18 @@ either = { version = "1.12.0", default-features = false, optional = true } futures-util = { version = "0.3.30", default-features = false } iso8601-timestamp = "0.2.17" fred = { workspace = true, optional = true } -just-retry = { path = "../just-retry" } +just-retry = { workspace = true } once_cell = { version = "1.19.0", optional = true } rand = { version = "0.8.5", optional = true } serde = { version = "1.0.202", features = ["derive"] } -simd-json = { version = "0.13.10", optional = true } +simd-json = { workspace = true, optional = true } smol_str = "0.2.2" -speedy-uuid = { path = "../speedy-uuid", features = ["redis", "serde"] } +speedy-uuid = { workspace = true, features = ["redis"] } thiserror = "1.0.61" tokio = { version = "1.37.0", features = ["macros", "rt", "sync"] } tokio-util = { version = "0.7.11", features = ["rt"] } tracing = "0.1.40" -triomphe = { version = "0.1.11", features = ["unsize"] } +triomphe = { workspace = true } typed-builder = "0.18.2" typetag = "0.2.16" unsize = "1.1.0" @@ -36,7 +36,7 @@ unsize = "1.1.0" redis = ["dep:either", "dep:fred", "dep:once_cell", "dep:rand", "dep:simd-json"] [dev-dependencies] -kitsune-test = { path = "../../crates/kitsune-test" } +kitsune-test = { workspace = true } tracing-subscriber = "0.3.18" [lints] diff --git a/lib/athena/src/redis/mod.rs b/lib/athena/src/redis/mod.rs index 2422d1cc5..43f758579 100644 --- a/lib/athena/src/redis/mod.rs +++ b/lib/athena/src/redis/mod.rs @@ -62,13 +62,29 @@ where { async fn initialise_group(&self) -> Result<()> { self.group_initialised - .get_or_try_init(|| { - self.redis_pool.xgroup_create( - self.queue_name.as_str(), - self.consumer_group.as_str(), - "0", - true, - ) + .get_or_try_init(|| async move { + let result = self + .redis_pool + .xgroup_create( + self.queue_name.as_str(), + self.consumer_group.as_str(), + "0", + true, + ) + .await; + + result.or_else(|err| { + if err.details().starts_with("BUSYGROUP") { + debug!( + recv_error = err.details(), + "Consumer group already exists, skipping creation", + ); + + Ok(()) + } else { + Err(err) + } + }) }) .await?; diff --git a/lib/cursiv/Cargo.toml b/lib/cursiv/Cargo.toml index efa3d3c28..2905310c2 100644 --- a/lib/cursiv/Cargo.toml +++ b/lib/cursiv/Cargo.toml @@ -14,7 +14,7 @@ http = "1.1.0" pin-project-lite = "0.2.14" rand = "0.8.5" tower = { version = "0.4.13", default-features = false } -triomphe = "0.1.11" +triomphe = { workspace = true } zeroize = { version = "1.7.0", features = ["derive"] } # `axum` feature diff --git a/lib/geomjeungja/Cargo.toml b/lib/geomjeungja/Cargo.toml index f9c299897..a4be16983 100644 --- a/lib/geomjeungja/Cargo.toml +++ b/lib/geomjeungja/Cargo.toml @@ -10,10 +10,10 @@ async-trait = "0.1.80" hickory-resolver = "0.24.1" rand = "0.8.5" serde = { version = "1.0.202", features = ["derive"] } -simdutf8 = { version = "0.1.4", features = ["aarch64_neon"] } +simdutf8 = { workspace = true } thiserror = "1.0.61" tracing = "0.1.40" -triomphe = { version = "0.1.11", features = ["unsize"] } +triomphe = { workspace = true } typed-builder = "0.18.2" unsize = "1.1.0" diff --git a/lib/http-signatures/Cargo.toml b/lib/http-signatures/Cargo.toml index 12bf1062c..464332521 100644 --- a/lib/http-signatures/Cargo.toml +++ b/lib/http-signatures/Cargo.toml @@ -20,19 +20,19 @@ path = "bin/parse_header.rs" [dependencies] atoi_radix10 = "0.0.1" base64-simd = "0.8.0" -blowocking = { path = "../blowocking", default-features = false, optional = true } +blowocking = { workspace = true, default-features = false, optional = true } const-oid = { version = "0.9.6", features = ["db"] } derive_builder = "0.20.0" http = "1.1.0" httpdate = "1.0.3" -itertools = { version = "0.13.0", default-features = false } +itertools = { workspace = true } logos = "0.14.0" miette = "7.2.0" pkcs8 = { version = "0.10.2", features = ["pem", "std"] } ring = { version = "0.17.8", features = ["std"] } scoped-futures = { version = "0.1.3", default-features = false } thiserror = "1.0.61" -tick-tock-mock = { path = "../tick-tock-mock" } +tick-tock-mock = { workspace = true } tracing = { version = "0.1.40", default-features = false, optional = true } [dev-dependencies] diff --git a/lib/mrf-tool/Cargo.toml b/lib/mrf-tool/Cargo.toml index 3d29787a6..947e84adb 100644 --- a/lib/mrf-tool/Cargo.toml +++ b/lib/mrf-tool/Cargo.toml @@ -7,9 +7,9 @@ version.workspace = true license = "MIT OR Apache-2.0" [dependencies] -clap = { version = "4.5.4", features = ["derive", "wrap_help"] } +clap = { workspace = true } color-eyre = "0.6.3" -mrf-manifest = { path = "../mrf-manifest", features = [ +mrf-manifest = { workspace = true, features = [ "decode", "encode", "serialise", diff --git a/lib/speedy-uuid/Cargo.toml b/lib/speedy-uuid/Cargo.toml index 2eaed9914..65a5c2f31 100644 --- a/lib/speedy-uuid/Cargo.toml +++ b/lib/speedy-uuid/Cargo.toml @@ -7,7 +7,7 @@ license = "MIT OR Apache-2.0" [dependencies] async-graphql = { version = "7.0.5", default-features = false, optional = true } -diesel = { version = "2.1.6", features = [ +diesel = { version = "2.1.6", default-features = false, features = [ "postgres_backend", "uuid", ], optional = true } diff --git a/lib/speedy-uuid/src/lib.rs b/lib/speedy-uuid/src/lib.rs index 58d0938e6..5351014c9 100644 --- a/lib/speedy-uuid/src/lib.rs +++ b/lib/speedy-uuid/src/lib.rs @@ -6,6 +6,9 @@ use std::{ use thiserror::Error; use uuid_simd::{format_hyphenated, AsciiCase, Out, UuidExt}; +#[cfg(feature = "diesel")] +use diesel::{deserialize::FromSqlRow, expression::AsExpression}; + pub use uuid; #[derive(Debug, Error)] @@ -17,7 +20,7 @@ pub enum Error { Uuid(#[from] uuid::Error), } -#[cfg_attr(feature = "diesel", derive(diesel::AsExpression, diesel::FromSqlRow))] +#[cfg_attr(feature = "diesel", derive(AsExpression, FromSqlRow))] #[cfg_attr(feature = "diesel", diesel(sql_type = diesel::sql_types::Uuid))] #[derive(Clone, Copy, Hash, PartialEq, Eq, PartialOrd, Ord)] #[repr(transparent)] diff --git a/lib/tower-x-clacks-overhead/Cargo.toml b/lib/tower-x-clacks-overhead/Cargo.toml index 9b0da103c..b5d12c447 100644 --- a/lib/tower-x-clacks-overhead/Cargo.toml +++ b/lib/tower-x-clacks-overhead/Cargo.toml @@ -7,11 +7,11 @@ license = "MIT OR Apache-2.0" [dependencies] http = "1.1.0" -itertools = { version = "0.13.0", default-features = false } +itertools = { workspace = true } pin-project-lite = "0.2.14" tower-layer = "0.3.2" tower-service = "0.3.2" -triomphe = "0.1.11" +triomphe = { workspace = true } [dev-dependencies] futures-test = "0.3.30"