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:
@@ -7,7 +7,7 @@
|
||||
|
||||
import { NextRequest, NextResponse } from 'next/server';
|
||||
import { db, chatConversations, chatMessages, users } from '@/db';
|
||||
import { eq, desc, and, lt } from 'drizzle-orm';
|
||||
import { eq, desc, and, lt, isNull } from 'drizzle-orm';
|
||||
import { getSession } from '@/lib/auth';
|
||||
import { decryptMessage } from '@/lib/swarm/chat-crypto';
|
||||
|
||||
@@ -53,10 +53,10 @@ export async function GET(request: NextRequest) {
|
||||
}
|
||||
|
||||
// Build query with cursor-based pagination
|
||||
let whereCondition = eq(chatMessages.conversationId, conversationId);
|
||||
if (cursor) {
|
||||
whereCondition = and(whereCondition, lt(chatMessages.createdAt, new Date(cursor)));
|
||||
}
|
||||
const baseCondition = eq(chatMessages.conversationId, conversationId);
|
||||
const whereCondition = cursor
|
||||
? and(baseCondition, lt(chatMessages.createdAt, new Date(cursor)))!
|
||||
: baseCondition;
|
||||
|
||||
// Get messages
|
||||
const messages = await db.query.chatMessages.findMany({
|
||||
@@ -124,7 +124,7 @@ export async function PATCH(request: NextRequest) {
|
||||
.where(
|
||||
and(
|
||||
eq(chatMessages.conversationId, conversationId),
|
||||
eq(chatMessages.readAt, null)
|
||||
isNull(chatMessages.readAt)
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user