From 2db06d8e894f98b4af537d311f0718ef6d9aa172 Mon Sep 17 00:00:00 2001 From: Astro Date: Mon, 30 Oct 2023 00:29:11 +0100 Subject: [PATCH] activitypub: make some fields optional --- src/activitypub.rs | 6 +++--- src/actor.rs | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/activitypub.rs b/src/activitypub.rs index 5002eec..1f1417d 100644 --- a/src/activitypub.rs +++ b/src/activitypub.rs @@ -11,7 +11,7 @@ pub struct Actor { pub name: Option, pub icon: Option, pub inbox: String, - pub outbox: String, + pub outbox: Option, #[serde(rename = "publicKey")] pub public_key: ActorPublicKey, #[serde(rename = "preferredUsername")] @@ -49,8 +49,8 @@ impl IntoResponse for Actor { #[derive(Debug, Clone, Serialize, Deserialize)] pub struct Media { #[serde(rename = "type")] - pub media_type: String, + pub media_type: Option, #[serde(rename = "mediaType")] - pub content_type: String, + pub content_type: Option, pub url: String, } diff --git a/src/actor.rs b/src/actor.rs index 843e4ee..ad8de30 100644 --- a/src/actor.rs +++ b/src/actor.rs @@ -51,12 +51,12 @@ impl Actor { instance.to_string(), }), icon: Some(activitypub::Media { - media_type: "Image".to_string(), - content_type: "image/jpeg".to_string(), + media_type: Some("Image".to_string()), + content_type: Some("image/jpeg".to_string()), url: "https://fedi.buzz/assets/favicon48.png".to_string(), }), inbox: self.uri(), - outbox: format!("{}/outbox", self.uri()), + outbox: Some(format!("{}/outbox", self.uri())), public_key: activitypub::ActorPublicKey { id: self.key_id(), owner: Some(self.uri()),