From af994da294d84e5e3a913e277ec2972d7c3ed2f5 Mon Sep 17 00:00:00 2001 From: alemi Date: Fri, 24 May 2024 00:26:22 +0200 Subject: [PATCH] fix: duplicate context to conversation properly --- Cargo.toml | 2 +- src/model/object.rs | 1 + src/routes/activitypub/jsonld.rs | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index bb68814..efaabfa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -40,7 +40,7 @@ sea-orm = { version = "0.12", features = ["macros", "sqlx-sqlite", "runtime-toki reqwest = { version = "0.12", features = ["json"] } axum = "0.7" tower-http = { version = "0.5", features = ["cors", "trace"] } -apb = { path = "apb", features = ["unstructured", "orm", "activitypub-fe", "activitypub-counters", "litepub"] } +apb = { path = "apb", features = ["unstructured", "orm", "activitypub-fe", "activitypub-counters", "litepub", "ostatus", "toot"] } # nodeinfo = "0.0.2" # the version on crates.io doesn't re-export necessary types to build the struct!!! nodeinfo = { git = "https://codeberg.org/thefederationinfo/nodeinfo-rs", rev = "e865094804" } # migrations diff --git a/src/model/object.rs b/src/model/object.rs index 61d2009..82387a8 100644 --- a/src/model/object.rs +++ b/src/model/object.rs @@ -69,6 +69,7 @@ impl Model { .set_summary(self.summary.as_deref()) .set_content(self.content.as_deref()) .set_context(apb::Node::maybe_link(self.context.clone())) + .set_conversation(apb::Node::maybe_link(self.context.clone())) // duplicate context for mastodon .set_in_reply_to(apb::Node::maybe_link(self.in_reply_to.clone())) .set_published(Some(self.published)) .set_updated(self.updated) diff --git a/src/routes/activitypub/jsonld.rs b/src/routes/activitypub/jsonld.rs index d9e2b54..023c261 100644 --- a/src/routes/activitypub/jsonld.rs +++ b/src/routes/activitypub/jsonld.rs @@ -33,6 +33,8 @@ impl LD for serde_json::Value { Some(_) => { ctx.insert("fe".to_string(), serde_json::Value::String("https://ns.alemi.dev/as/fe/#".into())); ctx.insert("likedByMe".to_string(), serde_json::Value::String("fe:likedByMe".into())); + ctx.insert("ostatus".to_string(), serde_json::Value::String("http://ostatus.org#".into())); + ctx.insert("conversation".to_string(), serde_json::Value::String("ostatus:conversation".into())); }, None => {}, }