Compare commits

..
Author SHA1 Message Date
MoepchiandClaude Sonnet 5 e917e8e906 Remove GitHub Pages demo workflow
Cloudflare Pages (demo.webspeak3.de) already covers this for free,
no need for a second free hosting fallback.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-12 21:39:49 +02:00
MoepchiandClaude Sonnet 5 5e2b2860ae Drop GitHub Pages fallback mention from README demo blurb
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-12 21:38:23 +02:00
MoepchiandClaude Sonnet 5 80e36539f3 Link webspeak3.de, client.webspeak3.de and demo.webspeak3.de in README
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-12 21:37:39 +02:00
MoepchiandClaude Sonnet 5 b70b4d1fc9 Fix: VITE_GATEWAY_URL override was missing the /ws path
The gateway's WebSocketServer only listens on /ws (gateway/src/index.ts),
but the VITE_GATEWAY_URL build-time override connected to the bare host
instead - causing 'Could not reach the gateway' on split-hosted deploys
(e.g. client.webspeak3.de -> gateway.webspeak3.de). Now /ws is always
appended, whether the URL comes from the same-origin fallback or the
override.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-11 02:17:53 +02:00
MoepchiandClaude Sonnet 5 fd24ae740e Add cloudflared tunnel service to docker-compose
Enables exposing the gateway via Cloudflare Tunnel without a public
DNS record pointing at the home server's real IP. Token is supplied
via CLOUDFLARE_TUNNEL_TOKEN in a gitignored .env file.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-11 01:22:48 +02:00
Moepchi c10572feda Support VITE_GATEWAY_URL to point the built frontend at a gateway on another host 2026-08-10 21:46:39 +02:00
Moepchi c305fc4e1e Remove redundant poke hover-button from client tree rows (already in context menu) 2026-08-10 21:31:13 +02:00
Moepchi ec3a693292 Fix icon right-alignment: remove duplicate margin-left:auto from poke button 2026-08-10 21:28:16 +02:00
Moepchi 6bc3dca567 Add colored-letter badges for TS3 built-in default group icons; only fetch real custom icon files 2026-08-10 21:23:54 +02:00
Moepchi 0a1163d4f9 Widen tree row to fill panel width; add ftdownload debug logging 2026-08-10 20:47:13 +02:00
Moepchi fee0169463 Right-align client row icons flush to the edge; add debug logging for group icon ids
Status icons and group badges previously sat right after the name with no
push-right, so they clustered close to it instead of at the row's right
edge like the poke button already does. Wrapped them in a flex span with
margin-left: auto to match.

