mirror of
https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak.git
synced 2026-12-02 19:42:51 +08:00
fix: restore member moves, avatars, and remembered identity
This commit is contained in:
1 parent
dc63f4b45b
commit
faff7a2237
3 files changed
+80
-10
No files matched your search
@@ -42,7 +42,10 @@ export interface TSClientAvatar {
|
||||
data: Buffer;
|
||||
}
|
||||
|
||||
const MAX_CLIENT_AVATAR_BYTES = 120 * 1024;
|
||||
// Keep enough room for avatars produced by the native client. The previous
|
||||
// 120 KiB limit rejected the 134 KiB PNG used by the Shanghai test account,
|
||||
// so every avatar silently fell back to its initial letter.
|
||||
const MAX_CLIENT_AVATAR_BYTES = 256 * 1024;
|
||||
|
||||
export type TSDirectorySnapshot = DirectorySnapshot;
|
||||
export type TSDirectoryClient = DirectoryClientInfo;
|
||||
|
||||
@@ -173,7 +173,9 @@ export class VoiceBridge {
|
||||
}
|
||||
|
||||
attach(server: Server): void {
|
||||
this.wss = new WebSocketServer({ server, path: "/ws/voice", maxPayload: 256 * 1024 });
|
||||
// Avatar data is delivered as a data URL in a memberAvatar message. Keep
|
||||
// the frame limit above the encoded avatar ceiling with room for JSON.
|
||||
this.wss = new WebSocketServer({ server, path: "/ws/voice", maxPayload: 512 * 1024 });
|
||||
this.startHeartbeat();
|
||||
|
||||
this.wss.on("connection", (ws: WebSocket, req: IncomingMessage) => {
|
||||
@@ -462,7 +464,16 @@ export class VoiceBridge {
|
||||
}
|
||||
} catch (error: unknown) {
|
||||
const operation = classifyOperationError(error, "OPERATION_FAILED", "操作失败");
|
||||
if (operation.code === "PERMISSION_DENIED" && entry.canMoveClients) {
|
||||
// TeamSpeak rejects a no-op move with ALREADY_IN_CHANNEL after it
|
||||
// has evaluated the caller's move power. That is still a positive
|
||||
// permission result for this capability probe; treating it as a
|
||||
// failed probe made server-admin clients look permanently disabled.
|
||||
if (operation.code === "ALREADY_IN_CHANNEL") {
|
||||
if (!entry.canMoveClients) {
|
||||
entry.canMoveClients = true;
|
||||
sendJson({ type: "capabilities", canMoveClients: true });
|
||||
}
|
||||
} else if (operation.code === "PERMISSION_DENIED" && entry.canMoveClients) {
|
||||
entry.canMoveClients = false;
|
||||
sendJson({ type: "capabilities", canMoveClients: false });
|
||||
}
|
||||
@@ -1234,6 +1245,10 @@ async function handleCommand(
|
||||
if (command.requestId) sendJson({ type: "commandCompleted", requestId: command.requestId });
|
||||
} catch (error: unknown) {
|
||||
const operation = classifyOperationError(error, "OPERATION_FAILED", "操作失败");
|
||||
if (command.type === "moveClient" && operation.code === "PERMISSION_DENIED" && entry.canMoveClients) {
|
||||
entry.canMoveClients = false;
|
||||
sendJson({ type: "capabilities", canMoveClients: false });
|
||||
}
|
||||
sendJson({ type: "error", requestId: command.requestId, error: { code: operation.code, message: operation.message, recoverable: false } });
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user