mirror of
https://github.com/LemmyNet/activitypub-federation-rust.git
synced 2024-04-28 15:28:45 +00:00
add comment
This commit is contained in:
parent
05ab30a1b9
commit
73222a8c37
|
@ -11,6 +11,7 @@ use crate::{
|
|||
FEDERATION_CONTENT_TYPE,
|
||||
};
|
||||
use bytes::Bytes;
|
||||
use chrono::{DateTime, Utc};
|
||||
use futures::StreamExt;
|
||||
use httpdate::fmt_http_date;
|
||||
use itertools::Itertools;
|
||||
|
@ -22,7 +23,6 @@ use std::{
|
|||
fmt::{Debug, Display},
|
||||
time::{Duration, SystemTime},
|
||||
};
|
||||
use chrono::{DateTime, Utc};
|
||||
use tracing::debug;
|
||||
use url::Url;
|
||||
|
||||
|
@ -133,10 +133,10 @@ where
|
|||
let activity_id = activity.id();
|
||||
let activity_serialized: Bytes = match published {
|
||||
Some(published) => serde_json::to_vec(&WithPublished::new(activity, published)),
|
||||
None => serde_json::to_vec(activity)
|
||||
None => serde_json::to_vec(activity),
|
||||
}
|
||||
.map_err(|e| Error::SerializeOutgoingActivity(e, format!("{:?}", activity)))?
|
||||
.into();
|
||||
.map_err(|e| Error::SerializeOutgoingActivity(e, format!("{:?}", activity)))?
|
||||
.into();
|
||||
let private_key = get_pkey_cached(data, actor).await?;
|
||||
|
||||
Ok(futures::stream::iter(
|
||||
|
@ -228,10 +228,7 @@ struct WithPublished<T> {
|
|||
|
||||
impl<T> WithPublished<T> {
|
||||
pub fn new(inner: T, published: DateTime<Utc>) -> WithPublished<T> {
|
||||
Self {
|
||||
published,
|
||||
inner,
|
||||
}
|
||||
Self { published, inner }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -39,6 +39,10 @@ where
|
|||
)?;
|
||||
|
||||
debug!("Receiving activity {}", activity.id().to_string());
|
||||
|
||||
// TODO: need to throw received activities in a queue ordered by published timestamp, then
|
||||
// process in order. tricky due to generics. probably need one queue per sending instance.
|
||||
|
||||
activity.verify(data).await?;
|
||||
activity.receive(data).await?;
|
||||
Ok(HttpResponse::Ok().finish())
|
||||
|
|
|
@ -343,7 +343,7 @@ pub mod tests {
|
|||
error::Error,
|
||||
fetch::object_id::ObjectId,
|
||||
http_signatures::{generate_actor_keypair, Keypair},
|
||||
protocol::{verification::verify_domains_match},
|
||||
protocol::verification::verify_domains_match,
|
||||
};
|
||||
use activitystreams_kinds::{activity::FollowType, actor::PersonType};
|
||||
use once_cell::sync::Lazy;
|
||||
|
|
Loading…
Reference in a new issue