mirror of
https://github.com/Moepchi/webspeak3.git
synced 2026-12-03 01:42:50 +08:00
Add Favoriten menu, Away/AFK status, and mic/output mute toggles
Implements the real TS3 client's Favoriten menu (add/manage/list, with a FavoritesDialog), the toolbar Away/AFK dropdown with saved presets and an AwayDialog, plus input/output mute toggle buttons on the toolbar. Reorders the toolbar to AFK -> Mic -> Speaker -> Theme and removes the standalone Connect button in favor of the Verbindungen menu.
This commit is contained in:
1 parent
53e2887e14
commit
3715a52de6
5 files changed
+824
-44
No files matched your search
@@ -51,6 +51,18 @@ wss.on("connection", (socket: WebSocket) => {
|
||||
await connection?.sendAudio(msg.pcm);
|
||||
break;
|
||||
}
|
||||
case "setAway": {
|
||||
await connection?.setAway(msg.away, msg.message ?? "");
|
||||
break;
|
||||
}
|
||||
case "setInputMuted": {
|
||||
await connection?.setInputMuted(msg.muted);
|
||||
break;
|
||||
}
|
||||
case "setOutputMuted": {
|
||||
await connection?.setOutputMuted(msg.muted);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
socket.send(
|
||||
JSON.stringify({ type: "error", message: `Unknown message type: ${msg.type}` })
|
||||
|
||||
@@ -29,6 +29,7 @@ export interface ClientInfo {
|
||||
outputMuted: boolean;
|
||||
inputHardwareEnabled: boolean;
|
||||
away: boolean;
|
||||
awayMessage: string;
|
||||
isChannelCommander: boolean;
|
||||
}
|
||||
|
||||
@@ -98,6 +99,7 @@ export class Ts3Connection {
|
||||
output_muted: boolean;
|
||||
input_hardware_enabled: boolean;
|
||||
away: boolean;
|
||||
away_message: string;
|
||||
is_channel_commander: boolean;
|
||||
}
|
||||
|
||||
@@ -163,6 +165,7 @@ export class Ts3Connection {
|
||||
outputMuted: c.output_muted,
|
||||
inputHardwareEnabled: c.input_hardware_enabled,
|
||||
away: c.away,
|
||||
awayMessage: c.away_message,
|
||||
isChannelCommander: c.is_channel_commander,
|
||||
})),
|
||||
});
|
||||
@@ -223,6 +226,23 @@ export class Ts3Connection {
|
||||
this.child?.stdin.write(`audio ${pcmBase64}\n`);
|
||||
}
|
||||
|
||||
async setAway(away: boolean, message: string): Promise<void> {
|
||||
if (away) {
|
||||
const sanitized = message.replace(/[\r\n]+/g, " ").trim();
|
||||
this.child?.stdin.write(`away ${sanitized}\n`);
|
||||
} else {
|
||||
this.child?.stdin.write("unaway\n");
|
||||
}
|
||||
}
|
||||
|
||||
async setInputMuted(muted: boolean): Promise<void> {
|
||||
this.child?.stdin.write(`muteinput ${muted ? "1" : "0"}\n`);
|
||||
}
|
||||
|
||||
async setOutputMuted(muted: boolean): Promise<void> {
|
||||
this.child?.stdin.write(`muteoutput ${muted ? "1" : "0"}\n`);
|
||||
}
|
||||
|
||||
async disconnect(): Promise<void> {
|
||||
if (this.child && !this.child.killed) {
|
||||
this.child.stdin.write("disconnect\n");
|
||||
|
||||
Reference in new issue
Block a user