Don't rename activitystreams' tokens to 07
This commit is contained in:
parent
bc96af7f5f
commit
40ce515e6c
@ -3,11 +3,11 @@ use crate::{
|
|||||||
schema::blogs, users::User, Connection, Error, PlumeRocket, Result, CONFIG, ITEMS_PER_PAGE,
|
schema::blogs, users::User, Connection, Error, PlumeRocket, Result, CONFIG, ITEMS_PER_PAGE,
|
||||||
};
|
};
|
||||||
use activitystreams::{
|
use activitystreams::{
|
||||||
actor::{ApActor, ApActorExt, AsApActor, Group as Group07},
|
actor::{ApActor, ApActorExt, AsApActor, Group},
|
||||||
base::AnyBase,
|
base::AnyBase,
|
||||||
collection::{OrderedCollection, OrderedCollectionPage},
|
collection::{OrderedCollection, OrderedCollectionPage},
|
||||||
iri_string::types::IriString,
|
iri_string::types::IriString,
|
||||||
object::{kind::ImageType, ApObject, Image as Image07, ObjectExt},
|
object::{kind::ImageType, ApObject, Image, ObjectExt},
|
||||||
prelude::*,
|
prelude::*,
|
||||||
};
|
};
|
||||||
use chrono::NaiveDateTime;
|
use chrono::NaiveDateTime;
|
||||||
@ -20,8 +20,8 @@ use openssl::{
|
|||||||
};
|
};
|
||||||
use plume_common::activity_pub::{
|
use plume_common::activity_pub::{
|
||||||
inbox::{AsActor, FromId},
|
inbox::{AsActor, FromId},
|
||||||
sign, ActivityStream, ApSignature07, CustomGroup as CustomGroup07, Id, IntoId, PublicKey07,
|
sign, ActivityStream, ApSignature07, CustomGroup, Id, IntoId, PublicKey07, Source,
|
||||||
Source, SourceProperty, ToAsString, ToAsUri,
|
SourceProperty, ToAsString, ToAsUri,
|
||||||
};
|
};
|
||||||
use webfinger::*;
|
use webfinger::*;
|
||||||
|
|
||||||
@ -160,8 +160,8 @@ impl Blog {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn to_activity07(&self, conn: &Connection) -> Result<CustomGroup07> {
|
pub fn to_activity07(&self, conn: &Connection) -> Result<CustomGroup> {
|
||||||
let mut blog = ApActor::new(self.inbox_url.parse()?, Group07::new());
|
let mut blog = ApActor::new(self.inbox_url.parse()?, Group::new());
|
||||||
blog.set_preferred_username(self.actor_id.clone());
|
blog.set_preferred_username(self.actor_id.clone());
|
||||||
blog.set_name(self.title.clone());
|
blog.set_name(self.title.clone());
|
||||||
blog.set_outbox(self.outbox_url.parse()?);
|
blog.set_outbox(self.outbox_url.parse()?);
|
||||||
@ -173,7 +173,7 @@ impl Blog {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut icon = Image07::new();
|
let mut icon = Image::new();
|
||||||
let _ = self.icon_id.map(|id| {
|
let _ = self.icon_id.map(|id| {
|
||||||
Media::get(conn, id).and_then(|m| {
|
Media::get(conn, id).and_then(|m| {
|
||||||
let _ = m
|
let _ = m
|
||||||
@ -190,7 +190,7 @@ impl Blog {
|
|||||||
});
|
});
|
||||||
blog.set_icon(icon.into_any_base()?);
|
blog.set_icon(icon.into_any_base()?);
|
||||||
|
|
||||||
let mut banner = Image07::new();
|
let mut banner = Image::new();
|
||||||
let _ = self.banner_id.map(|id| {
|
let _ = self.banner_id.map(|id| {
|
||||||
Media::get(conn, id).and_then(|m| {
|
Media::get(conn, id).and_then(|m| {
|
||||||
let _ = m
|
let _ = m
|
||||||
@ -218,7 +218,7 @@ impl Blog {
|
|||||||
public_key: pub_key,
|
public_key: pub_key,
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(CustomGroup07::new(blog, ap_signature, source))
|
Ok(CustomGroup::new(blog, ap_signature, source))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn outbox07(&self, conn: &Connection) -> Result<ActivityStream<OrderedCollection>> {
|
pub fn outbox07(&self, conn: &Connection) -> Result<ActivityStream<OrderedCollection>> {
|
||||||
@ -363,13 +363,13 @@ impl IntoId for Blog {
|
|||||||
|
|
||||||
impl FromId<DbConn> for Blog {
|
impl FromId<DbConn> for Blog {
|
||||||
type Error = Error;
|
type Error = Error;
|
||||||
type Object = CustomGroup07;
|
type Object = CustomGroup;
|
||||||
|
|
||||||
fn from_db07(conn: &DbConn, id: &str) -> Result<Self> {
|
fn from_db07(conn: &DbConn, id: &str) -> Result<Self> {
|
||||||
Self::find_by_ap_url(conn, id)
|
Self::find_by_ap_url(conn, id)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn from_activity07(conn: &DbConn, acct: CustomGroup07) -> Result<Self> {
|
fn from_activity07(conn: &DbConn, acct: CustomGroup) -> Result<Self> {
|
||||||
let (name, outbox_url, inbox_url) = {
|
let (name, outbox_url, inbox_url) = {
|
||||||
let actor = acct.ap_actor_ref();
|
let actor = acct.ap_actor_ref();
|
||||||
let name = actor
|
let name = actor
|
||||||
@ -412,7 +412,7 @@ impl FromId<DbConn> for Blog {
|
|||||||
.icon()
|
.icon()
|
||||||
.and_then(|icons| {
|
.and_then(|icons| {
|
||||||
icons.iter().next().and_then(|icon| {
|
icons.iter().next().and_then(|icon| {
|
||||||
let icon = icon.to_owned().extend::<Image07, ImageType>().ok()??;
|
let icon = icon.to_owned().extend::<Image, ImageType>().ok()??;
|
||||||
let owner = icon.attributed_to()?.to_as_uri()?;
|
let owner = icon.attributed_to()?.to_as_uri()?;
|
||||||
Media::save_remote(
|
Media::save_remote(
|
||||||
conn,
|
conn,
|
||||||
@ -429,7 +429,7 @@ impl FromId<DbConn> for Blog {
|
|||||||
.image()
|
.image()
|
||||||
.and_then(|banners| {
|
.and_then(|banners| {
|
||||||
banners.iter().next().and_then(|banner| {
|
banners.iter().next().and_then(|banner| {
|
||||||
let banner = banner.to_owned().extend::<Image07, ImageType>().ok()??;
|
let banner = banner.to_owned().extend::<Image, ImageType>().ok()??;
|
||||||
let owner = banner.attributed_to()?.to_as_uri()?;
|
let owner = banner.attributed_to()?.to_as_uri()?;
|
||||||
Media::save_remote(
|
Media::save_remote(
|
||||||
conn,
|
conn,
|
||||||
|
Loading…
Reference in New Issue
Block a user