mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-14 08:23:59 +00:00
Upgrade activitypub to 0.5.0-beta.5
(#4179)
* Remove anyhow test * Update lock * Fix lints hopefully!
This commit is contained in:
parent
f786df151f
commit
1c03a86c17
5 changed files with 14 additions and 17 deletions
6
Cargo.lock
generated
6
Cargo.lock
generated
|
@ -10,13 +10,12 @@ checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "activitypub_federation"
|
name = "activitypub_federation"
|
||||||
version = "0.5.0-beta.4"
|
version = "0.5.0-beta.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9a122cf2c2adf45b164134946bc069659cd93083fab294839a3f1d794b707c17"
|
checksum = "eb3d9484e58e121ce93b84407e077f5888526a8edccb8a8447d14e3ff611aaa3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"activitystreams-kinds",
|
"activitystreams-kinds",
|
||||||
"actix-web",
|
"actix-web",
|
||||||
"anyhow",
|
|
||||||
"async-trait",
|
"async-trait",
|
||||||
"base64 0.21.5",
|
"base64 0.21.5",
|
||||||
"bytes",
|
"bytes",
|
||||||
|
@ -2745,7 +2744,6 @@ dependencies = [
|
||||||
"lemmy_apub",
|
"lemmy_apub",
|
||||||
"lemmy_db_schema",
|
"lemmy_db_schema",
|
||||||
"lemmy_db_views_actor",
|
"lemmy_db_views_actor",
|
||||||
"lemmy_utils",
|
|
||||||
"moka",
|
"moka",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"reqwest",
|
"reqwest",
|
||||||
|
|
|
@ -69,7 +69,7 @@ lemmy_routes = { version = "=0.19.0-rc.5", path = "./crates/routes" }
|
||||||
lemmy_db_views = { version = "=0.19.0-rc.5", path = "./crates/db_views" }
|
lemmy_db_views = { version = "=0.19.0-rc.5", path = "./crates/db_views" }
|
||||||
lemmy_db_views_actor = { version = "=0.19.0-rc.5", path = "./crates/db_views_actor" }
|
lemmy_db_views_actor = { version = "=0.19.0-rc.5", path = "./crates/db_views_actor" }
|
||||||
lemmy_db_views_moderator = { version = "=0.19.0-rc.5", path = "./crates/db_views_moderator" }
|
lemmy_db_views_moderator = { version = "=0.19.0-rc.5", path = "./crates/db_views_moderator" }
|
||||||
activitypub_federation = { version = "0.5.0-beta.4", default-features = false, features = [
|
activitypub_federation = { version = "0.5.0-beta.5", default-features = false, features = [
|
||||||
"actix-web",
|
"actix-web",
|
||||||
] }
|
] }
|
||||||
diesel = "2.1.3"
|
diesel = "2.1.3"
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
use crate::fetcher::post_or_comment::PostOrComment;
|
use crate::fetcher::post_or_comment::PostOrComment;
|
||||||
use activitypub_federation::config::{Data, UrlVerifier};
|
use activitypub_federation::{
|
||||||
use anyhow::anyhow;
|
config::{Data, UrlVerifier},
|
||||||
|
error::Error as ActivityPubError,
|
||||||
|
};
|
||||||
use async_trait::async_trait;
|
use async_trait::async_trait;
|
||||||
use lemmy_api_common::context::LemmyContext;
|
use lemmy_api_common::context::LemmyContext;
|
||||||
use lemmy_db_schema::{
|
use lemmy_db_schema::{
|
||||||
|
@ -39,7 +41,7 @@ pub struct VerifyUrlData(pub ActualDbPool);
|
||||||
|
|
||||||
#[async_trait]
|
#[async_trait]
|
||||||
impl UrlVerifier for VerifyUrlData {
|
impl UrlVerifier for VerifyUrlData {
|
||||||
async fn verify(&self, url: &Url) -> Result<(), anyhow::Error> {
|
async fn verify(&self, url: &Url) -> Result<(), ActivityPubError> {
|
||||||
let local_site_data = local_site_data_cached(&mut (&self.0).into())
|
let local_site_data = local_site_data_cached(&mut (&self.0).into())
|
||||||
.await
|
.await
|
||||||
.expect("read local site data");
|
.expect("read local site data");
|
||||||
|
@ -47,16 +49,16 @@ impl UrlVerifier for VerifyUrlData {
|
||||||
LemmyError {
|
LemmyError {
|
||||||
error_type: LemmyErrorType::FederationDisabled,
|
error_type: LemmyErrorType::FederationDisabled,
|
||||||
..
|
..
|
||||||
} => anyhow!("Federation disabled"),
|
} => ActivityPubError::Other("Federation disabled".into()),
|
||||||
LemmyError {
|
LemmyError {
|
||||||
error_type: LemmyErrorType::DomainBlocked(domain),
|
error_type: LemmyErrorType::DomainBlocked(domain),
|
||||||
..
|
..
|
||||||
} => anyhow!("Domain {domain:?} is blocked"),
|
} => ActivityPubError::Other(format!("Domain {domain:?} is blocked")),
|
||||||
LemmyError {
|
LemmyError {
|
||||||
error_type: LemmyErrorType::DomainNotInAllowList(domain),
|
error_type: LemmyErrorType::DomainNotInAllowList(domain),
|
||||||
..
|
..
|
||||||
} => anyhow!("Domain {domain:?} is not in allowlist"),
|
} => ActivityPubError::Other(format!("Domain {domain:?} is not in allowlist")),
|
||||||
_ => anyhow!("Failed validating apub id"),
|
_ => ActivityPubError::Other("Failed validating apub id".into()),
|
||||||
})?;
|
})?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,6 @@ lemmy_api_common.workspace = true
|
||||||
lemmy_apub.workspace = true
|
lemmy_apub.workspace = true
|
||||||
lemmy_db_schema = { workspace = true, features = ["full"] }
|
lemmy_db_schema = { workspace = true, features = ["full"] }
|
||||||
lemmy_db_views_actor.workspace = true
|
lemmy_db_views_actor.workspace = true
|
||||||
lemmy_utils.workspace = true
|
|
||||||
|
|
||||||
activitypub_federation.workspace = true
|
activitypub_federation.workspace = true
|
||||||
anyhow.workspace = true
|
anyhow.workspace = true
|
||||||
|
|
|
@ -21,7 +21,6 @@ use lemmy_db_schema::{
|
||||||
utils::DbPool,
|
utils::DbPool,
|
||||||
};
|
};
|
||||||
use lemmy_db_views_actor::structs::CommunityFollowerView;
|
use lemmy_db_views_actor::structs::CommunityFollowerView;
|
||||||
use lemmy_utils::error::LemmyErrorExt2;
|
|
||||||
use once_cell::sync::Lazy;
|
use once_cell::sync::Lazy;
|
||||||
use reqwest::Url;
|
use reqwest::Url;
|
||||||
use std::{
|
use std::{
|
||||||
|
@ -218,9 +217,8 @@ impl InstanceWorker {
|
||||||
.context("failed getting actor instance (was it marked deleted / removed?)")?;
|
.context("failed getting actor instance (was it marked deleted / removed?)")?;
|
||||||
|
|
||||||
let inbox_urls = inbox_urls.into_iter().collect();
|
let inbox_urls = inbox_urls.into_iter().collect();
|
||||||
let requests = SendActivityTask::prepare(object, actor.as_ref(), inbox_urls, &self.context)
|
let requests =
|
||||||
.await
|
SendActivityTask::prepare(object, actor.as_ref(), inbox_urls, &self.context).await?;
|
||||||
.into_anyhow()?;
|
|
||||||
for task in requests {
|
for task in requests {
|
||||||
// usually only one due to shared inbox
|
// usually only one due to shared inbox
|
||||||
tracing::info!("sending out {}", task);
|
tracing::info!("sending out {}", task);
|
||||||
|
|
Loading…
Reference in a new issue