mirror of
https://github.com/Moepchi/webspeak3.git
synced 2026-12-01 00:42:49 +08:00
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>
This commit is contained in:
1 parent
bf85173a54
commit
b6448e65e8
11 files changed
+428
-28
No files matched your search
@@ -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);
|
||||
|
||||
+258
-14
@@ -260,12 +260,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 +469,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 +689,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 +724,7 @@ function ChannelTree({
|
||||
onSwitchChannel,
|
||||
onOpenPrivateChat,
|
||||
onPokeClient,
|
||||
onMoveClient,
|
||||
onClientContextMenu,
|
||||
onChannelContextMenu,
|
||||
}: {
|
||||
@@ -698,11 +743,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 +791,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 +812,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 +881,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 +981,7 @@ function ChannelTree({
|
||||
onSwitchChannel={onSwitchChannel}
|
||||
onOpenPrivateChat={onOpenPrivateChat}
|
||||
onPokeClient={onPokeClient}
|
||||
onMoveClient={onMoveClient}
|
||||
onClientContextMenu={onClientContextMenu}
|
||||
onChannelContextMenu={onChannelContextMenu}
|
||||
/>
|
||||
@@ -1470,6 +1548,7 @@ function FavoritesDialog({
|
||||
id: crypto.randomUUID(),
|
||||
bookmarkName: prefillNew.host || t("favorites.newFavoriteName"),
|
||||
...prefillNew,
|
||||
showServerQueryClients: prefillNew.showServerQueryClients === true,
|
||||
}
|
||||
: null
|
||||
);
|
||||
@@ -1496,6 +1575,7 @@ function FavoritesDialog({
|
||||
serverPassword: "",
|
||||
defaultChannel: "",
|
||||
defaultChannelPassword: "",
|
||||
showServerQueryClients: false,
|
||||
};
|
||||
setDraft((prev) => [...prev, nf]);
|
||||
setSelectedId(nf.id);
|
||||
@@ -1624,7 +1704,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 +2354,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}
|
||||
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 +5109,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 +5248,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
|
||||
@@ -5392,6 +5558,7 @@ function AppInner() {
|
||||
hasConnected: hasConnectedRef.current,
|
||||
previousClients: previousClientsRef.current,
|
||||
micWasOn: micOn,
|
||||
favoriteId: activeFavoriteId,
|
||||
});
|
||||
|
||||
const applyParkedToUi = (parked: ParkedSessionState) => {
|
||||
@@ -5417,6 +5584,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 +5636,7 @@ function AppInner() {
|
||||
hasConnectedRef.current = false;
|
||||
previousClientsRef.current = null;
|
||||
cleanDisconnectRef.current = false;
|
||||
setActiveFavoriteId(null);
|
||||
};
|
||||
|
||||
// serverGroups/channelGroups/permissionCatalog/banList/fileBrowser* are
|
||||
@@ -5597,6 +5766,7 @@ function AppInner() {
|
||||
defaultChannel?: string;
|
||||
privilegeKey?: string;
|
||||
serverType?: ServerType;
|
||||
favoriteId?: string | null;
|
||||
}) => {
|
||||
const connectHost = overrides?.host ?? host;
|
||||
const connectNickname = overrides?.nickname ?? nickname;
|
||||
@@ -5605,6 +5775,7 @@ function AppInner() {
|
||||
const connectDefaultChannel = overrides?.defaultChannel ?? defaultChannel;
|
||||
const connectPrivilegeKey = overrides?.privilegeKey ?? privilegeKey;
|
||||
const connectServerType = overrides?.serverType ?? serverType;
|
||||
const connectFavoriteId = 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)) {
|
||||
@@ -5612,6 +5783,7 @@ function AppInner() {
|
||||
}
|
||||
|
||||
clearActiveUi();
|
||||
setActiveFavoriteId(connectFavoriteId);
|
||||
hasConnectedRef.current = false;
|
||||
setConnecting(true);
|
||||
setConnectError(null);
|
||||
@@ -5660,7 +5832,11 @@ 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);
|
||||
@@ -5731,8 +5907,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");
|
||||
}
|
||||
@@ -6071,12 +6252,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 +6271,7 @@ function AppInner() {
|
||||
serverPassword,
|
||||
defaultChannel,
|
||||
defaultChannelPassword: channelPassword,
|
||||
showServerQueryClients: false,
|
||||
},
|
||||
});
|
||||
setFavoritesMenuOpen(false);
|
||||
@@ -6993,6 +7177,33 @@ 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;
|
||||
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 +7478,18 @@ 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);
|
||||
const treeClients = showServerQueryClients ? clients : clients.filter((c) => !c.isQuery);
|
||||
const queryClientCount = clients.reduce((n, c) => n + (c.isQuery ? 1 : 0), 0);
|
||||
const displayClientCount = showServerQueryClients
|
||||
? serverClientsOnline > 0
|
||||
? serverClientsOnline + queryClientCount
|
||||
: treeClients.length
|
||||
: serverClientsOnline > 0
|
||||
? serverClientsOnline
|
||||
: treeClients.length;
|
||||
const novaSplash = designTheme === "nova" && !connected;
|
||||
|
||||
return (
|
||||
@@ -8163,6 +8386,16 @@ function AppInner() {
|
||||
/>
|
||||
)}
|
||||
|
||||
{moveClientTarget && (
|
||||
<MoveClientDialog
|
||||
clientName={moveClientTarget.clientName}
|
||||
currentChannelId={moveClientTarget.channelId}
|
||||
channels={channels}
|
||||
onSelect={handleMoveClientToChannel}
|
||||
onClose={() => setMoveClientTarget(null)}
|
||||
/>
|
||||
)}
|
||||
|
||||
{permissionOverviewOpen && (
|
||||
<PermissionOverviewDialog
|
||||
entries={permissionOverview}
|
||||
@@ -8465,6 +8698,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 +8971,7 @@ function AppInner() {
|
||||
</div>
|
||||
<ChannelTree
|
||||
channels={channels}
|
||||
clients={clients}
|
||||
clients={treeClients}
|
||||
parent={0}
|
||||
ownClientId={ownClientId ?? ownClient?.id ?? null}
|
||||
talkers={displayTalkers}
|
||||
@@ -8738,6 +8983,7 @@ function AppInner() {
|
||||
onSwitchChannel={handleSwitchChannel}
|
||||
onOpenPrivateChat={handleOpenPrivateChat}
|
||||
onPokeClient={handlePokeClient}
|
||||
onMoveClient={handleMoveClient}
|
||||
onClientContextMenu={handleClientContextMenu}
|
||||
onChannelContextMenu={handleChannelContextMenu}
|
||||
/>
|
||||
@@ -8764,14 +9010,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 +9028,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"
|
||||
|
||||
@@ -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,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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({
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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": "添加到收藏夹",
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user