Also added temporary eprintln logging of each channel/server group's
resolved icon_id, to check whether this server's groups actually have
custom icons assigned (native TS3 doesn't show a badge for groups without
one either) before assuming the icon feature itself is broken.
2026-08-10 20:09:10 +02:00
Moepchi b7ef6f78e7 Add server group icon badges and a 'no talk power' status icon
Group icons were entirely missing from the data model - GroupEntry only
carried id/name. Added icon_id (from ServerGroup/ChannelGroup's Icon field)
through connector -> gateway -> frontend, matching the same channel-0
icon_<id> file convention already used for server icons (#77), reusing
that dialog's fetch/cache/render plumbing (serverIconImages, iconDataUrl).

Client rows now render a small badge per server group with a non-zero
icon, positioned after the name/status icons (i.e. on the right), instead
of not existing at all. Also added a 🔒 status icon for clients who aren't
muted but still can't talk due to insufficient talk power in a moderated
channel (previously no icon indicated this state at all).
2026-08-10 19:11:03 +02:00
Moepchi 6e343c4d4c Fix talking indicator: also respect missing talk power in moderated channels
The previous fix only accounted for the local mute toggle. In a moderated
channel (one with a talk power requirement) a client without sufficient
talk power still has selfActive/VAD firing locally and no local concept of
whether they're actually allowed to transmit, so the indicator stayed on
regardless.

The connector now computes has_talk_power per client from the book state
(talk_power_granted || talk_power >= channel.needed_talk_power), mirroring
tsclientlib's own internal intern_can_send_audio moderated-channel check,
and threads it through gateway and frontend. The talking indicator (both
the own-client injection into displayTalkers and the general per-client
render in ChannelTree) now requires hasTalkPower too.
2026-08-10 18:47:37 +02:00
Moepchi 4847972c80 Fix: don't show local talking indicator while mic is muted
selfActive is driven by MicCapture's local VAD (raw input level), which has
no notion of the input-muted state - only the actual audio send (onFrame)
checked inputMutedRef. So muting the mic still lit up the green talking
indicator on your own row locally, even though nothing was being
transmitted.
2026-08-10 18:30:37 +02:00
11 changed files with 387 additions and 111 deletions

No files matched your search

-57
View File
@@ -1,57 +0,0 @@
name: Deploy demo to GitHub Pages
on:
push:
branches: [main]
paths:
- "web/**"
- ".github/workflows/deploy-demo.yml"
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: pages
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
cache-dependency-path: web/package-lock.json
- name: Install dependencies
working-directory: web
run: npm ci
- name: Build (demo mode)
working-directory: web
env:
VITE_DEMO_MODE: "true"
VITE_BASE_PATH: /webspeak3/
run: npm run build
- uses: actions/configure-pages@v5
- uses: actions/upload-pages-artifact@v3
with:
path: web/dist
deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- id: deployment
uses: actions/deploy-pages@v4
+2
View File
@@ -0,0 +1,2 @@
/cache
/project.local.yml
+170
View File
@@ -0,0 +1,170 @@
# the name by which the project can be referenced within Serena/when chatting with the LLM.
project_name: "ts-web-client"
# list of language servers to start when using the LSP backend; choose from:
# ada al angular ansible bash
# bsl clojure cpp cpp_ccls crystal
# csharp csharp_omnisharp cue dart deno
# elixir elm erlang fortran fsharp
# gdscript gleam go groovy haskell
# haxe hlsl html java json
# julia kotlin latex lean4 lua
# luau markdown matlab msl nextflow
# nix ocaml pascal perl php
# php_phpactor php_phpantom powershell python python_basedpyright
# python_jedi python_pyrefly python_ty qml r
# rego ruby ruby_solargraph rust scala
# scss solidity svelte swift systemverilog
# terraform toml typescript typescript_vts vue
# wolfram yaml zig
# (This list may be outdated; generated with scripts/print_language_list.py;
# For the current list, see values of the LanguageServerId enum here:
# https://github.com/oraios/serena/blob/main/src/solidlsp/ls_config.py)
# For some languages, there are several alternative language servers, e.g. csharp_omnisharp, ruby_solargraph.)
# Note:
# - For C, use cpp
# - For JavaScript, use typescript
# - For Angular projects, use angular (subsumes typescript+html; requires `npm install` in the project root)
# - For Svelte projects, use svelte (subsumes typescript/javascript for .svelte projects; requires npm)
# - For Deno projects, use deno (serves the same .ts/.js files as typescript; requires the deno CLI on PATH)
# - For SCSS / Sass / plain CSS, use scss (some-sass-language-server handles all three)
# - For Free Pascal/Lazarus, use pascal
# Special requirements:
# Some language servers require additional setup/installations.
# See here for details: https://oraios.github.io/serena/01-about/020_programming-languages.html#language-servers
# When using multiple language servers, the first language server that supports a given file will be used for that file.
# The first language server is the default language and the respective language server will be used as a fallback.
# Note that when using the JetBrains backend, language servers are not used and this list is correspondingly ignored.
language_servers:
- rust
- typescript
# the encoding used by text files in the project
# For a list of possible encodings, see https://docs.python.org/3.11/library/codecs.html#standard-encodings
encoding: "utf-8"
# optional shell command to run before the language backend (LSP or JetBrains) is initialised.
# the command runs in the project root directory and is only executed if the project is trusted
# (see trusted_project_path_patterns in the global configuration).
# serena waits for the command to exit: a non-zero exit code is logged as an error but does not
# abort activation. a per-project timeout (activation_command_timeout, default 180s) is the safety
# backstop for non-terminating commands; on expiry the process is killed and activation continues.
# example: activation_command: "npx nx run-many -t build"
activation_command:
# maximum time in seconds to wait for activation_command to complete before killing it (default 180s).
# must be a positive number.
activation_command_timeout: 180.0
# line ending convention to use when writing source files.
# Possible values: unset (use global setting), "lf", "crlf", or "native" (platform default)
# This does not affect Serena's own files (e.g. memories and configuration files), which always use native line endings.
line_ending:
# The language backend to use for this project.
# If not set, the global setting from serena_config.yml is used.
# Valid values: LSP, JetBrains
# Note: the backend is fixed at startup. If a project with a different backend
# is activated post-init, an error will be returned.
language_backend:
# whether to use project's .gitignore files to ignore files
ignore_all_files_in_gitignore: true
# advanced configuration option allowing to configure language server-specific options.
# Maps the language key to the options.
# The settings are considered only if the project is trusted (see global configuration to define trusted projects).
# See https://oraios.github.io/serena/02-usage/050_configuration.html#language-server-specific-settings
ls_specific_settings: {}
# list of workspace folder paths (LSP backend only).
# These folders will be used to build up Serena's symbol index.
# Paths must be within the project root and should thus be relative to the project root.
# Furthermore, the paths should not be filtered by ignore settings.
# Default setting: The entire project root folder (".") is considered.
# In (large) monorepos, this can be used to index only subfolders of the project root, e.g.
# ls_workspace_folders:
# - "./subproject1"
# - "./subproject2"
ls_workspace_folders:
- "."
# list of additional workspace folder paths for cross-package reference support.
# Paths can be absolute or relative to the project root.
# Each folder is registered as an LSP workspace folder, enabling language servers to discover
# symbols and references across package boundaries, but these folders are not indexed by Serena,
# i.e. the respective symbols will not be found using Serena's symbol search tools.
# Example:
# additional_workspace_folders:
# - ../sibling-package
# - ../shared-lib
ls_additional_workspace_folders: []
# list of additional paths to ignore in this project.
# Same syntax as gitignore, so you can use * and **.
# Important: quote patterns that start with `*`, otherwise YAML treats them as aliases.
# Example:
# ignored_paths:
# - "examples/**"
# - ".worktrees/**"
# - "**/bin/**"
# - "**/obj/**"
# Note: global ignored_paths from serena_config.yml are also applied additively.
ignored_paths: []
# whether the project is in read-only mode
# If set to true, all editing tools will be disabled and attempts to use them will result in an error
# Added on 2025-04-18
read_only: false
# list of tool names to exclude.
# This extends the existing exclusions (e.g. from the global configuration)
# Find the list of tools here: https://oraios.github.io/serena/01-about/035_tools.html
excluded_tools: []
# list of tools to include that would otherwise be disabled (particularly optional tools that are disabled by default).
# This extends the existing inclusions (e.g. from the global configuration).
# Find the list of tools here: https://oraios.github.io/serena/01-about/035_tools.html
included_optional_tools: []
# fixed set of tools to use as the base tool set (if non-empty), replacing Serena's default set of tools.
# This cannot be combined with non-empty excluded_tools or included_optional_tools.
# Find the list of tools here: https://oraios.github.io/serena/01-about/035_tools.html
fixed_tools: []
# list of mode names that are to be activated by default, overriding the setting in the global configuration.
# The full set of modes to be activated is base_modes (from global config) + default_modes + added_modes.
# If the setting is undefined/empty, the default_modes from the global configuration (serena_config.yml) apply.
# Otherwise, this overrides the setting from the global configuration (serena_config.yml).
# Therefore, you can set this to [] if you do not want the default modes defined in the global config to apply
# for this project.
# This setting can, in turn, be overridden by CLI parameters (--mode).
# See https://oraios.github.io/serena/02-usage/050_configuration.html#modes
default_modes:
# list of mode names to be activated additionally for this project, e.g. ["query-projects"]
# The full set of modes to be activated is base_modes (from global config) + default_modes + added_modes.
# See https://oraios.github.io/serena/02-usage/050_configuration.html#modes
added_modes:
# initial prompt for the project. It will always be given to the LLM upon activating the project
# (contrary to the memories, which are loaded on demand).
initial_prompt: ""
# time budget (seconds) per tool call for the retrieval of additional symbol information
# such as docstrings or parameter information.
# This overrides the corresponding setting in the global configuration; see the documentation there.
# If null or missing, use the setting from the global configuration.
symbol_info_budget:
# list of regex patterns which, when matched, mark a memory entry as read‑only.
# Extends the list from the global configuration, merging the two lists.
read_only_memory_patterns: []
# list of regex patterns for memories to completely ignore.
# Matching memories will not appear in list_memories or activate_project output
# and cannot be accessed via read_memory or write_memory.
# To access ignored memory files, use the read_file tool on the raw file path.
# Extends the list from the global configuration, merging the two lists.
# Example: ["_archive/.*", "_episodes/.*"]
ignored_memory_patterns: []
+4 -2
View File
@@ -17,13 +17,15 @@
</p>
<p align="center">
<a href="https://moepchi.github.io/webspeak3/">🕹️ Live Demo</a> ·
<a href="https://webspeak3.de">🌐 Website</a> ·
<a href="https://client.webspeak3.de">💬 Open Client</a> ·
<a href="https://demo.webspeak3.de">🕹️ Live Demo</a> ·
<a href="#-installation">🚀 Quick Start</a> ·
<a href="#-installation">📖 Installation</a> ·
<a href="https://github.com/Moepchi/webspeak3/issues">🐛 Report Bug</a>
</p>
> The [live demo](https://moepchi.github.io/webspeak3/) runs entirely in your browser with simulated data — no real TeamSpeak server involved. It's there to show the UI, not the real connection.
> The [live demo](https://demo.webspeak3.de) runs entirely in your browser with simulated data — no real TeamSpeak server involved. It's there to show the UI, not the real connection.
---
+37 -19
View File
@@ -88,6 +88,12 @@ struct ClientInfo {
database_id: u64,
channel_group: u64,
server_groups: Vec<u64>,
/// Whether this client is currently allowed to talk in their channel -
/// `false` in a moderated channel (one with a talk power requirement)
/// when the client's talk power is below that requirement and they
/// haven't been individually granted talk power. Always `true` in a
/// non-moderated channel.
has_talk_power: bool,
}
/// Payload for the "serveredit " stdin command - every field is optional so
@@ -362,6 +368,7 @@ struct PermissionCatalogEntry {
struct GroupEntry {
id: u64,
name: String,
icon_id: u32,
}
#[derive(Serialize, Clone)]
@@ -535,21 +542,32 @@ fn snapshot(con: &data::Connection) -> Event {
let clients = con
.clients
.values()
.map(|c| ClientInfo {
id: c.id.0,
channel: c.channel.0,
name: c.name.clone(),
input_muted: c.input_muted,
output_muted: c.output_muted,
input_hardware_enabled: c.input_hardware_enabled,
away: c.away_message.is_some(),
away_message: c.away_message.clone().unwrap_or_default(),
is_channel_commander: c.is_channel_commander,
country: c.country_code.clone(),
uid: c.uid.as_ref().map(|u| u.to_string()).unwrap_or_default(),
database_id: c.database_id.0,
channel_group: c.channel_group.0,
server_groups: c.server_groups.iter().map(|g| g.0).collect(),
.map(|c| {
// A channel with no talk power requirement at all (the common
// case) is never moderated, so everyone can talk regardless of
// their own talk power - matches tsclientlib's own
// intern_can_send_audio logic for the moderated-channel check.
let has_talk_power = match con.channels.get(&c.channel).and_then(|ch| ch.needed_talk_power) {
Some(needed) => c.talk_power_granted || c.talk_power >= needed,
None => true,
};
ClientInfo {
id: c.id.0,
channel: c.channel.0,
name: c.name.clone(),
input_muted: c.input_muted,
output_muted: c.output_muted,
input_hardware_enabled: c.input_hardware_enabled,
away: c.away_message.is_some(),
away_message: c.away_message.clone().unwrap_or_default(),
is_channel_commander: c.is_channel_commander,
country: c.country_code.clone(),
uid: c.uid.as_ref().map(|u| u.to_string()).unwrap_or_default(),
database_id: c.database_id.0,
channel_group: c.channel_group.0,
server_groups: c.server_groups.iter().map(|g| g.0).collect(),
has_talk_power,
}
})
.collect();
Event::Channels { channels, clients }
@@ -1953,7 +1971,7 @@ async fn run(args: Args) -> Result<()> {
let mut entries: Vec<GroupEntry> = state
.channel_groups
.values()
.map(|g| GroupEntry { id: g.id.0, name: g.name.clone() })
.map(|g| GroupEntry { id: g.id.0, name: g.name.clone(), icon_id: g.icon.0 })
.collect();
entries.sort_by_key(|g| g.id);
emit(&Event::ChannelGroupList { entries });
@@ -1963,7 +1981,7 @@ async fn run(args: Args) -> Result<()> {
let mut entries: Vec<GroupEntry> = state
.server_groups
.values()
.map(|g| GroupEntry { id: g.id.0, name: g.name.clone() })
.map(|g| GroupEntry { id: g.id.0, name: g.name.clone(), icon_id: g.icon.0 })
.collect();
entries.sort_by_key(|g| g.id);
emit(&Event::ServerGroupList { entries });
@@ -2093,7 +2111,7 @@ async fn run(args: Args) -> Result<()> {
if let InMessage::ChannelGroupList(list) = &msg {
let entries: Vec<GroupEntry> = list
.iter()
.map(|part| GroupEntry { id: part.channel_group.0, name: part.name.clone() })
.map(|part| GroupEntry { id: part.channel_group.0, name: part.name.clone(), icon_id: part.icon.0 })
.collect();
emit(&Event::ChannelGroupList { entries });
pending_channel_group_list = false;
@@ -2103,7 +2121,7 @@ async fn run(args: Args) -> Result<()> {
if let InMessage::ServerGroupList(list) = &msg {
let entries: Vec<GroupEntry> = list
.iter()
.map(|part| GroupEntry { id: part.server_group_id.0, name: part.name.clone() })
.map(|part| GroupEntry { id: part.server_group_id.0, name: part.name.clone(), icon_id: part.icon.0 })
.collect();
emit(&Event::ServerGroupList { entries });
pending_server_group_list = false;
+12
View File
@@ -16,3 +16,15 @@ services:
# webspeak3:
# ports:
# - "8080:8080"
cloudflared:
image: cloudflare/cloudflared:latest
container_name: webspeak3-cloudflared
restart: unless-stopped
command: tunnel --no-autoupdate run --token ${CLOUDFLARE_TUNNEL_TOKEN}
# Token comes from a gitignored .env file next to this compose file:
# CLOUDFLARE_TUNNEL_TOKEN=eyJ...
# No depends_on/network wiring needed - the tunnel's Public Hostname
# config (set in the Cloudflare dashboard) points at the webspeak3
# service by its Compose service name (http://webspeak3:8080), and
# Compose puts both services on the same default network automatically.
+6 -2
View File
@@ -36,11 +36,13 @@ export interface ClientInfo {
databaseId: number;
channelGroup: number;
serverGroups: number[];
hasTalkPower: boolean;
}
export interface GroupEntry {
id: number;
name: string;
iconId: number;
}
export interface PermissionOverviewEntry {
@@ -233,6 +235,7 @@ export class Ts3Connection {
database_id: number;
channel_group: number;
server_groups: number[];
has_talk_power: boolean;
}
interface RawChannelInfo {
@@ -336,8 +339,8 @@ export class Ts3Connection {
message: string;
timestamp: string;
}
| { type: "channelGroupList"; entries: { id: number; name: string }[] }
| { type: "serverGroupList"; entries: { id: number; name: string }[] }
| { type: "channelGroupList"; entries: GroupEntry[] }
| { type: "serverGroupList"; entries: GroupEntry[] }
| {
type: "permissionOverview";
entries: { name: string; description: string; value: number; negated: boolean; skip: boolean }[];
@@ -387,6 +390,7 @@ export class Ts3Connection {
databaseId: c.database_id,
channelGroup: c.channel_group,
serverGroups: c.server_groups,
hasTalkPower: c.has_talk_power,
})),
});
} else if (event.type === "privateMessage") {
+35 -1
View File
@@ -501,6 +501,8 @@
border-radius: 2px;
white-space: nowrap;
line-height: 18px;
width: 100%;
box-sizing: border-box;
}
.ts-server-row {
@@ -543,6 +545,14 @@
background: color-mix(in srgb, #4caf50 15%, transparent);
}
.ts-client-icons {
display: inline-flex;
align-items: center;
gap: 0.2rem;
margin-left: auto;
padding-right: 0.3rem;
}
.ts-status-icons {
display: inline-flex;
gap: 0.15rem;
@@ -550,8 +560,32 @@
opacity: 0.85;
}
.ts-group-icon {
width: 14px;
height: 14px;
object-fit: contain;
flex-shrink: 0;
}
.ts-group-badge {
display: inline-flex;
align-items: center;
justify-content: center;
width: 14px;
height: 14px;
border-radius: 50%;
flex-shrink: 0;
font-size: 9px;
font-weight: 700;
line-height: 1;
color: #fff;
}
.ts-poke-button {
margin-left: auto;
/* No margin-left: auto here - .ts-client-icons already has one, and two
auto margins in the same row split the free space between them (leaving
a gap before the icons instead of pushing the whole trailing group
flush to the edge). Let the poke button just trail the icon cluster. */
background: transparent;
border: none;
cursor: pointer;
+105 -18
View File
@@ -44,11 +44,22 @@ import {
import { parseSoundpack } from "./soundpack";
// In dev, the gateway runs standalone on its own port. In production it's
// served from the same origin/port as the web app (single container behind a
// reverse proxy), so derive the WebSocket URL from the current location.
// normally served from the same origin/port as the web app (single
// container behind a reverse proxy), so the WebSocket URL is derived from
// the current location by default. If the static frontend is hosted
// separately from the gateway (e.g. a static host for the landing/app
// bundle, with the gateway staying on your own server), set
// VITE_GATEWAY_URL at build time to the gateway's public wss:// address
// instead - the browser will still block a plain ws:// gateway from an
// https:// page (mixed content), so that address needs real TLS.
// Either way the gateway's WebSocketServer only listens on /ws (see
// gateway/src/index.ts), so that path always gets appended here - a
// VITE_GATEWAY_URL override only needs to name the host, not the path.
const GATEWAY_URL = import.meta.env.DEV
? "ws://localhost:8080"
: `${window.location.protocol === "https:" ? "wss" : "ws"}://${window.location.host}/ws`;
: import.meta.env.VITE_GATEWAY_URL
? `${import.meta.env.VITE_GATEWAY_URL.replace(/\/$/, "")}/ws`
: `${window.location.protocol === "https:" ? "wss" : "ws"}://${window.location.host}/ws`;
// One-time migration from the pre-rename "ts-web-client:*" localStorage
// namespace so existing users don't lose their favorites/preferences.
@@ -330,11 +341,13 @@ interface ClientInfo {
databaseId: number;
channelGroup: number;
serverGroups: number[];
hasTalkPower: boolean;
}
interface GroupEntry {
id: number;
name: string;
iconId: number;
}
interface PermissionOverviewEntry {
@@ -462,6 +475,9 @@ function ClientStatusIcons({ client }: { client: ClientInfo }) {
{client.isChannelCommander && <span title={t("tree.channelCommander")}>⭐</span>}
{client.away && <span title={t("tree.away")}>💤</span>}
{(client.inputMuted || !client.inputHardwareEnabled) && <span title={t("tree.micMuted")}>🔇</span>}
{!client.inputMuted && client.inputHardwareEnabled && !client.hasTalkPower && (
<span title={t("tree.noTalkPower")}>🔒</span>
)}
{client.outputMuted && <span title={t("tree.soundMuted")}>🔕</span>}
</span>
);
@@ -484,6 +500,8 @@ function ChannelTree({
parent,
ownClientId,
talkers,
serverGroups,
groupIconImages,
selected,
onSelectItem,
onSwitchChannel,
@@ -497,6 +515,8 @@ function ChannelTree({
parent: number;
ownClientId: number | null;
talkers: Set<number>;
serverGroups: GroupEntry[] | null;
groupIconImages: Record<string, string>;
selected: SelectedItem | null;
onSelectItem: (item: SelectedItem) => void;
onSwitchChannel: (channelId: number) => void;
@@ -509,6 +529,13 @@ function ChannelTree({
const children = channels.filter((c) => c.parent === parent).sort((a, b) => a.order - b.order);
if (children.length === 0) return null;
const clientGroupBadges = (client: ClientInfo): GroupEntry[] =>
serverGroups
? client.serverGroups
.map((gid) => serverGroups.find((g) => g.id === gid))
.filter((g): g is GroupEntry => !!g && g.iconId !== 0)
: [];
return (
<ul className="ts-tree-list">
{children.map((channel) => (
@@ -533,7 +560,7 @@ function ChannelTree({
<li key={c.id}>
<div
className={`ts-row ts-client-row${c.id === ownClientId ? " ts-self" : ""}${
talkers.has(c.id) ? " ts-talking" : ""
talkers.has(c.id) && c.hasTalkPower ? " ts-talking" : ""
}`}
onClick={c.id === ownClientId ? undefined : () => onOpenPrivateChat(c.id, c.name)}
onContextMenu={(e) => onClientContextMenu(e, c.id, c.name, c.id === ownClientId)}
@@ -545,19 +572,29 @@ function ChannelTree({
{c.away && c.awayMessage && (
<span className="ts-client-away-message">({c.awayMessage})</span>
)}
<ClientStatusIcons client={c} />
{c.id !== ownClientId && (
<button
className="ts-poke-button"
onClick={(e) => {
e.stopPropagation();
onPokeClient(c.id, c.name);
}}
title={`${t("tree.poke")} ${c.name}`}
>
👉
</button>
)}
<span className="ts-client-icons">
<ClientStatusIcons client={c} />
{clientGroupBadges(c).map((g) => {
if (g.iconId >= CUSTOM_ICON_ID_THRESHOLD) {
const base64 = groupIconImages[`/icon_${g.iconId}`];
if (base64) {
return (
<img key={g.id} className="ts-group-icon" src={iconDataUrl(base64)} alt="" title={g.name} />
);
}
}
return (
<span
key={g.id}
className="ts-group-badge"
style={{ background: groupBadgeColor(g.iconId) }}
title={g.name}
>
{g.name.trim().charAt(0).toUpperCase() || "?"}
</span>
);
})}
</span>
</div>
</li>
))}
@@ -568,6 +605,8 @@ function ChannelTree({
parent={channel.id}
ownClientId={ownClientId}
talkers={talkers}
serverGroups={serverGroups}
groupIconImages={groupIconImages}
selected={selected}
onSelectItem={onSelectItem}
onSwitchChannel={onSwitchChannel}
@@ -1886,6 +1925,22 @@ function iconDataUrl(base64: string): string {
return `data:${sniffImageMime(atob(base64))};base64,${base64}`;
}
// IDs below this are TeamSpeak's built-in default group icons - they ship
// inside the official client and were never uploaded to the server's icon
// filebase, so downloadFile() for them just hangs forever (nothing to send
// back). We don't have those graphics to embed, so those get a generic
// colored-letter badge instead; only real custom uploads (id >= threshold)
// are fetched as actual images.
const CUSTOM_ICON_ID_THRESHOLD = 1000;
/** Deterministic color for a group's letter badge - same icon id always
* produces the same hue, so a group looks consistent across the tree
* without needing the real (unavailable) TeamSpeak icon graphics. */
function groupBadgeColor(iconId: number): string {
const hue = (iconId * 47) % 360;
return `hsl(${hue}, 55%, 45%)`;
}
/** The icon repository lives under TS3's special "channel 0" - not a real,
* selectable channel, just the server-wide filebase icons are stored in.
* Icon files are always named "icon_<id>", where <id> is what a server/
@@ -4898,6 +4953,34 @@ function AppInner() {
}
}, [serverIconsOpen, serverIconEntries, serverIconImages]);
// Server group badges next to client names need the group list (for the
// id->icon lookup) even if the user never opens a group-related dialog -
// fetch it once per connection instead of only on demand.
useEffect(() => {
if (!connected || serverGroups) return;
socketRef.current?.send(JSON.stringify({ type: "getServerGroupList" }));
}, [connected, serverGroups]);
// Same icon-file cache as the server icons dialog (fileDownloadData for
// cid 0 always lands in serverIconImages, regardless of who asked) - fetch
// any group icon referenced by a currently visible client that isn't
// cached yet.
useEffect(() => {
if (!serverGroups) return;
const iconById = new Map(serverGroups.map((g) => [g.id, g.iconId]));
const wantedIconIds = new Set(
clients
.flatMap((c) => c.serverGroups.map((gid) => iconById.get(gid) ?? 0))
.filter((id) => id >= CUSTOM_ICON_ID_THRESHOLD)
);
for (const iconId of wantedIconIds) {
const path = `/icon_${iconId}`;
if (!(path in serverIconImages)) {
socketRef.current?.send(JSON.stringify({ type: "downloadFile", channelId: 0, path }));
}
}
}, [clients, serverGroups, serverIconImages]);
useEffect(() => {
if (!connected) {
setWhisperChannelIds(new Set());
@@ -5839,7 +5922,9 @@ function AppInner() {
const inputMuted = ownClient?.inputMuted ?? false;
const outputMuted = ownClient?.outputMuted ?? false;
const displayTalkers =
selfActive && ownClient ? new Set(talkers).add(ownClient.id) : talkers;
selfActive && !inputMuted && ownClient?.hasTalkPower
? new Set(talkers).add(ownClient.id)
: talkers;
const t = useT();
return (
@@ -7195,6 +7280,8 @@ function AppInner() {
parent={0}
ownClientId={ownClient?.id ?? null}
talkers={displayTalkers}
serverGroups={serverGroups}
groupIconImages={serverIconImages}
selected={selected}
onSelectItem={handleSelectItem}
onSwitchChannel={handleSwitchChannel}
+14 -12
View File
@@ -33,6 +33,7 @@ interface DemoClient {
databaseId: number;
channelGroup: number;
serverGroups: number[];
hasTalkPower: boolean;
}
const DEMO_CHANNELS: DemoChannel[] = [
@@ -42,24 +43,24 @@ const DEMO_CHANNELS: DemoChannel[] = [
];
const DEMO_CHANNEL_GROUPS = [
{ id: 1, name: "Channel Admin" },
{ id: 2, name: "Operator" },
{ id: 3, name: "Voice" },
{ id: 4, name: "Guest" },
{ id: 1, name: "Channel Admin", iconId: 0 },
{ id: 2, name: "Operator", iconId: 0 },
{ id: 3, name: "Voice", iconId: 0 },
{ id: 4, name: "Guest", iconId: 0 },
];
const DEMO_SERVER_GROUPS = [
{ id: 1, name: "Server Admin" },
{ id: 2, name: "Moderator" },
{ id: 3, name: "Trusted" },
{ id: 4, name: "Guest" },
{ id: 1, name: "Server Admin", iconId: 0 },
{ id: 2, name: "Moderator", iconId: 0 },
{ id: 3, name: "Trusted", iconId: 0 },
{ id: 4, name: "Guest", iconId: 0 },
];
const DEMO_NPCS: DemoClient[] = [
{ id: 102, channel: 1, name: "Alex", inputMuted: false, outputMuted: false, inputHardwareEnabled: true, away: false, awayMessage: "", isChannelCommander: true, country: "US", uid: "demo-uid-alex", databaseId: 2, channelGroup: 2, serverGroups: [2] },
{ id: 103, channel: 2, name: "Sam", inputMuted: false, outputMuted: false, inputHardwareEnabled: true, away: false, awayMessage: "", isChannelCommander: false, country: "GB", uid: "demo-uid-sam", databaseId: 3, channelGroup: 4, serverGroups: [4] },
{ id: 104, channel: 2, name: "Jordan", inputMuted: true, outputMuted: false, inputHardwareEnabled: true, away: false, awayMessage: "", isChannelCommander: false, country: "CA", uid: "demo-uid-jordan", databaseId: 4, channelGroup: 4, serverGroups: [4] },
{ id: 105, channel: 3, name: "Riley", inputMuted: false, outputMuted: false, inputHardwareEnabled: true, away: true, awayMessage: "brb, grabbing coffee", isChannelCommander: false, country: "DE", uid: "demo-uid-riley", databaseId: 5, channelGroup: 4, serverGroups: [3, 4] },
{ id: 102, channel: 1, name: "Alex", inputMuted: false, outputMuted: false, inputHardwareEnabled: true, away: false, awayMessage: "", isChannelCommander: true, country: "US", uid: "demo-uid-alex", databaseId: 2, channelGroup: 2, serverGroups: [2], hasTalkPower: true },
{ id: 103, channel: 2, name: "Sam", inputMuted: false, outputMuted: false, inputHardwareEnabled: true, away: false, awayMessage: "", isChannelCommander: false, country: "GB", uid: "demo-uid-sam", databaseId: 3, channelGroup: 4, serverGroups: [4], hasTalkPower: true },
{ id: 104, channel: 2, name: "Jordan", inputMuted: true, outputMuted: false, inputHardwareEnabled: true, away: false, awayMessage: "", isChannelCommander: false, country: "CA", uid: "demo-uid-jordan", databaseId: 4, channelGroup: 4, serverGroups: [4], hasTalkPower: true },
{ id: 105, channel: 3, name: "Riley", inputMuted: false, outputMuted: false, inputHardwareEnabled: true, away: true, awayMessage: "brb, grabbing coffee", isChannelCommander: false, country: "DE", uid: "demo-uid-riley", databaseId: 5, channelGroup: 4, serverGroups: [3, 4], hasTalkPower: true },
];
interface DemoFileEntry {
@@ -617,6 +618,7 @@ export class DemoSocket {
databaseId: 1,
channelGroup: this.selfChannelGroup,
serverGroups: [...this.selfServerGroups],
hasTalkPower: true,
};
this.emit({ type: "channels", channels: DEMO_CHANNELS, clients: [self, ...DEMO_NPCS] });
}
+2
View File
@@ -291,6 +291,7 @@ const translations: Record<Lang, Record<string, string>> = {
"tree.channelCommander": "Channel Commander",
"tree.away": "Abwesend",
"tree.micMuted": "Mikrofon stummgeschaltet",
"tree.noTalkPower": "Keine Redeerlaubnis in diesem Channel",
"tree.soundMuted": "Ton stummgeschaltet (deafened)",
"chat.server": "Server",
@@ -791,6 +792,7 @@ const translations: Record<Lang, Record<string, string>> = {
"tree.channelCommander": "Channel commander",
"tree.away": "Away",
"tree.micMuted": "Microphone muted",
"tree.noTalkPower": "No talk power in this channel",
"tree.soundMuted": "Sound muted (deafened)",
"chat.server": "Server",