refactor: Migrate from ActivityPub federation to native Swarm network

- Remove ActivityPub infrastructure (webfinger, nodeinfo, inbox, activities, signatures)
- Implement native peer-to-peer Swarm network with gossip protocol
- Replace federated timeline with Swarm timeline aggregating posts from all nodes
- Migrate direct messaging to end-to-end encrypted Swarm Chat system
- Update user interactions (follow, like, repost) to use Swarm protocol
- Add cryptographic key management for DID-based identity system
- Remove server-bound identity model in favor of portable DID identities
- Update documentation to reflect Swarm architecture and capabilities
- Add debug utilities and chat testing tools for Swarm network
- Refactor database schema to support distributed user directory
- Update bot framework to work with Swarm network interactions
- Simplify API routes to use Swarm protocol instead of ActivityPub
- This transition enables true peer-to-peer communication, instant interactions, and encrypted messaging while maintaining sovereign identity through DIDs
This commit is contained in:
Christomatt
2026-01-27 01:27:15 +01:00
parent 6b8eeb6814
commit eb63194c56
49 changed files with 1173 additions and 3559 deletions
+5 -3
View File
@@ -60,10 +60,11 @@ export async function GET(request: NextRequest) {
// Use query builder for better conditional logic
// Only return posts from local users (not remote placeholder users)
// Local posts may have apId if they've been federated, so we check nodeId instead
let whereCondition = and(
isNull(posts.replyToId), // Not a reply
eq(posts.isRemoved, false), // Not removed
isNull(posts.apId) // Not a federated/swarm post (local posts only)
isNull(users.nodeId) // Local user (not from another swarm node)
);
if (cursor) {
@@ -77,7 +78,6 @@ export async function GET(request: NextRequest) {
}
// Get recent public posts (not replies, local users only, not removed)
// Filter out remote placeholder users by checking handle doesn't contain @
const recentPosts = await db
.select({
id: posts.id,
@@ -100,10 +100,12 @@ export async function GET(request: NextRequest) {
})
.from(posts)
.innerJoin(users, eq(posts.userId, users.id))
.where(and(whereCondition, sql`${users.handle} NOT LIKE '%@%'`))
.where(whereCondition)
.orderBy(desc(posts.createdAt))
.limit(limit);
console.log(`[Swarm Timeline API] Found ${recentPosts.length} posts for ${nodeDomain}`);
// Fetch media for each post
const swarmPosts: SwarmPost[] = [];