add a stub outbox

Fixes Github issue #7
This commit is contained in:
Astro 2023-08-07 19:58:11 +02:00
parent 83f6679209
commit c7f0335998
3 changed files with 14 additions and 0 deletions

View file

@ -11,6 +11,7 @@ pub struct Actor {
pub name: Option<String>,
pub icon: Option<Media>,
pub inbox: String,
pub outbox: String,
#[serde(rename = "publicKey")]
pub public_key: ActorPublicKey,
#[serde(rename = "preferredUsername")]

View file

@ -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()),

View file

@ -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<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 {