Compare commits

...
Author SHA1 Message Date
MoepchiandClaude Sonnet 5 8fb6d72957 Implement Nachrichten options panel: named away-message presets + disconnect message
Wires up the previously placeholder-only "Nachrichten" options section: users can now save/delete named away-message templates and set a default leave message that's sent to the server (via DisconnectOptions) when disconnecting.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-30 23:22:08 +02:00
MoepchiandClaude Sonnet 5 234feb4d55 Add per-event checkbox to mute individual sound notifications
Lets users disable e.g. join/leave chimes while keeping others on, without touching the master sounds toggle.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-30 23:10:19 +02:00
Moepchi 7a69d8602c Add sound notifications for connect/disconnect, join/leave, chat, and poke
New Sounds options panel (Extras > Optionen > Sounds) with a master
enable toggle, volume control, and per-event upload/test/reset. Falls
back to synthesized soft two-note chimes when no custom file is set.
Sounds are routed through the same output device as voice playback.

Custom .ts3soundpack (ZIP+XML) import is left for later - this covers
the simpler per-event custom-file approach first.
2026-07-30 22:58:53 +02:00
Moepchi 3881742338 Add MIT LICENSE file, point README badge at it
The README already claimed MIT via a Shields.io badge, but no
LICENSE file actually existed in the repo.
2026-07-30 19:01:42 +02:00
Moepchi a5551dad54 Remove redundant docker compose up -d from README
It was shown twice: once in the clone snippet (before the port
override is even set up) and again right after the override
explanation.
2026-07-30 18:38:27 +02:00
Moepchi 9f41f4bcbe Fix port double-publish from previous compose change
Compose concatenates ports: lists across an override file instead of
replacing them, so the ports mapping added in the last commit caused
the deployed container to try publishing both 8080 and the override's
8188, colliding with another service already on 8080. Move ports back
out of the base file (override-only, as before) and keep the new
container_name/image/environment fields.
2026-07-30 18:32:59 +02:00
Moepchi 302c025018 Flesh out docker-compose.yml with a complete, self-documenting example
Add container_name, an image tag, direct port mapping, and an
explicit PORT env var instead of pointing to a separate override
file just to publish a port.
2026-07-30 18:31:05 +02:00
Moepchi 6a0ba6f732 Merge INSTALL.md into README with a Docker-first install section
Add a Docker Compose (build-from-source) and a Docker Hub pull path as
the recommended install method, with the previous manual/from-source
steps kept as a collapsible section for anyone without Docker.
2026-07-30 18:26:15 +02:00
Moepchi 6158779184 Add real UI screenshots to README preview
Replace the placehold.co placeholders with actual dark/light mode
screenshots of WebSpeak3 connected to voice.teamspeak.com.
2026-07-30 18:13:23 +02:00
Moepchi 507f9e8e3c Fix disconnect on large servers, remove nickname placeholder
Fork tsclientlib to Moepchi/tsclientlib and bump the out-of-order
command queue limit (200 -> 4096). Large servers like
voice.teamspeak.com burst hundreds of command packets during the
initial channel/client sync; a single dropped packet in that burst
previously exceeded the queue and aborted the connection with
"Maximum length exceeded for command queue".

Also clear the "Claude Code" default nickname so the field starts
empty.
2026-07-30 17:35:01 +02:00
Moepchi 85b48fe214 Add German/English UI localization with language switcher
Introduces an i18n layer (src/i18n.tsx) with auto-detection (defaulting
to English) and a persisted override, wires every user-facing string in
App.tsx through it, and adds a language selector to the Anwendung
options panel in the same spot the native TeamSpeak client uses.
2026-07-30 16:58:30 +02:00
Moepchi 4f24d98e9f Redesign README with modern GitHub-style layout
Adds badges, tagline/quick-links, a screenshot showcase table, a
features grid, tech-stack badges, and a collapsible architecture
section; makes the Docker Compose quick start prominent. Legal
disclaimer and credits kept unchanged.
2026-07-30 16:43:44 +02:00
Moepchi ddf4f149f7 Add WebSpeak3 logo, favicons, and Open Graph preview image
Wires the official logo into the header, README, and browser tab; generates
favicon.ico/apple-touch-icon/OG image via a new ImageMagick script from a
single source PNG at web/public/logo.png.
2026-07-30 16:34:39 +02:00
Moepchi a77172b55a Rename project from TS Web Client to WebSpeak3
Rebrands the app as an independent project, adds a trademark disclaimer
to the README, and migrates localStorage keys with a compatibility shim
so existing favorites/settings survive the rename. The TeamSpeak
protocol bridge itself (Ts3Connection, ts-connector binary) is untouched.
2026-07-30 16:21:46 +02:00
Moepchi 0b7d2b7346 Allow switching servers via Favoriten while already connected 2026-07-30 16:04:35 +02:00
Moepchi f523005972 Remove myTeamSpeak from Options sidebar (proprietary, not implementable) 2026-07-29 23:05:56 +02:00
Moepchi 26eff72528 Remove non-implementable/non-sensible cosmetic options from Wiedergabe/Aufnahme panels 2026-07-29 23:02:08 +02:00
Moepchi 8af60bd0c2 Enlarge Options dialog so the Aufnahme panel fits without scrolling 2026-07-29 22:56:09 +02:00
Moepchi deb3f7b131 Fix Options dialog content overflow by making the body scrollable 2026-07-29 22:47:19 +02:00
Moepchi 0f24c4b092 Wire up the real Wiedergabe/Aufnahme options panels
Builds out the Wiedergabe and Aufnahme sections of the Options dialog to
match the real TS3 client's layout, with the "Standard" profile only.
Everything technically feasible in a browser is wired to real behavior:
output/input device pickers (input device selection is new - MicCapture
can now target a specific deviceId), playback volume (new gain stage in
AudioPlayer), a real test tone, the voice-activation threshold/hangover
(hangover was previously hardcoded), noise suppression/echo cancellation
toggles (restart capture to apply new getUserMedia constraints), a live
mic level meter, and a mic self-monitoring ("Test starten") loopback.
Settings persist to localStorage. Everything the browser genuinely can't
do (Windows audio session mode, mono/surround downmix, ducking, typing
attenuation, mic-click sounds, comfort noise) stays as a disabled
placeholder control. Local-only for now, not deployed.
2026-07-29 21:43:47 +02:00
Moepchi e5c5cc3f80 Add Options dialog with the real client's settings sidebar
Opens via Extras -> Optionen. Sidebar navigation matches the real TS3
client (Anwendung/myTeamSpeak/Wiedergabe/.../Meldungen) and switches the
content panel, but the settings themselves are still placeholders - none
of the actual options are wired up yet. Local-only for now, not deployed.
2026-07-29 21:08:25 +02:00
Moepchi a2863520a5 Add Extras menu as a layout-only dropdown
Matches the real TS3 client's Extras menu items/grouping/shortcuts, but
every entry is disabled - none of these (identities, ban list, recording,
ServerQuery, etc.) are implemented yet. Local-only for now, not deployed.
2026-07-29 20:54:55 +02:00
Moepchi 0d65c3b123 Enable the mic automatically on page load instead of requiring a click
Voice activation already gates what's actually transmitted, so there's no
reason to make the user click "Enable microphone" every time - it's now
requested once on mount via the same handleToggleMic() path a manual click
uses. Also resume the AudioContext if it starts suspended (autoplay policy),
since granting the permission prompt itself counts as a user gesture and
unblocks it even when start() wasn't triggered by a click.
2026-07-29 20:46:17 +02:00
Moepchi 41559c7712 Allow enabling the mic (and picking an output device) before connecting
The AudioContext/AudioPlayer were only created inside handleConnect, so
clicking the mic button while disconnected silently did nothing - no
permission prompt, no error. Lazily create them on first use instead
(ensureAudioContext), and drop the mic button's connected-only disabled
state, matching the real TS3 client where you can test your devices before
joining a server.
2026-07-29 20:39:51 +02:00
Moepchi 234213d33e Move port publishing out of the base compose file into a local override
Committing a fixed port mapping doesn't work across hosts (this one already
had 8080 taken), so ports now belong in a gitignored docker-compose.override.yml.
2026-07-29 20:20:05 +02:00
Moepchi c48534dbc4 Add Docker deployment and fix crash in insecure (non-HTTPS) contexts
Adds a multi-stage Dockerfile (Rust connector + gateway + web build) and
docker-compose.yml for running the whole stack as a single container behind
a reverse proxy; the gateway now serves the built web app and the WebSocket
endpoint (/ws) from one port, and the frontend derives its gateway URL from
window.location in production instead of a hardcoded localhost address.

Also guards all navigator.mediaDevices usage against being undefined, which
happens when the page is loaded over plain HTTP on a non-localhost address
(not a secure context) - previously this crashed the whole React app on
mount instead of just disabling the affected voice features.
2026-07-29 18:45:23 +02:00
Moepchi 3715a52de6 Add Favoriten menu, Away/AFK status, and mic/output mute toggles
Implements the real TS3 client's Favoriten menu (add/manage/list, with a
FavoritesDialog), the toolbar Away/AFK dropdown with saved presets and an
AwayDialog, plus input/output mute toggle buttons on the toolbar. Reorders
the toolbar to AFK -> Mic -> Speaker -> Theme and removes the standalone
Connect button in favor of the Verbindungen menu.
2026-07-29 17:24:56 +02:00
Moepchi 53e2887e14 Add Verbindungen menu, TS3-style Connect dialog, and layout restructure
- Replace inline toolbar connect fields with a modal Connect dialog matching
  the real TS3 client's layout, including a functional Standard Channel field
  wired through a new connector --default-channel flag
- Add a Verbindungen dropdown menu (Verbinden/Aktuelle Verbindung trennen/
  Alle Verbindungen trennen) with click-outside/Escape close and Ctrl+S/Ctrl+D
  shortcuts
- Restructure layout: chat area (messages/tabs/input) now spans the full
  width at the bottom; right side shows a separate, non-scrollable server
  banner (object-fit scaled, shown only when set) above the client/server
  info panel; tree width and upper-area height are now drag-resizable
- Surface server version, license, and banner URL from tsclientlib through
  the connector and gateway
2026-07-29 16:38:40 +02:00
30 changed files with 3984 additions and 339 deletions

No files matched your search

