From: Riley Date: Thu, 13 Jan 2022 00:17:00 +0000 (-0600) Subject: Remove unneeded dependency on activitystreams (#2034) X-Git-Url: http://these/git/%7B%24%7B%60data:application/%22%7Burl%7D/%7Bthis.state.url%7D?a=commitdiff_plain;h=bc8ed1e6da5ab66019d66a692c9dfccd7e06346d;p=lemmy.git Remove unneeded dependency on activitystreams (#2034) --- diff --git a/Cargo.lock b/Cargo.lock index 79bd2bcb..11ca872b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,21 +2,6 @@ # It is not intended for manual editing. version = 3 -[[package]] -name = "activitystreams" -version = "0.7.0-alpha.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bcc3fbb392890a1942b1e5cca76cba93c8ed24b5ff50004cc3289afaab3f92c" -dependencies = [ - "activitystreams-kinds", - "chrono", - "mime", - "serde", - "serde_json", - "thiserror", - "url", -] - [[package]] name = "activitystreams-kinds" version = "0.1.2" @@ -1966,12 +1951,12 @@ dependencies = [ name = "lemmy_apub_lib" version = "0.15.1" dependencies = [ - "activitystreams", "actix-web", "anyhow", "async-trait", "background-jobs", "base64 0.13.0", + "chrono", "diesel", "http", "http-signature-normalization-actix", @@ -2086,7 +2071,6 @@ dependencies = [ name = "lemmy_server" version = "0.15.1" dependencies = [ - "activitystreams", "actix", "actix-rt", "actix-web", diff --git a/Cargo.toml b/Cargo.toml index b34ec648..5dfcdf09 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -64,7 +64,6 @@ anyhow = "1.0.51" reqwest = { version = "0.11.7", features = ["json"] } reqwest-middleware = "0.1.3" reqwest-tracing = { version = "0.2.0", features = ["opentelemetry_0_16"] } -activitystreams = "0.7.0-alpha.14" actix-rt = { version = "2.5.0", default-features = false } serde_json = { version = "1.0.72", features = ["preserve_order"] } clokwerk = "0.3.5" diff --git a/crates/apub_lib/Cargo.toml b/crates/apub_lib/Cargo.toml index 86702f48..34c9612b 100644 --- a/crates/apub_lib/Cargo.toml +++ b/crates/apub_lib/Cargo.toml @@ -10,7 +10,7 @@ documentation = "https://join-lemmy.org/docs/en/index.html" [dependencies] lemmy_utils = { version = "=0.15.1", path = "../utils" } lemmy_apub_lib_derive = { version = "=0.15.1", path = "../apub_lib_derive" } -activitystreams = "0.7.0-alpha.14" +chrono = "0.4.19" serde = { version = "1.0.131", features = ["derive"] } async-trait = "0.1.52" url = { version = "2.2.2", features = ["serde"] } diff --git a/crates/apub_lib/src/object_id.rs b/crates/apub_lib/src/object_id.rs index 5bb862f6..b2be92e5 100644 --- a/crates/apub_lib/src/object_id.rs +++ b/crates/apub_lib/src/object_id.rs @@ -1,6 +1,6 @@ use crate::{traits::ApubObject, APUB_JSON_CONTENT_TYPE}; -use activitystreams::chrono::{Duration as ChronoDuration, NaiveDateTime, Utc}; use anyhow::anyhow; +use chrono::{Duration as ChronoDuration, NaiveDateTime, Utc}; use diesel::NotFound; use lemmy_utils::{request::retry, settings::structs::Settings, LemmyError}; use reqwest::StatusCode; diff --git a/crates/apub_lib/src/traits.rs b/crates/apub_lib/src/traits.rs index e96b568c..bc57dfa4 100644 --- a/crates/apub_lib/src/traits.rs +++ b/crates/apub_lib/src/traits.rs @@ -1,5 +1,5 @@ use crate::{data::Data, signatures::PublicKey}; -use activitystreams::chrono::NaiveDateTime; +use chrono::NaiveDateTime; pub use lemmy_apub_lib_derive::*; use lemmy_utils::LemmyError; use url::Url; diff --git a/crates/apub_lib/src/verify.rs b/crates/apub_lib/src/verify.rs index 426409b7..b7927758 100644 --- a/crates/apub_lib/src/verify.rs +++ b/crates/apub_lib/src/verify.rs @@ -1,7 +1,17 @@ -use activitystreams::error::DomainError; use lemmy_utils::LemmyError; use url::Url; +#[derive(Debug)] +struct DomainError; + +impl std::fmt::Display for DomainError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "Domain mismatch") + } +} + +impl std::error::Error for DomainError {} + pub fn verify_domains_match(a: &Url, b: &Url) -> Result<(), LemmyError> { if a.domain() != b.domain() { return Err(DomainError.into());