From c7f033599875cfdc2ca313ec0104c8c8dcd1e795 Mon Sep 17 00:00:00 2001 From: Astro Date: Mon, 7 Aug 2023 19:58:11 +0200 Subject: [PATCH] add a stub outbox Fixes Github issue #7 --- src/activitypub.rs | 1 + src/actor.rs | 1 + src/main.rs | 12 ++++++++++++ 3 files changed, 14 insertions(+) diff --git a/src/activitypub.rs b/src/activitypub.rs index 8534fd1..5002eec 100644 --- a/src/activitypub.rs +++ b/src/activitypub.rs @@ -11,6 +11,7 @@ pub struct Actor { pub name: Option, pub icon: Option, pub inbox: String, + pub outbox: String, #[serde(rename = "publicKey")] pub public_key: ActorPublicKey, #[serde(rename = "preferredUsername")] diff --git a/src/actor.rs b/src/actor.rs index 9a759f2..edbe21c 100644 --- a/src/actor.rs +++ b/src/actor.rs @@ -56,6 +56,7 @@ impl Actor { url: "https://fedi.buzz/assets/favicon48.png".to_string(), }), inbox: self.uri(), + outbox: format!("https://{}/outbox", self.host), public_key: activitypub::ActorPublicKey { id: self.key_id(), owner: Some(self.uri()), diff --git a/src/main.rs b/src/main.rs index b0f590a..b133a37 100644 --- a/src/main.rs +++ b/src/main.rs @@ -248,6 +248,17 @@ async fn post_relay( } } +/// An empty ActivityStreams outbox just to satisfy the spec +async fn outbox() -> Response { + Json(json!({ + "@context": "https://www.w3.org/ns/activitystreams", + "summary": "buzzrelay stub outbox", + "type": "OrderedCollection", + "totalItems": 0, + "orderedItems": [] + })).into_response() +} + async fn nodeinfo(axum::extract::State(state): axum::extract::State) -> Response { let follows_count = state.database.get_follows_count() .await @@ -339,6 +350,7 @@ async fn main() { let app = Router::new() .route("/tag/:tag", get(get_tag_actor).post(post_tag_relay)) .route("/instance/:instance", get(get_instance_actor).post(post_instance_relay)) + .route("/outbox", get(outbox)) .route("/.well-known/webfinger", get(webfinger)) .route("/.well-known/nodeinfo", get(nodeinfo)) .route("/metrics", get(|| async move {