Add Bannliste and Beschwerdeliste management dialogs

Implements #91 (ban list) and #92 (complaint list), reusing the
StreamItem::MessageEvent handling infrastructure added for #94.

Connector:
- New raw commands: banlist, bandel, bandelall, complainlist,
  complaindel, complaindelall (no typed builders exist for these).
- New pending_ban_list/pending_complain_list flags + MessageEvent
  match arms parsing InMessage::BanList/ComplainList replies into
  BanListEntry/ComplainListEntry structs, emitted as banList/
  complainList events.
- Unlike serverlog/serverconninfo, the test server actually replies
  with an error return code for these (surfaced as a "permission
  error" Server-tab log line) rather than staying silent - the
  connector already handles that path via the existing pending
  message result matching.

Gateway: getBanList/deleteBan/deleteAllBans/getComplainList/
deleteComplaint/deleteAllComplaintsFor methods and message cases,
plus camelCase remapping for the two new event types.

Frontend: BanListDialog and ComplainListDialog components (table
view, per-row delete + delete-all for bans, optimistic local removal
on delete), wired into the Extras menu (previously disabled
placeholders), with the same 6s timeout-to-"unavailable" fallback
pattern used by the other async-reply dialogs. Demo mode gets fake
ban/complaint entries.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
MoepchiandClaude Sonnet 5 committed 2026-08-05 13:08:01 +02:00
1 parent 4318ce359f
commit bd0122812d
7 files changed
+678 -13

No files matched your search

+24
View File
@@ -150,6 +150,30 @@ wss.on("connection", (socket: WebSocket) => {
await connection?.getServerLog();
break;
}
case "getBanList": {
await connection?.getBanList();
break;
}
case "deleteBan": {
await connection?.deleteBan(msg.banId);
break;
}
case "deleteAllBans": {
await connection?.deleteAllBans();
break;
}
case "getComplainList": {
await connection?.getComplainList();
break;
}
case "deleteComplaint": {
await connection?.deleteComplaint(msg.targetClientDbId, msg.fromClientDbId);
break;
}
case "deleteAllComplaintsFor": {
await connection?.deleteAllComplaintsFor(msg.targetClientDbId);
break;
}
case "disconnect": {
await connection?.disconnect(msg.message ?? "");
break;
+104 -2
View File
@@ -35,6 +35,28 @@ export interface ClientInfo {
uid: string;
}
export interface BanListEntry {
banId: number;
ip: string;
name: string;
uid: string;
lastNickname: string;
created: string;
durationSecs: number;
invokerName: string;
reason: string;
enforcements: number;
}
export interface ComplainListEntry {
targetClientDbId: number;
targetName: string;
fromClientDbId: number;
fromName: string;
message: string;
timestamp: string;
}
export type ServerLogEntry =
| { kind: "clientJoin"; client: string; channel: string }
| { kind: "clientLeave"; client: string }
@@ -91,7 +113,9 @@ export type Ts3ConnectionEvent =
bandwidthSentLastSecond: number;
bandwidthReceivedLastSecond: number;
}
| { type: "serverProtocolLog"; lines: string[] };
| { type: "serverProtocolLog"; lines: string[] }
| { type: "banList"; entries: BanListEntry[] }
| { type: "complainList"; entries: ComplainListEntry[] };
export interface Ts3ConnectOptions {
host: string;
@@ -207,7 +231,33 @@ export class Ts3Connection {
bandwidth_sent_last_second: number;
bandwidth_received_last_second: number;
}
| { type: "serverProtocolLog"; lines: string[] };
| { type: "serverProtocolLog"; lines: string[] }
| {
type: "banList";
entries: {
ban_id: number;
ip: string;
name: string;
uid: string;
last_nickname: string;
created: string;
duration_secs: number;
invoker_name: string;
reason: string;
enforcements: number;
}[];
}
| {
type: "complainList";
entries: {
target_client_db_id: number;
target_name: string;
from_client_db_id: number;
from_name: string;
message: string;
timestamp: string;
}[];
};
if (event.type === "connected") {
this.emit({
@@ -281,6 +331,34 @@ export class Ts3Connection {
bandwidthSentLastSecond: event.bandwidth_sent_last_second,
bandwidthReceivedLastSecond: event.bandwidth_received_last_second,
});
} else if (event.type === "banList") {
this.emit({
type: "banList",
entries: event.entries.map((e) => ({
banId: e.ban_id,
ip: e.ip,
name: e.name,
uid: e.uid,
lastNickname: e.last_nickname,
created: e.created,
durationSecs: e.duration_secs,
invokerName: e.invoker_name,
reason: e.reason,
enforcements: e.enforcements,
})),
});
} else if (event.type === "complainList") {
this.emit({
type: "complainList",
entries: event.entries.map((e) => ({
targetClientDbId: e.target_client_db_id,
targetName: e.target_name,
fromClientDbId: e.from_client_db_id,
fromName: e.from_name,
message: e.message,
timestamp: e.timestamp,
})),
});
} else {
this.emit(event);
}
@@ -357,6 +435,30 @@ export class Ts3Connection {
this.child?.stdin.write(`serverlog\n`);
}
async getBanList(): Promise<void> {
this.child?.stdin.write(`banlist\n`);
}
async deleteBan(banId: number): Promise<void> {
this.child?.stdin.write(`bandel ${banId}\n`);
}
async deleteAllBans(): Promise<void> {
this.child?.stdin.write(`bandelall\n`);
}
async getComplainList(): Promise<void> {
this.child?.stdin.write(`complainlist\n`);
}
async deleteComplaint(targetClientDbId: number, fromClientDbId: number): Promise<void> {
this.child?.stdin.write(`complaindel ${targetClientDbId} ${fromClientDbId}\n`);
}
async deleteAllComplaintsFor(targetClientDbId: number): Promise<void> {
this.child?.stdin.write(`complaindelall ${targetClientDbId}\n`);
}
async sendChatMessage(message: string): Promise<void> {
const sanitized = message.replace(/[\r\n]+/g, " ").trim();
if (sanitized) this.child?.stdin.write(`chat ${sanitized}\n`);