Remove unneeded dependency on activitystreams (#2034)

This commit is contained in:
Riley 2022-01-12 18:17:00 -06:00 committed by GitHub
parent 55bb68f6f9
commit bc8ed1e6da
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 15 additions and 22 deletions

18
Cargo.lock generated
View file

@ -2,21 +2,6 @@
# It is not intended for manual editing. # It is not intended for manual editing.
version = 3 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]] [[package]]
name = "activitystreams-kinds" name = "activitystreams-kinds"
version = "0.1.2" version = "0.1.2"
@ -1966,12 +1951,12 @@ dependencies = [
name = "lemmy_apub_lib" name = "lemmy_apub_lib"
version = "0.15.1" version = "0.15.1"
dependencies = [ dependencies = [
"activitystreams",
"actix-web", "actix-web",
"anyhow", "anyhow",
"async-trait", "async-trait",
"background-jobs", "background-jobs",
"base64 0.13.0", "base64 0.13.0",
"chrono",
"diesel", "diesel",
"http", "http",
"http-signature-normalization-actix", "http-signature-normalization-actix",
@ -2086,7 +2071,6 @@ dependencies = [
name = "lemmy_server" name = "lemmy_server"
version = "0.15.1" version = "0.15.1"
dependencies = [ dependencies = [
"activitystreams",
"actix", "actix",
"actix-rt", "actix-rt",
"actix-web", "actix-web",

View file

@ -64,7 +64,6 @@ anyhow = "1.0.51"
reqwest = { version = "0.11.7", features = ["json"] } reqwest = { version = "0.11.7", features = ["json"] }
reqwest-middleware = "0.1.3" reqwest-middleware = "0.1.3"
reqwest-tracing = { version = "0.2.0", features = ["opentelemetry_0_16"] } 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 } actix-rt = { version = "2.5.0", default-features = false }
serde_json = { version = "1.0.72", features = ["preserve_order"] } serde_json = { version = "1.0.72", features = ["preserve_order"] }
clokwerk = "0.3.5" clokwerk = "0.3.5"

View file

@ -10,7 +10,7 @@ documentation = "https://join-lemmy.org/docs/en/index.html"
[dependencies] [dependencies]
lemmy_utils = { version = "=0.15.1", path = "../utils" } lemmy_utils = { version = "=0.15.1", path = "../utils" }
lemmy_apub_lib_derive = { version = "=0.15.1", path = "../apub_lib_derive" } 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"] } serde = { version = "1.0.131", features = ["derive"] }
async-trait = "0.1.52" async-trait = "0.1.52"
url = { version = "2.2.2", features = ["serde"] } url = { version = "2.2.2", features = ["serde"] }

View file

@ -1,6 +1,6 @@
use crate::{traits::ApubObject, APUB_JSON_CONTENT_TYPE}; use crate::{traits::ApubObject, APUB_JSON_CONTENT_TYPE};
use activitystreams::chrono::{Duration as ChronoDuration, NaiveDateTime, Utc};
use anyhow::anyhow; use anyhow::anyhow;
use chrono::{Duration as ChronoDuration, NaiveDateTime, Utc};
use diesel::NotFound; use diesel::NotFound;
use lemmy_utils::{request::retry, settings::structs::Settings, LemmyError}; use lemmy_utils::{request::retry, settings::structs::Settings, LemmyError};
use reqwest::StatusCode; use reqwest::StatusCode;

View file

@ -1,5 +1,5 @@
use crate::{data::Data, signatures::PublicKey}; use crate::{data::Data, signatures::PublicKey};
use activitystreams::chrono::NaiveDateTime; use chrono::NaiveDateTime;
pub use lemmy_apub_lib_derive::*; pub use lemmy_apub_lib_derive::*;
use lemmy_utils::LemmyError; use lemmy_utils::LemmyError;
use url::Url; use url::Url;

View file

@ -1,7 +1,17 @@
use activitystreams::error::DomainError;
use lemmy_utils::LemmyError; use lemmy_utils::LemmyError;
use url::Url; 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> { pub fn verify_domains_match(a: &Url, b: &Url) -> Result<(), LemmyError> {
if a.domain() != b.domain() { if a.domain() != b.domain() {
return Err(DomainError.into()); return Err(DomainError.into());