Compare commits

...
Author SHA1 Message Date
Moepchi 20d1944dc9 Reconnect resilience: gateway heartbeat + session auto-reconnect
Two related bugs: a browser tab that lost network (or got backgrounded/
suspended on Android) could leave the connector alive on the TS3/TeaSpeak
server for minutes after the frontend showed disconnected, and multi-join
background tabs simply vanished on any drop instead of staying connected.

- gateway: WebSocket ping/pong heartbeat (20s) so a dead browser socket is
  detected and its connector torn down promptly instead of waiting on an
  OS-level TCP timeout.
- web: every session (active tab or parked multi-join background tab) now
  remembers its connect params and can reopen its own socket after an
  unexpected drop, with exponential backoff (1s-30s) so a persistently
  unreachable gateway isn't hammered. Wake Lock keeps the screen (and the
  tab's throttling) at bay while any session is live; a visibilitychange
  sweep reconnects every dropped session once the page is visible again.
  Mic stays off for background sessions throughout, same as before.
2026-09-07 16:01:05 +02:00
Möpchi fd5a4cd6e0 Merge pull request #6 from Moepchi/pr-5-review-fixes
Client move/DnD, ServerQuery toggle, TeaSpeak poke handling + review fixes
2026-09-06 12:03:53 +02:00
MoepchiandClaude Sonnet 5 701bd867fc fix: self-move channel password prompt, spacer targets, client-list memoization
- handleMoveClient: route self-drags through handleSwitchChannel so
  moving your own client still prompts for a channel password when
  required, while admin moves of other clients keep bypassing the
  target channel's password (matches native TS3/GTS behavior - only
  the mover needs permission, not the password).
- MoveClientDialog: disable channel spacers as move targets, they are
  display-only rows with no backing channel.
- connector moveclient handler: carry the already-decoded password
  through the fallback branch (client not found in local state)
  instead of hardcoding an empty password, so self-moves via that
  path still authenticate correctly.
- App.tsx: memoize treeClients/queryClientCount so they are not
  recomputed on every render (e.g. on unrelated "talkers" updates),
  and simplify the duplicated displayClientCount ternary.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-06 11:57:30 +02:00
Nico B.andCursor b6448e65e8 Add client move/DnD, ServerQuery favorite toggle, and TeaSpeak poke handling.
Lets users move clients via context menu or drag-and-drop (including spacers), show ServerQuery clients per favorite without reconnecting, and surface TeaSpeak/GTS notifyclientpoke reliably via connector fallback plus tsclientlib parse fallthrough.

EOF

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-06 02:09:52 +02:00
Moepchi bf85173a54 docs: clarify GreenTeaSpeak feature covers server connectivity, not just theme 2026-09-06 02:00:45 +02:00
12 changed files with 728 additions and 82 deletions

No files matched your search

