diff --git a/src/controllers/api/streaming.ts b/src/controllers/api/streaming.ts index fbe825b..310b529 100644 --- a/src/controllers/api/streaming.ts +++ b/src/controllers/api/streaming.ts @@ -50,6 +50,16 @@ const streamingController: AppController = async (c) => { return c.json({ error: 'Invalid access token' }, 401); } + const mutedUsersSet = new Set(); + if (pubkey) { + const [mutedUsers] = await Storages.admin.query([{ authors: [pubkey], kinds: [10000], limit: 1 }], { signal }); + if (mutedUsers) { + for (const pubkey of getTagSet(mutedUsers.tags, 'p')) { + mutedUsersSet.add(pubkey); + } + } + } + const { socket, response } = Deno.upgradeWebSocket(c.req.raw, { protocol: token }); function send(name: string, payload: object) { @@ -63,16 +73,6 @@ const streamingController: AppController = async (c) => { } } - const mutedUsersSet = new Set(); - if (pubkey) { - const [mutedUsers] = await Storages.admin.query([{ authors: [pubkey], kinds: [10000], limit: 1 }], { signal }); - if (mutedUsers) { - for (const pubkey of getTagSet(mutedUsers.tags, 'p')) { - mutedUsersSet.add(pubkey); - } - } - } - socket.onopen = async () => { if (!stream) return;