mirror of
https://github.com/versia-pub/activitypub.git
synced 2025-12-06 14:48:19 +01:00
fix: AP user federation behavior
This commit is contained in:
parent
c2a79b128b
commit
483212c7fa
|
|
@ -217,13 +217,21 @@ pub struct FieldKV {
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
pub struct ContentEntry {
|
pub struct ContentEntry {
|
||||||
content: String,
|
content: String,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
description: Option<String>,
|
description: Option<String>,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
size: Option<u64>,
|
size: Option<u64>,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
hash: Option<ContentHash>,
|
hash: Option<ContentHash>,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
blurhash: Option<String>,
|
blurhash: Option<String>,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
fps: Option<u64>,
|
fps: Option<u64>,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
width: Option<u64>,
|
width: Option<u64>,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
height: Option<u64>,
|
height: Option<u64>,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
duration: Option<u64>,
|
duration: Option<u64>,
|
||||||
}
|
}
|
||||||
impl ContentEntry {
|
impl ContentEntry {
|
||||||
|
|
@ -251,6 +259,7 @@ pub struct User {
|
||||||
pub uri: Url,
|
pub uri: Url,
|
||||||
#[serde(with = "iso_lysand")]
|
#[serde(with = "iso_lysand")]
|
||||||
pub created_at: OffsetDateTime,
|
pub created_at: OffsetDateTime,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub display_name: Option<String>,
|
pub display_name: Option<String>,
|
||||||
pub inbox: Url,
|
pub inbox: Url,
|
||||||
pub outbox: Url,
|
pub outbox: Url,
|
||||||
|
|
@ -260,17 +269,23 @@ pub struct User {
|
||||||
pub likes: Url,
|
pub likes: Url,
|
||||||
pub dislikes: Url,
|
pub dislikes: Url,
|
||||||
pub username: String,
|
pub username: String,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub bio: Option<ContentFormat>,
|
pub bio: Option<ContentFormat>,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub avatar: Option<ContentFormat>,
|
pub avatar: Option<ContentFormat>,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub header: Option<ContentFormat>,
|
pub header: Option<ContentFormat>,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub fields: Option<Vec<FieldKV>>,
|
pub fields: Option<Vec<FieldKV>>,
|
||||||
pub indexable: bool,
|
pub indexable: bool,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub extensions: Option<ExtensionSpecs>,
|
pub extensions: Option<ExtensionSpecs>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
pub struct ExtensionSpecs {
|
pub struct ExtensionSpecs {
|
||||||
#[serde(rename = "org.lysand:custom_emojis")]
|
#[serde(rename = "org.lysand:custom_emojis")]
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub custom_emojis: Option<CustomEmojis>,
|
pub custom_emojis: Option<CustomEmojis>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -297,7 +312,9 @@ pub struct LinkPreview {
|
||||||
description: String,
|
description: String,
|
||||||
title: String,
|
title: String,
|
||||||
link: Url,
|
link: Url,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
image: Option<Url>,
|
image: Option<Url>,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
icon: Option<Url>,
|
icon: Option<Url>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -310,17 +327,29 @@ pub struct Note {
|
||||||
pub author: Url,
|
pub author: Url,
|
||||||
#[serde(with = "iso_lysand")]
|
#[serde(with = "iso_lysand")]
|
||||||
pub created_at: OffsetDateTime,
|
pub created_at: OffsetDateTime,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub category: Option<CategoryType>,
|
pub category: Option<CategoryType>,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub content: Option<ContentFormat>,
|
pub content: Option<ContentFormat>,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub device: Option<DeviceInfo>,
|
pub device: Option<DeviceInfo>,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub previews: Option<Vec<LinkPreview>>,
|
pub previews: Option<Vec<LinkPreview>>,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub group: Option<String>,
|
pub group: Option<String>,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub attachments: Option<Vec<ContentFormat>>,
|
pub attachments: Option<Vec<ContentFormat>>,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub replies_to: Option<Url>,
|
pub replies_to: Option<Url>,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub quotes: Option<Url>,
|
pub quotes: Option<Url>,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub mentions: Option<Vec<Url>>,
|
pub mentions: Option<Vec<Url>>,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub subject: Option<String>,
|
pub subject: Option<String>,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub is_sensitive: Option<bool>,
|
pub is_sensitive: Option<bool>,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub visibility: Option<VisibilityType>,
|
pub visibility: Option<VisibilityType>,
|
||||||
//TODO extensions
|
//TODO extensions
|
||||||
}
|
}
|
||||||
|
|
@ -329,7 +358,9 @@ pub struct Note {
|
||||||
pub struct Outbox {
|
pub struct Outbox {
|
||||||
pub first: Url,
|
pub first: Url,
|
||||||
pub last: Url,
|
pub last: Url,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub next: Option<Url>,
|
pub next: Option<Url>,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub prev: Option<Url>,
|
pub prev: Option<Url>,
|
||||||
pub items: Vec<Note>,
|
pub items: Vec<Note>,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -79,28 +79,45 @@ pub struct Person {
|
||||||
pub id: ObjectId<user::Model>,
|
pub id: ObjectId<user::Model>,
|
||||||
pub inbox: Url,
|
pub inbox: Url,
|
||||||
pub public_key: PublicKey,
|
pub public_key: PublicKey,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub indexable: Option<bool>,
|
pub indexable: Option<bool>,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub discoverable: Option<bool>,
|
pub discoverable: Option<bool>,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub manually_approves_followers: Option<bool>,
|
pub manually_approves_followers: Option<bool>,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub followers: Option<Url>,
|
pub followers: Option<Url>,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub following: Option<Url>,
|
pub following: Option<Url>,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub featured: Option<Url>,
|
pub featured: Option<Url>,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub endpoints: Option<EndpointType>,
|
pub endpoints: Option<EndpointType>,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub outbox: Option<Url>,
|
pub outbox: Option<Url>,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub featured_tags: Option<Url>,
|
pub featured_tags: Option<Url>,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub tag: Option<Vec<TagType>>,
|
pub tag: Option<Vec<TagType>>,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub icon: Option<IconType>,
|
pub icon: Option<IconType>,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub image: Option<IconType>,
|
pub image: Option<IconType>,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub attachment: Option<Vec<AttachmentType>>,
|
pub attachment: Option<Vec<AttachmentType>>,
|
||||||
}
|
}
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||||
pub struct TagType {
|
pub struct TagType {
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub id: Option<Url>,
|
pub id: Option<Url>,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub href: Option<Url>,
|
pub href: Option<Url>,
|
||||||
pub name: String,
|
pub name: String,
|
||||||
#[serde(rename = "type")]
|
#[serde(rename = "type")]
|
||||||
pub type_: String,
|
pub type_: String,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub updated: Option<DateTime<Utc>>,
|
pub updated: Option<DateTime<Utc>>,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub icon: Option<IconType>,
|
pub icon: Option<IconType>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,9 +39,12 @@ pub struct Note {
|
||||||
#[serde(deserialize_with = "deserialize_one_or_many")]
|
#[serde(deserialize_with = "deserialize_one_or_many")]
|
||||||
pub(crate) to: Vec<Url>,
|
pub(crate) to: Vec<Url>,
|
||||||
pub(crate) content: String,
|
pub(crate) content: String,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub(crate) in_reply_to: Option<ObjectId<post::Model>>,
|
pub(crate) in_reply_to: Option<ObjectId<post::Model>>,
|
||||||
pub(crate) tag: Vec<Mention>,
|
pub(crate) tag: Vec<Mention>,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub(crate) sensitive: Option<bool>,
|
pub(crate) sensitive: Option<bool>,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub(crate) cc: Option<Vec<Url>>,
|
pub(crate) cc: Option<Vec<Url>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue