Remove XsdAnyUri
This commit is contained in:
+3
-3
@@ -2,15 +2,15 @@ use activitystreams_ext::{Ext1, UnparsedExtension};
|
||||
use activitystreams_new::{
|
||||
activity::ActorAndObject,
|
||||
actor::{Actor, ApActor},
|
||||
primitives::XsdAnyUri,
|
||||
unparsed::UnparsedMutExt,
|
||||
url::Url,
|
||||
};
|
||||
|
||||
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct PublicKeyInner {
|
||||
pub id: XsdAnyUri,
|
||||
pub owner: XsdAnyUri,
|
||||
pub id: Url,
|
||||
pub owner: Url,
|
||||
pub public_key_pem: String,
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -1,5 +1,5 @@
|
||||
use crate::{apub::AcceptedActors, db::Db, error::MyError, requests::Requests};
|
||||
use activitystreams_new::{prelude::*, primitives::XsdAnyUri, uri, url::Url};
|
||||
use activitystreams_new::{prelude::*, uri, url::Url};
|
||||
use log::error;
|
||||
use std::{collections::HashSet, sync::Arc, time::Duration};
|
||||
use tokio::sync::RwLock;
|
||||
@@ -317,8 +317,8 @@ fn get_inbox(actor: &AcceptedActors) -> Result<&Url, MyError> {
|
||||
|
||||
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
|
||||
pub struct Actor {
|
||||
pub id: XsdAnyUri,
|
||||
pub id: Url,
|
||||
pub public_key: String,
|
||||
pub public_key_id: XsdAnyUri,
|
||||
pub inbox: XsdAnyUri,
|
||||
pub public_key_id: Url,
|
||||
pub inbox: Url,
|
||||
}
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
use crate::{db::Db, error::MyError};
|
||||
use activitystreams_new::{primitives::XsdAnyUri, uri, url::Url};
|
||||
use activitystreams_new::{uri, url::Url};
|
||||
use log::{debug, error};
|
||||
use std::{
|
||||
collections::{HashMap, HashSet},
|
||||
@@ -417,8 +417,8 @@ pub struct Instance {
|
||||
pub struct Contact {
|
||||
pub username: String,
|
||||
pub display_name: String,
|
||||
pub url: XsdAnyUri,
|
||||
pub avatar: XsdAnyUri,
|
||||
pub url: Url,
|
||||
pub avatar: Url,
|
||||
pub updated: SystemTime,
|
||||
}
|
||||
|
||||
|
||||
@@ -7,22 +7,19 @@ use crate::{
|
||||
DeliverMany, JobState,
|
||||
},
|
||||
};
|
||||
use activitystreams_new::{activity::Announce as AsAnnounce, primitives::XsdAnyUri, url::Url};
|
||||
use activitystreams_new::{activity::Announce as AsAnnounce, url::Url};
|
||||
use background_jobs::ActixJob;
|
||||
use std::{future::Future, pin::Pin};
|
||||
|
||||
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
|
||||
pub struct Announce {
|
||||
object_id: XsdAnyUri,
|
||||
object_id: Url,
|
||||
actor: Actor,
|
||||
}
|
||||
|
||||
impl Announce {
|
||||
pub fn new(object_id: Url, actor: Actor) -> Self {
|
||||
Announce {
|
||||
object_id: object_id.into(),
|
||||
actor,
|
||||
}
|
||||
Announce { object_id, actor }
|
||||
}
|
||||
|
||||
async fn perform(self, state: JobState) -> Result<(), anyhow::Error> {
|
||||
@@ -34,10 +31,7 @@ impl Announce {
|
||||
.job_server
|
||||
.queue(DeliverMany::new(inboxes, announce)?)?;
|
||||
|
||||
state
|
||||
.state
|
||||
.cache(self.object_id.into_inner(), activity_id)
|
||||
.await;
|
||||
state.state.cache(self.object_id, activity_id).await;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,10 +31,7 @@ impl Follow {
|
||||
|
||||
async fn perform(self, state: JobState) -> Result<(), anyhow::Error> {
|
||||
if !self.is_listener {
|
||||
state
|
||||
.db
|
||||
.add_listener(self.actor.inbox.clone().into_inner())
|
||||
.await?;
|
||||
state.db.add_listener(self.actor.inbox.clone()).await?;
|
||||
}
|
||||
let my_id = state.config.generate_url(UrlKind::Actor);
|
||||
|
||||
|
||||
@@ -12,10 +12,7 @@ pub struct Reject(pub Actor);
|
||||
impl Reject {
|
||||
async fn perform(self, state: JobState) -> Result<(), anyhow::Error> {
|
||||
if state.actors.unfollower(&self.0).await?.is_some() {
|
||||
state
|
||||
.db
|
||||
.remove_listener(self.0.inbox.clone().into_inner())
|
||||
.await?;
|
||||
state.db.remove_listener(self.0.inbox.clone()).await?;
|
||||
}
|
||||
|
||||
let my_id = state.config.generate_url(UrlKind::Actor);
|
||||
|
||||
@@ -22,10 +22,7 @@ impl Undo {
|
||||
let was_following = state.actors.is_following(&self.actor.id).await;
|
||||
|
||||
if state.actors.unfollower(&self.actor).await?.is_some() {
|
||||
state
|
||||
.db
|
||||
.remove_listener(self.actor.inbox.clone().into_inner())
|
||||
.await?;
|
||||
state.db.remove_listener(self.actor.inbox.clone()).await?;
|
||||
}
|
||||
|
||||
if was_following {
|
||||
|
||||
+4
-7
@@ -1,17 +1,17 @@
|
||||
use crate::{error::MyError, jobs::JobState};
|
||||
use activitystreams_new::primitives::XsdAnyUri;
|
||||
use activitystreams_new::url::Url;
|
||||
use anyhow::Error;
|
||||
use background_jobs::{ActixJob, Backoff};
|
||||
use std::{future::Future, pin::Pin};
|
||||
|
||||
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
|
||||
pub struct Deliver {
|
||||
to: XsdAnyUri,
|
||||
to: Url,
|
||||
data: serde_json::Value,
|
||||
}
|
||||
|
||||
impl Deliver {
|
||||
pub fn new<T>(to: XsdAnyUri, data: T) -> Result<Self, MyError>
|
||||
pub fn new<T>(to: Url, data: T) -> Result<Self, MyError>
|
||||
where
|
||||
T: serde::ser::Serialize,
|
||||
{
|
||||
@@ -31,10 +31,7 @@ impl ActixJob for Deliver {
|
||||
|
||||
fn run(self, state: Self::State) -> Self::Future {
|
||||
Box::pin(async move {
|
||||
state
|
||||
.requests
|
||||
.deliver(self.to.into_inner(), &self.data)
|
||||
.await?;
|
||||
state.requests.deliver(self.to, &self.data).await?;
|
||||
|
||||
Ok(())
|
||||
})
|
||||
|
||||
@@ -2,14 +2,14 @@ use crate::{
|
||||
error::MyError,
|
||||
jobs::{Deliver, JobState},
|
||||
};
|
||||
use activitystreams_new::{primitives::XsdAnyUri, url::Url};
|
||||
use activitystreams_new::url::Url;
|
||||
use anyhow::Error;
|
||||
use background_jobs::ActixJob;
|
||||
use futures::future::{ready, Ready};
|
||||
|
||||
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
|
||||
pub struct DeliverMany {
|
||||
to: Vec<XsdAnyUri>,
|
||||
to: Vec<Url>,
|
||||
data: serde_json::Value,
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ impl DeliverMany {
|
||||
T: serde::ser::Serialize,
|
||||
{
|
||||
Ok(DeliverMany {
|
||||
to: to.into_iter().map(XsdAnyUri::from).collect(),
|
||||
to,
|
||||
data: serde_json::to_value(data)?,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ use crate::{
|
||||
config::UrlKind,
|
||||
jobs::{cache_media::CacheMedia, JobState},
|
||||
};
|
||||
use activitystreams_new::{primitives::XsdAnyUri, url::Url};
|
||||
use activitystreams_new::url::Url;
|
||||
use anyhow::Error;
|
||||
use background_jobs::ActixJob;
|
||||
use futures::join;
|
||||
@@ -10,7 +10,7 @@ use std::{future::Future, pin::Pin};
|
||||
|
||||
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
|
||||
pub struct QueryInstance {
|
||||
listener: XsdAnyUri,
|
||||
listener: Url,
|
||||
}
|
||||
|
||||
impl QueryInstance {
|
||||
@@ -64,8 +64,8 @@ impl QueryInstance {
|
||||
&self.listener,
|
||||
contact.username,
|
||||
contact.display_name,
|
||||
contact.url.into_inner(),
|
||||
contact.avatar.into_inner(),
|
||||
contact.url,
|
||||
contact.avatar,
|
||||
)
|
||||
.await?;
|
||||
}
|
||||
@@ -116,6 +116,6 @@ struct Instance {
|
||||
struct Contact {
|
||||
username: String,
|
||||
display_name: String,
|
||||
url: XsdAnyUri,
|
||||
avatar: XsdAnyUri,
|
||||
url: Url,
|
||||
avatar: Url,
|
||||
}
|
||||
|
||||
@@ -1,19 +1,17 @@
|
||||
use crate::jobs::JobState;
|
||||
use activitystreams_new::{primitives::XsdAnyUri, url::Url};
|
||||
use activitystreams_new::url::Url;
|
||||
use anyhow::Error;
|
||||
use background_jobs::ActixJob;
|
||||
use std::{future::Future, pin::Pin};
|
||||
|
||||
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
|
||||
pub struct QueryNodeinfo {
|
||||
listener: XsdAnyUri,
|
||||
listener: Url,
|
||||
}
|
||||
|
||||
impl QueryNodeinfo {
|
||||
pub fn new(listener: Url) -> Self {
|
||||
QueryNodeinfo {
|
||||
listener: listener.into(),
|
||||
}
|
||||
QueryNodeinfo { listener }
|
||||
}
|
||||
|
||||
async fn perform(self, state: JobState) -> Result<(), Error> {
|
||||
|
||||
Reference in New Issue
Block a user