From 3a526b0b7d7a6e4c3f0d30efe0a5405e9f0b04fd Mon Sep 17 00:00:00 2001 From: Nutomic Date: Wed, 5 Apr 2023 22:29:08 +0200 Subject: [PATCH] Remove unused dependencies (#2795) --- Cargo.lock | 22 ++-------------------- Cargo.toml | 4 ---- crates/api/Cargo.toml | 2 -- crates/api_common/Cargo.toml | 7 +------ crates/api_crud/Cargo.toml | 1 - crates/apub/Cargo.toml | 1 - crates/db_schema/Cargo.toml | 2 -- crates/db_views/Cargo.toml | 1 - crates/routes/Cargo.toml | 1 - crates/routes/src/webfinger.rs | 19 +++++++------------ crates/utils/Cargo.toml | 2 -- 11 files changed, 10 insertions(+), 52 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fa1cded7..77424468 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -959,9 +959,9 @@ checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" [[package]] name = "cookie" -version = "0.16.1" +version = "0.16.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "344adc371239ef32293cb1c4fe519592fcf21206c79c02854320afcdf3ab4917" +checksum = "e859cd57d0710d9e06c381b550c06e76992472a8c6d527aecd2fc673dcc231fb" dependencies = [ "percent-encoding", "time 0.3.15", @@ -2392,7 +2392,6 @@ dependencies = [ "bcrypt", "captcha", "chrono", - "diesel", "lemmy_api_common", "lemmy_db_schema", "lemmy_db_views", @@ -2400,7 +2399,6 @@ dependencies = [ "lemmy_db_views_moderator", "lemmy_utils", "serde", - "serde_json", "serial_test", "tokio", "tracing", @@ -2415,9 +2413,7 @@ dependencies = [ "actix-web", "actix-ws", "anyhow", - "background-jobs", "chrono", - "diesel", "encoding", "futures", "lemmy_db_schema", @@ -2425,7 +2421,6 @@ dependencies = [ "lemmy_db_views_actor", "lemmy_db_views_moderator", "lemmy_utils", - "opentelemetry 0.17.0", "percent-encoding", "rand 0.8.5", "regex", @@ -2436,9 +2431,7 @@ dependencies = [ "serde_json", "strum", "strum_macros", - "tokio", "tracing", - "tracing-opentelemetry 0.17.4", "url", "uuid", "webpage", @@ -2458,7 +2451,6 @@ dependencies = [ "lemmy_db_views_actor", "lemmy_utils", "serde", - "serde_json", "tracing", "url", "webmention", @@ -2497,7 +2489,6 @@ dependencies = [ "sha2", "strum_macros", "task-local-extensions", - "tokio", "tracing", "url", "uuid", @@ -2517,7 +2508,6 @@ dependencies = [ "diesel-derive-newtype", "diesel_ltree", "diesel_migrations", - "futures", "lemmy_utils", "once_cell", "regex", @@ -2529,7 +2519,6 @@ dependencies = [ "strum_macros", "tokio", "tracing", - "tracing-error", "typed-builder", "url", ] @@ -2547,7 +2536,6 @@ dependencies = [ "tokio", "tracing", "typed-builder", - "url", ] [[package]] @@ -2579,7 +2567,6 @@ dependencies = [ "actix-web", "anyhow", "chrono", - "diesel", "futures", "lemmy_api_common", "lemmy_db_schema", @@ -2610,7 +2597,6 @@ dependencies = [ "console-subscriber", "diesel", "diesel-async", - "diesel_migrations", "doku", "futures", "lemmy_api", @@ -2622,9 +2608,7 @@ dependencies = [ "lemmy_utils", "opentelemetry 0.17.0", "opentelemetry-otlp 0.10.0", - "parking_lot 0.12.1", "pict-rs", - "rand 0.8.5", "reqwest", "reqwest-middleware", "reqwest-retry", @@ -2660,9 +2644,7 @@ dependencies = [ "lettre", "once_cell", "openssl", - "parking_lot 0.12.1", "percent-encoding", - "rand 0.8.5", "regex", "reqwest", "reqwest-middleware", diff --git a/Cargo.toml b/Cargo.toml index 970ebb75..3a97f620 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -76,7 +76,6 @@ reqwest-middleware = "0.2.0" reqwest-tracing = "0.4.0" clokwerk = "0.3.5" doku = { version = "0.20.0", features = ["url-2"] } -parking_lot = "0.12.1" reqwest-retry = "0.2.0" bcrypt = "0.13.0" chrono = { version = "0.4.22", features = ["serde"], default-features = false } @@ -117,7 +116,6 @@ lemmy_api_common = { workspace = true } lemmy_routes = { workspace = true } activitypub_federation = { workspace = true } diesel = { workspace = true } -diesel_migrations = { workspace = true } diesel-async = { workspace = true } serde = { workspace = true } actix-web = { workspace = true } @@ -132,7 +130,6 @@ reqwest-middleware = { workspace = true } reqwest-tracing = { workspace = true } clokwerk = { workspace = true } doku = { workspace = true } -parking_lot = { workspace = true } reqwest-retry = { workspace = true } serde_json = { workspace = true } futures = { workspace = true } @@ -141,7 +138,6 @@ tracing-opentelemetry = { workspace = true, optional = true } opentelemetry = { workspace = true, optional = true } actix-web-actors = { version = "4.1.0", default-features = false } actix-rt = "2.6" -rand = { workspace = true } console-subscriber = { version = "0.1.8", optional = true } opentelemetry-otlp = { version = "0.10.0", optional = true } pict-rs = { version = "0.4.0-beta.9", optional = true } diff --git a/crates/api/Cargo.toml b/crates/api/Cargo.toml index f7f1b0bf..69f1b28e 100644 --- a/crates/api/Cargo.toml +++ b/crates/api/Cargo.toml @@ -20,10 +20,8 @@ lemmy_db_views = { workspace = true, features = ["full"] } lemmy_db_views_moderator = { workspace = true, features = ["full"] } lemmy_db_views_actor = { workspace = true, features = ["full"] } lemmy_api_common = { workspace = true, features = ["full"] } -diesel = { workspace = true } bcrypt = { workspace = true } chrono = { workspace = true } -serde_json = { workspace = true } serde = { workspace = true } actix-web = { workspace = true } base64 = { workspace = true } diff --git a/crates/api_common/Cargo.toml b/crates/api_common/Cargo.toml index 368163d0..15e8d370 100644 --- a/crates/api_common/Cargo.toml +++ b/crates/api_common/Cargo.toml @@ -14,7 +14,7 @@ path = "src/lib.rs" doctest = false [features] -full = ["diesel", "tracing", "rosetta-i18n", "chrono", "actix-web", "lemmy_utils", +full = ["tracing", "rosetta-i18n", "chrono", "actix-web", "lemmy_utils", "lemmy_db_views/full", "lemmy_db_views_actor/full", "lemmy_db_views_moderator/full", "percent-encoding", "encoding", "reqwest-middleware", "webpage"] @@ -28,7 +28,6 @@ serde = { workspace = true } url = { workspace = true } actix-web = { workspace = true, features = ["cookies"], optional = true } chrono = { workspace = true, optional = true } -diesel = { workspace = true, optional = true } tracing = { workspace = true, optional = true } reqwest-middleware = { workspace = true, optional = true } regex = { workspace = true } @@ -39,14 +38,10 @@ encoding = { version = "0.2.33", optional = true } rand = { workspace = true } serde_json = { workspace = true } anyhow = { workspace = true } -tokio = { workspace = true } strum = { workspace = true } strum_macros = { workspace = true } -opentelemetry = { workspace = true } -tracing-opentelemetry = { workspace = true } actix-ws = { workspace = true } futures = { workspace = true } -background-jobs = "0.13.0" uuid = { workspace = true } actix-rt = { workspace = true } reqwest = { workspace = true } diff --git a/crates/api_crud/Cargo.toml b/crates/api_crud/Cargo.toml index 2d177446..1fb1e5a6 100644 --- a/crates/api_crud/Cargo.toml +++ b/crates/api_crud/Cargo.toml @@ -16,7 +16,6 @@ lemmy_db_views_actor = { workspace = true, features = ["full"] } lemmy_api_common = { workspace = true, features = ["full"] } activitypub_federation = { workspace = true } bcrypt = { workspace = true } -serde_json = { workspace = true } serde = { workspace = true } actix-web = { workspace = true } tracing = { workspace = true } diff --git a/crates/apub/Cargo.toml b/crates/apub/Cargo.toml index 9ac447c9..e50915fa 100644 --- a/crates/apub/Cargo.toml +++ b/crates/apub/Cargo.toml @@ -38,7 +38,6 @@ async-trait = { workspace = true } anyhow = { workspace = true } reqwest = { workspace = true } once_cell = { workspace = true } -tokio = { workspace = true } html2md = "0.2.13" serde_with = "1.14.0" http-signature-normalization-actix = { version = "0.6.1", default-features = false, features = ["server", "sha-2"] } diff --git a/crates/db_schema/Cargo.toml b/crates/db_schema/Cargo.toml index 75884d58..87278a20 100644 --- a/crates/db_schema/Cargo.toml +++ b/crates/db_schema/Cargo.toml @@ -40,8 +40,6 @@ typed-builder = { workspace = true } async-trait = { workspace = true } tokio = { workspace = true } tracing = { workspace = true } -tracing-error = { workspace = true } -futures = { workspace = true } deadpool = { version = "0.9.5", features = ["rt_tokio_1"], optional = true } [dev-dependencies] diff --git a/crates/db_views/Cargo.toml b/crates/db_views/Cargo.toml index 41968f31..8f7c8ae8 100644 --- a/crates/db_views/Cargo.toml +++ b/crates/db_views/Cargo.toml @@ -22,7 +22,6 @@ diesel_ltree = { workspace = true, optional = true} serde = { workspace = true } tracing = { workspace = true, optional = true } typed-builder = { workspace = true } -url = { workspace = true } [dev-dependencies] serial_test = { workspace = true } diff --git a/crates/routes/Cargo.toml b/crates/routes/Cargo.toml index c9056abf..1f621203 100644 --- a/crates/routes/Cargo.toml +++ b/crates/routes/Cargo.toml @@ -18,7 +18,6 @@ lemmy_db_views_actor = { workspace = true } lemmy_db_schema = { workspace = true } lemmy_api_common = { workspace = true, features = ["full"] } activitypub_federation = { workspace = true } -diesel = { workspace = true } actix-web = { workspace = true } anyhow = { workspace = true } chrono = { workspace = true } diff --git a/crates/routes/src/webfinger.rs b/crates/routes/src/webfinger.rs index deade197..79de351a 100644 --- a/crates/routes/src/webfinger.rs +++ b/crates/routes/src/webfinger.rs @@ -1,12 +1,14 @@ -use activitypub_federation::fetch::webfinger::{Webfinger, WebfingerLink}; +use activitypub_federation::{ + config::Data, + fetch::webfinger::{extract_webfinger_name, Webfinger, WebfingerLink}, +}; use actix_web::{web, web::Query, HttpResponse}; -use anyhow::Context; use lemmy_api_common::context::LemmyContext; use lemmy_db_schema::{ source::{community::Community, person::Person}, traits::ApubActor, }; -use lemmy_utils::{error::LemmyError, location_info}; +use lemmy_utils::error::LemmyError; use serde::Deserialize; use std::collections::HashMap; use url::Url; @@ -31,16 +33,9 @@ pub fn config(cfg: &mut web::ServiceConfig) { /// https://radical.town/.well-known/webfinger?resource=acct:felix@radical.town async fn get_webfinger_response( info: Query, - context: web::Data, + context: Data, ) -> Result { - let name = context - .settings() - .webfinger_regex() - .captures(&info.resource) - .and_then(|c| c.get(1)) - .context(location_info!())? - .as_str() - .to_string(); + let name = extract_webfinger_name(&info.resource, &context)?; let name_ = name.clone(); let user_id: Option = Person::read_from_name(context.pool(), &name_, false) diff --git a/crates/utils/Cargo.toml b/crates/utils/Cargo.toml index d9f68678..4e80c5df 100644 --- a/crates/utils/Cargo.toml +++ b/crates/utils/Cargo.toml @@ -19,7 +19,6 @@ chrono = { workspace = true } tracing = { workspace = true } tracing-error = { workspace = true } itertools = { workspace = true } -rand = { workspace = true } serde = { workspace = true } serde_json = { workspace = true } once_cell = { workspace = true } @@ -35,7 +34,6 @@ http = { workspace = true } doku = { workspace = true, features = ["url-2"] } uuid = { workspace = true, features = ["serde", "v4"] } rosetta-i18n = { workspace = true } -parking_lot = { workspace = true } typed-builder = { workspace = true } percent-encoding = { workspace = true } tokio = { workspace = true } -- 2.44.1