fix: gate member moves by TeamSpeak permissions

This commit is contained in:
illusia committed 2026-09-18 17:36:45 +08:00
1 parent 883703dd0c
commit 010b8ef072
5 files changed
+311 -6

No files matched your search

+22
View File
@@ -277,6 +277,28 @@ export class TSClient extends EventEmitter {
this.preferredChannelId = channelId;
}
/** Move another visible TeamSpeak client; the server enforces both move powers. */
async moveClient(clientId: number, channelId: bigint, password?: string): Promise<void> {
if (!this.client || !this.connected) throw new Error("TeamSpeak session is not ready");
if (!Number.isInteger(clientId) || clientId <= 0 || clientId > 65535) throw new Error("Invalid TeamSpeak client id");
await tsClientMove(this.client, clientId, channelId, password);
}
/**
* Probe whether this identity may move a visible client into a channel.
*
* The browser client protocol does not expose ServerQuery's `permget`, so
* the only authoritative capability check available through this session is
* the same `clientmove` operation the UI will use. The bridge calls this
* with the client's current channel, making the probe a no-op when accepted;
* TeamSpeak still evaluates both move-power permissions.
*/
async probeMovePermission(clientId: number, channelId: bigint): Promise<void> {
if (!this.client || !this.connected) throw new Error("TeamSpeak session is not ready");
if (!Number.isInteger(clientId) || clientId <= 0 || clientId > 65535) throw new Error("Invalid TeamSpeak client id");
await tsClientMove(this.client, clientId, channelId);
}
getClientId(): number {
// The SDK learns the real client id during the welcome sequence, before
// TSClient.connect() resumes. Reading it from the SDK prevents the first