mirror of
https://github.com/Moepchi/webspeak3.git
synced 2026-12-03 01:42:50 +08:00
Add "Virtuellen Server editieren" dialog
Wires up tsclientlib's typed Server::edit() builder (name, welcome message, password, host message/banner/button settings, nickname, phonetic name, codec encryption mode) through a new "serveredit" stdin command. Frontend dialog has Host and Verschiedenes tabs fully implemented, with Übertragung/Anti-Flood/Sicherheit/Protokoll shown as not-yet-implemented placeholders (their fields have no typed setter in tsclientlib's generated bindings, would need hand-built raw commands). Entry point is a new link in the server info panel, next to the connection-info one added earlier. Every field is optional in the payload - blank means "leave unchanged" - except the password field, which has an explicit "remove password" checkbox for the clear case. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
330ecccadb
commit
181b0fc43b
7 files changed
+493
-3
No files matched your search
@@ -142,6 +142,10 @@ wss.on("connection", (socket: WebSocket) => {
|
||||
await connection?.banClient(msg.clientId, msg.seconds ?? 0, msg.reason ?? "");
|
||||
break;
|
||||
}
|
||||
case "editServer": {
|
||||
await connection?.editServer(msg.payload ?? {});
|
||||
break;
|
||||
}
|
||||
case "disconnect": {
|
||||
await connection?.disconnect(msg.message ?? "");
|
||||
break;
|
||||
|
||||
@@ -327,6 +327,30 @@ export class Ts3Connection {
|
||||
this.child?.stdin.write(`banclient ${clientId} ${Math.max(0, Math.floor(seconds))} ${sanitized}\n`);
|
||||
}
|
||||
|
||||
/** Every field is optional - only send what actually changed. JSON.stringify
|
||||
* already escapes embedded newlines, so this is safe as a single stdin line
|
||||
* without extra sanitization. */
|
||||
async editServer(payload: {
|
||||
name?: string;
|
||||
welcomeMessage?: string;
|
||||
password?: string;
|
||||
maxClients?: number;
|
||||
hostmessage?: string;
|
||||
hostmessageMode?: string;
|
||||
hostbannerUrl?: string;
|
||||
hostbannerGfxUrl?: string;
|
||||
hostbannerGfxIntervalSecs?: number;
|
||||
hostbannerMode?: string;
|
||||
hostbuttonTooltip?: string;
|
||||
hostbuttonUrl?: string;
|
||||
hostbuttonGfxUrl?: string;
|
||||
nickname?: string;
|
||||
phoneticName?: string;
|
||||
codecEncryptionMode?: string;
|
||||
}): Promise<void> {
|
||||
this.child?.stdin.write(`serveredit ${JSON.stringify(payload)}\n`);
|
||||
}
|
||||
|
||||
async sendChatMessage(message: string): Promise<void> {
|
||||
const sanitized = message.replace(/[\r\n]+/g, " ").trim();
|
||||
if (sanitized) this.child?.stdin.write(`chat ${sanitized}\n`);
|
||||
|
||||
Reference in new issue
Block a user