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 82f2a3aaa0 - Show all commits

View File

@@ -28,6 +28,24 @@ use crate::{
webfinger::webfinger_handler,
};
fn content_to_html(text: &str) -> String {
let escaped = text
.replace('&', "&")
.replace('<', "&lt;")
.replace('>', "&gt;")
.replace('"', "&quot;");
let paragraphs: Vec<&str> = escaped.split('\n').filter(|s| !s.is_empty()).collect();
if paragraphs.is_empty() {
format!("<p>{}</p>", escaped)
} else {
paragraphs
.iter()
.map(|p| format!("<p>{}</p>", p))
.collect::<Vec<_>>()
.join("")
}
}
fn thought_note_json(
thought: &domain::models::thought::Thought,
local_actor: &crate::actors::DbActor,
@@ -56,7 +74,7 @@ fn thought_note_json(
"id": ap_id.to_string(),
"url": ap_id.to_string(),
"attributedTo": local_actor.ap_id.to_string(),
"content": thought.content.as_str(),
"content": content_to_html(thought.content.as_str()),
"published": thought.created_at.to_rfc3339(),
"to": to,
"cc": cc,