+8
View File
@@ -0,0 +1,8 @@
**/node_modules
**/dist
**/target
tsclientlib/.git
.git
*.log
.env
.env.local
+1
View File
@@ -6,3 +6,4 @@ dist-ssr/
.env
.env.local
.DS_Store
docker-compose.override.yml
+1 -1
View File
@@ -1,3 +1,3 @@
[submodule "tsclientlib"]
path = tsclientlib
url = https://github.com/ReSpeak/tsclientlib.git
url = https://github.com/Moepchi/tsclientlib.git
+45
View File
@@ -0,0 +1,45 @@
# --- Rust connector -----------------------------------------------------
FROM rust:1-bookworm AS connector-builder
RUN apt-get update && apt-get install -y --no-install-recommends cmake && rm -rf /var/lib/apt/lists/*
WORKDIR /src
COPY tsclientlib/ tsclientlib/
COPY connector/ connector/
WORKDIR /src/connector
ENV CMAKE_POLICY_VERSION_MINIMUM=3.5
RUN cargo build --release
# --- Web frontend ---------------------------------------------------------
FROM node:22-bookworm-slim AS web-builder
WORKDIR /src/web
COPY web/package*.json ./
RUN npm ci
COPY web/ ./
# tsc -b currently fails on pre-existing type errors unrelated to this build;
# vite build alone is enough to produce the production bundle.
RUN npx vite build
# --- Gateway ----------------------------------------------------------------
FROM node:22-bookworm-slim AS gateway-builder
WORKDIR /src/gateway
COPY gateway/package*.json ./
RUN npm ci
COPY gateway/ ./
RUN npm run build
# --- Runtime ----------------------------------------------------------------
FROM node:22-bookworm-slim AS runtime
LABEL org.opencontainers.image.title="WebSpeak3"
LABEL org.opencontainers.image.description="Self-hosted web client for TeamSpeak 3 servers"
WORKDIR /app
COPY gateway/package*.json ./
RUN npm ci --omit=dev
COPY --from=gateway-builder /src/gateway/dist ./dist
COPY --from=connector-builder /src/connector/target/release/ts-connector /app/connector-bin/ts-connector
COPY --from=web-builder /src/web/dist /app/web/dist
ENV PORT=8080
ENV WEB_DIST=/app/web/dist
ENV CONNECTOR_BIN=/app/connector-bin/ts-connector
EXPOSE 8080
CMD ["node", "dist/index.js"]
-87
View File
@@ -1,87 +0,0 @@
# Installation
## Prerequisites
- **Node.js** 20+ and npm
- **Rust** (stable toolchain) — [rustup.rs](https://rustup.rs)
- **CMake** and a C/C++ toolchain — needed to build the Opus codec library
(`audiopus_sys`) used for voice. On Windows, the Visual Studio "Desktop
development with C++" workload covers this; on Linux, install `cmake` and
`build-essential` (or equivalent); on macOS, `cmake` via Homebrew plus Xcode
command line tools.
- **git**
## 1. Clone the repository
The Rust connector depends on the `tsclientlib` crate, vendored as a git
submodule — make sure to pull it in too:
```bash
git clone --recurse-submodules <your-repo-url>
cd ts-web-client
```
If you already cloned without `--recurse-submodules`:
```bash
git submodule update --init --recursive
```
## 2. Build the Rust connector
```bash
cd connector
cargo build
```
> **Note:** if the build fails with a CMake error like `Compatibility with
> CMake < 3.5 has been removed`, it's because the vendored Opus source uses an
> old `cmake_minimum_required`. Work around it with:
>
> ```bash
> CMAKE_POLICY_VERSION_MINIMUM=3.5 cargo build
> ```
> (On Windows PowerShell: `$env:CMAKE_POLICY_VERSION_MINIMUM = "3.5"; cargo build`)
This produces `connector/target/debug/ts-connector` (or `ts-connector.exe` on
Windows), which the gateway spawns automatically — no manual step needed
after this.
## 3. Install and start the gateway
```bash
cd gateway
npm install
npm run dev
```
This starts the WebSocket gateway on `ws://localhost:8080`.
## 4. Install and start the web frontend
In a separate terminal:
```bash
cd web
npm install
npm run dev
```
Vite will print a local dev URL (typically `http://localhost:5173`) — open
it in a browser.
## 5. Connect
In the web UI, enter the address of a TeamSpeak server and a nickname, then
click **Connect**. Voice requires microphone permission when you enable the
mic button; the output-device picker (if your browser supports it) requires
no extra permission.
## Rebuilding after changes
- Frontend and gateway changes hot-reload automatically (`npm run dev` in
both cases).
- Connector changes require a rebuild (`cargo build` in `connector/`) and a
reconnect from the browser — if the old `ts-connector` binary is still
running (an active browser connection), disconnect first or the build will
fail to overwrite the binary.
+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2026 Moepchi
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+192 -23
View File
@@ -1,29 +1,70 @@
# TS Web Client
<p align="center">
<img src="web/public/logo.png" width="140" alt="WebSpeak3 logo">
</p>
Browser-based client for TeamSpeak servers — same idea as the native
installable client, but running in a web browser. The TeamSpeak server side
stays exactly as-is (a regular TS server); only the client is being
reimagined.
<h1 align="center">WebSpeak3</h1>
**Status: private prototype, not for production use.**
<p align="center">
<a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="License"></a>
<a href="Dockerfile"><img src="https://img.shields.io/badge/docker-build%20passing-2496ED?logo=docker&logoColor=white" alt="Docker Build"></a>
<a href="gateway/package.json"><img src="https://img.shields.io/badge/node-%3E%3D18-339933?logo=node.js&logoColor=white" alt="Node Version"></a>
<a href="connector/Cargo.toml"><img src="https://img.shields.io/badge/rust-2021-000000?logo=rust&logoColor=white" alt="Rust Version"></a>
<img src="https://img.shields.io/badge/status-beta%20%2F%20prototype-yellow" alt="Project Status">
</p>
## Features
<p align="center">
<b>A modern, self-hosted browser client for TeamSpeak 3 servers — no install, just open a tab.</b>
</p>
- Connect to a real TeamSpeak (3/6) server, with optional server and
default-channel passwords
- Remembers the last server/nickname you connected with
- Channel/client tree with correct ordering, click to switch channels
- Per-client status icons (channel commander, away, mic muted, deafened)
- Text chat: channel, server-wide, and private (1:1) — each in its own tab
- Voice with voice activation ("Sprachaktivierung", not push-to-talk),
adjustable sensitivity, and per-client speaking indicators
- Audio output device picker (routes playback to a chosen device) — works in
Chrome/Edge and Firefox 130+; playback is routed through a hidden `<audio>`
element so device switching works even in browsers without
`AudioContext.setSinkId`
- Light/dark theme
<p align="center">
<a href="#-installation">🚀 Quick Start</a> ·
<a href="#-installation">📖 Installation</a> ·
<a href="https://github.com/Moepchi/webspeak3/issues">🐛 Report Bug</a>
</p>
## Architecture
---
## 📸 Preview
<table>
<tr>
<th>Dark Mode</th>
<th>Light Mode</th>
</tr>
<tr>
<td><img src="docs/screenshots/webspeak_dark.png" width="100%" alt="Dark mode screenshot"></td>
<td><img src="docs/screenshots/webspeak_light.png" width="100%" alt="Light mode screenshot"></td>
</tr>
</table>
## ✨ Features
| | |
|---|---|
| 🔌 **Real TeamSpeak protocol** | Connects to actual TS3/TS6 servers over a WebSocket gateway — the server stays exactly as-is |
| 🎙️ **Low-latency voice** | Opus-encoded voice with voice activation ("Sprachaktivierung") and adjustable sensitivity |
| 🔊 **Custom audio output picker** | Route playback to any output device — works even in browsers without `AudioContext.setSinkId` |
| 💬 **Full text chat** | Channel, server-wide, and private (1:1) chat, each in its own tab |
| 🌳 **Live channel/client tree** | Correct ordering, status icons (channel commander, away, muted, deafened), click to switch channels |
| ⭐ **Favorites & reconnect** | Remembers your last server/nickname; switch servers without leaving your tab |
| 🌗 **Dark / light theme** | Clean, modern UI that adapts to your preference |
| 🔁 **Seamless reconnect** | Switch connections mid-session — old state tears down cleanly, no leaks or duplicates |
## 🧱 Tech Stack
<p>
<img src="https://img.shields.io/badge/React-61DAFB?logo=react&logoColor=black" alt="React">
<img src="https://img.shields.io/badge/Vite-646CFF?logo=vite&logoColor=white" alt="Vite">
<img src="https://img.shields.io/badge/TypeScript-3178C6?logo=typescript&logoColor=white" alt="TypeScript">
<img src="https://img.shields.io/badge/Node.js-339933?logo=node.js&logoColor=white" alt="Node.js">
<img src="https://img.shields.io/badge/Rust-000000?logo=rust&logoColor=white" alt="Rust">
<img src="https://img.shields.io/badge/Docker-2496ED?logo=docker&logoColor=white" alt="Docker">
</p>
<details>
<summary><b>🏗️ Architecture details</b></summary>
<br>
Browsers can't send raw UDP, which is what TeamSpeak's native protocol runs
over, so a pure client-side implementation isn't possible — a server-side
@@ -44,10 +85,138 @@ Browser (web/) <--WebSocket--> Gateway (gateway/) <--stdin/stdout JSON--> Ru
protocol implementation. Handles connecting, channel/client state, chat,
and Opus-encoded voice.
## Installation
</details>
See [INSTALL.md](INSTALL.md).
## 🚀 Installation
### 🐳 Docker (recommended)
Clone the repo (the Rust connector depends on a git submodule, so pull it in too):
```bash
git clone --recurse-submodules https://github.com/Moepchi/webspeak3.git
cd webspeak3
```
This is what ships in [`docker-compose.yml`](docker-compose.yml):
```yaml
services:
webspeak3:
build: .
image: moepchi/webspeak3:latest
container_name: webspeak3
restart: unless-stopped
environment:
- PORT=8080
```
Port publishing is left out on purpose — set it in a local, gitignored `docker-compose.override.yml` so it doesn't clash with whatever else is already using a port on your host:
```yaml
services:
webspeak3:
ports:
- "8080:8080"
```
Then `docker compose up -d` and open `http://localhost:8080` (or whatever host port you chose).
Prefer to skip the build entirely? A prebuilt image is published on [Docker Hub](https://hub.docker.com/r/moepchi/webspeak3):
```bash
docker run -d -p 8080:8080 --name webspeak3 moepchi/webspeak3:latest
```
<details>
<summary><b>🛠️ Manual installation (without Docker)</b></summary>
<br>
**Prerequisites**
- **Node.js** 20+ and npm
- **Rust** (stable toolchain) — [rustup.rs](https://rustup.rs)
- **CMake** and a C/C++ toolchain — needed to build the Opus codec library (`audiopus_sys`) used for voice. On Windows, the Visual Studio "Desktop development with C++" workload covers this; on Linux, install `cmake` and `build-essential` (or equivalent); on macOS, `cmake` via Homebrew plus Xcode command line tools.
- **git**
**1. Clone the repository**
The Rust connector depends on the `tsclientlib` crate, vendored as a git submodule — make sure to pull it in too:
```bash
git clone --recurse-submodules https://github.com/Moepchi/webspeak3.git
cd webspeak3
```
If you already cloned without `--recurse-submodules`:
```bash
git submodule update --init --recursive
```
**2. Build the Rust connector**
```bash
cd connector
cargo build
```
> **Note:** if the build fails with a CMake error like `Compatibility with CMake < 3.5 has been removed`, it's because the vendored Opus source uses an old `cmake_minimum_required`. Work around it with:
>
> ```bash
> CMAKE_POLICY_VERSION_MINIMUM=3.5 cargo build
> ```
> (On Windows PowerShell: `$env:CMAKE_POLICY_VERSION_MINIMUM = "3.5"; cargo build`)
This produces `connector/target/debug/ts-connector` (or `ts-connector.exe` on Windows), which the gateway spawns automatically — no manual step needed after this.
**3. Install and start the gateway**
```bash
cd gateway
npm install
npm run dev
```
This starts the WebSocket gateway on `ws://localhost:8080`.
**4. Install and start the web frontend**
In a separate terminal:
```bash
cd web
npm install
npm run dev
```
Vite will print a local dev URL (typically `http://localhost:5173`) — open it in a browser.
**5. Connect**
In the web UI, enter the address of a TeamSpeak server and a nickname, then click **Connect**. Voice requires microphone permission when you enable the mic button; the output-device picker (if your browser supports it) requires no extra permission.
**Rebuilding after changes**
- Frontend and gateway changes hot-reload automatically (`npm run dev` in both cases).
- Connector changes require a rebuild (`cargo build` in `connector/`) and a reconnect from the browser — if the old `ts-connector` binary is still running (an active browser connection), disconnect first or the build will fail to overwrite the binary.
</details>
## Credits
The vast majority of this project's code was written by [Claude Code](https://claude.com/claude-code) (Anthropic's Claude), working iteratively with the repo owner one feature at a time.
---
### Legal / Disclaimer
**WebSpeak3** is an independent, open-source, self-hosted project and is
**not** affiliated with, associated with, authorized by, endorsed by, or in
any way officially connected with TeamSpeak Systems GmbH.
"TeamSpeak", "TS3", and related logos or names are registered trademarks of
TeamSpeak Systems GmbH. All product and company names are trademarks™ or
registered® trademarks of their respective holders. Use of them does not
imply any affiliation with or endorsement by them.
+58 -5
View File
@@ -16,7 +16,7 @@ use tsclientlib::messages::c2s::{OutClientPokeRequestPart, OutSendTextMessagePar
use tsclientlib::prelude::*;
use tsclientlib::{
data, ChannelId, ClientId, Connection, DisconnectOptions, MaxClients, MessageHandle,
MessageTarget, StreamItem, TextMessageTargetMode,
MessageTarget, Reason, StreamItem, TextMessageTargetMode,
};
use tsproto_packets::packets::{AudioData, CodecType, OutAudio};
@@ -39,6 +39,10 @@ struct Args {
/// Password for the default channel to join, if it's password-protected
#[arg(long)]
channel_password: Option<String>,
/// Channel (name or path, e.g. "Default Channel/Nested") to join on connect,
/// instead of the server's actual default channel
#[arg(long)]
default_channel: Option<String>,
}
#[derive(Serialize)]
@@ -62,6 +66,7 @@ struct ClientInfo {
output_muted: bool,
input_hardware_enabled: bool,
away: bool,
away_message: String,
is_channel_commander: bool,
}
@@ -69,7 +74,14 @@ struct ClientInfo {
#[serde(tag = "type")]
enum Event {
#[serde(rename = "connected")]
Connected { welcome_message: String, server_name: String, server_max_clients: u16 },
Connected {
welcome_message: String,
server_name: String,
server_max_clients: u16,
server_version: String,
server_license: String,
server_banner_url: String,
},
#[serde(rename = "channels")]
Channels { channels: Vec<ChannelInfo>, clients: Vec<ClientInfo> },
#[serde(rename = "chatMessage")]
@@ -168,6 +180,7 @@ fn snapshot(con: &data::Connection) -> Event {
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,
})
.collect();
@@ -214,6 +227,9 @@ async fn run(args: Args) -> Result<()> {
if let Some(pwd) = args.channel_password {
con_config = con_config.channel_password(pwd);
}
if let Some(channel) = args.default_channel {
con_config = con_config.channel(channel);
}
let mut con = con_config.connect().map_err(|e| friendly_connect_error(&address, e))?;
@@ -242,7 +258,17 @@ async fn run(args: Args) -> Result<()> {
let welcome_message = server_state.server.welcome_message.clone();
let server_name = server_state.server.name.clone();
let server_max_clients = server_state.server.max_clients;
emit(&Event::Connected { welcome_message, server_name, server_max_clients });
let server_version = server_state.server.version.clone();
let server_license = format!("{:?}", server_state.server.license);
let server_banner_url = server_state.server.hostbanner_gfx_url.clone();
emit(&Event::Connected {
welcome_message,
server_name,
server_max_clients,
server_version,
server_license,
server_banner_url,
});
// Subscribe to all channels so we actually receive the full channel/client list.
con.get_state()?.server.set_subscribed(true).send(&mut con)?;
@@ -295,8 +321,14 @@ async fn run(args: Args) -> Result<()> {
LoopOutcome::StdinLine(line) => match line {
Ok(Some(l)) => {
let l = l.trim();
if l == "disconnect" {
con.disconnect(DisconnectOptions::new())?;
if l == "disconnect" || l.starts_with("disconnect ") {
let message = l.strip_prefix("disconnect").unwrap_or("").trim();
let options = if message.is_empty() {
DisconnectOptions::new()
} else {
DisconnectOptions::new().reason(Reason::Clientdisconnect).message(message)
};
con.disconnect(options)?;
con.events().for_each(|_| future::ready(())).await;
emit(&Event::Disconnected { reason: "client requested".into() });
break;
@@ -382,6 +414,27 @@ async fn run(args: Args) -> Result<()> {
}
Err(_) => emit(&Event::Error { message: format!("Invalid client id: {id}") }),
}
} 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));
if let Err(e) = part.send(&mut con) {
emit(&Event::Error { message: e.to_string() });
}
} else if l == "unaway" {
let part = con.get_state()?.client_update().set_away(None);
if let Err(e) = part.send(&mut con) {
emit(&Event::Error { message: e.to_string() });
}
} else if let Some(rest) = l.strip_prefix("muteinput ") {
let part = con.get_state()?.client_update().set_input_muted(rest.trim() == "1");
if let Err(e) = part.send(&mut con) {
emit(&Event::Error { message: e.to_string() });
}
} else if let Some(rest) = l.strip_prefix("muteoutput ") {
let part = con.get_state()?.client_update().set_output_muted(rest.trim() == "1");
if let Err(e) = part.send(&mut con) {
emit(&Event::Error { message: e.to_string() });
}
} else if let Some(b64) = l.strip_prefix("audio ") {
match base64::engine::general_purpose::STANDARD.decode(b64.trim()) {
Ok(bytes) => {
+18
View File
@@ -0,0 +1,18 @@
services:
webspeak3:
build: .
image: moepchi/webspeak3:latest
container_name: webspeak3
restart: unless-stopped
environment:
- PORT=8080
# Port publishing is deployment-specific and left out of this file on
# purpose - Compose concatenates `ports:` lists across an override file
# instead of replacing them, so adding one here would double-publish
# instead of letting an override change it. Set it in a local, gitignored
# docker-compose.override.yml:
#
# services:
# webspeak3:
# ports:
# - "8080:8080"
Binary file not shown.

After

Width:  |  Height:  |  Size: 820 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 811 KiB

+2 -2
View File
@@ -1,8 +1,8 @@
{
"name": "ts-web-gateway",
"name": "webspeak3-gateway",
"version": "0.1.0",
"private": true,
"description": "Gateway server: bridges browser (WebSocket) clients to a native TeamSpeak server",
"description": "WebSpeak3 gateway server: bridges browser (WebSocket) clients to a native TeamSpeak server",
"type": "module",
"scripts": {
"dev": "tsx watch src/index.ts",
+69 -2
View File
@@ -1,11 +1,61 @@
import { createServer } from "node:http";
import { readFile } from "node:fs/promises";
import path from "node:path";
import { fileURLToPath } from "node:url";
import { WebSocketServer, type WebSocket } from "ws";
import { Ts3Connection, type Ts3ConnectOptions } from "./ts3/connection.js";
const PORT = Number(process.env.PORT ?? 8080);
const wss = new WebSocketServer({ port: PORT });
// In production (Docker), the built web app lives alongside the gateway and
// is served from the same port as the WebSocket endpoint, so a single
// reverse-proxied origin (e.g. a Zoraxy subdomain) is enough for everything.
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const WEB_DIST = process.env.WEB_DIST ?? path.resolve(__dirname, "../../web/dist");
console.log(`Gateway listening on ws://localhost:${PORT}`);
const MIME_TYPES: Record<string, string> = {
".html": "text/html",
".js": "text/javascript",
".css": "text/css",
".svg": "image/svg+xml",
".png": "image/png",
".ico": "image/x-icon",
".json": "application/json",
".woff2": "font/woff2",
};
const server = createServer((req, res) => {
void (async () => {
try {
const url = new URL(req.url ?? "/", "http://localhost");
let filePath = path.join(WEB_DIST, decodeURIComponent(url.pathname));
if (!filePath.startsWith(WEB_DIST)) {
res.writeHead(403);
res.end();
return;
}
let body: Buffer;
try {
body = await readFile(filePath);
} catch {
// SPA fallback: unknown paths (client-side routes, or "/") serve index.html.
filePath = path.join(WEB_DIST, "index.html");
body = await readFile(filePath);
}
res.writeHead(200, { "Content-Type": MIME_TYPES[path.extname(filePath)] ?? "application/octet-stream" });
res.end(body);
} catch {
res.writeHead(404);
res.end("Not found");
}
})();
});
const wss = new WebSocketServer({ server, path: "/ws" });
server.listen(PORT, () => {
console.log(`WebSpeak3 gateway listening on http://localhost:${PORT} (WebSocket at /ws)`);
});
wss.on("connection", (socket: WebSocket) => {
let connection: Ts3Connection | undefined;
@@ -20,6 +70,7 @@ wss.on("connection", (socket: WebSocket) => {
nickname: msg.nickname,
serverPassword: msg.serverPassword,
channelPassword: msg.channelPassword,
defaultChannel: msg.defaultChannel,
};
connection = new Ts3Connection(options);
connection.onEvent((event) => socket.send(JSON.stringify(event)));
@@ -50,6 +101,22 @@ wss.on("connection", (socket: WebSocket) => {
await connection?.sendAudio(msg.pcm);
break;
}
case "setAway": {
await connection?.setAway(msg.away, msg.message ?? "");
break;
}
case "setInputMuted": {
await connection?.setInputMuted(msg.muted);
break;
}
case "setOutputMuted": {
await connection?.setOutputMuted(msg.muted);
break;
}
case "disconnect": {
await connection?.disconnect(msg.message ?? "");
break;
}
default:
socket.send(
JSON.stringify({ type: "error", message: `Unknown message type: ${msg.type}` })
+53 -9
View File
@@ -29,11 +29,20 @@ export interface ClientInfo {
outputMuted: boolean;
inputHardwareEnabled: boolean;
away: boolean;
awayMessage: string;
isChannelCommander: boolean;
}
export type Ts3ConnectionEvent =
| { type: "connected"; welcomeMessage: string; serverName: string; serverMaxClients: number }
| {
type: "connected";
welcomeMessage: string;
serverName: string;
serverMaxClients: number;
serverVersion: string;
serverLicense: string;
serverBannerUrl: string;
}
| { type: "channels"; channels: ChannelInfo[]; clients: ClientInfo[] }
| { type: "chatMessage"; from: string; message: string }
| { type: "serverMessage"; from: string; message: string }
@@ -49,14 +58,17 @@ export interface Ts3ConnectOptions {
nickname: string;
serverPassword?: string;
channelPassword?: string;
defaultChannel?: string;
}
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const CONNECTOR_BIN = path.resolve(
__dirname,
"../../../connector/target/debug",
process.platform === "win32" ? "ts-connector.exe" : "ts-connector"
);
const CONNECTOR_BIN =
process.env.CONNECTOR_BIN ??
path.resolve(
__dirname,
"../../../connector/target/debug",
process.platform === "win32" ? "ts-connector.exe" : "ts-connector"
);
export class Ts3Connection {
private listeners = new Set<(event: Ts3ConnectionEvent) => void>();
@@ -76,6 +88,7 @@ export class Ts3Connection {
const args = ["--address", this.options.host, "--nickname", this.options.nickname];
if (this.options.serverPassword) args.push("--server-password", this.options.serverPassword);
if (this.options.channelPassword) args.push("--channel-password", this.options.channelPassword);
if (this.options.defaultChannel) args.push("--default-channel", this.options.defaultChannel);
this.child = spawn(CONNECTOR_BIN, args);
createInterface({ input: this.child.stdout }).on("line", (line) => {
@@ -88,6 +101,7 @@ export class Ts3Connection {
output_muted: boolean;
input_hardware_enabled: boolean;
away: boolean;
away_message: string;
is_channel_commander: boolean;
}
@@ -103,7 +117,15 @@ export class Ts3Connection {
}
const event = JSON.parse(line) as
| { type: "connected"; welcome_message: string; server_name: string; server_max_clients: number }
| {
type: "connected";
welcome_message: string;
server_name: string;
server_max_clients: number;
server_version: string;
server_license: string;
server_banner_url: string;
}
| { type: "channels"; channels: RawChannelInfo[]; clients: RawClientInfo[] }
| { type: "chatMessage"; from: string; message: string }
| { type: "serverMessage"; from: string; message: string }
@@ -120,6 +142,9 @@ export class Ts3Connection {
welcomeMessage: event.welcome_message,
serverName: event.server_name,
serverMaxClients: event.server_max_clients,
serverVersion: event.server_version,
serverLicense: event.server_license,
serverBannerUrl: event.server_banner_url,
});
} else if (event.type === "channels") {
this.emit({
@@ -142,6 +167,7 @@ export class Ts3Connection {
outputMuted: c.output_muted,
inputHardwareEnabled: c.input_hardware_enabled,
away: c.away,
awayMessage: c.away_message,
isChannelCommander: c.is_channel_commander,
})),
});
@@ -202,9 +228,27 @@ export class Ts3Connection {
this.child?.stdin.write(`audio ${pcmBase64}\n`);
}
async disconnect(): Promise<void> {
async setAway(away: boolean, message: string): Promise<void> {
if (away) {
const sanitized = message.replace(/[\r\n]+/g, " ").trim();
this.child?.stdin.write(`away ${sanitized}\n`);
} else {
this.child?.stdin.write("unaway\n");
}
}
async setInputMuted(muted: boolean): Promise<void> {
this.child?.stdin.write(`muteinput ${muted ? "1" : "0"}\n`);
}
async setOutputMuted(muted: boolean): Promise<void> {
this.child?.stdin.write(`muteoutput ${muted ? "1" : "0"}\n`);
}
async disconnect(message = ""): Promise<void> {
if (this.child && !this.child.killed) {
this.child.stdin.write("disconnect\n");
const sanitized = message.replace(/[\r\n]+/g, " ").trim();
this.child.stdin.write(`disconnect ${sanitized}\n`);
this.child.stdin.end();
}
this.listeners.clear();
+17 -2
View File
@@ -2,9 +2,24 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32.png" />
<link rel="icon" type="image/png" sizes="192x192" href="/favicon-192.png" />
<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>web</title>
<title>WebSpeak3</title>
<meta name="description" content="WebSpeak3 — an independent, self-hosted web client for TeamSpeak 3 servers." />
<meta property="og:type" content="website" />
<meta property="og:title" content="WebSpeak3" />
<meta property="og:description" content="An independent, self-hosted web client for TeamSpeak 3 servers." />
<meta property="og:url" content="https://ts.moepchi.de/" />
<meta property="og:image" content="https://ts.moepchi.de/og-image.png" />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content="WebSpeak3" />
<meta name="twitter:description" content="An independent, self-hosted web client for TeamSpeak 3 servers." />
<meta name="twitter:image" content="https://ts.moepchi.de/og-image.png" />
</head>
<body>
<div id="root"></div>
+1 -1
View File
@@ -1,5 +1,5 @@
{
"name": "web",
"name": "webspeak3-web",
"private": true,
"version": "0.0.0",
"type": "module",
Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

-1
View File
@@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="48" height="46" fill="none" viewBox="0 0 48 46"><path fill="#863bff" d="M25.946 44.938c-.664.845-2.021.375-2.021-.698V33.937a2.26 2.26 0 0 0-2.262-2.262H10.287c-.92 0-1.456-1.04-.92-1.788l7.48-10.471c1.07-1.497 0-3.578-1.842-3.578H1.237c-.92 0-1.456-1.04-.92-1.788L10.013.474c.214-.297.556-.474.92-.474h28.894c.92 0 1.456 1.04.92 1.788l-7.48 10.471c-1.07 1.498 0 3.579 1.842 3.579h11.377c.943 0 1.473 1.088.89 1.83L25.947 44.94z" style="fill:#863bff;fill:color(display-p3 .5252 .23 1);fill-opacity:1"/><mask id="a" width="48" height="46" x="0" y="0" maskUnits="userSpaceOnUse" style="mask-type:alpha"><path fill="#000" d="M25.842 44.938c-.664.844-2.021.375-2.021-.698V33.937a2.26 2.26 0 0 0-2.262-2.262H10.183c-.92 0-1.456-1.04-.92-1.788l7.48-10.471c1.07-1.498 0-3.579-1.842-3.579H1.133c-.92 0-1.456-1.04-.92-1.787L9.91.473c.214-.297.556-.474.92-.474h28.894c.92 0 1.456 1.04.92 1.788l-7.48 10.471c-1.07 1.498 0 3.578 1.842 3.578h11.377c.943 0 1.473 1.088.89 1.832L25.843 44.94z" style="fill:#000;fill-opacity:1"/></mask><g mask="url(#a)"><g filter="url(#b)"><ellipse cx="5.508" cy="14.704" fill="#ede6ff" rx="5.508" ry="14.704" style="fill:#ede6ff;fill:color(display-p3 .9275 .9033 1);fill-opacity:1" transform="matrix(.00324 1 1 -.00324 -4.47 31.516)"/></g><g filter="url(#c)"><ellipse cx="10.399" cy="29.851" fill="#ede6ff" rx="10.399" ry="29.851" style="fill:#ede6ff;fill:color(display-p3 .9275 .9033 1);fill-opacity:1" transform="matrix(.00324 1 1 -.00324 -39.328 7.883)"/></g><g filter="url(#d)"><ellipse cx="5.508" cy="30.487" fill="#7e14ff" rx="5.508" ry="30.487" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="rotate(89.814 -25.913 -14.639)scale(1 -1)"/></g><g filter="url(#e)"><ellipse cx="5.508" cy="30.599" fill="#7e14ff" rx="5.508" ry="30.599" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="rotate(89.814 -32.644 -3.334)scale(1 -1)"/></g><g filter="url(#f)"><ellipse cx="5.508" cy="30.599" fill="#7e14ff" rx="5.508" ry="30.599" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="matrix(.00324 1 1 -.00324 -34.34 30.47)"/></g><g filter="url(#g)"><ellipse cx="14.072" cy="22.078" fill="#ede6ff" rx="14.072" ry="22.078" style="fill:#ede6ff;fill:color(display-p3 .9275 .9033 1);fill-opacity:1" transform="rotate(93.35 24.506 48.493)scale(-1 1)"/></g><g filter="url(#h)"><ellipse cx="3.47" cy="21.501" fill="#7e14ff" rx="3.47" ry="21.501" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="rotate(89.009 28.708 47.59)scale(-1 1)"/></g><g filter="url(#i)"><ellipse cx="3.47" cy="21.501" fill="#7e14ff" rx="3.47" ry="21.501" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="rotate(89.009 28.708 47.59)scale(-1 1)"/></g><g filter="url(#j)"><ellipse cx=".387" cy="8.972" fill="#7e14ff" rx="4.407" ry="29.108" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="rotate(39.51 .387 8.972)"/></g><g filter="url(#k)"><ellipse cx="47.523" cy="-6.092" fill="#7e14ff" rx="4.407" ry="29.108" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="rotate(37.892 47.523 -6.092)"/></g><g filter="url(#l)"><ellipse cx="41.412" cy="6.333" fill="#47bfff" rx="5.971" ry="9.665" style="fill:#47bfff;fill:color(display-p3 .2799 .748 1);fill-opacity:1" transform="rotate(37.892 41.412 6.333)"/></g><g filter="url(#m)"><ellipse cx="-1.879" cy="38.332" fill="#7e14ff" rx="4.407" ry="29.108" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="rotate(37.892 -1.88 38.332)"/></g><g filter="url(#n)"><ellipse cx="-1.879" cy="38.332" fill="#7e14ff" rx="4.407" ry="29.108" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="rotate(37.892 -1.88 38.332)"/></g><g filter="url(#o)"><ellipse cx="35.651" cy="29.907" fill="#7e14ff" rx="4.407" ry="29.108" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="rotate(37.892 35.651 29.907)"/></g><g filter="url(#p)"><ellipse cx="38.418" cy="32.4" fill="#47bfff" rx="5.971" ry="15.297" style="fill:#47bfff;fill:color(display-p3 .2799 .748 1);fill-opacity:1" transform="rotate(37.892 38.418 32.4)"/></g></g><defs><filter id="b" width="60.045" height="41.654" x="-19.77" y="16.149" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="7.659"/></filter><filter id="c" width="90.34" height="51.437" x="-54.613" y="-7.533" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="7.659"/></filtLine truncated

Before

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 911 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 KiB

+23
View File
@@ -0,0 +1,23 @@
#!/usr/bin/env bash
# Generates every derived favicon/OG-image size from the single source logo
# at web/public/logo.png. Requires ImageMagick (`magick` on the PATH).
#
# Usage: run from web/ after dropping the source logo at public/logo.png:
# bash scripts/generate-icons.sh
set -euo pipefail
cd "$(dirname "$0")/.."
SRC=public/logo.png
if [ ! -f "$SRC" ]; then
echo "Missing $SRC - drop the source logo there first (square PNG, >=512x512, transparent background)." >&2
exit 1
fi
magick "$SRC" -resize 32x32 public/favicon-32.png
magick "$SRC" -resize 192x192 public/favicon-192.png
magick "$SRC" -resize 180x180 -background white -alpha remove -alpha off public/apple-touch-icon.png
magick "$SRC" -define icon:auto-resize=16,32,48 public/favicon.ico
magick "$SRC" -resize 400x400 -background "#1e1e1e" -gravity center -extent 1200x630 public/og-image.png
echo "Generated favicon-32.png, favicon-192.png, apple-touch-icon.png, favicon.ico, og-image.png in public/"
+677 -10
View File
@@ -70,6 +70,78 @@
cursor: default;
}
.ts-menubar-item-active {
color: var(--text);
cursor: pointer;
padding: 0.1rem 0.3rem;
border-radius: 2px;
}
.ts-menubar-item-active:hover {
background: var(--row-hover);
}
.ts-menubar-dropdown {
position: relative;
}
.ts-menu {
position: absolute;
top: 100%;
left: 0;
z-index: 20;
display: flex;
flex-direction: column;
min-width: 260px;
padding: 0.25rem;
background: var(--bg-toolbar-1);
border: 1px solid var(--border);
border-radius: 4px;
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}
.ts-menu-item {
display: flex;
align-items: center;
gap: 0.5rem;
border: none;
background: transparent;
color: var(--text);
padding: 0.35rem 0.5rem;
border-radius: 2px;
cursor: pointer;
font-size: 12px;
text-align: left;
}
.ts-menu-item:hover:not(:disabled) {
background: var(--row-hover);
}
.ts-menu-item:disabled {
opacity: 0.4;
cursor: default;
}
.ts-menu-item-icon {
width: 1.1rem;
text-align: center;
}
.ts-menu-item-label {
flex: 1;
}
.ts-menu-item-shortcut {
color: var(--text-muted);
}
.ts-menu-separator {
height: 1px;
margin: 0.25rem 0.3rem;
background: var(--border-soft);
}
.ts-toolbar {
display: flex;
flex-direction: column;
@@ -136,10 +208,16 @@
max-width: 160px;
}
.ts-app-logo {
height: 20px;
width: 20px;
margin-left: auto;
border-radius: 4px;
}
.ts-app-title {
font-weight: 600;
color: var(--accent);
margin-left: auto;
}
.ts-toolbar-fields {
@@ -205,29 +283,72 @@
.ts-body {
flex: 1;
display: flex;
flex-direction: column;
overflow: hidden;
background: var(--bg);
}
.ts-upper {
display: flex;
flex-shrink: 0;
overflow: hidden;
}
.ts-tree-panel {
width: 260px;
flex-shrink: 0;
overflow-y: auto;
padding: 0.4rem 0.5rem;
border-right: 1px solid var(--border-soft);
}
.ts-main-panel {
.ts-resize-handle-vertical {
width: 4px;
flex-shrink: 0;
cursor: col-resize;
background: var(--border-soft);
}
.ts-resize-handle-vertical:hover,
.ts-resize-handle-horizontal:hover {
background: var(--accent);
}
.ts-resize-handle-horizontal {
height: 4px;
flex-shrink: 0;
cursor: row-resize;
background: var(--border-soft);
}
.ts-side-panel {
flex: 1;
min-width: 0;
overflow: hidden;
display: flex;
flex-direction: column;
min-width: 0;
}
.ts-banner-panel {
flex: 1;
min-height: 0;
overflow: hidden;
display: flex;
align-items: center;
justify-content: center;
background: #000;
border-bottom: 1px solid var(--border-soft);
}
.ts-server-banner {
width: 100%;
height: 100%;
object-fit: contain;
display: block;
}
.ts-info-panel {
flex-shrink: 0;
overflow-y: auto;
padding: 0.6rem 0.9rem;
border-bottom: 1px solid var(--border-soft);
background: var(--bg-toolbar-1);
}
@@ -345,6 +466,55 @@
background: color-mix(in srgb, #4caf50 30%, var(--button-bg-1)) !important;
}
.ts-muted-on {
background: color-mix(in srgb, var(--log-error) 30%, var(--button-bg-1)) !important;
}
.ts-client-away-message {
color: var(--text-muted);
font-style: italic;
font-size: 11px;
}
.ts-toolbar-away {
position: relative;
display: flex;
align-items: center;
}
.ts-icon-caret {
border: 1px solid var(--border);
border-left: none;
border-radius: 0 3px 3px 0;
background: linear-gradient(to bottom, var(--button-bg-1), var(--button-bg-2));
color: var(--text);
padding: 0.25rem 0.3rem;
cursor: pointer;
font-size: 10px;
line-height: 1;
}
.ts-icon-caret:hover:not(:disabled) {
background: linear-gradient(to bottom, var(--button-bg-hover-1), var(--button-bg-hover-2));
}
.ts-icon-caret:disabled {
opacity: 0.4;
cursor: default;
}
.ts-toolbar-away .ts-icon-button {
border-radius: 3px 0 0 3px;
}
.ts-away-on {
background: color-mix(in srgb, #e8a53d 30%, var(--button-bg-1)) !important;
}
.ts-menu-away {
min-width: 220px;
}
/* Chat */
.ts-chat-panel {
@@ -358,8 +528,8 @@
flex-shrink: 0;
display: flex;
gap: 2px;
padding: 0.3rem 0.5rem 0;
border-bottom: 1px solid var(--border-soft);
padding: 0 0.5rem 0.3rem;
border-top: 1px solid var(--border-soft);
overflow-x: auto;
}
@@ -368,8 +538,8 @@
align-items: center;
gap: 0.4rem;
border: 1px solid var(--border-soft);
border-bottom: none;
border-radius: 3px 3px 0 0;
border-top: none;
border-radius: 0 0 3px 3px;
background: var(--bg-toolbar-1);
color: var(--text-muted);
padding: 0.25rem 0.6rem;
@@ -487,6 +657,503 @@
opacity: 1;
}
.ts-dialog-backdrop {
position: fixed;
inset: 0;
background: rgba(0, 0, 0, 0.4);
display: flex;
align-items: center;
justify-content: center;
z-index: 15;
}
.ts-dialog {
background: var(--bg-toolbar-1);
border: 1px solid var(--border);
border-radius: 6px;
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
color: var(--text);
}
.ts-connect-dialog {
width: 480px;
}
.ts-favorites-dialog {
width: 760px;
}
.ts-away-dialog {
width: 420px;
}
.ts-away-dialog .ts-dialog-row {
align-items: center;
justify-content: space-between;
}
.ts-dialog-away-label {
font-size: 11px;
color: var(--text-muted);
}
.ts-away-dialog .ts-dialog-field {
flex-direction: row;
align-items: center;
gap: 0.4rem;
}
.ts-away-message-input {
border: 1px solid var(--border);
border-radius: 2px;
padding: 0.6rem;
font-size: 13px;
background: var(--input-bg);
color: var(--input-text);
}
.ts-favorites-body {
display: flex;
gap: 0;
}
.ts-favorites-list-col {
width: 220px;
flex-shrink: 0;
border-right: 1px solid var(--border-soft);
padding: 0.75rem;
display: flex;
flex-direction: column;
gap: 0.3rem;
}
.ts-favorites-list-group-title {
font-size: 10px;
font-weight: 600;
text-transform: uppercase;
color: var(--text-muted);
margin-top: 0.4rem;
}
.ts-favorites-list-group-title:first-child {
margin-top: 0;
}
.ts-favorites-list-empty {
font-size: 11px;
font-style: italic;
color: var(--text-muted);
}
.ts-favorites-list {
list-style: none;
margin: 0;
padding: 0;
overflow-y: auto;
}
.ts-favorites-list-item {
padding: 0.3rem 0.4rem;
border-radius: 2px;
font-size: 12px;
cursor: pointer;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.ts-favorites-list-item:hover {
background: var(--row-hover);
}
.ts-favorites-list-item-selected {
background: var(--row-hover);
outline: 1px solid var(--border);
}
.ts-favorites-fields-col {
flex: 1;
display: flex;
flex-direction: column;
gap: 0.6rem;
padding: 0.75rem;
}
.ts-favorites-profile-col {
width: 200px;
flex-shrink: 0;
border-left: 1px solid var(--border-soft);
padding: 0.75rem;
display: flex;
flex-direction: column;
gap: 0.6rem;
}
.ts-options-dialog {
width: 720px;
}
.ts-options-body {
display: flex;
height: min(560px, 85vh);
}
.ts-options-sidebar {
width: 200px;
flex-shrink: 0;
border-right: 1px solid var(--border-soft);
padding: 0.5rem;
display: flex;
flex-direction: column;
gap: 0.15rem;
overflow-y: auto;
}
.ts-options-sidebar-item {
display: flex;
align-items: center;
gap: 0.5rem;
padding: 0.4rem 0.5rem;
border-radius: 2px;
font-size: 12px;
text-align: left;
background: none;
border: none;
color: var(--text);
cursor: pointer;
}
.ts-options-sidebar-item:hover {
background: var(--row-hover);
}
.ts-options-sidebar-item-active {
background: var(--row-hover);
outline: 1px solid var(--border);
font-weight: 600;
}
.ts-options-sidebar-icon {
width: 1.2em;
text-align: center;
}
.ts-options-content {
flex: 1;
padding: 1rem;
overflow-y: auto;
min-width: 0;
}
.ts-options-content h3 {
margin: 0 0 0.5rem;
}
.ts-options-placeholder {
font-size: 12px;
font-style: italic;
color: var(--text-muted);
}
.ts-options-subtitle {
font-size: 11px;
color: var(--text-muted);
margin: 0 0 0.75rem;
}
.ts-options-columns {
display: flex;
gap: 1rem;
}
.ts-options-profile-list {
width: 110px;
flex-shrink: 0;
list-style: none;
margin: 0;
padding: 0;
}
.ts-options-profile-item-active {
padding: 0.3rem 0.4rem;
border-radius: 2px;
font-size: 12px;
background: var(--row-hover);
outline: 1px solid var(--border);
}
.ts-options-fields {
flex: 1;
display: flex;
flex-direction: column;
gap: 0.6rem;
min-width: 0;
}
.ts-options-field {
display: flex;
flex-direction: column;
gap: 0.2rem;
font-size: 11px;
color: var(--text-muted);
}
.ts-options-field select,
.ts-options-field-inline input {
background: var(--input-bg);
color: var(--text);
border: 1px solid var(--border);
border-radius: 2px;
padding: 0.3rem;
font-size: 12px;
}
.ts-options-field select:disabled {
opacity: 0.6;
}
.ts-options-slider-row {
display: flex;
justify-content: space-between;
font-size: 11px;
color: var(--text-muted);
}
.ts-options-slider-label {
font-weight: 600;
color: var(--text);
}
.ts-options-slider-with-value {
display: flex;
align-items: center;
gap: 0.5rem;
}
.ts-options-slider-with-value input[type="range"] {
flex: 1;
}
.ts-options-db-value {
font-size: 11px;
color: var(--text-muted);
width: 4.5em;
text-align: right;
}
.ts-options-fieldset {
border: 1px solid var(--border-soft);
border-radius: 4px;
padding: 0.5rem 0.75rem 0.75rem;
margin: 0;
}
.ts-options-fieldset legend {
font-size: 11px;
color: var(--text-muted);
padding: 0 0.3rem;
}
.ts-options-checkbox,
.ts-options-radio {
display: flex;
align-items: center;
gap: 0.4rem;
font-size: 12px;
padding: 0.15rem 0;
}
.ts-options-dsp-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 0.2rem 1rem;
}
.ts-options-level-wrap {
position: relative;
margin: 0.5rem 0;
}
.ts-options-level-track {
height: 8px;
border-radius: 4px;
background: var(--input-bg);
border: 1px solid var(--border-soft);
overflow: hidden;
}
.ts-options-level-fill {
height: 100%;
background: var(--accent);
transition: width 0.05s linear;
}
.ts-options-level-threshold {
width: 100%;
margin-top: 0.3rem;
}
.ts-options-field-row {
display: flex;
align-items: center;
gap: 0.5rem;
}
.ts-options-field-inline {
display: flex;
align-items: center;
gap: 0.3rem;
font-size: 11px;
color: var(--text-muted);
}
.ts-options-field-inline input[type="number"] {
width: 4em;
}
.ts-options-sounds-table {
width: 100%;
border-collapse: collapse;
margin-top: 0.75rem;
font-size: 12px;
}
.ts-options-sounds-table td {
padding: 0.35rem 0.5rem 0.35rem 0;
vertical-align: middle;
border-bottom: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
}
.ts-options-sounds-source {
color: var(--text-muted);
}
.ts-options-sounds-table button {
font-size: 11px;
white-space: nowrap;
}
.ts-options-test-dot {
width: 10px;
height: 10px;
border-radius: 50%;
background: var(--border);
display: inline-block;
}
.ts-options-test-dot-on {
background: #4caf50;
}
.ts-dialog-titlebar {
display: flex;
align-items: center;
justify-content: space-between;
padding: 0.5rem 0.75rem;
border-bottom: 1px solid var(--border-soft);
font-weight: 600;
}
.ts-dialog-titlebar button {
background: transparent;
border: none;
color: var(--text-muted);
cursor: pointer;
font-size: 13px;
}
.ts-dialog-titlebar button:hover {
color: var(--text);
}
.ts-dialog-body {
padding: 0.75rem;
display: flex;
flex-direction: column;
gap: 0.6rem;
}
.ts-dialog-row {
display: flex;
gap: 0.6rem;
}
.ts-dialog-field {
display: flex;
flex-direction: column;
gap: 0.2rem;
font-size: 11px;
color: var(--text-muted);
}
.ts-dialog-field-grow {
flex: 1;
}
.ts-dialog-field input,
.ts-dialog-field select {
border: 1px solid var(--border);
border-radius: 2px;
padding: 0.3rem 0.4rem;
font-size: 13px;
background: var(--input-bg);
color: var(--input-text);
}
.ts-dialog-field input:disabled,
.ts-dialog-field select:disabled {
opacity: 0.5;
}
.ts-dialog-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 0.6rem;
padding-top: 0.4rem;
border-top: 1px solid var(--border-soft);
}
.ts-dialog-checkbox {
display: flex;
align-items: center;
gap: 0.4rem;
font-size: 12px;
color: var(--text-muted);
align-self: end;
}
.ts-dialog-buttons {
display: flex;
align-items: center;
justify-content: space-between;
padding: 0.6rem 0.75rem;
border-top: 1px solid var(--border-soft);
}
.ts-dialog-buttons-right {
display: flex;
gap: 0.5rem;
}
.ts-dialog-buttons button {
border: 1px solid var(--border);
border-radius: 3px;
background: linear-gradient(to bottom, var(--button-bg-1), var(--button-bg-2));
color: var(--text);
padding: 0.3rem 0.8rem;
cursor: pointer;
font-size: 12px;
}
.ts-dialog-buttons button:hover:not(:disabled) {
background: linear-gradient(to bottom, var(--button-bg-hover-1), var(--button-bg-hover-2));
}
.ts-dialog-buttons button:disabled {
opacity: 0.4;
cursor: default;
}
.ts-poke-compose-backdrop {
position: fixed;
inset: 0;
+1967 -186
View File
File diff suppressed because it is too large. Load diff
+507
View File
@@ -0,0 +1,507 @@
import { createContext, useContext, useEffect, useState, type ReactNode } from "react";
export type Lang = "de" | "en";
export type LangPref = "auto" | Lang;
const LANGUAGE_KEY = "webspeak3:language";
// Keyed flat dictionary. Every user-facing string in the app should have an
// entry here in both languages - falls back to the English string (or the
// raw key) if a translation is missing, so a partial dictionary never blanks
// out the UI.
const translations: Record<Lang, Record<string, string>> = {
de: {
"menu.connections": "Verbindungen",
"menu.connections.connect": "Verbinden",
"menu.connections.disconnectCurrent": "Aktuelle Verbindung trennen",
"menu.connections.disconnectAll": "Alle Verbindungen trennen",
"menu.favorites": "Favoriten",
"menu.favorites.add": "Zu Favoriten hinzufügen",
"menu.favorites.manage": "Favoriten verwalten",
"menu.self": "Selbst",
"menu.rights": "Rechte",
"menu.extras": "Extras",
"menu.help": "Hilfe",
"menu.extras.identities": "Identitäten",
"menu.extras.contacts": "Kontakte",
"menu.extras.collectedUrls": "Gesammelte URLs",
"menu.extras.fileTransfers": "Dateitransfers",
"menu.extras.inviteFriend": "Freund einladen",
"menu.extras.offlineMessages": "Offline Nachrichten",
"menu.extras.whisperLists": "Whisperlisten",
"menu.extras.whisperHistory": "Whisper Verlauf",
"menu.extras.clientLog": "Client Protokoll",
"menu.extras.banList": "Bannliste",
"menu.extras.complaintList": "Beschwerdeliste",
"menu.extras.serverQueryLogin": "ServerQuery Login",
"menu.extras.serverLog": "Server Protokoll",
"menu.extras.startRecording": "Aufnahme starten",
"menu.extras.startMultitrackRecording": "Start Multitrack Recording",
"menu.extras.stopRecording": "Aufnahme beenden",
"menu.extras.installOverwolf": "Overwolf installieren",
"menu.extras.options": "Optionen",
"toolbar.setAway": "Als abwesend markieren",
"toolbar.backOnline": "Wieder online",
"toolbar.awayOptions": "Abwesenheitsoptionen",
"toolbar.micEnable": "Mikrofon aktivieren",
"toolbar.micMute": "Mikrofon stummschalten",
"toolbar.micUnmute": "Mikrofon aktivieren (unmute)",
"toolbar.vadSensitivity": "Empfindlichkeit der Sprachaktivierung",
"toolbar.muteSound": "Ton stummschalten (Ausgabe stumm)",
"toolbar.unmuteSound": "Ton aktivieren (Ausgabe an)",
"toolbar.chooseOutputDevice": "Wiedergabegerät wählen",
"toolbar.toggleTheme": "Design wechseln",
"away.setGlobal": "Global abwesend setzen",
"away.setGlobalStatus": "Abwesenheit-Status global setzen",
"connect.title": "Verbinden",
"connect.serverAddress": "Server Nickname oder Adresse:",
"connect.serverPassword": "Server Passwort:",
"connect.nickname": "Nickname:",
"connect.phoneticNickname": "Phonetischer Nickname:",
"connect.identity": "Identität:",
"connect.defaultChannel": "Standard Channel:",
"connect.recordingProfile": "Aufnahmeprofil:",
"connect.channelPassword": "Channel Passwort:",
"connect.playbackProfile": "Wiedergabeprofil:",
"connect.onetimeGrant": "Einmalige Berechtigung:",
"connect.hotkeyProfile": "Hotkeyprofil:",
"connect.sendMyTeamSpeakId": "myTeamSpeak ID senden",
"connect.soundPack": "Sound Pack:",
"connect.more": "Mehr",
"connect.less": "Weniger",
"connect.connect": "Verbinden",
"connect.connecting": "Verbinde…",
"connect.newTab": "In neuem Tab",
"connect.cancel": "Abbrechen",
"favorites.title": "🔖 myTeamSpeak Favoriten",
"favorites.synced": "Synchronisierte Favoriten",
"favorites.notLoggedIn": "Nicht angemeldet",
"favorites.local": "Lokale Favoriten",
"favorites.unnamed": "(unbenannt)",
"favorites.bookmarkName": "Bookmark Name:",
"favorites.newFavoriteName": "Neuer Favorit",
"favorites.showServerQueryClients": "ServerQuery Clients anzeigen",
"favorites.connectOnStartup": "Beim Start verbinden",
"favorites.enableMyTeamSpeak": "Aktiviere myTeamSpeak Funktionen",
"favorites.new": "Neuer Favorit",
"favorites.newFolder": "Neuer Ordner",
"favorites.remove": "Entfernen",
"favorites.ok": "OK",
"favorites.cancel": "Abbrechen",
"favorites.apply": "Anwenden",
"away.dialog.title": "Abwesenheit-Nachricht setzen",
"away.dialog.message": "Nachricht:",
"away.dialog.template": "Vorlage:",
"away.dialog.none": "<Keine>",
"away.dialog.ok": "OK",
"away.dialog.save": "Speichern",
"away.dialog.cancel": "Abbrechen",
"options.title": "Optionen",
"options.ok": "OK",
"options.cancel": "Abbrechen",
"options.notImplemented": "Diese Einstellungen sind noch nicht implementiert.",
"options.section.anwendung": "Anwendung",
"options.section.wiedergabe": "Wiedergabe",
"options.section.aufnahme": "Aufnahme",
"options.section.design": "Design",
"options.section.erweiterungen": "Erweiterungen",
"options.section.hotkeys": "Hotkeys",
"options.section.whispern": "Whispern",
"options.section.downloads": "Downloads",
"options.section.chat": "Chat",
"options.section.sicherheit": "Sicherheit",
"options.section.nachrichten": "Nachrichten",
"options.section.meldungen": "Meldungen",
"options.section.sounds": "Sounds",
"app.title": "Anwendung",
"app.subtitle": "Allgemeine Anwendungseinstellungen",
"app.language": "Sprache",
"app.language.auto": "Systemvorgabe",
"app.language.de": "Deutsch",
"app.language.en": "English",
"playback.title": "Wiedergabe",
"playback.subtitle": "Ändern der Wiedergabeeinstellungen",
"playback.profile": "Profile",
"playback.default": "Standard",
"playback.device": "Wiedergabegerät:",
"playback.systemDefault": "System default",
"playback.quiet": "Leise",
"playback.loud": "Laut",
"playback.voiceVolume": "Sprachlautstärke",
"playback.playTestTone": "▶ Test Ton abspielen",
"playback.options": "Optionen",
"playback.autoVolume": "Automatische Lautstärkeanpassung",
"playback.ownMicClicks": "Eigener Client spielt Mikro Klicks",
"playback.otherMicClicks": "Andere Clients spielen Mikro Klicks",
"recording.title": "Aufnahme",
"recording.subtitle": "Ändern der Aufnahmeeinstellungen",
"recording.device": "Aufnahmegerät:",
"recording.activation": "Aktivierung",
"recording.pushToTalk": "Push-To-Talk",
"recording.continuous": "Dauersenden",
"recording.voiceActivation": "Automatische Spracherkennung",
"recording.testStart": "Test starten",
"recording.testStop": "Test beenden",
"recording.hangoverDelay": "Abschaltverzögerung:",
"recording.secondsUnit": "Sek",
"recording.dsp": "Digital Signal Processing",
"recording.typingAttenuation": "Typing attenuation",
"recording.echoCancellation": "Echo Dämpfung",
"recording.noiseSuppression": "Hintergrundgeräusche entfernen",
"info.address": "Adresse:",
"info.version": "Version:",
"info.license": "Lizenz:",
"info.currentClients": "Aktuelle Clients:",
"info.currentChannels": "Aktuelle Channel:",
"info.topic": "Topic:",
"info.audioCodec": "Audio Codec:",
"info.passwordProtected": "Passwort geschützt:",
"info.clients": "Clients:",
"info.yes": "Ja",
"info.no": "Nein",
"tree.notConnected": "Nicht verbunden",
"tree.clickToSelect": "Klicken zum Auswählen, Doppelklick zum Beitreten",
"tree.passwordProtected": "Passwortgeschützt",
"tree.privateChatWith": "Privater Chat mit",
"tree.poke": "Anstupsen",
"tree.channelCommander": "Channel Commander",
"tree.away": "Abwesend",
"tree.micMuted": "Mikrofon stummgeschaltet",
"tree.soundMuted": "Ton stummgeschaltet (deafened)",
"chat.server": "Server",
"chat.channel": "Channel",
"chat.notConnected": "Nicht verbunden",
"chat.messageChannel": "Nachricht an Channel...",
"chat.messageServer": "Nachricht an Server...",
"chat.messagePartner": "Nachricht an {name}...",
"chat.send": "Senden",
"chat.you": "Du",
"poke.title": "Anstupsen",
"poke.optionalMessage": "Optionale Nachricht...",
"poke.send": "Anstupsen",
"poke.cancel": "Abbrechen",
"poke.pokedYou": "hat dich angestupst",
"poke.dismiss": "Schließen",
"connectError.dismiss": "Schließen",
"dialog.close": "Schließen",
"sounds.title": "Sounds",
"sounds.subtitle": "Sound-Benachrichtigungen für Ereignisse festlegen",
"sounds.enable": "Sounds aktivieren",
"sounds.volume": "Lautstärke",
"sounds.eventEnable": "Diesen Sound aktivieren",
"sounds.event.connect": "Verbunden",
"sounds.event.disconnect": "Getrennt",
"sounds.event.clientJoin": "Client kommt",
"sounds.event.clientLeave": "Client geht",
"sounds.event.message": "Nachricht empfangen",
"sounds.event.poke": "Anstupsen erhalten",
"sounds.default": "Standard",
"sounds.custom": "Eigene Datei: {name}",
"sounds.test": "▶ Testen",
"sounds.upload": "Hochladen",
"sounds.reset": "Zurücksetzen",
"nachrichten.title": "Nachrichten",
"nachrichten.subtitle": "Nachrichten anpassen",
"nachrichten.disconnectMessage": "Verbindung trennen:",
"nachrichten.disconnectMessagePlaceholder": "verlassen",
"nachrichten.presetsTitle": "Voreingestellte Nachrichten",
"nachrichten.type": "Typ",
"nachrichten.type.away": "Abwesend",
"nachrichten.templateName": "Vorlagenname",
"nachrichten.message": "Nachricht",
"nachrichten.add": "Hinzufügen",
"nachrichten.delete": "Löschen",
},
en: {
"menu.connections": "Connections",
"menu.connections.connect": "Connect",
"menu.connections.disconnectCurrent": "Disconnect from current server",
"menu.connections.disconnectAll": "Disconnect from all servers",
"menu.favorites": "Bookmarks",
"menu.favorites.add": "Add bookmark",
"menu.favorites.manage": "Manage bookmarks",
"menu.self": "Self",
"menu.rights": "Permissions",
"menu.extras": "Tools",
"menu.help": "Help",
"menu.extras.identities": "Identities",
"menu.extras.contacts": "Contacts",
"menu.extras.collectedUrls": "Collected URLs",
"menu.extras.fileTransfers": "File Transfers",
"menu.extras.inviteFriend": "Invite a friend",
"menu.extras.offlineMessages": "Offline Messages",
"menu.extras.whisperLists": "Whisper Lists",
"menu.extras.whisperHistory": "Whisper History",
"menu.extras.clientLog": "Client Log",
"menu.extras.banList": "Ban List",
"menu.extras.complaintList": "Complaint List",
"menu.extras.serverQueryLogin": "ServerQuery Login",
"menu.extras.serverLog": "Server Log",
"menu.extras.startRecording": "Start Recording",
"menu.extras.startMultitrackRecording": "Start Multitrack Recording",
"menu.extras.stopRecording": "Stop Recording",
"menu.extras.installOverwolf": "Install Overwolf",
"menu.extras.options": "Options",
"toolbar.setAway": "Set away",
"toolbar.backOnline": "Back online",
"toolbar.awayOptions": "Away options",
"toolbar.micEnable": "Enable microphone",
"toolbar.micMute": "Mute microphone",
"toolbar.micUnmute": "Unmute microphone",
"toolbar.vadSensitivity": "Voice activation sensitivity",
"toolbar.muteSound": "Mute sound (deafen)",
"toolbar.unmuteSound": "Unmute sound (undeafen)",
"toolbar.chooseOutputDevice": "Choose output device",
"toolbar.toggleTheme": "Toggle theme",
"away.setGlobal": "Set globally away",
"away.setGlobalStatus": "Set global away status",
"connect.title": "Connect",
"connect.serverAddress": "Server nickname or address:",
"connect.serverPassword": "Server password:",
"connect.nickname": "Nickname:",
"connect.phoneticNickname": "Phonetic nickname:",
"connect.identity": "Identity:",
"connect.defaultChannel": "Default channel:",
"connect.recordingProfile": "Capture profile:",
"connect.channelPassword": "Channel password:",
"connect.playbackProfile": "Playback profile:",
"connect.onetimeGrant": "One-time privilege key:",
"connect.hotkeyProfile": "Hotkey profile:",
"connect.sendMyTeamSpeakId": "Send myTeamSpeak ID",
"connect.soundPack": "Sound pack:",
"connect.more": "More",
"connect.less": "Less",
"connect.connect": "Connect",
"connect.connecting": "Connecting…",
"connect.newTab": "In new tab",
"connect.cancel": "Cancel",
"favorites.title": "🔖 myTeamSpeak Bookmarks",
"favorites.synced": "Synced Bookmarks",
"favorites.notLoggedIn": "Not logged in",
"favorites.local": "Local Bookmarks",
"favorites.unnamed": "(unnamed)",
"favorites.bookmarkName": "Bookmark name:",
"favorites.newFavoriteName": "New bookmark",
"favorites.showServerQueryClients": "Show ServerQuery clients",
"favorites.connectOnStartup": "Connect on startup",
"favorites.enableMyTeamSpeak": "Enable myTeamSpeak features",
"favorites.new": "New bookmark",
"favorites.newFolder": "New folder",
"favorites.remove": "Remove",
"favorites.ok": "OK",
"favorites.cancel": "Cancel",
"favorites.apply": "Apply",
"away.dialog.title": "Set away message",
"away.dialog.message": "Message:",
"away.dialog.template": "Template:",
"away.dialog.none": "<None>",
"away.dialog.ok": "OK",
"away.dialog.save": "Save",
"away.dialog.cancel": "Cancel",
"options.title": "Options",
"options.ok": "OK",
"options.cancel": "Cancel",
"options.notImplemented": "This setting isn't implemented yet.",
"options.section.anwendung": "Application",
"options.section.wiedergabe": "Playback",
"options.section.aufnahme": "Capture",
"options.section.design": "Appearance",
"options.section.erweiterungen": "Addons",
"options.section.hotkeys": "Hotkeys",
"options.section.whispern": "Whisper",
"options.section.downloads": "Downloads",
"options.section.chat": "Chat",
"options.section.sicherheit": "Security",
"options.section.nachrichten": "Messages",
"options.section.meldungen": "Notifications",
"options.section.sounds": "Sounds",
"app.title": "Application",
"app.subtitle": "General application settings",
"app.language": "Language",
"app.language.auto": "System default",
"app.language.de": "Deutsch",
"app.language.en": "English",
"playback.title": "Playback",
"playback.subtitle": "Change your playback settings",
"playback.profile": "Profile",
"playback.default": "Default",
"playback.device": "Playback device:",
"playback.systemDefault": "System default",
"playback.quiet": "Quiet",
"playback.loud": "Loud",
"playback.voiceVolume": "Voice volume",
"playback.playTestTone": "▶ Play test sound",
"playback.options": "Options",
"playback.autoVolume": "Automatic volume adjustment",
"playback.ownMicClicks": "Play mic clicks for own client",
"playback.otherMicClicks": "Play mic clicks for other clients",
"recording.title": "Capture",
"recording.subtitle": "Change your capture settings",
"recording.device": "Capture device:",
"recording.activation": "Activation",
"recording.pushToTalk": "Push-To-Talk",
"recording.continuous": "Continuous transmission",
"recording.voiceActivation": "Voice activation detection",
"recording.testStart": "Start test",
"recording.testStop": "Stop test",
"recording.hangoverDelay": "Delay before deactivation:",
"recording.secondsUnit": "sec",
"recording.dsp": "Digital Signal Processing",
"recording.typingAttenuation": "Typing attenuation",
"recording.echoCancellation": "Echo cancellation",
"recording.noiseSuppression": "Remove background noise",
"info.address": "Address:",
"info.version": "Version:",
"info.license": "License:",
"info.currentClients": "Current clients:",
"info.currentChannels": "Current channels:",
"info.topic": "Topic:",
"info.audioCodec": "Audio codec:",
"info.passwordProtected": "Password protected:",
"info.clients": "Clients:",
"info.yes": "Yes",
"info.no": "No",
"tree.notConnected": "Not connected",
"tree.clickToSelect": "Click to select, double-click to join",
"tree.passwordProtected": "Password protected",
"tree.privateChatWith": "Private chat with",
"tree.poke": "Poke",
"tree.channelCommander": "Channel commander",
"tree.away": "Away",
"tree.micMuted": "Microphone muted",
"tree.soundMuted": "Sound muted (deafened)",
"chat.server": "Server",
"chat.channel": "Channel",
"chat.notConnected": "Not connected",
"chat.messageChannel": "Message channel...",
"chat.messageServer": "Message server...",
"chat.messagePartner": "Message {name}...",
"chat.send": "Send",
"chat.you": "You",
"poke.title": "Poke",
"poke.optionalMessage": "Optional message...",
"poke.send": "Poke",
"poke.cancel": "Cancel",
"poke.pokedYou": "poked you",
"poke.dismiss": "Dismiss",
"connectError.dismiss": "Dismiss",
"dialog.close": "Close",
"sounds.title": "Sounds",
"sounds.subtitle": "Configure sound notifications for events",
"sounds.enable": "Enable sounds",
"sounds.volume": "Volume",
"sounds.eventEnable": "Enable this sound",
"sounds.event.connect": "Connected",
"sounds.event.disconnect": "Disconnected",
"sounds.event.clientJoin": "Client joins",
"sounds.event.clientLeave": "Client leaves",
"sounds.event.message": "Message received",
"sounds.event.poke": "Poke received",
"sounds.default": "Default",
"sounds.custom": "Custom file: {name}",
"sounds.test": "▶ Test",
"sounds.upload": "Upload",
"sounds.reset": "Reset",
"nachrichten.title": "Messages",
"nachrichten.subtitle": "Customize messages",
"nachrichten.disconnectMessage": "Disconnect:",
"nachrichten.disconnectMessagePlaceholder": "leaving",
"nachrichten.presetsTitle": "Preset messages",
"nachrichten.type": "Type",
"nachrichten.type.away": "Away",
"nachrichten.templateName": "Template name",
"nachrichten.message": "Message",
"nachrichten.add": "Add",
"nachrichten.delete": "Delete",
},
};
function detectSystemLang(): Lang {
const nav = typeof navigator !== "undefined" ? navigator.language : "en";
return nav?.toLowerCase().startsWith("de") ? "de" : "en";
}
export function resolveLang(pref: LangPref): Lang {
return pref === "auto" ? detectSystemLang() : pref;
}
export function loadLangPref(): LangPref {
const raw = localStorage.getItem(LANGUAGE_KEY);
return raw === "de" || raw === "en" || raw === "auto" ? raw : "auto";
}
export function saveLangPref(pref: LangPref) {
localStorage.setItem(LANGUAGE_KEY, pref);
}
type TranslateFn = (key: string, vars?: Record<string, string>) => string;
function interpolate(template: string, vars?: Record<string, string>): string {
if (!vars) return template;
return template.replace(/\{(\w+)\}/g, (match, name) => vars[name] ?? match);
}
const LanguageContext = createContext<{ lang: Lang; langPref: LangPref; setLangPref: (p: LangPref) => void; t: TranslateFn }>({
lang: "en",
langPref: "auto",
setLangPref: () => {},
t: (key) => translations.en[key] ?? key,
});
export function LanguageProvider({ children }: { children: ReactNode }) {
const [langPref, setLangPrefState] = useState<LangPref>(() => loadLangPref());
const lang = resolveLang(langPref);
useEffect(() => {
saveLangPref(langPref);
}, [langPref]);
const t: TranslateFn = (key, vars) =>
interpolate(translations[lang][key] ?? translations.en[key] ?? key, vars);
return (
<LanguageContext.Provider value={{ lang, langPref, setLangPref: setLangPrefState, t }}>
{children}
</LanguageContext.Provider>
);
}
export function useLanguage() {
return useContext(LanguageContext);
}
export function useT() {
return useContext(LanguageContext).t;
}
+221
View File
@@ -0,0 +1,221 @@
export type SoundEventId = "connect" | "disconnect" | "clientJoin" | "clientLeave" | "message" | "poke";
export const SOUND_EVENTS: SoundEventId[] = ["connect", "disconnect", "clientJoin", "clientLeave", "message", "poke"];
const ENABLED_KEY = "webspeak3:sounds-enabled";
const VOLUME_KEY = "webspeak3:sounds-volume";
const EVENT_ENABLED_KEY_PREFIX = "webspeak3:sounds-enabled:";
const DB_NAME = "webspeak3-sounds";
const STORE_NAME = "custom";
interface StoredSound {
blob: Blob;
name: string;
}
function openDb(): Promise<IDBDatabase> {
return new Promise((resolve, reject) => {
const req = indexedDB.open(DB_NAME, 1);
req.onupgradeneeded = () => {
req.result.createObjectStore(STORE_NAME);
};
req.onsuccess = () => resolve(req.result);
req.onerror = () => reject(req.error);
});
}
export async function saveCustomSound(event: SoundEventId, file: File): Promise<void> {
const db = await openDb();
await new Promise<void>((resolve, reject) => {
const tx = db.transaction(STORE_NAME, "readwrite");
tx.objectStore(STORE_NAME).put({ blob: file, name: file.name } satisfies StoredSound, event);
tx.oncomplete = () => resolve();
tx.onerror = () => reject(tx.error);
});
db.close();
}
export async function loadCustomSound(event: SoundEventId): Promise<StoredSound | undefined> {
const db = await openDb();
const result = await new Promise<StoredSound | undefined>((resolve, reject) => {
const tx = db.transaction(STORE_NAME, "readonly");
const req = tx.objectStore(STORE_NAME).get(event);
req.onsuccess = () => resolve(req.result as StoredSound | undefined);
req.onerror = () => reject(req.error);
});
db.close();
return result;
}
export async function clearCustomSound(event: SoundEventId): Promise<void> {
const db = await openDb();
await new Promise<void>((resolve, reject) => {
const tx = db.transaction(STORE_NAME, "readwrite");
tx.objectStore(STORE_NAME).delete(event);
tx.oncomplete = () => resolve();
tx.onerror = () => reject(tx.error);
});
db.close();
}
export function loadSoundsEnabled(): boolean {
const raw = localStorage.getItem(ENABLED_KEY);
return raw === null ? true : raw === "true";
}
export function saveSoundsEnabled(enabled: boolean): void {
localStorage.setItem(ENABLED_KEY, String(enabled));
}
export function loadEventSoundEnabled(event: SoundEventId): boolean {
const raw = localStorage.getItem(EVENT_ENABLED_KEY_PREFIX + event);
return raw === null ? true : raw === "true";
}
export function saveEventSoundEnabled(event: SoundEventId, enabled: boolean): void {
localStorage.setItem(EVENT_ENABLED_KEY_PREFIX + event, String(enabled));
}
export function loadSoundsVolume(): number {
const raw = localStorage.getItem(VOLUME_KEY);
const n = raw ? Number(raw) : 0.5;
return Number.isFinite(n) ? Math.min(1, Math.max(0, n)) : 0.5;
}
export function saveSoundsVolume(volume: number): void {
localStorage.setItem(VOLUME_KEY, String(volume));
}
type SinkableElement = HTMLAudioElement & { setSinkId?: (id: string) => Promise<void> };
/**
* Notification sounds get their own AudioContext, independent from the
* voice AudioContext in voice.ts - that one is created on connect and torn
* down on disconnect, but sounds must keep working (and be testable from
* Options) regardless of connection state.
*/
class NotificationSoundPlayer {
private context: AudioContext | null = null;
private destination: MediaStreamAudioDestinationNode | null = null;
private element: SinkableElement | null = null;
private outputDeviceId = "";
private ensure(): { context: AudioContext; destination: MediaStreamAudioDestinationNode } {
if (!this.context) {
const context = new AudioContext();
const destination = context.createMediaStreamDestination();
const element: SinkableElement = new Audio();
element.srcObject = destination.stream;
element.autoplay = true;
this.context = context;
this.destination = destination;
this.element = element;
if (this.outputDeviceId && typeof element.setSinkId === "function") {
element.setSinkId(this.outputDeviceId).catch(() => {});
}
}
return { context: this.context, destination: this.destination! };
}
async setOutputDevice(deviceId: string): Promise<void> {
this.outputDeviceId = deviceId;
if (this.element && typeof this.element.setSinkId === "function") {
await this.element.setSinkId(deviceId).catch(() => {});
}
}
async playBlob(blob: Blob, volume: number): Promise<void> {
const { context, destination } = this.ensure();
if (context.state === "suspended") await context.resume().catch(() => {});
const arrayBuffer = await blob.arrayBuffer();
const audioBuffer = await context.decodeAudioData(arrayBuffer);
const source = context.createBufferSource();
source.buffer = audioBuffer;
const gain = context.createGain();
gain.gain.value = volume;
source.connect(gain).connect(destination);
source.start();
}
playSynth(event: SoundEventId, volume: number): void {
const { context, destination } = this.ensure();
if (context.state === "suspended") context.resume().catch(() => {});
const now = context.currentTime;
for (const note of synthNotes(event)) {
this.playNote(context, destination, now + note.delay, note.freq, note.duration, volume * note.gain);
}
}
private playNote(
context: AudioContext,
destination: AudioNode,
startTime: number,
freq: number,
duration: number,
peakGain: number
): void {
const osc = context.createOscillator();
osc.type = "sine";
osc.frequency.value = freq;
const gain = context.createGain();
gain.gain.setValueAtTime(0, startTime);
gain.gain.linearRampToValueAtTime(peakGain, startTime + 0.02);
gain.gain.exponentialRampToValueAtTime(0.0001, startTime + duration);
osc.connect(gain).connect(destination);
osc.start(startTime);
osc.stop(startTime + duration + 0.05);
}
}
/** Soft, modern two/three-note chimes - a sine-wave, quick-attack/exponential-decay
* shape reads as gentle rather than the harsh square/saw beeps of classic UI sounds. */
function synthNotes(event: SoundEventId): { delay: number; freq: number; duration: number; gain: number }[] {
switch (event) {
case "connect":
return [
{ delay: 0, freq: 523.25, duration: 0.16, gain: 0.5 },
{ delay: 0.09, freq: 783.99, duration: 0.22, gain: 0.5 },
];
case "disconnect":
return [
{ delay: 0, freq: 659.25, duration: 0.16, gain: 0.45 },
{ delay: 0.09, freq: 440.0, duration: 0.24, gain: 0.45 },
];
case "clientJoin":
return [{ delay: 0, freq: 880.0, duration: 0.14, gain: 0.4 }];
case "clientLeave":
return [{ delay: 0, freq: 587.33, duration: 0.16, gain: 0.4 }];
case "message":
return [
{ delay: 0, freq: 987.77, duration: 0.09, gain: 0.35 },
{ delay: 0.06, freq: 1318.51, duration: 0.12, gain: 0.3 },
];
case "poke":
return [
{ delay: 0, freq: 987.77, duration: 0.1, gain: 0.5 },
{ delay: 0.12, freq: 987.77, duration: 0.1, gain: 0.5 },
];
}
}
const player = new NotificationSoundPlayer();
export function setSoundsOutputDevice(deviceId: string): void {
void player.setOutputDevice(deviceId);
}
export async function playSound(event: SoundEventId): Promise<void> {
if (!loadSoundsEnabled()) return;
if (!loadEventSoundEnabled(event)) return;
const volume = loadSoundsVolume();
const custom = await loadCustomSound(event).catch(() => undefined);
if (custom) {
try {
await player.playBlob(custom.blob, volume);
return;
} catch {
// Stored file failed to decode (corrupted/unsupported) - fall back to the default chime.
}
}
player.playSynth(event, volume);
}
+102 -9
View File
@@ -24,8 +24,19 @@ function base64ToInt16(b64: string): Int16Array {
return new Int16Array(bytes.buffer);
}
/** How long transmission continues after the level drops back below the threshold, so words aren't clipped. */
const VAD_HANGOVER_SECONDS = 0.4;
export interface MicCaptureOptions {
onFrame: (base64Pcm: string) => void;
onActivity?: (active: boolean) => void;
/** Reports the raw input RMS (roughly 0-1) on every processing tick, for live level meters. */
onLevel?: (rms: number) => void;
threshold?: number;
/** How long transmission continues after the level drops back below the threshold, so words aren't clipped. */
hangoverSeconds?: number;
/** `MediaDeviceInfo.deviceId` of the input device to use - omit for the system default. */
deviceId?: string;
echoCancellation?: boolean;
noiseSuppression?: boolean;
}
/**
* Captures the microphone and emits base64-encoded mono 16-bit PCM frames.
@@ -40,24 +51,49 @@ export class MicCapture {
private source: MediaStreamAudioSourceNode | null = null;
private processor: ScriptProcessorNode | null = null;
private silence: GainNode | null = null;
private monitorTarget: AudioNode | null = null;
private pending: number[] = [];
private active = false;
private activeUntil = 0;
private onFrame: (base64Pcm: string) => void;
private onActivity?: (active: boolean) => void;
private onLevel?: (rms: number) => void;
private deviceId?: string;
private echoCancellation: boolean;
private noiseSuppression: boolean;
threshold: number;
hangoverSeconds: number;
constructor(
private context: AudioContext,
private onFrame: (base64Pcm: string) => void,
private onActivity?: (active: boolean) => void,
threshold = 0.02
options: MicCaptureOptions
) {
this.threshold = threshold;
this.onFrame = options.onFrame;
this.onActivity = options.onActivity;
this.onLevel = options.onLevel;
this.threshold = options.threshold ?? 0.02;
this.hangoverSeconds = options.hangoverSeconds ?? 0.3;
this.deviceId = options.deviceId;
this.echoCancellation = options.echoCancellation ?? true;
this.noiseSuppression = options.noiseSuppression ?? true;
}
async start(): Promise<void> {
if (!navigator.mediaDevices) {
throw new Error("Microphone access requires HTTPS (or localhost) - the site is not a secure context.");
}
this.stream = await navigator.mediaDevices.getUserMedia({
audio: { channelCount: 1, echoCancellation: true, noiseSuppression: true },
audio: {
channelCount: 1,
echoCancellation: this.echoCancellation,
noiseSuppression: this.noiseSuppression,
...(this.deviceId ? { deviceId: { exact: this.deviceId } } : {}),
},
});
// Granting the permission prompt counts as a user gesture, so this can
// succeed even when start() was triggered automatically on page load,
// before the AudioContext would otherwise be allowed to leave "suspended".
if (this.context.state === "suspended") await this.context.resume();
this.source = this.context.createMediaStreamSource(this.stream);
this.processor = this.context.createScriptProcessor(2048, 1, 1);
this.processor.onaudioprocess = (event) => {
@@ -66,9 +102,10 @@ export class MicCapture {
let sumSquares = 0;
for (let i = 0; i < input.length; i++) sumSquares += input[i] * input[i];
const rms = Math.sqrt(sumSquares / input.length);
this.onLevel?.(rms);
const now = this.context.currentTime;
if (rms >= this.threshold) this.activeUntil = now + VAD_HANGOVER_SECONDS;
if (rms >= this.threshold) this.activeUntil = now + this.hangoverSeconds;
const shouldBeActive = now < this.activeUntil;
if (shouldBeActive !== this.active) {
this.active = shouldBeActive;
@@ -98,7 +135,22 @@ export class MicCapture {
this.silence.connect(this.context.destination);
}
/** Routes the raw mic signal to `destination` too, so you can hear yourself (a mic test), until disabled again. */
setMonitoring(enabled: boolean, destination: AudioNode): void {
if (!this.source) return;
if (enabled && this.monitorTarget !== destination) {
if (this.monitorTarget) this.source.disconnect(this.monitorTarget);
this.source.connect(destination);
this.monitorTarget = destination;
} else if (!enabled && this.monitorTarget) {
this.source.disconnect(this.monitorTarget);
this.monitorTarget = null;
}
}
stop(): void {
if (this.source && this.monitorTarget) this.source.disconnect(this.monitorTarget);
this.monitorTarget = null;
this.processor?.disconnect();
this.silence?.disconnect();
this.source?.disconnect();
@@ -117,14 +169,23 @@ export class MicCapture {
/** Output ("audiooutput") devices available for playback, e.g. for a device picker. */
export async function listAudioOutputDevices(): Promise<MediaDeviceInfo[]> {
if (!navigator.mediaDevices) return [];
const devices = await navigator.mediaDevices.enumerateDevices();
return devices.filter((d) => d.kind === "audiooutput");
}
/** Input ("audioinput") devices available for the mic, e.g. for a device picker. */
export async function listAudioInputDevices(): Promise<MediaDeviceInfo[]> {
if (!navigator.mediaDevices) return [];
const devices = await navigator.mediaDevices.enumerateDevices();
return devices.filter((d) => d.kind === "audioinput");
}
type MediaDevicesWithPicker = MediaDevices & { selectAudioOutput?: () => Promise<MediaDeviceInfo> };
/** Whether the browser supports the native OS output-device picker (Chrome/Edge 105+). */
export function hasNativeOutputPicker(): boolean {
if (!navigator.mediaDevices) return false;
return typeof (navigator.mediaDevices as MediaDevicesWithPicker).selectAudioOutput === "function";
}
@@ -135,6 +196,7 @@ export function hasNativeOutputPicker(): boolean {
* the user to pick one, each call - no persistent listing to keep in sync.
*/
export async function pickAudioOutputDevice(): Promise<MediaDeviceInfo | null> {
if (!navigator.mediaDevices) return null;
const md = navigator.mediaDevices as MediaDevicesWithPicker;
if (typeof md.selectAudioOutput !== "function") return null;
return md.selectAudioOutput();
@@ -159,9 +221,12 @@ export class AudioPlayer {
private nextTime = 0;
private destination: MediaStreamAudioDestinationNode;
private element: SinkableElement;
private gain: GainNode;
constructor(private context: AudioContext) {
this.destination = context.createMediaStreamDestination();
this.gain = context.createGain();
this.gain.connect(this.destination);
this.element = document.createElement("audio") as SinkableElement;
this.element.autoplay = true;
this.element.srcObject = this.destination.stream;
@@ -184,7 +249,7 @@ export class AudioPlayer {
const source = this.context.createBufferSource();
source.buffer = buffer;
source.connect(this.destination);
source.connect(this.gain);
const now = this.context.currentTime;
if (this.nextTime < now + 0.02) {
@@ -200,6 +265,34 @@ export class AudioPlayer {
this.nextTime = 0;
}
/** Playback volume as linear gain (1 = unity/0dB). */
setVolume(gain: number): void {
this.gain.gain.value = gain;
}
/** The node all voice/test audio ultimately reaches - use as a mic-monitoring target so it also respects volume/output device. */
getInputNode(): AudioNode {
return this.gain;
}
/** Plays a short sine-wave test tone through the same volume/output-device routing as voice playback. */
playTestTone(): void {
const osc = this.context.createOscillator();
osc.type = "sine";
osc.frequency.value = 440;
const toneGain = this.context.createGain();
toneGain.gain.value = 0.3;
osc.connect(toneGain);
toneGain.connect(this.gain);
const now = this.context.currentTime;
osc.start(now);
osc.stop(now + 0.6);
osc.onended = () => {
osc.disconnect();
toneGain.disconnect();
};
}
/** Routes playback to a specific device (empty string = system default). */
async setOutputDevice(deviceId: string): Promise<void> {
if (typeof this.element.setSinkId === "function") {