feat: lift DM gates for federated users

Remove requireLocalUser from DM routes, include DMs in federated
ready payload, replace blanket dm_* WS gate with call-only blocklist.
DM calls remain gated (separate scope).
This commit is contained in:
Jannis Braun
2026-04-07 19:48:07 +02:00
parent 9b8330fcdb
commit 662143bf08
3 changed files with 14 additions and 10 deletions
+2 -3
View File
@@ -1,7 +1,7 @@
import type { FastifyInstance } from 'fastify';
import { eq, and, or, desc, lt, inArray, isNull, sql } from 'drizzle-orm';
import { getDb, schema } from '../db/index.js';
import { authenticate, requireLocalUser } from '../utils/auth.js';
import { authenticate } from '../utils/auth.js';
import { generateSnowflake } from '../utils/snowflake.js';
import { isDmMember } from '../utils/permissions.js';
import { connectionManager } from '../ws/handler.js';
@@ -243,9 +243,8 @@ export function broadcastDmMessage(dmChannelId: string, message: DmMessageWithUs
}
export async function dmRoutes(app: FastifyInstance): Promise<void> {
// Centralized auth + federation gating for all DM routes
// Centralized auth for all DM routes
app.addHook('preHandler', authenticate);
app.addHook('preHandler', requireLocalUser);
// GET /api/dm - List user's DM channels
app.get('/api/dm', async (request, reply) => {