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.
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",

View File

@ -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"

View File

@ -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"] }

View File

@ -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;

View File

@ -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;

View File

@ -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());