Add chat page, improve chat API, and remove ChatWidget

Introduces a new chat page with end-to-end encryption, conversation list, and message thread UI. Adds new API endpoints for unread message count and debugging chat keys/messages. Improves chat key validation and reciprocal conversation/message creation for local recipients. Removes the old ChatWidget component. Updates login and chat API logic for better Turnstile and key handling.
This commit is contained in:
Christopher
2026-01-27 01:05:40 -08:00
parent 9739539733
commit 44610157a1
14 changed files with 1168 additions and 573 deletions
+2 -2
View File
@@ -6,7 +6,7 @@ import { z } from 'zod';
const loginSchema = z.object({
email: z.string().email(),
password: z.string(),
turnstileToken: z.string().optional(),
turnstileToken: z.string().optional().nullable(),
});
export async function POST(request: Request) {
@@ -14,7 +14,7 @@ export async function POST(request: Request) {
const body = await request.json();
const data = loginSchema.parse(body);
// Verify Turnstile token if provided
// Verify Turnstile token only if it's provided (meaning Turnstile is enabled)
if (data.turnstileToken) {
const ip = request.headers.get('x-forwarded-for') || request.headers.get('x-real-ip') || undefined;
const isValid = await verifyTurnstileToken(data.turnstileToken, ip);