Proper vc leaving

This commit is contained in:
2026-08-27 20:32:16 +02:00
parent ee71a99f5d
commit 6fb889840e
5 changed files with 107 additions and 28 deletions
+11
View File
@@ -219,6 +219,17 @@ export default class Enclave<P = Page> {
this.server?.getUsers([msg.pubkey]);
return;
case "UserLeftVoice":
if (!server.voiceChatUsers[msg.channel_id]) return;
server.voiceChatUsers[msg.channel_id] = server.voiceChatUsers[
msg.channel_id
].filter((v) => v !== msg.pubkey);
this.forceRender();
return;
case "Speaking":
clearTimeout(server.voiceChatSpeakers[msg.pubkey]);
+8
View File
@@ -40,6 +40,11 @@ export type ClientMethod =
channel_id: string;
pubkey: string;
}
| {
method: "UserLeftVoice";
channel_id: string;
pubkey: string;
}
| {
method: "Speaking";
pubkey: string;
@@ -89,4 +94,7 @@ export type ServerMethod =
| {
method: "JoinVoice";
channel_id: string;
}
| {
method: "LeaveVoice";
};
+1 -1
View File
@@ -33,7 +33,7 @@ export default class EnclaveServer {
public messages: Record<string, Record<string, StoredMessage>>;
public users: Record<string, ClientMeta | null>;
public voiceJoin?: (pin: number, channelId: string) => void;
public voiceJoin?: (pin: bigint, channelId: string) => void;
public voiceChatUsers: Record<string, string[]>;
public voiceChatSpeakers: Record<string, NodeJS.Timeout>;