feat: v2 rewrite — hexagonal arch, ActivityPub federation, NATS, deployment-ready #1

Merged
GKaszewski merged 334 commits from v2 into master 2026-05-16 09:42:43 +00:00
Showing only changes of commit 057fc29abc - Show all commits

View File

@@ -1278,6 +1278,8 @@ impl ActivityPubService {
#[async_trait::async_trait]
impl domain::ports::OutboundFederationPort for ActivityPubService {
// Actor identity (ap_id, followers_url) comes from federation config via get_local_actor.
// author_username is provided by the caller but not needed here.
async fn broadcast_create(
&self,
author_user_id: &domain::value_objects::UserId,
@@ -1328,6 +1330,8 @@ impl domain::ports::OutboundFederationPort for ActivityPubService {
.map_err(|e| domain::errors::DomainError::Internal(e.to_string()))
}
// Actor identity (ap_id, followers_url) comes from federation config via get_local_actor.
// author_username is provided by the caller but not needed here.
async fn broadcast_update(
&self,
author_user_id: &domain::value_objects::UserId,
@@ -1340,10 +1344,11 @@ impl domain::ports::OutboundFederationPort for ActivityPubService {
.await
.map_err(|e| domain::errors::DomainError::Internal(e.to_string()))?;
let ap_id = format!("{}/thoughts/{}", self.base_url, thought.id);
let ap_id = url::Url::parse(&format!("{}/thoughts/{}", self.base_url, thought.id))
.map_err(|e| domain::errors::DomainError::Internal(e.to_string()))?;
let mut note = serde_json::json!({
"type": "Note",
"id": ap_id,
"id": ap_id.to_string(),
"attributedTo": local_actor.ap_id.to_string(),
"content": thought.content.as_str(),
"published": thought.created_at.to_rfc3339(),
@@ -1357,6 +1362,9 @@ impl domain::ports::OutboundFederationPort for ActivityPubService {
if let Some(ref reply_url) = thought.in_reply_to_url {
note["inReplyTo"] = serde_json::json!(reply_url);
}
if let Some(updated_at) = thought.updated_at {
note["updated"] = serde_json::json!(updated_at.to_rfc3339());
}
self.broadcast_update_to_followers(user_uuid, note)
.await