mirror of
https://github.com/Moepchi/webspeak3.git
synced 2026-12-03 01:42:50 +08:00
Add Server Log tab notifications for client/channel/permission events
Surfaces join/leave/channel-switch/group-assignment/channel- and server-edit events inline in the Server tab, matching the native TS3 client's behavior. Own missing-permission errors are shown; other clients' permission failures are not. Sourced from tsclientlib's book-event diffs rather than admin-only ServerQuery logs, so it works for any connected user regardless of log-view permissions. Also upgrades the channel-switch command to report permission errors instead of failing silently, and adds a scripted demo-mode preview of the feature for the GitHub Pages demo. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
0d8e9336f8
commit
42f82d49aa
6 files changed
+272
-11
No files matched your search
@@ -121,11 +121,21 @@ export class DemoSocket {
|
||||
welcomeMessage: "This is a simulated demo - no real TeamSpeak server is involved. Connect with any name/address you like.",
|
||||
});
|
||||
this.after(150, () => this.sendChannels(nickname));
|
||||
this.scriptServerLog(nickname);
|
||||
});
|
||||
break;
|
||||
}
|
||||
case "switchChannel": {
|
||||
const fromChannel = this.channelName(this.selfChannel);
|
||||
this.selfChannel = msg.channelId;
|
||||
const toChannel = this.channelName(this.selfChannel);
|
||||
this.emit({
|
||||
type: "serverLog",
|
||||
kind: "clientChannelSwitch",
|
||||
client: this.lastNickname,
|
||||
fromChannel,
|
||||
toChannel,
|
||||
});
|
||||
this.after(120, () => this.sendChannels(this.lastNickname));
|
||||
break;
|
||||
}
|
||||
@@ -167,6 +177,35 @@ export class DemoSocket {
|
||||
|
||||
private lastNickname = "Guest";
|
||||
|
||||
private channelName(id: number): string {
|
||||
return DEMO_CHANNELS.find((c) => c.id === id)?.name ?? "";
|
||||
}
|
||||
|
||||
/** A short, scripted burst of Server-tab log lines so the feature is visible
|
||||
* in the demo without needing a second real user to trigger them. */
|
||||
private scriptServerLog(nickname: string) {
|
||||
this.after(2500, () =>
|
||||
this.emit({ type: "serverLog", kind: "clientJoin", client: "Sam", channel: this.channelName(2) })
|
||||
);
|
||||
this.after(5000, () =>
|
||||
this.emit({
|
||||
type: "serverLog",
|
||||
kind: "clientChannelSwitch",
|
||||
client: "Jordan",
|
||||
fromChannel: this.channelName(2),
|
||||
toChannel: this.channelName(1),
|
||||
})
|
||||
);
|
||||
this.after(7500, () =>
|
||||
this.emit({
|
||||
type: "serverLog",
|
||||
kind: "clientChannelGroupAssigned",
|
||||
client: nickname,
|
||||
group: "Guest",
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
private sendChannels(nickname: string) {
|
||||
this.lastNickname = nickname;
|
||||
const self: DemoClient = {
|
||||
|
||||
Reference in new issue
Block a user