+2 -2
View File
@@ -80,7 +80,7 @@ not need to be installed on the same machine, modified, or operated by you.
| 🌗 **Dark / light theme** | Clean, modern UI that adapts to your preference |
| 🔁 **Multi-join (server tabs)** | Several connections in parallel — one tab per server, like GreenTeaSpeak 2. Audio stays on the active tab |
| 🔁 **Seamless reconnect** | Switch or add connections mid-session without tearing down unrelated tabs |
| 🍵 **GreenTeaSpeak theme** | Optional GTS-styled UI chrome (dark panels, gold menu bar, connection-tab strip) alongside the default look |
| 🍵 **GreenTeaSpeak support** | Connects to real GreenTeaSpeak servers (not just TS3/TS6/TeaSpeak), plus an optional GTS-styled UI chrome (dark panels, gold menu bar, connection-tab strip) alongside the default look |
## 🧱 Tech Stack
@@ -104,7 +104,7 @@ gateway is required that speaks the real TS protocol on one side and
WebSocket to the browser on the other.
```
Browser (web/) <--WebSocket--> Gateway (gateway/) <--stdin/stdout JSON--> Rust connector (connector/) <--TS3/TS6/TeaSpeak protocol--> Server
Browser (web/) <--WebSocket--> Gateway (gateway/) <--stdin/stdout JSON--> Rust connector (connector/) <--TS3/TS6/TeaSpeak/GreenTeaSpeak protocol--> Server
```
- **`web/`** — Vite + React frontend. TS3-lookalike UI: channel tree, chat
+100 -13
View File
@@ -17,9 +17,9 @@ use tsclientlib::messages::c2s::{
OutChannelAddPermPart, OutChannelClientAddPermPart, OutChannelClientDelPermPart,
OutChannelClientPermListRequestPart, OutChannelDelPermPart, OutChannelGroupAddPermPart,
OutChannelGroupDelPermPart, OutChannelGroupPermListRequestPart, OutChannelPermListRequestPart,
OutClientAddPermPart, OutClientDelPermPart, OutClientPermListRequestPart, OutClientPokeRequestPart,
OutCreateDirectoryPart, OutDeleteFilePart, OutFileListRequestPart, OutRenameFilePart,
OutSendTextMessagePart, OutServerGroupAddPermPart, OutServerGroupDelPermPart,
OutClientAddPermPart, OutClientDelPermPart, OutClientMovePart, OutClientPermListRequestPart,
OutClientPokeRequestPart, OutCreateDirectoryPart, OutDeleteFilePart, OutFileListRequestPart,
OutRenameFilePart, OutSendTextMessagePart, OutServerGroupAddPermPart, OutServerGroupDelPermPart,
OutServerGroupPermListRequestPart,
};
use tsclientlib::prelude::*;
@@ -103,6 +103,9 @@ struct ClientInfo {
/// haven't been individually granted talk power. Always `true` in a
/// non-moderated channel.
has_talk_power: bool,
/// ServerQuery client (`ClientType::Query`). Always included in the
/// snapshot; the UI hides these unless the user enables them per favorite.
is_query: bool,
}
/// Payload for the "serveredit " stdin command - every field is optional so
@@ -573,13 +576,13 @@ fn snapshot(con: &data::Connection) -> Event {
has_password: ch.has_password.unwrap_or(false),
})
.collect::<Vec<_>>();
// Bookkeeping includes ServerQuery clients (`ClientType::Query`); hide them
// from the channel tree / client lists, and from the online-count fallback
// below too, so the number shown never counts a client the list doesn't.
// Bookkeeping includes ServerQuery clients (`ClientType::Query`). We always
// forward them (with `is_query`) so the UI can toggle visibility live from
// a favorite setting without reconnecting. Online counts below still exclude
// Query by default so the headline matches the default (hidden) tree.
let clients = con
.clients
.values()
.filter(|c| !matches!(c.client_type, ClientType::Query { .. }))
.map(|c| {
// A channel with no talk power requirement at all (the common
// case) is never moderated, so everyone can talk regardless of
@@ -605,19 +608,20 @@ fn snapshot(con: &data::Connection) -> Event {
channel_group: c.channel_group.0,
server_groups: c.server_groups.iter().map(|g| g.0).collect(),
has_talk_power,
is_query: matches!(c.client_type, ClientType::Query { .. }),
}
})
.collect::<Vec<_>>();
// Prefer server-reported counters (GTS/TS `virtualserver_*` via notifyserverupdated)
// but never under-report vs. the visible (non-Query) client set (stale
// optional_data after joins would otherwise freeze the InfoPanel left number).
// `virtualserver_clientsonline` usually includes ServerQuery; subtract the
// Query clients we filtered from the list so the headline matches the tree.
// but never under-report vs. the non-Query client set (stale optional_data
// after joins would otherwise freeze the InfoPanel left number).
// `virtualserver_clientsonline` usually includes ServerQuery; subtract them
// so the default (Query-hidden) headline matches the default tree.
let opt = con.server.optional_data.as_ref();
let visible_channels = channels.len() as u64;
let visible_clients_count = clients.len() as u16;
let query_count = (con.clients.len() as u16).saturating_sub(visible_clients_count);
let query_count = clients.iter().filter(|c| c.is_query).count() as u16;
let visible_clients_count = (clients.len() as u16).saturating_sub(query_count);
let server_clients_online = opt
.map(|d| {
let without_query = d.client_count.saturating_sub(query_count);
@@ -1094,6 +1098,72 @@ async fn run(args: Args) -> Result<()> {
}
Err(_) => emit(&Event::Error { message: format!("Invalid client id: {id}") }),
}
} else if let Some(rest) = l.strip_prefix("moveclient ") {
// Move another client (or self) into a channel: clientmove clid=… cid=…
// Optional trailing base64 password, same as `switch`.
let mut move_args = rest.trim().splitn(3, ' ');
let clid_arg = move_args.next().unwrap_or("");
let cid_arg = move_args.next().unwrap_or("");
let password_arg = move_args.next();
match (clid_arg.parse::<u16>(), cid_arg.parse::<u64>()) {
(Ok(clid), Ok(cid)) => {
let password = password_arg.and_then(|p| {
base64::engine::general_purpose::STANDARD
.decode(p)
.ok()
.and_then(|bytes| String::from_utf8(bytes).ok())
});
let part = match con.get_state() {
Ok(state) => match state.clients.get(&ClientId(clid)) {
Some(client) => {
let mut part = client.client_move(ChannelId(cid));
match &password {
Some(pwd) => {
part = part.set_password(pwd);
}
None => {
part.channel_password =
Some(std::borrow::Cow::Borrowed(""));
}
}
Some(part)
}
None => {
// Still try with raw ids if the client left our view.
// Carry through the already-decoded password instead of
// dropping it - this path is also used for self-moves
// via drag-and-drop, which still need the password to
// reach the server when the target channel requires one.
Some(OutClientMovePart {
client_id: ClientId(clid),
channel_id: ChannelId(cid),
channel_password: Some(match &password {
Some(pwd) => Cow::Owned(pwd.clone()),
None => Cow::Borrowed(""),
}),
})
}
},
Err(e) => {
emit(&Event::Error {
message: format!("Move client failed: {e}"),
});
None
}
};
if let Some(part) = part {
match part.send_with_result(&mut con) {
Ok(handle) => {
pending_messages.insert(handle, "Move client".into());
}
Err(e) => emit(&Event::Error { message: e.to_string() }),
}
}
}
_ => emit(&Event::Error {
message: format!("Malformed moveclient command: {rest}"),
}),
}
} else if l == "away" || l.starts_with("away ") {
let message = l.strip_prefix("away").unwrap_or("").trim();
let part = con.get_state()?.client_update().set_away(Some(message));
@@ -2292,6 +2362,23 @@ async fn run(args: Args) -> Result<()> {
}
}
Some(Ok(StreamItem::MessageEvent(msg))) => {
// Defense in depth: TeaSpeak/GTS may surface notifyclientpoke as an
// unhandled MessageEvent if bookkeeping did not mark it handled.
if let InMessage::ClientPoke(poke) = &msg {
for part in poke.iter() {
emit(&Event::Poke {
from: part.invoker_name.clone(),
message: part.message.clone().unwrap_or_default(),
});
}
} else if let InMessage::ClientPokeNormal(poke) = &msg {
for part in poke.iter() {
emit(&Event::Poke {
from: part.invoker_name.clone(),
message: part.message.clone().unwrap_or_default(),
});
}
}
if pending_server_log {
if let InMessage::ServerLog(log) = &msg {
let lines: Vec<String> = log.iter().map(|part| part.log.clone()).collect();
+45
View File
@@ -86,6 +86,36 @@ const server = createServer((req, res) => {
const wss = new WebSocketServer({ server, path: "/ws" });
// Heartbeat: a browser tab that loses its network mid-session (mobile
// handover, Wi-Fi drop, backgrounded/frozen tab) often never sends a proper
// WS close frame — the OS-level TCP timeout that would eventually notice can
// take minutes, during which the connector child process (and the TS3/TeaSpeak
// session it holds open) stays alive even though the frontend has already
// given up and shown "disconnected". Standard `ws` ping/pong liveness check
// closes those zombie sockets (and their connector) promptly instead.
const HEARTBEAT_INTERVAL_MS = 20_000;
interface HeartbeatState {
isAlive: boolean;
}
const heartbeats = new WeakMap<WebSocket, HeartbeatState>();
const heartbeatTimer = setInterval(() => {
for (const socket of wss.clients) {
const state = heartbeats.get(socket);
if (!state) continue;
if (!state.isAlive) {
socket.terminate();
continue;
}
state.isAlive = false;
socket.ping();
}
}, HEARTBEAT_INTERVAL_MS);
wss.on("close", () => clearInterval(heartbeatTimer));
server.listen(PORT, () => {
console.log(`WebSpeak3 gateway listening on http://localhost:${PORT} (WebSocket at /ws)`);
if (SERVE_STATIC) {
@@ -101,6 +131,12 @@ wss.on("connection", (socket: WebSocket) => {
// multiple /ws connections in parallel (one per server tab).
let connection: Ts3Connection | undefined;
heartbeats.set(socket, { isAlive: true });
socket.on("pong", () => {
const state = heartbeats.get(socket);
if (state) state.isAlive = true;
});
socket.on("message", async (raw) => {
const msg = JSON.parse(raw.toString());
@@ -138,6 +174,14 @@ wss.on("connection", (socket: WebSocket) => {
}
break;
}
case "moveClient": {
const clientId = Number(msg.clientId);
const channelId = Number(msg.channelId);
if (Number.isFinite(clientId) && Number.isFinite(channelId)) {
await connection?.moveClient(clientId, channelId, msg.channelPassword);
}
break;
}
case "sendChatMessage": {
await connection?.sendChatMessage(msg.message);
break;
@@ -330,6 +374,7 @@ wss.on("connection", (socket: WebSocket) => {
});
socket.on("close", () => {
heartbeats.delete(socket);
connection?.disconnect();
});
});
+12
View File
@@ -37,6 +37,8 @@ export interface ClientInfo {
channelGroup: number;
serverGroups: number[];
hasTalkPower: boolean;
/** ServerQuery client; UI may hide these unless enabled per favorite. */
isQuery: boolean;
}
export interface GroupEntry {
@@ -252,6 +254,7 @@ export class Ts3Connection {
channel_group: number;
server_groups: number[];
has_talk_power: boolean;
is_query?: boolean;
}
interface RawChannelInfo {
@@ -424,6 +427,7 @@ export class Ts3Connection {
channelGroup: c.channel_group,
serverGroups: c.server_groups,
hasTalkPower: c.has_talk_power,
isQuery: Boolean(c.is_query),
})),
ownClientId: event.own_client_id ?? 0,
serverMaxClients: event.server_max_clients ?? 0,
@@ -550,6 +554,14 @@ export class Ts3Connection {
this.child?.stdin.write(`switch ${id}${passwordArg}\n`);
}
async moveClient(clientId: number, channelId: number, channelPassword?: string): Promise<void> {
const clid = Number(clientId);
const cid = Number(channelId);
if (!Number.isFinite(clid) || !Number.isFinite(cid)) return;
const passwordArg = channelPassword ? ` ${Buffer.from(channelPassword, "utf8").toString("base64")}` : "";
this.child?.stdin.write(`moveclient ${clid} ${cid}${passwordArg}\n`);
}
async getClientConnectionInfo(clientId: number): Promise<void> {
this.child?.stdin.write(`clientconninfo ${clientId}\n`);
}
+12
View File
@@ -1787,6 +1787,13 @@
background: var(--row-hover);
}
.ts-channel-row.ts-drop-target,
.ts-channel-row.ts-spacer.ts-drop-target {
background: color-mix(in srgb, var(--accent) 22%, transparent);
outline: 1px dashed var(--accent);
outline-offset: -1px;
}
/* Channel spacers ([cspacer], [*spacer01], …) — GreenTeaSpeak / TS parity */
.ts-channel-row.ts-spacer {
position: relative;
@@ -1897,10 +1904,15 @@
}
.ts-client-row {
cursor: grab;
color: var(--client-text);
padding-left: 0;
}
.ts-client-row:active {
cursor: grabbing;
}
.ts-client-row.ts-self {
font-weight: 700;
color: var(--self-text);
+512 -66
View File
@@ -1,4 +1,4 @@
import { useEffect, useRef, useState } from "react";
import { useEffect, useMemo, useRef, useState } from "react";
import "./App.css";
/** Only dismiss on a genuine backdrop click, not a text-selection drag that
@@ -100,6 +100,21 @@ function loadServerType(): ServerType {
const raw = localStorage.getItem(LAST_SERVER_TYPE_KEY);
return raw === "teamspeak" || raw === "teaspeak" || raw === "auto" ? raw : "auto";
}
/** Everything needed to (re)open a gateway connection for one session, kept
* around per session id so a dropped socket — active tab or a parked
* background one — can be silently reconnected. */
type ConnectParams = {
host: string;
nickname: string;
serverPassword: string;
channelPassword: string;
defaultChannel: string;
privilegeKey: string;
serverType: ServerType;
identityId: string | null;
favoriteId: string | null;
};
/** Identity persisted across sessions so the server sees the same client UID
* each time, instead of a fresh one being generated per connection. */
const IDENTITY_KEY = "webspeak3:identity";
@@ -260,12 +275,33 @@ interface Favorite {
serverPassword: string;
defaultChannel: string;
defaultChannelPassword: string;
/** When true, ServerQuery clients appear in the channel tree. Default: false. */
showServerQueryClients: boolean;
}
function normalizeFavorite(raw: Partial<Favorite> & Pick<Favorite, "id">): Favorite {
return {
id: raw.id,
bookmarkName: typeof raw.bookmarkName === "string" ? raw.bookmarkName : "",
nickname: typeof raw.nickname === "string" ? raw.nickname : "",
host: typeof raw.host === "string" ? raw.host : "",
serverPassword: typeof raw.serverPassword === "string" ? raw.serverPassword : "",
defaultChannel: typeof raw.defaultChannel === "string" ? raw.defaultChannel : "",
defaultChannelPassword:
typeof raw.defaultChannelPassword === "string" ? raw.defaultChannelPassword : "",
showServerQueryClients: raw.showServerQueryClients === true,
};
}
function loadFavorites(): Favorite[] {
try {
const raw = localStorage.getItem(FAVORITES_KEY);
return raw ? (JSON.parse(raw) as Favorite[]) : [];
if (!raw) return [];
const parsed = JSON.parse(raw);
if (!Array.isArray(parsed)) return [];
return parsed
.filter((v): v is Partial<Favorite> & Pick<Favorite, "id"> => v && typeof v.id === "string")
.map(normalizeFavorite);
} catch {
return [];
}
@@ -448,6 +484,8 @@ interface ClientInfo {
channelGroup: number;
serverGroups: number[];
hasTalkPower: boolean;
/** ServerQuery client; filtered from the tree unless a favorite enables them. */
isQuery?: boolean;
}
interface GroupEntry {
@@ -666,6 +704,27 @@ function ServerIcon() {
const lastChannelClickBySession = new Map<string, { id: number; at: number }>();
let switchArmedUntil = 0;
const CLIENT_DRAG_MIME = "application/x-webspeak3-client";
type ClientDragPayload = { clientId: number; channelId: number };
function parseClientDragPayload(raw: string): ClientDragPayload | null {
try {
const data = JSON.parse(raw) as Partial<ClientDragPayload>;
if (
typeof data.clientId === "number" &&
Number.isFinite(data.clientId) &&
typeof data.channelId === "number" &&
Number.isFinite(data.channelId)
) {
return { clientId: data.clientId, channelId: data.channelId };
}
} catch {
/* ignore */
}
return null;
}
function ChannelTree({
channels,
clients,
@@ -680,6 +739,7 @@ function ChannelTree({
onSwitchChannel,
onOpenPrivateChat,
onPokeClient,
onMoveClient,
onClientContextMenu,
onChannelContextMenu,
}: {
@@ -698,11 +758,13 @@ function ChannelTree({
onSwitchChannel: (channelId: number) => void;
onOpenPrivateChat: (clientId: number, clientName: string) => void;
onPokeClient: (clientId: number, clientName: string) => void;
onMoveClient: (clientId: number, channelId: number) => void;
onClientContextMenu: (e: React.MouseEvent, clientId: number, clientName: string, isSelf: boolean) => void;
onChannelContextMenu: (e: React.MouseEvent, channelId: number, channelName: string) => void;
}) {
const t = useT();
const [collapsed, setCollapsed] = useState<Set<number>>(() => new Set());
const [dragOverChannelId, setDragOverChannelId] = useState<number | null>(null);
// Module-level click tracking (see lastChannelClick) — refs alone are not
// enough when Select re-renders remount nested ChannelTree instances.
const children = channels.filter((c) => c.parent === parent).sort((a, b) => a.order - b.order);
@@ -744,7 +806,7 @@ function ChannelTree({
<div
className={`ts-row ts-channel-row${spacerClass}${
selected?.type === "channel" && selected.id === channel.id ? " ts-row-selected" : ""
}`}
}${dragOverChannelId === channel.id ? " ts-drop-target" : ""}`}
onClick={() => {
onSelectItem({ type: "channel", id: channel.id });
// Manual double-click: native dblclick is often lost when the first
@@ -765,6 +827,24 @@ function ChannelTree({
onSwitchChannel(channel.id);
}}
onContextMenu={(e) => onChannelContextMenu(e, channel.id, channel.name)}
onDragOver={(e) => {
if (![...e.dataTransfer.types].includes(CLIENT_DRAG_MIME)) return;
e.preventDefault();
e.dataTransfer.dropEffect = "move";
if (dragOverChannelId !== channel.id) setDragOverChannelId(channel.id);
}}
onDragLeave={(e) => {
const related = e.relatedTarget as Node | null;
if (related && e.currentTarget.contains(related)) return;
setDragOverChannelId((prev) => (prev === channel.id ? null : prev));
}}
onDrop={(e) => {
e.preventDefault();
setDragOverChannelId(null);
const payload = parseClientDragPayload(e.dataTransfer.getData(CLIENT_DRAG_MIME));
if (!payload || payload.channelId === channel.id) return;
onMoveClient(payload.clientId, channel.id);
}}
title={t("tree.clickToJoin")}
>
{!spacer.isSpacer && (
@@ -816,6 +896,18 @@ function ChannelTree({
? " ts-talking"
: ""
}${selected?.type === "client" && selected.id === c.id ? " ts-row-selected" : ""}`}
draggable
onDragStart={(e) => {
const payload: ClientDragPayload = {
clientId: c.id,
channelId: c.channel,
};
const raw = JSON.stringify(payload);
e.dataTransfer.setData(CLIENT_DRAG_MIME, raw);
e.dataTransfer.setData("text/plain", raw);
e.dataTransfer.effectAllowed = "move";
}}
onDragEnd={() => setDragOverChannelId(null)}
onClick={() => onSelectItem({ type: "client", id: c.id })}
onDoubleClick={
c.id === ownClientId ? undefined : () => onOpenPrivateChat(c.id, c.name)
@@ -904,6 +996,7 @@ function ChannelTree({
onSwitchChannel={onSwitchChannel}
onOpenPrivateChat={onOpenPrivateChat}
onPokeClient={onPokeClient}
onMoveClient={onMoveClient}
onClientContextMenu={onClientContextMenu}
onChannelContextMenu={onChannelContextMenu}
/>
@@ -1470,6 +1563,7 @@ function FavoritesDialog({
id: crypto.randomUUID(),
bookmarkName: prefillNew.host || t("favorites.newFavoriteName"),
...prefillNew,
showServerQueryClients: prefillNew.showServerQueryClients === true,
}
: null
);
@@ -1496,6 +1590,7 @@ function FavoritesDialog({
serverPassword: "",
defaultChannel: "",
defaultChannelPassword: "",
showServerQueryClients: false,
};
setDraft((prev) => [...prev, nf]);
setSelectedId(nf.id);
@@ -1624,7 +1719,12 @@ function FavoritesDialog({
</select>
</label>
<label className="ts-dialog-checkbox">
<input type="checkbox" disabled defaultChecked title="Not supported yet" />
<input
type="checkbox"
disabled={!selected}
checked={selected?.showServerQueryClients ?? false}
onChange={(e) => updateSelected({ showServerQueryClients: e.target.checked })}
/>
{t("favorites.showServerQueryClients")}
</label>
<label className="ts-dialog-checkbox">
@@ -2269,6 +2369,80 @@ function GroupAssignDialog({
);
}
function MoveClientDialog({
clientName,
currentChannelId,
channels,
onSelect,
onClose,
}: {
clientName: string;
currentChannelId: number;
channels: ChannelInfo[];
onSelect: (channelId: number) => void;
onClose: () => void;
}) {
const t = useT();
const backdrop = useBackdropDismiss(onClose);
const movable = [...channels].sort((a, b) => a.order - b.order);
return (
<div className="ts-dialog-backdrop" {...backdrop}>
<div className="ts-dialog ts-group-assign-dialog" onClick={(e) => e.stopPropagation()}>
<div className="ts-dialog-titlebar">
<span>
{t("moveClient.title")} - {clientName}
</span>
<button onClick={onClose} title={t("dialog.close")}>
✕
</button>
</div>
<div className="ts-dialog-body">
{movable.length === 0 ? (
<div className="ts-connection-info-loading">{t("moveClient.empty")}</div>
) : (
<ul className="ts-group-assign-list">
{movable.map((ch) => {
const current = ch.id === currentChannelId;
const spacer = spacerDisplayName(ch.name, ch.parent === 0);
const label = spacer.isSpacer
? spacer.label.trim() || ch.name
: ch.name;
return (
<li key={ch.id}>
<button
className={`ts-menu-item${current ? " ts-group-assign-current" : ""}`}
disabled={current || spacer.isSpacer}
onClick={() => onSelect(ch.id)}
>
<span className="ts-menu-item-icon">
{current ? "✔️" : spacer.isSpacer ? "➖" : "📁"}
</span>
<span className="ts-menu-item-label">{label}</span>
{current && (
<span className="ts-group-assign-hint">{t("moveClient.current")}</span>
)}
{!current && spacer.isSpacer && (
<span className="ts-group-assign-hint">{t("moveClient.spacer")}</span>
)}
</button>
</li>
);
})}
</ul>
)}
</div>
<div className="ts-dialog-buttons">
<div />
<div className="ts-dialog-buttons-right">
<button onClick={onClose}>{t("dialog.close")}</button>
</div>
</div>
</div>
</div>
);
}
/** Builds the full channel-relative path TS3's ft* commands expect (e.g.
* "/foo/bar.txt") from a directory and a bare entry name. */
function ftJoinPath(dir: string, name: string): string {
@@ -4950,6 +5124,11 @@ function AppInner() {
clientId: number;
clientName: string;
} | null>(null);
const [moveClientTarget, setMoveClientTarget] = useState<{
clientId: number;
clientName: string;
channelId: number;
} | null>(null);
const [permissionOverviewOpen, setPermissionOverviewOpen] = useState(false);
const [permissionOverview, setPermissionOverview] = useState<PermissionOverviewEntry[] | null>(null);
const [permissionsEditorOpen, setPermissionsEditorOpen] = useState(false);
@@ -5084,6 +5263,8 @@ function AppInner() {
const [novaMenuOpen, setNovaMenuOpen] = useState(false);
const novaMenuRef = useRef<HTMLDivElement | null>(null);
const [favorites, setFavorites] = useState<Favorite[]>(() => loadFavorites());
/** Favorite that opened the active session tab; drives ServerQuery visibility. */
const [activeFavoriteId, setActiveFavoriteId] = useState<string | null>(null);
const [favoritesMenuOpen, setFavoritesMenuOpen] = useState(false);
const [favoritesDialogMode, setFavoritesDialogMode] = useState<
{ kind: "add"; prefill: Omit<Favorite, "id" | "bookmarkName"> } | { kind: "manage" } | null
@@ -5146,6 +5327,10 @@ function AppInner() {
const [activeSessionId, setActiveSessionId] = useState<string | null>(null);
const sessionsRef = useRef<Map<string, SessionRecord>>(new Map());
const activeSessionIdRef = useRef<string | null>(null);
/** Last-used connect params per session, kept around so a dropped session
* (active OR parked/background) can reconnect itself without the user
* re-entering host/password — see reconnectSession(). */
const sessionParamsRef = useRef<Map<string, ConnectParams>>(new Map());
const connectionsMenuRef = useRef<HTMLDivElement | null>(null);
const favoritesMenuRef = useRef<HTMLDivElement | null>(null);
const awayMenuRef = useRef<HTMLDivElement | null>(null);
@@ -5392,6 +5577,7 @@ function AppInner() {
hasConnected: hasConnectedRef.current,
previousClients: previousClientsRef.current,
micWasOn: micOn,
favoriteId: activeFavoriteId,
});
const applyParkedToUi = (parked: ParkedSessionState) => {
@@ -5417,6 +5603,7 @@ function AppInner() {
setServerChat(parked.serverChat);
setPmThreads(parked.pmThreads);
setPokes(parked.pokes);
setActiveFavoriteId(parked.favoriteId);
setActiveTab(parked.chatTab);
setTalkers(new Set(parked.talkers));
setWhisperChannelIds(new Set(parked.whisperChannelIds));
@@ -5468,6 +5655,7 @@ function AppInner() {
hasConnectedRef.current = false;
previousClientsRef.current = null;
cleanDisconnectRef.current = false;
setActiveFavoriteId(null);
};
// serverGroups/channelGroups/permissionCatalog/banList/fileBrowser* are
@@ -5560,6 +5748,7 @@ function AppInner() {
}
}
sessionsRef.current.delete(id);
sessionParamsRef.current.delete(id);
lastChannelClickBySession.delete(id);
setSessionTabs((prev) => prev.filter((t) => t.id !== id));
@@ -5589,52 +5778,23 @@ function AppInner() {
}
};
const handleConnect = (overrides?: {
host?: string;
nickname?: string;
serverPassword?: string;
channelPassword?: string;
defaultChannel?: string;
privilegeKey?: string;
serverType?: ServerType;
}) => {
const connectHost = overrides?.host ?? host;
const connectNickname = overrides?.nickname ?? nickname;
const connectServerPassword = overrides?.serverPassword ?? serverPassword;
const connectChannelPassword = overrides?.channelPassword ?? channelPassword;
const connectDefaultChannel = overrides?.defaultChannel ?? defaultChannel;
const connectPrivilegeKey = overrides?.privilegeKey ?? privilegeKey;
const connectServerType = overrides?.serverType ?? serverType;
// Multi-join: keep existing sessions; park the active tab and open a new one.
if (activeSessionIdRef.current && sessionsRef.current.has(activeSessionIdRef.current)) {
parkActiveSession();
}
clearActiveUi();
hasConnectedRef.current = false;
setConnecting(true);
setConnectError(null);
setConnectDialogOpen(false);
setHost(connectHost);
setNickname(connectNickname);
ensureAudioContext();
const sessionId = crypto.randomUUID();
const connectIdentityId = activeIdentityId;
// Wires onopen/onmessage/onerror/onclose for one session's socket. Shared
// by handleConnect (brand-new session) and reconnectSession (an existing
// session — active or parked in the background — getting a fresh socket
// after an unexpected drop), so a reconnect behaves identically to the
// original connect from the gateway/UI's point of view.
const wireSocket = (sessionId: string, socket: WebSocket | DemoSocket, params: ConnectParams) => {
const connectHost = params.host;
const connectNickname = params.nickname;
const connectServerPassword = params.serverPassword;
const connectChannelPassword = params.channelPassword;
const connectDefaultChannel = params.defaultChannel;
const connectPrivilegeKey = params.privilegeKey;
const connectServerType = params.serverType;
const connectIdentityId = params.identityId;
const connectFavoriteId = params.favoriteId;
const connectIdentityBlob = identities.find((i) => i.id === connectIdentityId)?.blob ?? undefined;
const socket = DEMO_MODE ? new DemoSocket() : new WebSocket(GATEWAY_URL);
sessionsRef.current.set(sessionId, { id: sessionId, socket, parked: null });
socketRef.current = socket;
activeSessionIdRef.current = sessionId;
setActiveSessionId(sessionId);
setSessionTabs((prev) => [
...prev,
{ id: sessionId, label: connectHost || "…", connected: false, connecting: true },
]);
socket.onopen = () => {
logClient("info", "Connection", `Connecting to ${connectHost}…`);
socket.send(
@@ -5660,14 +5820,16 @@ function AppInner() {
const rec = sessionsRef.current.get(sessionId);
if (!rec) return;
if (!rec.parked) {
rec.parked = emptyParkedState({ host: connectHost, nickname: connectNickname });
rec.parked = emptyParkedState({
host: connectHost,
nickname: connectNickname,
favoriteId: connectFavoriteId,
});
}
if (data.type === "disconnected") {
sessionsRef.current.delete(sessionId);
sessionParamsRef.current.delete(sessionId);
setSessionTabs((prev) => prev.filter((t) => t.id !== sessionId));
if (hasConnectedRef.current === false) {
/* noop — background */
}
void playSound("disconnect");
return;
}
@@ -5681,7 +5843,10 @@ function AppInner() {
connected: rec.parked.connected,
connecting: rec.parked.connecting,
});
if (data.type === "connected") void playSound("connect");
if (data.type === "connected") {
reconnectAttemptsRef.current.delete(sessionId);
void playSound("connect");
}
else if (data.type === "poke") void playSound("poke");
return;
}
@@ -5689,6 +5854,7 @@ function AppInner() {
switch (data.type) {
case "connected":
logClient("info", "Connection", `Connected to ${data.serverName}`);
reconnectAttemptsRef.current.delete(sessionId);
hasConnectedRef.current = true;
setConnecting(false);
setConnectError(null);
@@ -5731,8 +5897,13 @@ function AppInner() {
if (prevClients) {
const prevIds = new Set(prevClients.map((c) => c.id));
const newIds = new Set(newClients.map((c) => c.id));
const joined = newClients.some((c) => !prevIds.has(c.id) && c.name !== connectNickname);
const left = prevClients.some((c) => !newIds.has(c.id) && c.name !== connectNickname);
// ServerQuery churn is noisy; never play join/leave for those clients.
const joined = newClients.some(
(c) => !prevIds.has(c.id) && c.name !== connectNickname && !c.isQuery
);
const left = prevClients.some(
(c) => !newIds.has(c.id) && c.name !== connectNickname && !c.isQuery
);
if (joined) void playSound("clientJoin");
if (left) void playSound("clientLeave");
}
@@ -5997,23 +6168,217 @@ function AppInner() {
};
socket.onclose = () => {
if (sessionId !== activeSessionIdRef.current) {
if (sessionsRef.current.has(sessionId)) {
sessionsRef.current.delete(sessionId);
setSessionTabs((prev) => prev.filter((t) => t.id !== sessionId));
const rec = sessionsRef.current.get(sessionId);
// Missing already means a deliberate disconnect (the "disconnected"
// message handler above already removed it) — nothing to do.
if (!rec) return;
if (rec.parked?.hasConnected) {
// Unexpected drop of a background tab (network blip, or the OS
// suspended the backgrounded/screen-off page) — keep the tab
// instead of dropping it, same as a real TS3 client keeps other
// server connections open while you're looking at a different
// one. It comes back on its own (immediately if we're still in
// the foreground, otherwise the visibilitychange handler retries
// it once the page is visible again), mic still off throughout.
rec.parked = { ...rec.parked, connecting: false, connected: false };
updateTabMeta(sessionId, { connecting: false, connected: false });
if (document.visibilityState === "visible") scheduleReconnectRef.current(sessionId);
return;
}
sessionsRef.current.delete(sessionId);
sessionParamsRef.current.delete(sessionId);
setSessionTabs((prev) => prev.filter((t) => t.id !== sessionId));
return;
}
if (!hasConnectedRef.current && !cleanDisconnectRef.current) {
setConnecting(false);
setConnectError((prev) => prev ?? "Connection closed before the server responded");
cleanDisconnectRef.current = false;
if (sessionsRef.current.has(sessionId)) {
removeSession(sessionId, { skipSocketClose: true });
}
return;
}
const wasConnected = hasConnectedRef.current;
cleanDisconnectRef.current = false;
if (wasConnected && sessionsRef.current.has(sessionId)) {
// Same as above, for the active tab: an unexpected drop after a
// successful connect tries to come back rather than closing the tab.
// A deliberate disconnect goes through the "disconnected" message
// handler (or handleDisconnect()), both of which remove the session
// before this fires, so we only land here for a real hiccup.
setConnected(false);
updateTabMeta(sessionId, { connecting: false, connected: false });
if (document.visibilityState === "visible") scheduleReconnectRef.current(sessionId);
return;
}
if (sessionsRef.current.has(sessionId)) {
removeSession(sessionId, { skipSocketClose: true });
}
};
};
const handleConnect = (overrides?: {
host?: string;
nickname?: string;
serverPassword?: string;
channelPassword?: string;
defaultChannel?: string;
privilegeKey?: string;
serverType?: ServerType;
favoriteId?: string | null;
}) => {
const params: ConnectParams = {
host: overrides?.host ?? host,
nickname: overrides?.nickname ?? nickname,
serverPassword: overrides?.serverPassword ?? serverPassword,
channelPassword: overrides?.channelPassword ?? channelPassword,
defaultChannel: overrides?.defaultChannel ?? defaultChannel,
privilegeKey: overrides?.privilegeKey ?? privilegeKey,
serverType: overrides?.serverType ?? serverType,
identityId: activeIdentityId,
favoriteId: overrides?.favoriteId !== undefined ? overrides.favoriteId : null,
};
// Multi-join: keep existing sessions; park the active tab and open a new one.
if (activeSessionIdRef.current && sessionsRef.current.has(activeSessionIdRef.current)) {
parkActiveSession();
}
clearActiveUi();
setActiveFavoriteId(params.favoriteId);
hasConnectedRef.current = false;
setConnecting(true);
setConnectError(null);
setConnectDialogOpen(false);
setHost(params.host);
setNickname(params.nickname);
ensureAudioContext();
const sessionId = crypto.randomUUID();
sessionParamsRef.current.set(sessionId, params);
const socket = DEMO_MODE ? new DemoSocket() : new WebSocket(GATEWAY_URL);
sessionsRef.current.set(sessionId, { id: sessionId, socket, parked: null });
socketRef.current = socket;
activeSessionIdRef.current = sessionId;
setActiveSessionId(sessionId);
setSessionTabs((prev) => [
...prev,
{ id: sessionId, label: params.host || "…", connected: false, connecting: true },
]);
wireSocket(sessionId, socket, params);
};
// Opens a fresh socket for a session that already exists (active or
// parked) and re-runs the same connect handshake, reusing the params
// stored at connect time. Used to recover from an unexpected drop —
// network blip, or the page coming back from being backgrounded/suspended
// — without disturbing which tab is active or losing chat/scroll history.
const reconnectSession = (sessionId: string) => {
const params = sessionParamsRef.current.get(sessionId);
const rec = sessionsRef.current.get(sessionId);
if (!params || !rec) return;
// Already open or mid-(re)connect — nothing to do.
if (rec.socket && rec.socket.readyState !== WebSocket.CLOSED && rec.socket.readyState !== WebSocket.CLOSING) {
return;
}
logClient("info", "Connection", `Reconnecting to ${params.host}…`);
const socket = DEMO_MODE ? new DemoSocket() : new WebSocket(GATEWAY_URL);
rec.socket = socket;
if (sessionId === activeSessionIdRef.current) {
socketRef.current = socket;
hasConnectedRef.current = false;
setConnecting(true);
setConnectError(null);
} else if (rec.parked) {
rec.parked = { ...rec.parked, connecting: true, connected: false, connectError: null };
}
updateTabMeta(sessionId, { connecting: true, connected: false });
wireSocket(sessionId, socket, params);
};
const reconnectSessionRef = useRef(reconnectSession);
reconnectSessionRef.current = reconnectSession;
// Per-session backoff so a persistently unreachable gateway doesn't get
// hammered with back-to-back reconnect attempts (each one fails near-
// instantly, which without a delay would tight-loop). Reset to 0 once a
// session actually reaches "connected" again (see the two spots below).
const reconnectAttemptsRef = useRef<Map<string, number>>(new Map());
const reconnectTimersRef = useRef<Map<string, ReturnType<typeof setTimeout>>>(new Map());
const scheduleReconnect = (sessionId: string) => {
if (reconnectTimersRef.current.has(sessionId)) return; // already scheduled
const attempt = reconnectAttemptsRef.current.get(sessionId) ?? 0;
const delay = Math.min(1000 * 2 ** attempt, 30_000);
reconnectAttemptsRef.current.set(sessionId, attempt + 1);
const timer = setTimeout(() => {
reconnectTimersRef.current.delete(sessionId);
// A manual disconnect meanwhile drops the session's stored params, so
// reconnectSession() below is a no-op in that case — no explicit
// cancellation needed.
reconnectSessionRef.current(sessionId);
}, delay);
reconnectTimersRef.current.set(sessionId, timer);
};
const scheduleReconnectRef = useRef(scheduleReconnect);
scheduleReconnectRef.current = scheduleReconnect;
// Android/mobile browsers aggressively suspend backgrounded or screen-off
// tabs — timers stall and the OS/browser can silently drop a WebSocket
// without ever firing onerror/onclose while hidden. There's no event for
// that; the only reliable signal is coming back to a socket that isn't
// OPEN anymore. Wake Lock keeps the screen (and the tab's throttling) at
// bay while any session is live — active tab AND parked background ones,
// same as a real TS3 client keeping every joined server connected, mic
// only ever live for the foreground tab. The visibilitychange re-check
// below catches whatever still slips through (screen-off ignores Wake
// Lock on some devices, the lock request can be refused, full app
// backgrounding on Android isn't preventable from a web page at all) by
// reconnecting every dropped session with the params used last time.
useEffect(() => {
if (sessionTabs.length === 0) return;
let wakeLock: { release: () => Promise<void> } | null = null;
const releaseWakeLock = () => {
wakeLock?.release().catch(() => {});
wakeLock = null;
};
const requestWakeLock = () => {
const wl = (navigator as { wakeLock?: { request: (type: "screen") => Promise<any> } }).wakeLock;
if (!wl || document.visibilityState !== "visible") return;
wl.request("screen")
.then((lock) => {
wakeLock = lock;
lock.addEventListener("release", () => {
if (wakeLock === lock) wakeLock = null;
});
})
.catch(() => {
/* refused (battery saver, unsupported, …) — non-fatal */
});
};
const onVisibilityChange = () => {
if (document.visibilityState !== "visible") return;
requestWakeLock();
for (const id of sessionsRef.current.keys()) {
reconnectSessionRef.current(id);
}
};
document.addEventListener("visibilitychange", onVisibilityChange);
requestWakeLock();
return () => {
document.removeEventListener("visibilitychange", onVisibilityChange);
releaseWakeLock();
};
}, [sessionTabs.length]);
const handleDisconnect = () => {
const id = activeSessionIdRef.current;
if (id) {
@@ -6071,12 +6436,14 @@ function AppInner() {
serverPassword: f.serverPassword,
channelPassword: f.defaultChannelPassword,
defaultChannel: f.defaultChannel,
favoriteId: f.id,
});
};
const saveFavorites = (next: Favorite[]) => {
setFavorites(next);
localStorage.setItem(FAVORITES_KEY, JSON.stringify(next));
const normalized = next.map((f) => normalizeFavorite(f));
setFavorites(normalized);
localStorage.setItem(FAVORITES_KEY, JSON.stringify(normalized));
};
const openAddFavorite = () => {
@@ -6088,6 +6455,7 @@ function AppInner() {
serverPassword,
defaultChannel,
defaultChannelPassword: channelPassword,
showServerQueryClients: false,
},
});
setFavoritesMenuOpen(false);
@@ -6993,6 +7361,43 @@ function AppInner() {
socketRef.current?.send(JSON.stringify({ type: "getChannelGroupList" }));
};
const handleShowMoveClient = (clientId: number, clientName: string) => {
const target = clients.find((c) => c.id === clientId);
setMoveClientTarget({
clientId,
clientName,
channelId: target?.channel ?? 0,
});
};
const handleMoveClient = (clientId: number, channelId: number) => {
const client = clients.find((c) => c.id === clientId);
if (client && client.channel === channelId) return;
// Moving yourself (e.g. dragging your own row) is a plain channel join,
// not an admin action - route it through the normal switch flow so it
// only needs join permission and still prompts for a channel password
// when required. The `moveClient` command below is for moving OTHER
// clients, which - like the native client - bypasses the target
// channel's password for whoever holds the move permission.
if (clientId === ownClientId) {
handleSwitchChannel(channelId);
return;
}
socketRef.current?.send(
JSON.stringify({
type: "moveClient",
clientId,
channelId,
})
);
};
const handleMoveClientToChannel = (channelId: number) => {
if (!moveClientTarget) return;
handleMoveClient(moveClientTarget.clientId, channelId);
setMoveClientTarget(null);
};
const handleShowServerGroupAssign = (clientId: number, clientName: string) => {
setGroupAssignTarget({ kind: "server", clientId, clientName });
setServerGroups(null);
@@ -7267,6 +7672,26 @@ function AppInner() {
selfActive && !inputMuted && ownClient?.hasTalkPower
? new Set(talkers).add(ownClient.id)
: talkers;
const showServerQueryClients =
activeFavoriteId != null &&
favorites.some((f) => f.id === activeFavoriteId && f.showServerQueryClients);
// clients can be a large, frequently-unchanged list re-scanned on every
// render - including on every "talkers" voice-activity update, which has
// nothing to do with the client list itself - so memoize on the inputs
// that actually affect the result instead of re-filtering/re-reducing it
// every time.
const treeClients = useMemo(
() => (showServerQueryClients ? clients : clients.filter((c) => !c.isQuery)),
[clients, showServerQueryClients]
);
const queryClientCount = useMemo(
() => clients.reduce((n, c) => n + (c.isQuery ? 1 : 0), 0),
[clients]
);
const displayClientCount =
serverClientsOnline > 0
? serverClientsOnline + (showServerQueryClients ? queryClientCount : 0)
: treeClients.length;
const novaSplash = designTheme === "nova" && !connected;
return (
@@ -8163,6 +8588,16 @@ function AppInner() {
/>
)}
{moveClientTarget && (
<MoveClientDialog
clientName={moveClientTarget.clientName}
currentChannelId={moveClientTarget.channelId}
channels={channels}
onSelect={handleMoveClientToChannel}
onClose={() => setMoveClientTarget(null)}
/>
)}
{permissionOverviewOpen && (
<PermissionOverviewDialog
entries={permissionOverview}
@@ -8465,6 +8900,18 @@ function AppInner() {
<span className="ts-menu-item-icon">👉</span>
<span className="ts-menu-item-label">{t("clientContext.poke")}</span>
</button>
{!clientContextMenu.isSelf && (
<button
className="ts-menu-item"
onClick={() => {
handleShowMoveClient(clientContextMenu.clientId, clientContextMenu.clientName);
setClientContextMenu(null);
}}
>
<span className="ts-menu-item-icon">🚚</span>
<span className="ts-menu-item-label">{t("clientContext.moveTo")}</span>
</button>
)}
<button
className="ts-menu-item"
onClick={() => {
@@ -8726,7 +9173,7 @@ function AppInner() {
</div>
<ChannelTree
channels={channels}
clients={clients}
clients={treeClients}
parent={0}
ownClientId={ownClientId ?? ownClient?.id ?? null}
talkers={displayTalkers}
@@ -8738,6 +9185,7 @@ function AppInner() {
onSwitchChannel={handleSwitchChannel}
onOpenPrivateChat={handleOpenPrivateChat}
onPokeClient={handlePokeClient}
onMoveClient={handleMoveClient}
onClientContextMenu={handleClientContextMenu}
onChannelContextMenu={handleChannelContextMenu}
/>
@@ -8764,14 +9212,12 @@ function AppInner() {
serverVersion={serverVersion}
serverLicense={serverLicense}
serverLicenseId={serverLicenseId}
totalClientCount={
serverClientsOnline > 0 ? serverClientsOnline : clients.length
}
totalClientCount={displayClientCount}
totalChannelCount={
serverChannelsOnline > 0 ? serverChannelsOnline : channels.length
}
channels={channels}
clients={clients}
clients={treeClients}
serverGroups={serverGroups}
onShowServerConnectionInfo={handleShowServerConnectionInfo}
onEditServer={() => setServerEditOpen(true)}
@@ -8784,7 +9230,7 @@ function AppInner() {
<div className="ts-chat-panel">
{connected && designTheme === "pulse" && (
<SpeakingNowBar clients={clients} talkers={displayTalkers} ownClientId={ownClient?.id ?? null} />
<SpeakingNowBar clients={treeClients} talkers={displayTalkers} ownClientId={ownClient?.id ?? null} />
)}
<div className="ts-chat-messages">
{activeTab === "channel"
+5
View File
@@ -50,6 +50,8 @@ export type ClientInfo = {
channelGroup: number;
serverGroups: number[];
hasTalkPower: boolean;
/** ServerQuery client; hidden in the tree unless the favorite enables them. */
isQuery?: boolean;
};
export type WhisperLogEntry = {
@@ -92,6 +94,8 @@ export type ParkedSessionState = {
previousClients: ClientInfo[] | null;
/** Whether the mic was on for this tab when it was parked, so switching back restores it. */
micWasOn: boolean;
/** Favorite used to open this session (drives ServerQuery visibility). */
favoriteId: string | null;
};
export type SessionTabInfo = {
@@ -143,6 +147,7 @@ export function emptyParkedState(partial?: Partial<ParkedSessionState>): ParkedS
hasConnected: false,
previousClients: null,
micWasOn: false,
favoriteId: null,
...partial,
};
}
+14
View File
@@ -277,6 +277,20 @@ export class DemoSocket {
);
break;
}
case "moveClient": {
const clientId = Number(msg.clientId);
const channelId = Number(msg.channelId);
if (Number.isFinite(clientId) && Number.isFinite(channelId)) {
if (clientId === SELF_ID) {
this.selfChannel = channelId;
} else {
const npc = DEMO_NPCS.find((c) => c.id === clientId);
if (npc) npc.channel = channelId;
}
this.after(120, () => this.sendChannels(this.lastNickname));
}
break;
}
case "getClientConnectionInfo": {
this.after(400, () =>
this.emit({
+12
View File
@@ -521,6 +521,7 @@ const translations: Record<Lang, Record<string, string>> = {
"clientContext.privateChat": "Privater Chat",
"clientContext.poke": "Anstupsen",
"clientContext.moveTo": "Verschieben in…",
"clientContext.copyName": "Namen kopieren",
"clientContext.connectionInfo": "Verbindungsinformationen anzeigen",
"clientContext.addWhisperTarget": "Als Whisper-Ziel hinzufügen",
@@ -532,6 +533,11 @@ const translations: Record<Lang, Record<string, string>> = {
"clientContext.ban": "Bannen",
"clientContext.notSupported": "Im Web-Client noch nicht unterstützt",
"moveClient.title": "Verschieben",
"moveClient.empty": "Keine Channels verfügbar.",
"moveClient.current": "Aktueller Channel",
"moveClient.spacer": "Spacer",
"serverContext.connectionInfo": "Serververbindungsinformationen",
"serverContext.copyAddress": "Serveradresse kopieren",
"serverContext.addFavorite": "Zu Favoriten hinzufügen",
@@ -1081,6 +1087,7 @@ const translations: Record<Lang, Record<string, string>> = {
"clientContext.privateChat": "Private chat",
"clientContext.poke": "Poke",
"clientContext.moveTo": "Move to…",
"clientContext.copyName": "Copy name",
"clientContext.connectionInfo": "Show connection info",
"clientContext.addWhisperTarget": "Add as whisper target",
@@ -1092,6 +1099,11 @@ const translations: Record<Lang, Record<string, string>> = {
"clientContext.ban": "Ban",
"clientContext.notSupported": "Not yet supported in the web client",
"moveClient.title": "Move",
"moveClient.empty": "No channels available.",
"moveClient.current": "Current channel",
"moveClient.spacer": "Spacer",
"serverContext.connectionInfo": "Server Connection Info",
"serverContext.copyAddress": "Copy server address",
"serverContext.addFavorite": "Add to favorites",
+6
View File
@@ -486,6 +486,7 @@ export const zhCN: Record<string, string> = {
"clientContext.privateChat": "私聊",
"clientContext.poke": "戳一戳",
"clientContext.moveTo": "移动到…",
"clientContext.copyName": "复制名称",
"clientContext.connectionInfo": "查看连接信息",
"clientContext.addWhisperTarget": "添加为悄悄话目标",
@@ -497,6 +498,11 @@ export const zhCN: Record<string, string> = {
"clientContext.ban": "封禁",
"clientContext.notSupported": "网页客户端暂不支持此功能",
"moveClient.title": "移动",
"moveClient.empty": "没有可用频道。",
"moveClient.current": "当前频道",
"moveClient.spacer": "间隔频道",
"serverContext.connectionInfo": "服务器连接信息",
"serverContext.copyAddress": "复制服务器地址",
"serverContext.addFavorite": "添加到收藏夹",
+7
View File
@@ -652,6 +652,13 @@
padding-right: 0;
}
.ts-app.ts-design-greenteaspeak .ts-channel-row.ts-drop-target,
.ts-app.ts-design-greenteaspeak .ts-channel-row.ts-spacer.ts-drop-target {
background: color-mix(in srgb, var(--accent, #4caf50) 28%, transparent);
outline: 1px dashed var(--accent, #4caf50);
outline-offset: -1px;
}
.ts-app.ts-design-greenteaspeak .ts-channel-row.ts-spacer .ts-spacer-label {
left: 4px;
right: 4px;