Compare commits

..
Author SHA1 Message Date
MoepchiandClaude Sonnet 5 74f688aba8 Add client and server connection-info windows
Sends raw getconnectioninfo/serverrequestconnectioninfo commands and
reads the reply out of tsclientlib's bookkeeping state (it already
tracks ping, packet loss, bytes/packets sent+received internally -
just needed to be requested and surfaced). Wired into the client
context menu (any client), the Selbst menu (self), and a new link in
the server info panel.

Uses send_with_result() so a permission-denied rejection surfaces as
a visible error instead of silently doing nothing; the dialogs also
fall back to a "no response" message after 6s in case the server
declines without any reply at all (observed against a real server
where a guest lacked b_virtualserver_connectioninfo_view).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-04 22:42:23 +02:00
MoepchiandClaude Sonnet 5 a300daedeb Add Identitäten (identity) management dialog
Replaces the single flat identity key with a list of named identities
you can add, rename, delete, and switch between (each keeps its own
tsclientlib identity blob, generated lazily on first connect). The
Connect dialog's identity dropdown, previously a disabled "Standard"
placeholder, now reflects and can switch the active one too. Existing
users' single stored identity migrates automatically into the new list.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-04 19:47:20 +02:00
MoepchiandClaude Sonnet 5 46ae5b120e Add Whisperlisten (saved whisper target lists)
Lets you save the current whisper channel/client selection as a named
list and reactivate it later. Lists are matched by name rather than id
on activation, since ids only stay stable for the current connection.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-04 19:37:14 +02:00
MoepchiandClaude Sonnet 5 284645f18d Save local recordings as WAV instead of webm
Swaps the MediaRecorder-based capture for a raw PCM tap (ScriptProcessorNode)
and a hand-rolled WAV encoder, since MediaRecorder's output format/codec is
browser-dependent (webm/opus) and the user wants a plain, universally
compatible file.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-04 19:28:46 +02:00
MoepchiandClaude Sonnet 5 67c4bc1072 Add local session recording (Aufnahme)
Wires up the Extras menu's Aufnahme starten/beenden items: mixes the
incoming voice playback and outgoing mic signal into a MediaRecorder
and downloads the result as webm on stop. Multitrack recording stays
disabled (needs a plugin-equivalent per-client split not modeled here).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-04 19:21:29 +02:00
Moepchi 7bcced06fd Add Kontakte (contacts) feature
Threads the client's persistent unique identifier through the
connector/gateway/frontend pipeline (previously only the ephemeral
session client id was exposed) so contacts can be keyed by the same
person across reconnects, not by name. The Kontakte dialog supports
adding currently-online clients, per-contact category/phonetic name,
ignoring (filters their chat messages), and quick-whisper/show actions
that reuse existing whisper and channel-selection logic.
2026-08-04 18:37:49 +02:00
Moepchi f5cb4dd160 Add Whisper Verlauf dialog and complete the Selbst menu
Whisper Verlauf logs outgoing whisper-target changes with timestamps
(incoming-whisper detection isn't observable yet, so it's outgoing-only
for now). The Selbst menu now wires Abwesend/Mikrofon/Lautsprecher to
the existing toolbar actions and adds a real nickname-change flow,
backed by a new "nickname" connector command using tsclientlib's
existing client_update().set_name().
2026-08-04 18:14:04 +02:00
Moepchi a0ede4a12a Add Gesammelte URLs, Freund einladen, and Client Protokoll dialogs
Three of the Extras menu's placeholder items are now functional:
collected chat URLs with counts/timestamps, a ts3server:// invite
link generator, and a local client-side event log with level
filtering and search.
2026-08-04 17:53:12 +02:00
Moepchi 6c1fec8dcc Remove Overwolf, File Transfers, and Offline Messages menu items
These pointed at features that don't exist in this project and were
never going to be built - Overwolf integration is out of scope
entirely, and the other two are covered by planned real features
instead.
2026-08-04 16:52:00 +02:00
Moepchi 6c4ace585d Update README feature list
The table hadn't been touched since the early prototype and was
missing everything shipped since: whisper, persistent identity,
country flags, soundpack import, mobile layout, context menu, server
log, sound notifications, and i18n.
2026-08-02 17:51:48 +02:00
Moepchi 5858631e6d Add whisper (targeted voice to channels/clients)
Connector: a new "whisper <channelIds>;<clientIds>" stdin command sets
persistent whisper targets; outgoing audio then goes out as
AudioData::C2SWhisper instead of the normal C2S broadcast until
"unwhisper" clears it. Gateway relays a setWhisperTargets message the
same way.

Frontend: a toolbar toggle lists channels as checkboxes, and the
client context menu gets an "add/remove as whisper target" entry;
selecting any target switches all subsequent outgoing voice to
whisper mode.

Verified against the real test server: setting a channel target and
sending a frame produced no connector error, and clearing targets
resumed normal voice cleanly.
2026-08-02 14:41:54 +02:00
Moepchi 7217bc146a Persist client identity across sessions
Previously every connect generated a fresh tsclientlib identity, so
the server saw a new client UID each session. The connector now
accepts a saved identity via --identity and always reports the one
actually used (freshly generated or reused) back in the "connected"
event; the frontend round-trips it through localStorage so
reconnecting keeps the same UID.

Verified end-to-end against the real test server: two separate
connects with the identity carried over produced byte-identical
identity blobs.
2026-08-02 14:29:00 +02:00
Moepchi 249687d98a Support importing .ts3soundpack files
Real TS3 soundpacks have no documented, stable manifest format across
client versions, so instead of parsing a manifest this unzips the
pack (via fflate) and matches each audio file to one of our sound
events by keyword against its filename. Unmatched files are reported
rather than silently dropped, since match confidence varies by pack.
2026-08-02 14:21:55 +02:00
Moepchi 3644ae7c41 Show country flags next to client nicknames
Threads TeamSpeak's per-client country_code field through the
connector snapshot and gateway relay, then renders it as a flag
emoji (regional indicator symbols, no image assets needed) next to
the nickname. Renders nothing when the server has no geo-IP data for
a client (most common on non-official/self-hosted servers).
2026-08-02 14:15:39 +02:00
Moepchi 0529ab72f1 Add right-click context menu on channel tree clients
Works for both other clients (private chat, poke, copy name, plus
disabled placeholders for group assignment/kick/ban) and the own
client (copy name and group placeholders only, since you can't poke
or private-message yourself).
2026-08-02 14:03:01 +02:00
Moepchi af3a7c97cf Support Shift+Enter for newlines in chat input
The chat field was a single-line <input>, unable to hold a line
break. Switch it to an auto-growing <textarea>: plain Enter still
sends, Shift+Enter inserts a newline.
2026-08-02 13:55:23 +02:00
Moepchi 69b256eb42 Add demo-only mobile view toggle
Simulates a narrow viewport by capping .ts-app's own width and using
a container query (instead of a media query) for the mobile
breakpoint, so the toggle exercises the exact same CSS path real
narrow browsers hit. Only rendered when VITE_DEMO_MODE is set.
2026-08-02 13:43:17 +02:00
Moepchi 530415b50b Fix mobile menu bar clipping its own dropdown menus
overflow-x: auto on the menu bar also forces overflow-y to auto,
which clipped the absolutely-positioned dropdown to the bar's own
height instead of letting it float over the page. Let the bar wrap
onto a second line instead, since overflow isn't needed at this
breakpoint anyway.
2026-08-02 13:37:59 +02:00
Moepchi fcbf3ea40d Fix Connect dialog closing on text-selection drag; add mobile layout
Backdrop click-to-close now requires the mousedown to also start on
the backdrop, so selecting text inside any dialog and releasing the
drag outside it no longer closes the dialog.

Add a responsive breakpoint that stacks the tree/side/chat panels and
dialogs into a single column on narrow viewports instead of clipping
the fixed-width desktop layout.
2026-08-02 13:28:53 +02:00
MoepchiandClaude Sonnet 5 42f82d49aa Add Server Log tab notifications for client/channel/permission events
Surfaces join/leave/channel-switch/group-assignment/channel- and
server-edit events inline in the Server tab, matching the native TS3
client's behavior. Own missing-permission errors are shown; other
clients' permission failures are not. Sourced from tsclientlib's
book-event diffs rather than admin-only ServerQuery logs, so it works
for any connected user regardless of log-view permissions. Also
upgrades the channel-switch command to report permission errors
instead of failing silently, and adds a scripted demo-mode preview of
the feature for the GitHub Pages demo.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-01 10:54:18 +02:00
MoepchiandClaude Sonnet 5 0d8e9336f8 Link the live GitHub Pages demo from the README
Now that the demo build/deploy is up and running, point to it from the top of the README alongside the other quick links, with a callout that it's simulated data only.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-01 00:36:07 +02:00
MoepchiandClaude Sonnet 5 f6170f0576 Fix pre-existing TypeScript errors blocking CI build
npm run build runs tsc -b before vite build, and the Pages workflow uses it - these four errors were already present but never surfaced locally since testing here used vite build directly. Removes truly-dead outputDeviceLabel state (its value was never read, only the dropdown's own device list rendered labels), narrows the PmThread lookup to a proper number check, and replaces two constructor parameter properties with explicit fields (disallowed under erasableSyntaxOnly).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-01 00:27:40 +02:00
MoepchiandClaude Sonnet 5 65813b6367 Fix logo not loading under a non-root base path
The logo <img> used a hardcoded absolute "/logo.png" path, which only resolves correctly when the app is served from the domain root. Under the GitHub Pages demo (served from /webspeak3/), this 404'd. Vite already rewrites asset references in index.html for the configured base path, but plain string literals in JSX aren't touched, so this needs import.meta.env.BASE_URL explicitly.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-01 00:23:56 +02:00
MoepchiandClaude Sonnet 5 fe1b5ff991 Add a static demo mode for a GitHub Pages showcase
GitHub Pages only serves static files, but the real app needs a Node gateway and Rust connector to speak the TS3 protocol - neither of which can run there. This adds a fake WebSocket (DemoSocket) that simulates a connection with canned channels/clients entirely client-side, gated behind VITE_DEMO_MODE so the normal Docker build is unaffected, plus a GitHub Actions workflow that builds and publishes it to Pages.

Also fixes a real bug surfaced while testing the disconnect flow: a clean disconnect incorrectly showed "Connection closed before the server responded" because the socket's onclose handler couldn't tell a clean disconnect apart from one that never connected.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-01 00:19:22 +02:00
Moepchi 9b83e9d93f Merge branch 'main' of https://github.com/Moepchi/webspeak3 2026-07-31 23:57:16 +02:00
MoepchiandClaude Sonnet 5 186a3f958b Add GitHub issue templates for bugs and feature requests
Gives bug reports and feature requests a structured format instead of blank issues, and points questions to Discussions.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-31 23:56:55 +02:00
Möpchi b6ccc6f627 Create FUNDING.yml 2026-07-31 23:53:55 +02:00
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
40 changed files with 7784 additions and 377 deletions

No files matched your search

+8
View File
@@ -0,0 +1,8 @@
**/node_modules
**/dist
**/target
tsclientlib/.git
.git
*.log
.env
.env.local
+15
View File
@@ -0,0 +1,15 @@
# These are supported funding model platforms
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: moepchi
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
polar: # Replace with a single Polar username
buy_me_a_coffee: # Replace with a single Buy Me a Coffee username
thanks_dev: # Replace with a single thanks.dev username
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
+85
View File
@@ -0,0 +1,85 @@
name: Bug Report
description: Something isn't working as expected
labels: ["bug"]
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to report a bug! Please fill in as much detail as you can.
- type: textarea
id: description
attributes:
label: What happened?
description: A clear description of the bug.
placeholder: e.g. The Connect dialog closes unexpectedly when I select text inside it.
validations:
required: true
- type: textarea
id: steps
attributes:
label: Steps to reproduce
description: How can we reproduce this?
placeholder: |
1. Open the Connect dialog
2. Click and drag to select the server address text
3. Release the mouse outside the dialog
4. Dialog closes unexpectedly
validations:
required: true
- type: textarea
id: expected
attributes:
label: Expected behavior
description: What did you expect to happen instead?
validations:
required: false
- type: dropdown
id: browser
attributes:
label: Browser
options:
- Chrome / Chromium
- Firefox
- Safari
- Edge
- Other (mention in description)
validations:
required: true
- type: input
id: deployment
attributes:
label: Deployment method
description: How are you running WebSpeak3?
placeholder: e.g. Docker Hub image moepchi/webspeak3:latest, built from source, docker-compose
validations:
required: true
- type: input
id: version
attributes:
label: Version / commit
description: Docker tag, commit hash, or release version if known
validations:
required: false
- type: textarea
id: logs
attributes:
label: Relevant logs / console output
description: Browser console errors, gateway logs, or connector output, if any.
render: shell
validations:
required: false
- type: textarea
id: additional
attributes:
label: Additional context
description: Screenshots, TeamSpeak server version, anything else relevant.
validations:
required: false
+5
View File
@@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Question / Discussion
url: https://github.com/Moepchi/webspeak3/discussions
about: Ask a question or discuss an idea before filing an issue.
@@ -0,0 +1,42 @@
name: Feature Request
description: Suggest an idea or improvement for WebSpeak3
labels: ["enhancement"]
body:
- type: markdown
attributes:
value: |
Thanks for the suggestion! Note that some native TeamSpeak 3 client features (myTeamSpeak integration,
badges, plugins) are intentionally out of scope — see the README for details.
- type: textarea
id: problem
attributes:
label: What problem does this solve?
description: Is this related to something that's currently missing or annoying?
placeholder: e.g. I can't send a targeted whisper to specific clients like in the native client.
validations:
required: true
- type: textarea
id: solution
attributes:
label: Proposed solution
description: What would you like to see happen?
validations:
required: true
- type: textarea
id: alternatives
attributes:
label: Alternatives considered
description: Any workarounds or alternative approaches you've thought of?
validations:
required: false
- type: textarea
id: additional
attributes:
label: Additional context
description: Screenshots of the native client, links, or other context that helps explain the request.
validations:
required: false
+57
View File
@@ -0,0 +1,57 @@
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
+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.
+203 -23
View File
@@ -1,29 +1,81 @@
# 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="https://moepchi.github.io/webspeak3/">🕹️ 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>
## Architecture
> 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.
---
## 📸 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 |
| 🤫 **Whisper** | Target your voice at specific channels or clients instead of your whole current channel |
| 🔊 **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 — Shift+Enter for a newline |
| 🌳 **Live channel/client tree** | Correct ordering, status icons (channel commander, away, muted, deafened), country flags, click to switch channels |
| 🖱️ **Right-click context menu** | Private chat, poke, copy name, and whisper-target toggle straight from a client's row |
| 📜 **Server log** | Join/leave/switch, channel-group, and channel/server-change events shown inline, like the native client |
| 🔔 **Custom sound notifications** | Per-event sounds (connect, poke, messages, ...) with volume control and `.ts3soundpack` import |
| 🪪 **Persistent identity** | Keeps the same client UID across sessions instead of generating a new one every connect |
| 👉 **Poke & away status** | Poke clients with an optional message; set yourself away with presets or a custom status |
| ⭐ **Favorites & reconnect** | Remembers your last server/nickname; switch servers without leaving your tab |
| 📱 **Mobile-friendly layout** | Responsive single-column layout for narrow screens, not just a shrunk desktop UI |
| 🌍 **Localized UI** | Interface available in German and English, detected automatically or switchable in Options |
| 🌗 **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 +96,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.
+370 -16
View File
@@ -11,12 +11,12 @@ use serde::Serialize;
use tokio::io::{AsyncBufReadExt, BufReader};
use tsclientlib::audio::AudioHandler;
use tsclientlib::events::Event as BookEvent;
use tsclientlib::events::{Event as BookEvent, PropertyId, PropertyValue};
use tsclientlib::messages::c2s::{OutClientPokeRequestPart, OutSendTextMessagePart};
use tsclientlib::prelude::*;
use tsclientlib::{
data, ChannelId, ClientId, Connection, DisconnectOptions, MaxClients, MessageHandle,
MessageTarget, StreamItem, TextMessageTargetMode,
data, ChannelId, ClientId, Connection, DisconnectOptions, Identity, MaxClients, MessageHandle,
MessageTarget, Reason, StreamItem, TextMessageTargetMode,
};
use tsproto_packets::packets::{AudioData, CodecType, OutAudio};
@@ -39,6 +39,16 @@ 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>,
/// Previously-issued identity (as emitted in the "connected" event's
/// `identity` field) to reconnect with, so the server sees the same
/// client UID across sessions. A fresh identity is generated - and
/// reported back the same way - when omitted or unparseable.
#[arg(long)]
identity: Option<String>,
}
#[derive(Serialize)]
@@ -62,14 +72,47 @@ struct ClientInfo {
output_muted: bool,
input_hardware_enabled: bool,
away: bool,
away_message: String,
is_channel_commander: bool,
country: String,
uid: String,
}
/// Human-facing entries for the Server tab's log-style notifications
/// (client join/leave/switch, channel group assignment, channel/server
/// changes, own permission errors) - mirrors what the native TS3 client
/// shows inline in the server chat. `rename_all = "camelCase"` covers both
/// the `kind` tag values and field names, so this needs no remapping on the
/// gateway side (unlike the snake_case variants below).
#[derive(Serialize)]
#[serde(tag = "kind", rename_all = "camelCase")]
enum ServerLogEntry {
ClientJoin { client: String, channel: String },
ClientLeave { client: String },
ClientChannelSwitch { client: String, from_channel: String, to_channel: String },
ClientChannelGroupAssigned { client: String, group: String },
ChannelCreated { channel: String },
ChannelDeleted { channel: String },
ChannelEdited { channel: String },
ServerEdited,
PermissionError { action: String },
}
#[derive(Serialize)]
#[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,
/// Opaque JSON blob the frontend can store and pass back as `--identity`
/// on a future connection to keep the same client UID.
identity: String,
},
#[serde(rename = "channels")]
Channels { channels: Vec<ChannelInfo>, clients: Vec<ClientInfo> },
#[serde(rename = "chatMessage")]
@@ -96,12 +139,146 @@ enum Event {
Disconnected { reason: String },
#[serde(rename = "error")]
Error { message: String },
/// Server-tab log notification (client join/leave/switch, channel group
/// assignment, channel/server changes, own permission errors).
#[serde(rename = "serverLog")]
ServerLog {
#[serde(flatten)]
entry: ServerLogEntry,
},
/// Reply to a "clientconninfo <id>" request - live stats for one client's
/// connection (ping, packet loss, bytes/packets sent+received).
#[serde(rename = "clientConnectionInfo")]
ClientConnectionInfo {
client_id: u16,
ping_ms: Option<f64>,
connected_secs: Option<i64>,
ip: Option<String>,
packets_sent: u64,
bytes_sent: u64,
packets_received: u64,
bytes_received: u64,
packet_loss_percent: f32,
},
/// Reply to a "serverconninfo" request - aggregate connection stats for
/// the whole server-side link.
#[serde(rename = "serverConnectionInfo")]
ServerConnectionInfo {
ping_ms: f64,
connected_secs: i64,
packet_loss_percent: f32,
packets_sent_total: u64,
bytes_sent_total: u64,
packets_received_total: u64,
bytes_received_total: u64,
bandwidth_sent_last_second: u64,
bandwidth_received_last_second: u64,
},
}
fn emit(event: &Event) {
println!("{}", serde_json::to_string(event).unwrap());
}
fn emit_server_log(entry: ServerLogEntry) {
emit(&Event::ServerLog { entry });
}
/// Translates a single book-state diff into a Server-tab log entry, when it's
/// one of the changes worth surfacing there (client join/leave/switch,
/// channel group assignment, channel/server changes). Most diffs (e.g.
/// per-field client updates like mute state) are intentionally not logged -
/// only the categories the native client's server log shows for these.
fn log_book_event(con: &data::Connection, event: &BookEvent) {
match event {
BookEvent::PropertyAdded { id: PropertyId::Client(client_id), .. } => {
if let Some(client) = con.clients.get(client_id) {
let channel = con.channels.get(&client.channel).map(|c| c.name.clone()).unwrap_or_default();
emit_server_log(ServerLogEntry::ClientJoin { client: client.name.clone(), channel });
}
}
BookEvent::PropertyRemoved { id: PropertyId::Client(_), old: PropertyValue::Client(client), .. } => {
emit_server_log(ServerLogEntry::ClientLeave { client: client.name.clone() });
}
BookEvent::PropertyAdded { id: PropertyId::Channel(channel_id), .. } => {
if let Some(channel) = con.channels.get(channel_id) {
emit_server_log(ServerLogEntry::ChannelCreated { channel: channel.name.clone() });
}
}
BookEvent::PropertyRemoved { id: PropertyId::Channel(_), old: PropertyValue::Channel(channel), .. } => {
emit_server_log(ServerLogEntry::ChannelDeleted { channel: channel.name.clone() });
}
BookEvent::PropertyChanged { id: PropertyId::ClientChannel(client_id), old: PropertyValue::ChannelId(old_channel), .. } => {
if let Some(client) = con.clients.get(client_id) {
let from_channel = con.channels.get(old_channel).map(|c| c.name.clone()).unwrap_or_default();
let to_channel = con.channels.get(&client.channel).map(|c| c.name.clone()).unwrap_or_default();
emit_server_log(ServerLogEntry::ClientChannelSwitch {
client: client.name.clone(),
from_channel,
to_channel,
});
}
}
BookEvent::PropertyChanged { id: PropertyId::ClientChannelGroup(client_id), .. } => {
if let Some(client) = con.clients.get(client_id) {
let group =
con.channel_groups.get(&client.channel_group).map(|g| g.name.clone()).unwrap_or_default();
emit_server_log(ServerLogEntry::ClientChannelGroupAssigned { client: client.name.clone(), group });
}
}
BookEvent::PropertyChanged {
id:
PropertyId::ChannelName(channel_id)
| PropertyId::ChannelTopic(channel_id)
| PropertyId::ChannelMaxClients(channel_id)
| PropertyId::ChannelMaxFamilyClients(channel_id)
| PropertyId::ChannelHasPassword(channel_id)
| PropertyId::ChannelNeededTalkPower(channel_id)
| PropertyId::ChannelCodec(channel_id)
| PropertyId::ChannelCodecQuality(channel_id)
| PropertyId::ChannelIsDefault(channel_id)
| PropertyId::ChannelDeleteDelay(channel_id)
| PropertyId::ChannelPhoneticName(channel_id)
| PropertyId::ChannelIsPrivate(channel_id)
| PropertyId::ChannelForcedSilence(channel_id)
| PropertyId::ChannelOrder(channel_id)
| PropertyId::ChannelParent(channel_id),
..
} => {
if let Some(channel) = con.channels.get(channel_id) {
emit_server_log(ServerLogEntry::ChannelEdited { channel: channel.name.clone() });
}
}
BookEvent::PropertyChanged {
id:
PropertyId::ServerName
| PropertyId::ServerWelcomeMessage
| PropertyId::ServerHostmessage
| PropertyId::ServerHostmessageMode
| PropertyId::ServerHostbannerUrl
| PropertyId::ServerHostbannerGfxUrl
| PropertyId::ServerHostbannerGfxInterval
| PropertyId::ServerHostbannerMode
| PropertyId::ServerHostbuttonTooltip
| PropertyId::ServerHostbuttonUrl
| PropertyId::ServerHostbuttonGfxUrl
| PropertyId::ServerPhoneticName
| PropertyId::ServerIcon
| PropertyId::ServerMaxClients
| PropertyId::ServerAskForPrivilegekey
| PropertyId::ServerDefaultServerGroup
| PropertyId::ServerDefaultChannelGroup
| PropertyId::ServerCodecEncryptionMode
| PropertyId::ServerTempChannelDefaultDeleteDelay
| PropertyId::ServerPrioritySpeakerDimmModificator,
..
} => {
emit_server_log(ServerLogEntry::ServerEdited);
}
_ => {}
}
}
/// `Channel::order` is not a plain position, it's the id of the preceding
/// sibling channel (0 = first child of its parent) - effectively a linked
/// list per parent. This resolves that into a plain 0-based sequence index
@@ -168,7 +345,10 @@ 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,
country: c.country_code.clone(),
uid: c.uid.as_ref().map(|u| u.to_string()).unwrap_or_default(),
})
.collect();
Event::Channels { channels, clients }
@@ -207,13 +387,22 @@ async fn run(args: Args) -> Result<()> {
tracing_subscriber::fmt().with_env_filter("warn").with_writer(std::io::stderr).init();
let address = args.address.clone();
let mut con_config = Connection::build(args.address).name(args.nickname);
let identity = args
.identity
.as_deref()
.and_then(|s| serde_json::from_str::<Identity>(s).ok())
.unwrap_or_else(Identity::create);
let identity_str = serde_json::to_string(&identity).unwrap();
let mut con_config = Connection::build(args.address).name(args.nickname).identity(identity);
if let Some(pwd) = args.server_password {
con_config = con_config.password(pwd);
}
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 +431,18 @@ 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,
identity: identity_str,
});
// Subscribe to all channels so we actually receive the full channel/client list.
con.get_state()?.server.set_subscribed(true).send(&mut con)?;
@@ -275,6 +475,16 @@ async fn run(args: Args) -> Result<()> {
// `send_with_result()` for text messages gets us a `MessageResult` event we
// can surface as a visible error instead of the message just vanishing.
let mut pending_messages: HashMap<MessageHandle, String> = HashMap::new();
// When non-empty, outgoing voice is whispered to just these channels/clients
// instead of being sent to the current channel - set via the "whisper "
// stdin command, cleared via "unwhisper".
let mut whisper_channels: Vec<u64> = Vec::new();
let mut whisper_clients: Vec<u16> = Vec::new();
// Set by "clientconninfo"/"serverconninfo" while waiting for the server's
// reply to land in book state (it arrives async as a later BookEvents
// batch, not as a direct command result) - checked and emitted below.
let mut pending_client_conninfo: Option<ClientId> = None;
let mut pending_server_conninfo = false;
enum LoopOutcome {
StdinLine(std::io::Result<Option<String>>),
@@ -295,8 +505,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;
@@ -308,8 +524,11 @@ async fn run(args: Args) -> Result<()> {
let own = &state.clients[&state.own_client];
own.client_move(ChannelId(id))
};
if let Err(e) = part.send(&mut con) {
emit(&Event::Error { message: e.to_string() });
match part.send_with_result(&mut con) {
Ok(handle) => {
pending_messages.insert(handle, "Channel switch".into());
}
Err(e) => emit(&Event::Error { message: e.to_string() }),
}
}
Err(_) => emit(&Event::Error { message: format!("Invalid channel id: {rest}") }),
@@ -382,6 +601,76 @@ 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(rest) = l.strip_prefix("nickname ") {
let part = con.get_state()?.client_update().set_name(rest.trim());
if let Err(e) = part.send(&mut con) {
emit(&Event::Error { message: e.to_string() });
}
} else if let Some(rest) = l.strip_prefix("whisper ") {
// Format: "whisper <channelId,channelId,...>;<clientId,clientId,...>"
// (either side may be empty, e.g. "whisper 5;" or "whisper ;12,13").
let mut parts = rest.splitn(2, ';');
let channels_part = parts.next().unwrap_or("");
let clients_part = parts.next().unwrap_or("");
whisper_channels = channels_part.split(',').filter_map(|s| s.trim().parse().ok()).collect();
whisper_clients = clients_part.split(',').filter_map(|s| s.trim().parse().ok()).collect();
} else if l == "unwhisper" {
whisper_channels.clear();
whisper_clients.clear();
} else if let Some(rest) = l.strip_prefix("clientconninfo ") {
match rest.trim().parse::<u16>() {
Ok(id) => {
let client_id = ClientId(id);
let part = con.get_state()?.clients.get(&client_id).map(|c| c.connection_info());
match part {
// send_with_result (rather than send) so a missing-permission
// rejection (e.g. viewing another client's connection info
// without b_client_view_connection_info) surfaces as a visible
// error instead of leaving the dialog stuck loading forever.
Some(part) => match part.send_with_result(&mut con) {
Ok(handle) => {
pending_client_conninfo = Some(client_id);
pending_messages.insert(handle, "Connection info".into());
}
Err(e) => emit(&Event::Error { message: e.to_string() }),
},
None => {
emit(&Event::Error { message: format!("Unknown client id: {id}") })
}
}
}
Err(_) => emit(&Event::Error { message: format!("Invalid client id: {rest}") }),
}
} else if l == "serverconninfo" {
let part = con.get_state()?.server.connection_info();
match part.send_with_result(&mut con) {
Ok(handle) => {
pending_server_conninfo = true;
pending_messages.insert(handle, "Server connection info".into());
}
Err(e) => 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) => {
@@ -393,11 +682,23 @@ async fn run(args: Args) -> Result<()> {
let mut opus_output = [0u8; 1275];
match opus_encoder.encode_float(&samples, &mut opus_output) {
Ok(len) => {
let packet = OutAudio::new(&AudioData::C2S {
id: 0,
codec: CodecType::OpusVoice,
data: &opus_output[..len],
});
let has_whisper_targets =
!whisper_channels.is_empty() || !whisper_clients.is_empty();
let packet = if has_whisper_targets {
OutAudio::new(&AudioData::C2SWhisper {
id: 0,
codec: CodecType::OpusVoice,
channels: whisper_channels.clone(),
clients: whisper_clients.clone(),
data: &opus_output[..len],
})
} else {
OutAudio::new(&AudioData::C2S {
id: 0,
codec: CodecType::OpusVoice,
data: &opus_output[..len],
})
};
if let Err(e) = con.send_audio(packet) {
emit(&Event::Error { message: e.to_string() });
}
@@ -465,6 +766,53 @@ async fn run(args: Args) -> Result<()> {
emit(&Event::Poke { from: invoker.name.clone(), message: message.clone() });
}
}
} else {
log_book_event(con.get_state()?, event);
}
}
if let Some(client_id) = pending_client_conninfo {
match con.get_state()?.clients.get(&client_id) {
Some(client) => {
if let Some(data) = &client.connection_data {
emit(&Event::ClientConnectionInfo {
client_id: client_id.0,
ping_ms: data.ping.map(|d| d.as_seconds_f64() * 1000.0),
connected_secs: data.connected_time.map(|d| d.whole_seconds()),
ip: data.client_address.map(|a| a.ip().to_string()),
packets_sent: data.packets_sent_speech.unwrap_or(0)
+ data.packets_sent_keepalive.unwrap_or(0)
+ data.packets_sent_control.unwrap_or(0),
bytes_sent: data.bytes_sent_speech.unwrap_or(0)
+ data.bytes_sent_keepalive.unwrap_or(0)
+ data.bytes_sent_control.unwrap_or(0),
packets_received: data.packets_received_speech.unwrap_or(0)
+ data.packets_received_keepalive.unwrap_or(0)
+ data.packets_received_control.unwrap_or(0),
bytes_received: data.bytes_received_speech.unwrap_or(0)
+ data.bytes_received_keepalive.unwrap_or(0)
+ data.bytes_received_control.unwrap_or(0),
packet_loss_percent: data.client_to_server_packetloss_total,
});
pending_client_conninfo = None;
}
}
None => pending_client_conninfo = None,
}
}
if pending_server_conninfo {
if let Some(data) = &con.get_state()?.server.connection_data {
emit(&Event::ServerConnectionInfo {
ping_ms: data.ping.as_seconds_f64() * 1000.0,
connected_secs: data.connected_time_total.whole_seconds(),
packet_loss_percent: data.packetloss_total,
packets_sent_total: data.packets_sent_total,
bytes_sent_total: data.bytes_sent_total,
packets_received_total: data.packets_received_total,
bytes_received_total: data.bytes_received_total,
bandwidth_sent_last_second: data.bandwidth_sent_last_second_total,
bandwidth_received_last_second: data.bandwidth_received_last_second_total,
});
pending_server_conninfo = false;
}
}
emit(&snapshot(con.get_state()?));
@@ -486,7 +834,13 @@ async fn run(args: Args) -> Result<()> {
Some(Ok(StreamItem::MessageResult(handle, result))) => {
if let Some(label) = pending_messages.remove(&handle) {
if let Err(e) = result {
emit(&Event::Error { message: format!("{label} failed: {e}") });
if e.missing_permission.is_some() {
emit(&Event::ServerLog {
entry: ServerLogEntry::PermissionError { action: label },
});
} else {
emit(&Event::Error { message: format!("{label} failed: {e}") });
}
}
}
}
+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",
+86 -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,8 @@ wss.on("connection", (socket: WebSocket) => {
nickname: msg.nickname,
serverPassword: msg.serverPassword,
channelPassword: msg.channelPassword,
defaultChannel: msg.defaultChannel,
identity: msg.identity,
};
connection = new Ts3Connection(options);
connection.onEvent((event) => socket.send(JSON.stringify(event)));
@@ -50,6 +102,38 @@ 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 "setNickname": {
await connection?.setNickname(msg.nickname);
break;
}
case "setWhisperTargets": {
await connection?.setWhisperTargets(msg.channelIds ?? [], msg.clientIds ?? []);
break;
}
case "getClientConnectionInfo": {
await connection?.getClientConnectionInfo(msg.clientId);
break;
}
case "getServerConnectionInfo": {
await connection?.getServerConnectionInfo();
break;
}
case "disconnect": {
await connection?.disconnect(msg.message ?? "");
break;
}
default:
socket.send(
JSON.stringify({ type: "error", message: `Unknown message type: ${msg.type}` })
+178 -11
View File
@@ -29,11 +29,34 @@ export interface ClientInfo {
outputMuted: boolean;
inputHardwareEnabled: boolean;
away: boolean;
awayMessage: string;
isChannelCommander: boolean;
country: string;
uid: string;
}
export type ServerLogEntry =
| { kind: "clientJoin"; client: string; channel: string }
| { kind: "clientLeave"; client: string }
| { kind: "clientChannelSwitch"; client: string; fromChannel: string; toChannel: string }
| { kind: "clientChannelGroupAssigned"; client: string; group: string }
| { kind: "channelCreated"; channel: string }
| { kind: "channelDeleted"; channel: string }
| { kind: "channelEdited"; channel: string }
| { kind: "serverEdited" }
| { kind: "permissionError"; action: string };
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;
identity: string;
}
| { type: "channels"; channels: ChannelInfo[]; clients: ClientInfo[] }
| { type: "chatMessage"; from: string; message: string }
| { type: "serverMessage"; from: string; message: string }
@@ -42,21 +65,52 @@ export type Ts3ConnectionEvent =
| { type: "audioOut"; pcm: string }
| { type: "talkers"; clients: number[] }
| { type: "disconnected"; reason: string }
| { type: "error"; message: string };
| { type: "error"; message: string }
| ({ type: "serverLog" } & ServerLogEntry)
| {
type: "clientConnectionInfo";
clientId: number;
pingMs: number | null;
connectedSecs: number | null;
ip: string | null;
packetsSent: number;
bytesSent: number;
packetsReceived: number;
bytesReceived: number;
packetLossPercent: number;
}
| {
type: "serverConnectionInfo";
pingMs: number;
connectedSecs: number;
packetLossPercent: number;
packetsSentTotal: number;
bytesSentTotal: number;
packetsReceivedTotal: number;
bytesReceivedTotal: number;
bandwidthSentLastSecond: number;
bandwidthReceivedLastSecond: number;
};
export interface Ts3ConnectOptions {
host: string;
nickname: string;
serverPassword?: string;
channelPassword?: string;
defaultChannel?: string;
/** Previously-issued identity (from a prior "connected" event) to keep
* the same client UID across sessions. Omit to get a freshly generated one. */
identity?: 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 +130,8 @@ 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);
if (this.options.identity) args.push("--identity", this.options.identity);
this.child = spawn(CONNECTOR_BIN, args);
createInterface({ input: this.child.stdout }).on("line", (line) => {
@@ -88,7 +144,10 @@ export class Ts3Connection {
output_muted: boolean;
input_hardware_enabled: boolean;
away: boolean;
away_message: string;
is_channel_commander: boolean;
country: string;
uid: string;
}
interface RawChannelInfo {
@@ -103,7 +162,16 @@ 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;
identity: string;
}
| { type: "channels"; channels: RawChannelInfo[]; clients: RawClientInfo[] }
| { type: "chatMessage"; from: string; message: string }
| { type: "serverMessage"; from: string; message: string }
@@ -112,7 +180,32 @@ export class Ts3Connection {
| { type: "audioOut"; pcm: string }
| { type: "talkers"; clients: number[] }
| { type: "disconnected"; reason: string }
| { type: "error"; message: string };
| { type: "error"; message: string }
| ({ type: "serverLog" } & ServerLogEntry)
| {
type: "clientConnectionInfo";
client_id: number;
ping_ms: number | null;
connected_secs: number | null;
ip: string | null;
packets_sent: number;
bytes_sent: number;
packets_received: number;
bytes_received: number;
packet_loss_percent: number;
}
| {
type: "serverConnectionInfo";
ping_ms: number;
connected_secs: number;
packet_loss_percent: number;
packets_sent_total: number;
bytes_sent_total: number;
packets_received_total: number;
bytes_received_total: number;
bandwidth_sent_last_second: number;
bandwidth_received_last_second: number;
};
if (event.type === "connected") {
this.emit({
@@ -120,6 +213,10 @@ 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,
identity: event.identity,
});
} else if (event.type === "channels") {
this.emit({
@@ -142,7 +239,10 @@ export class Ts3Connection {
outputMuted: c.output_muted,
inputHardwareEnabled: c.input_hardware_enabled,
away: c.away,
awayMessage: c.away_message,
isChannelCommander: c.is_channel_commander,
country: c.country,
uid: c.uid,
})),
});
} else if (event.type === "privateMessage") {
@@ -153,6 +253,32 @@ export class Ts3Connection {
fromSelf: event.from_self,
message: event.message,
});
} else if (event.type === "clientConnectionInfo") {
this.emit({
type: "clientConnectionInfo",
clientId: event.client_id,
pingMs: event.ping_ms,
connectedSecs: event.connected_secs,
ip: event.ip,
packetsSent: event.packets_sent,
bytesSent: event.bytes_sent,
packetsReceived: event.packets_received,
bytesReceived: event.bytes_received,
packetLossPercent: event.packet_loss_percent,
});
} else if (event.type === "serverConnectionInfo") {
this.emit({
type: "serverConnectionInfo",
pingMs: event.ping_ms,
connectedSecs: event.connected_secs,
packetLossPercent: event.packet_loss_percent,
packetsSentTotal: event.packets_sent_total,
bytesSentTotal: event.bytes_sent_total,
packetsReceivedTotal: event.packets_received_total,
bytesReceivedTotal: event.bytes_received_total,
bandwidthSentLastSecond: event.bandwidth_sent_last_second,
bandwidthReceivedLastSecond: event.bandwidth_received_last_second,
});
} else {
this.emit(event);
}
@@ -178,6 +304,14 @@ export class Ts3Connection {
this.child?.stdin.write(`switch ${channelId}\n`);
}
async getClientConnectionInfo(clientId: number): Promise<void> {
this.child?.stdin.write(`clientconninfo ${clientId}\n`);
}
async getServerConnectionInfo(): Promise<void> {
this.child?.stdin.write(`serverconninfo\n`);
}
async sendChatMessage(message: string): Promise<void> {
const sanitized = message.replace(/[\r\n]+/g, " ").trim();
if (sanitized) this.child?.stdin.write(`chat ${sanitized}\n`);
@@ -202,9 +336,42 @@ 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 setNickname(nickname: string): Promise<void> {
const sanitized = nickname.replace(/[\r\n]+/g, " ").trim();
if (sanitized) this.child?.stdin.write(`nickname ${sanitized}\n`);
}
/** Empty channelIds/clientIds clears whisper mode, returning outgoing
* voice to the normal current-channel broadcast. */
async setWhisperTargets(channelIds: number[], clientIds: number[]): Promise<void> {
if (channelIds.length === 0 && clientIds.length === 0) {
this.child?.stdin.write("unwhisper\n");
} else {
this.child?.stdin.write(`whisper ${channelIds.join(",")};${clientIds.join(",")}\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();
+1
View File
@@ -9,6 +9,7 @@ lerna-debug.log*
node_modules
dist
dist-demo
dist-ssr
*.local
+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>
+9 -2
View File
@@ -1,13 +1,14 @@
{
"name": "web",
"name": "webspeak3-web",
"version": "0.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "web",
"name": "webspeak3-web",
"version": "0.0.0",
"dependencies": {
"fflate": "^0.8.3",
"react": "^19.2.7",
"react-dom": "^19.2.7"
},
@@ -855,6 +856,12 @@
}
}
},
"node_modules/fflate": {
"version": "0.8.3",
"resolved": "https://registry.npmjs.org/fflate/-/fflate-0.8.3.tgz",
"integrity": "sha512-tbZNuJrLwGUp3zshBtdy4W+ORxZuIh8a5ilyIEQDC5rY1f3U20JMry0Ll3WBzU58EZKsEuJFXhb5gwv8CsPvgA==",
"license": "MIT"
},
"node_modules/fsevents": {
"version": "2.3.3",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
+2 -1
View File
@@ -1,5 +1,5 @@
{
"name": "web",
"name": "webspeak3-web",
"private": true,
"version": "0.0.0",
"type": "module",
@@ -10,6 +10,7 @@
"preview": "vite preview"
},
"dependencies": {
"fflate": "^0.8.3",
"react": "^19.2.7",
"react-dom": "^19.2.7"
},
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/"
+1247 -11
View File
File diff suppressed because it is too large. Load diff
+3890 -204
View File
File diff suppressed because it is too large. Load diff
+262
View File
@@ -0,0 +1,262 @@
// Standalone frontend demo: no gateway, no real TeamSpeak server. Everything
// below simulates the WebSocket protocol the real gateway speaks (see
// gateway/src/index.ts) so App.tsx doesn't need to know it isn't talking to
// a real backend. Only enabled in the GitHub Pages build (VITE_DEMO_MODE=true)
// so the normal Docker image is completely unaffected.
export const DEMO_MODE = import.meta.env.VITE_DEMO_MODE === "true";
export const DEMO_HOST = "demo.webspeak3.example";
interface DemoChannel {
id: number;
parent: number;
order: number;
name: string;
topic: string;
codec: string;
maxClients: number | null;
hasPassword: boolean;
}
interface DemoClient {
id: number;
channel: number;
name: string;
inputMuted: boolean;
outputMuted: boolean;
inputHardwareEnabled: boolean;
away: boolean;
awayMessage: string;
isChannelCommander: boolean;
country: string;
uid: string;
}
const DEMO_CHANNELS: DemoChannel[] = [
{ id: 1, parent: 0, order: 0, name: "Lobby", topic: "Welcome to the WebSpeak3 demo!", codec: "Opus Voice", maxClients: null, hasPassword: false },
{ id: 2, parent: 0, order: 1, name: "Gaming", topic: "", codec: "Opus Voice", maxClients: 10, hasPassword: false },
{ id: 3, parent: 0, order: 2, name: "AFK", topic: "", codec: "Opus Voice", maxClients: null, hasPassword: false },
];
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" },
{ id: 103, channel: 2, name: "Sam", inputMuted: false, outputMuted: false, inputHardwareEnabled: true, away: false, awayMessage: "", isChannelCommander: false, country: "GB", uid: "demo-uid-sam" },
{ id: 104, channel: 2, name: "Jordan", inputMuted: true, outputMuted: false, inputHardwareEnabled: true, away: false, awayMessage: "", isChannelCommander: false, country: "CA", uid: "demo-uid-jordan" },
{ 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" },
];
const SELF_ID = 101;
/**
* Drop-in stand-in for a real WebSocket. Implements the subset of the
* WebSocket interface App.tsx actually uses (onopen/onmessage/onerror/
* onclose/send/close/readyState), so it can be assigned to the same
* socketRef without any changes to the event-handling code.
*/
export class DemoSocket {
onopen: ((ev: Event) => void) | null = null;
onmessage: ((ev: MessageEvent) => void) | null = null;
onerror: ((ev: Event) => void) | null = null;
onclose: ((ev: CloseEvent) => void) | null = null;
readyState: number = WebSocket.CONNECTING;
private closed = false;
private timers: number[] = [];
private selfChannel = 1;
constructor() {
this.after(400, () => {
this.readyState = WebSocket.OPEN;
this.onopen?.(new Event("open"));
});
}
send(raw: string) {
if (this.closed) return;
let msg: any;
try {
msg = JSON.parse(raw);
} catch {
return;
}
this.handle(msg);
}
close() {
if (this.closed) return;
// Mirrors the real gateway: a "disconnected" event arrives before the
// socket itself finishes closing (see gateway's disconnected event vs.
// the client-initiated WebSocket close in handleDisconnect).
this.emit({ type: "disconnected", reason: "client requested" });
this.closed = true;
this.readyState = WebSocket.CLOSED;
this.timers.forEach((id) => window.clearTimeout(id));
this.timers = [];
this.onclose?.({} as CloseEvent);
}
private after(ms: number, fn: () => void) {
const id = window.setTimeout(() => {
if (this.closed) return;
fn();
}, ms);
this.timers.push(id);
}
private emit(data: unknown) {
if (this.closed) return;
this.onmessage?.({ data: JSON.stringify(data) } as MessageEvent);
}
private handle(msg: any) {
switch (msg.type) {
case "connect": {
const nickname = String(msg.nickname || "Guest").trim() || "Guest";
this.after(900, () => {
this.emit({
type: "connected",
serverName: "WebSpeak3 Demo Server",
serverMaxClients: 32,
serverVersion: "3.13.7 [Build: demo]",
serverLicense: "Demo License",
serverBannerUrl: null,
welcomeMessage: "This is a simulated demo - no real TeamSpeak server is involved. Connect with any name/address you like.",
});
this.after(150, () => this.sendChannels(nickname));
this.scriptServerLog(nickname);
});
break;
}
case "switchChannel": {
const fromChannel = this.channelName(this.selfChannel);
this.selfChannel = msg.channelId;
const toChannel = this.channelName(this.selfChannel);
this.emit({
type: "serverLog",
kind: "clientChannelSwitch",
client: this.lastNickname,
fromChannel,
toChannel,
});
this.after(120, () => this.sendChannels(this.lastNickname));
break;
}
case "sendChatMessage":
this.after(80, () => this.emit({ type: "chatMessage", from: this.lastNickname, message: msg.message }));
break;
case "sendServerMessage":
this.after(80, () => this.emit({ type: "serverMessage", from: this.lastNickname, message: msg.message }));
break;
case "sendPrivateMessage": {
const partner = DEMO_NPCS.find((c) => c.id === msg.clientId);
this.after(80, () =>
this.emit({
type: "privateMessage",
partnerId: msg.clientId,
partnerName: partner?.name ?? "Unknown",
message: msg.message,
fromSelf: true,
})
);
break;
}
case "sendPoke": {
const partner = DEMO_NPCS.find((c) => c.id === msg.clientId);
this.after(400, () =>
this.emit({ type: "poke", from: partner?.name ?? "Someone", message: "(demo poke - no reply expected)" })
);
break;
}
case "getClientConnectionInfo": {
this.after(400, () =>
this.emit({
type: "clientConnectionInfo",
clientId: msg.clientId,
pingMs: 12.4,
connectedSecs: 217,
ip: msg.clientId === SELF_ID ? "127.0.0.1" : null,
packetsSent: 4213,
bytesSent: 512_340,
packetsReceived: 3987,
bytesReceived: 498_120,
packetLossPercent: 0,
})
);
break;
}
case "getServerConnectionInfo": {
this.after(400, () =>
this.emit({
type: "serverConnectionInfo",
pingMs: 8.1,
connectedSecs: 217,
packetLossPercent: 0,
packetsSentTotal: 21_004,
bytesSentTotal: 2_411_000,
packetsReceivedTotal: 19_872,
bytesReceivedTotal: 2_198_500,
bandwidthSentLastSecond: 4200,
bandwidthReceivedLastSecond: 3900,
})
);
break;
}
// "disconnect" is intentionally unhandled here: handleDisconnect() in
// App.tsx always calls socket.close() right after sending it, and
// close() already emits the "disconnected" event below.
// setAway, setInputMuted, setOutputMuted, sendAudio: no observable effect
// in a simulated single-user session, intentionally no-ops.
default:
break;
}
}
private lastNickname = "Guest";
private channelName(id: number): string {
return DEMO_CHANNELS.find((c) => c.id === id)?.name ?? "";
}
/** A short, scripted burst of Server-tab log lines so the feature is visible
* in the demo without needing a second real user to trigger them. */
private scriptServerLog(nickname: string) {
this.after(2500, () =>
this.emit({ type: "serverLog", kind: "clientJoin", client: "Sam", channel: this.channelName(2) })
);
this.after(5000, () =>
this.emit({
type: "serverLog",
kind: "clientChannelSwitch",
client: "Jordan",
fromChannel: this.channelName(2),
toChannel: this.channelName(1),
})
);
this.after(7500, () =>
this.emit({
type: "serverLog",
kind: "clientChannelGroupAssigned",
client: nickname,
group: "Guest",
})
);
}
private sendChannels(nickname: string) {
this.lastNickname = nickname;
const self: DemoClient = {
id: SELF_ID,
channel: this.selfChannel,
name: nickname,
inputMuted: false,
outputMuted: false,
inputHardwareEnabled: true,
away: false,
awayMessage: "",
isChannelCommander: false,
country: "",
uid: "demo-uid-self",
};
this.emit({ type: "channels", channels: DEMO_CHANNELS, clients: [self, ...DEMO_NPCS] });
}
}
+749
View File
@@ -0,0 +1,749 @@
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.inviteFriend": "Freund einladen",
"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.options": "Optionen",
"toolbar.setAway": "Als abwesend markieren",
"toolbar.backOnline": "Wieder online",
"toolbar.awayOptions": "Abwesenheitsoptionen",
"toolbar.whisper": "Whisper-Ziele",
"whisper.channels": "Channels",
"whisper.clients": "Clients",
"whisper.clearAll": "Alle Whisper-Ziele entfernen",
"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",
"collectedUrls.title": "Gesammelte URLs",
"collectedUrls.search": "Suchen:",
"collectedUrls.url": "URL",
"collectedUrls.count": "Anzahl",
"collectedUrls.lastSeen": "Zuletzt erwähnt",
"collectedUrls.mentionedBy": "Erwähnt von",
"collectedUrls.clearList": "Liste löschen",
"inviteFriend.title": "Freund einladen",
"inviteFriend.type": "Art der Einladung",
"inviteFriend.includeChannel": "Aktuellen Channel einfügen",
"inviteFriend.link": "Link",
"inviteFriend.addPermissionKey": "Berechtigungsschlüssel hinzufügen",
"inviteFriend.copyToClipboard": "In Zwischenablage kopieren",
"inviteFriend.copied": "Kopiert!",
"clientLog.title": "Client Protokoll",
"clientLog.level.critical": "Kritisch",
"clientLog.level.error": "Fehler",
"clientLog.level.warning": "Warnungen",
"clientLog.level.info": "Info",
"clientLog.level.debug": "Debug",
"clientLog.search": "Suchen:",
"clientLog.filter": "Filter:",
"clientLog.caseSensitive": "Groß-/Kleinschreibung",
"clientLog.mark": "Markieren",
"whisperHistory.title": "Whisper Verlauf - {server}",
"whisperHistory.empty": "Kein Whisper-Verlauf vorhanden.",
"whisperHistory.started": "Whispern an: {targets}",
"whisperHistory.stopped": "Whispern beendet",
"whisperHistory.clear": "Löschen",
"whisperHistory.options": "Optionen",
"whisperLists.title": "Whisperlisten",
"whisperLists.namePlaceholder": "Name der Liste",
"whisperLists.saveCurrent": "Aktuelle Auswahl speichern",
"whisperLists.itemDetail": "{channels} Channel, {clients} Clients",
"whisperLists.activate": "Aktivieren",
"whisperLists.delete": "Löschen",
"whisperLists.empty": "Keine Whisperlisten gespeichert. Wähle Whisper-Ziele aus und speichere sie hier als Liste.",
"identities.title": "Identitäten",
"identities.activate": "Aktivieren",
"identities.add": "Neue Identität",
"identities.delete": "Löschen",
"identities.newName": "Neue Identität",
"identities.generated": "Erstellt",
"identities.pending": "Wird bei der nächsten Verbindung erstellt",
"connectionInfo.clientTitle": "Verbindungsinformationen - {name}",
"connectionInfo.serverTitle": "Serververbindungsinformationen",
"connectionInfo.loading": "Wird geladen…",
"connectionInfo.unavailable": "Keine Antwort vom Server (fehlende Berechtigung?).",
"connectionInfo.ping": "Ping:",
"connectionInfo.connectedSince": "Verbunden seit:",
"connectionInfo.ip": "IP-Adresse:",
"connectionInfo.packetLoss": "Paketverlust:",
"connectionInfo.packetsSent": "Pakete gesendet:",
"connectionInfo.packetsReceived": "Pakete empfangen:",
"connectionInfo.bytesSent": "Daten gesendet:",
"connectionInfo.bytesReceived": "Daten empfangen:",
"connectionInfo.bandwidthSent": "Bandbreite gesendet:",
"connectionInfo.bandwidthReceived": "Bandbreite empfangen:",
"menu.self.recordingProfile": "Aufnahmeprofil",
"menu.self.playbackProfile": "Wiedergabeprofil",
"menu.self.hotkeyProfile": "Hotkeyprofil",
"menu.self.soundPack": "Sound Pack",
"menu.self.setAway": "Abwesend setzen",
"menu.self.enableMic": "Mikrofon aktivieren",
"menu.self.disableMic": "Mikrofon ausschalten",
"menu.self.muteOutput": "Lautsprecher/Kopfhörer ausschalten",
"menu.self.unmuteOutput": "Lautsprecher/Kopfhörer einschalten",
"menu.self.changeNickname": "Nickname ändern",
"menu.self.requestTalkPower": "Talk Power anfordern",
"menu.self.setAvatar": "Avatar setzen",
"menu.self.setPhoneticNickname": "Phonetischen Nicknamen setzen",
"menu.self.connectionInfo": "Verbindungsinformationen",
"contacts.title": "Kontakte",
"contacts.addOnlineClient": "Online-Client auswählen...",
"contacts.add": "Hinzufügen",
"contacts.remove": "Entfernen",
"contacts.empty": "Noch keine Kontakte.",
"contacts.customName": "Benutzerdefinierter Name:",
"contacts.category.acquaintance": "Bekannter",
"contacts.category.blocked": "Blockiert",
"contacts.category.friend": "Freund",
"contacts.phoneticName": "Phonetischer Name:",
"contacts.show": "Anzeige",
"contacts.ignore": "Ignorieren",
"contacts.unignore": "Nicht mehr ignorieren",
"contacts.whisper": "Whispern",
"contacts.preferences": "Voreinstellungen",
"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",
"serverLog.clientJoin": "{client} loggte sich in Channel \"{channel}\" ein",
"serverLog.clientLeave": "{client} hat die Verbindung getrennt (Verlassen)",
"serverLog.clientChannelSwitch": "{client} ging von Channel \"{fromChannel}\" in \"{toChannel}\"",
"serverLog.clientChannelGroupAssigned": "Die Channel-Gruppe \"{group}\" wurde {client} zugewiesen",
"serverLog.channelCreated": "Channel \"{channel}\" wurde erstellt",
"serverLog.channelDeleted": "Channel \"{channel}\" wurde gelöscht",
"serverLog.channelEdited": "Channel \"{channel}\" wurde bearbeitet",
"serverLog.serverEdited": "Die Servereinstellungen wurden geändert",
"serverLog.permissionError": "Fehlende Berechtigung: {action}",
"poke.title": "Anstupsen",
"poke.optionalMessage": "Optionale Nachricht...",
"poke.send": "Anstupsen",
"poke.cancel": "Abbrechen",
"poke.pokedYou": "hat dich angestupst",
"poke.dismiss": "Schließen",
"clientContext.privateChat": "Privater Chat",
"clientContext.poke": "Anstupsen",
"clientContext.copyName": "Namen kopieren",
"clientContext.connectionInfo": "Verbindungsinformationen anzeigen",
"clientContext.addWhisperTarget": "Als Whisper-Ziel hinzufügen",
"clientContext.removeWhisperTarget": "Als Whisper-Ziel entfernen",
"clientContext.assignChannelGroup": "Channel-Gruppe zuweisen",
"clientContext.assignServerGroup": "Server-Gruppe zuweisen",
"clientContext.kick": "Vom Server kicken",
"clientContext.ban": "Bannen",
"clientContext.notSupported": "Im Web-Client noch nicht unterstützt",
"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",
"sounds.importSoundpack": "Soundpack importieren (.ts3soundpack)",
"sounds.importResult": "{matched} Sound(s) übernommen, {unmatched} Datei(en) nicht zugeordnet",
"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.inviteFriend": "Invite a friend",
"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.options": "Options",
"toolbar.setAway": "Set away",
"toolbar.backOnline": "Back online",
"toolbar.awayOptions": "Away options",
"toolbar.whisper": "Whisper targets",
"whisper.channels": "Channels",
"whisper.clients": "Clients",
"whisper.clearAll": "Clear all whisper targets",
"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",
"collectedUrls.title": "Collected URLs",
"collectedUrls.search": "Search:",
"collectedUrls.url": "URL",
"collectedUrls.count": "Count",
"collectedUrls.lastSeen": "Last mentioned",
"collectedUrls.mentionedBy": "Mentioned by",
"collectedUrls.clearList": "Clear list",
"inviteFriend.title": "Invite a friend",
"inviteFriend.type": "Invitation type",
"inviteFriend.includeChannel": "Insert current channel",
"inviteFriend.link": "Link",
"inviteFriend.addPermissionKey": "Add permission key",
"inviteFriend.copyToClipboard": "Copy to clipboard",
"inviteFriend.copied": "Copied!",
"clientLog.title": "Client Log",
"clientLog.level.critical": "Critical",
"clientLog.level.error": "Errors",
"clientLog.level.warning": "Warnings",
"clientLog.level.info": "Info",
"clientLog.level.debug": "Debug",
"clientLog.search": "Search:",
"clientLog.filter": "Filter:",
"clientLog.caseSensitive": "Case sensitive",
"clientLog.mark": "Mark",
"whisperHistory.title": "Whisper History - {server}",
"whisperHistory.empty": "No whisper history yet.",
"whisperHistory.started": "Whispering to: {targets}",
"whisperHistory.stopped": "Stopped whispering",
"whisperHistory.clear": "Clear",
"whisperHistory.options": "Options",
"whisperLists.title": "Whisper Lists",
"whisperLists.namePlaceholder": "List name",
"whisperLists.saveCurrent": "Save current selection",
"whisperLists.itemDetail": "{channels} channels, {clients} clients",
"whisperLists.activate": "Activate",
"whisperLists.delete": "Delete",
"whisperLists.empty": "No whisper lists saved yet. Select whisper targets and save them here as a list.",
"identities.title": "Identities",
"identities.activate": "Activate",
"identities.add": "New Identity",
"identities.delete": "Delete",
"identities.newName": "New Identity",
"identities.generated": "Generated",
"identities.pending": "Will be generated on next connection",
"connectionInfo.clientTitle": "Connection Info - {name}",
"connectionInfo.serverTitle": "Server Connection Info",
"connectionInfo.loading": "Loading…",
"connectionInfo.unavailable": "No response from the server (missing permission?).",
"connectionInfo.ping": "Ping:",
"connectionInfo.connectedSince": "Connected since:",
"connectionInfo.ip": "IP address:",
"connectionInfo.packetLoss": "Packet loss:",
"connectionInfo.packetsSent": "Packets sent:",
"connectionInfo.packetsReceived": "Packets received:",
"connectionInfo.bytesSent": "Data sent:",
"connectionInfo.bytesReceived": "Data received:",
"connectionInfo.bandwidthSent": "Bandwidth sent:",
"connectionInfo.bandwidthReceived": "Bandwidth received:",
"menu.self.recordingProfile": "Recording Profile",
"menu.self.playbackProfile": "Playback Profile",
"menu.self.hotkeyProfile": "Hotkey Profile",
"menu.self.soundPack": "Sound Pack",
"menu.self.setAway": "Set Away",
"menu.self.enableMic": "Enable Microphone",
"menu.self.disableMic": "Disable Microphone",
"menu.self.muteOutput": "Mute Speakers/Headphones",
"menu.self.unmuteOutput": "Unmute Speakers/Headphones",
"menu.self.changeNickname": "Change Nickname",
"menu.self.requestTalkPower": "Request Talk Power",
"menu.self.setAvatar": "Set Avatar",
"menu.self.setPhoneticNickname": "Set Phonetic Nickname",
"menu.self.connectionInfo": "Connection Info",
"contacts.title": "Contacts",
"contacts.addOnlineClient": "Select an online client...",
"contacts.add": "Add",
"contacts.remove": "Remove",
"contacts.empty": "No contacts yet.",
"contacts.customName": "Custom Name:",
"contacts.category.acquaintance": "Acquaintance",
"contacts.category.blocked": "Blocked",
"contacts.category.friend": "Friend",
"contacts.phoneticName": "Phonetic Name:",
"contacts.show": "Show",
"contacts.ignore": "Ignore",
"contacts.unignore": "Unignore",
"contacts.whisper": "Whisper",
"contacts.preferences": "Preferences",
"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",
"serverLog.clientJoin": "{client} entered channel \"{channel}\"",
"serverLog.clientLeave": "{client} disconnected (Left)",
"serverLog.clientChannelSwitch": "{client} moved from channel \"{fromChannel}\" to \"{toChannel}\"",
"serverLog.clientChannelGroupAssigned": "Channel group \"{group}\" was assigned to {client}",
"serverLog.channelCreated": "Channel \"{channel}\" was created",
"serverLog.channelDeleted": "Channel \"{channel}\" was deleted",
"serverLog.channelEdited": "Channel \"{channel}\" was edited",
"serverLog.serverEdited": "Server settings were changed",
"serverLog.permissionError": "Missing permission: {action}",
"poke.title": "Poke",
"poke.optionalMessage": "Optional message...",
"poke.send": "Poke",
"poke.cancel": "Cancel",
"poke.pokedYou": "poked you",
"poke.dismiss": "Dismiss",
"clientContext.privateChat": "Private chat",
"clientContext.poke": "Poke",
"clientContext.copyName": "Copy name",
"clientContext.connectionInfo": "Show connection info",
"clientContext.addWhisperTarget": "Add as whisper target",
"clientContext.removeWhisperTarget": "Remove as whisper target",
"clientContext.assignChannelGroup": "Assign channel group",
"clientContext.assignServerGroup": "Assign server group",
"clientContext.kick": "Kick from server",
"clientContext.ban": "Ban",
"clientContext.notSupported": "Not yet supported in the web client",
"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",
"sounds.importSoundpack": "Import soundpack (.ts3soundpack)",
"sounds.importResult": "{matched} sound(s) imported, {unmatched} file(s) not matched",
"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;
}
+71
View File
@@ -0,0 +1,71 @@
import { unzipSync } from "fflate";
import type { SoundEventId } from "./sounds";
const AUDIO_EXTENSIONS = [".wav", ".mp3", ".ogg", ".m4a"];
const MIME_BY_EXTENSION: Record<string, string> = {
".wav": "audio/wav",
".mp3": "audio/mpeg",
".ogg": "audio/ogg",
".m4a": "audio/mp4",
};
/** Real .ts3soundpack files use TeamSpeak's own internal event names, which
* vary between client versions and aren't documented anywhere stable - so
* this matches by keyword against the filename (soundpacks are zips of
* individual audio files, not proprietary-encoded) rather than depending on
* an exact manifest format. Falls back to a "not matched" list the caller
* can surface, instead of silently dropping unrecognized files. */
const EVENT_KEYWORDS: Record<SoundEventId, string[]> = {
connect: ["connectionaccepted", "connectionestablished", "youhaveconnected", "connect"],
disconnect: ["connectionlost", "connectiondisconnected", "youhavebeendisconnected", "disconnect"],
clientJoin: ["userenteredchannel", "userenteredvisibility", "cliententerview", "userjoined", "enter"],
clientLeave: ["userleftchannel", "userleftvisibility", "clientleftview", "userleave", "userleft", "leave"],
message: ["textmessagereceived", "chatmessage", "newmessage", "message"],
poke: ["gotpoked", "poke"],
};
function normalize(filename: string): string {
const base = filename.slice(filename.lastIndexOf("/") + 1);
const dot = base.lastIndexOf(".");
return (dot === -1 ? base : base.slice(0, dot)).toLowerCase().replace(/[^a-z0-9]/g, "");
}
function extensionOf(filename: string): string | null {
const lower = filename.toLowerCase();
return AUDIO_EXTENSIONS.find((ext) => lower.endsWith(ext)) ?? null;
}
export interface SoundpackImportResult {
matched: Partial<Record<SoundEventId, { name: string; blob: Blob }>>;
unmatchedFiles: string[];
}
export async function parseSoundpack(file: File): Promise<SoundpackImportResult> {
const buffer = new Uint8Array(await file.arrayBuffer());
const entries = unzipSync(buffer, {
filter: (entry) => extensionOf(entry.name) !== null,
});
const matched: SoundpackImportResult["matched"] = {};
const unmatchedFiles: string[] = [];
for (const [name, data] of Object.entries(entries)) {
const ext = extensionOf(name);
if (!ext) continue;
const key = normalize(name);
const eventId = (Object.keys(EVENT_KEYWORDS) as SoundEventId[]).find(
(id) => !matched[id] && EVENT_KEYWORDS[id].some((keyword) => key.includes(keyword))
);
if (eventId) {
matched[eventId] = {
name: name.slice(name.lastIndexOf("/") + 1),
blob: new Blob([data.slice()], { type: MIME_BY_EXTENSION[ext] }),
};
} else {
unmatchedFiles.push(name);
}
}
return { matched, unmatchedFiles };
}
+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);
}
+151 -13
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,48 @@ 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;
private context: AudioContext;
threshold: number;
hangoverSeconds: number;
constructor(
private context: AudioContext,
private onFrame: (base64Pcm: string) => void,
private onActivity?: (active: boolean) => void,
threshold = 0.02
) {
this.threshold = threshold;
constructor(context: AudioContext, options: MicCaptureOptions) {
this.context = context;
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 +101,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 +134,27 @@ export class MicCapture {
this.silence.connect(this.context.destination);
}
/** The raw mic input node, e.g. to additionally route it into a recorder. */
getSourceNode(): AudioNode | null {
return this.source;
}
/** 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();
@@ -115,16 +171,64 @@ export class MicCapture {
}
}
function writeAsciiString(view: DataView, offset: number, text: string): void {
for (let i = 0; i < text.length; i++) view.setUint8(offset + i, text.charCodeAt(i));
}
/** Encodes raw stereo float samples (range -1..1) as an uncompressed 16-bit PCM WAV file. */
export function encodeWavStereo(left: Float32Array, right: Float32Array, sampleRate: number): Blob {
const numChannels = 2;
const bytesPerSample = 2;
const blockAlign = numChannels * bytesPerSample;
const dataSize = left.length * blockAlign;
const buffer = new ArrayBuffer(44 + dataSize);
const view = new DataView(buffer);
writeAsciiString(view, 0, "RIFF");
view.setUint32(4, 36 + dataSize, true);
writeAsciiString(view, 8, "WAVE");
writeAsciiString(view, 12, "fmt ");
view.setUint32(16, 16, true);
view.setUint16(20, 1, true); // PCM
view.setUint16(22, numChannels, true);
view.setUint32(24, sampleRate, true);
view.setUint32(28, sampleRate * blockAlign, true);
view.setUint16(32, blockAlign, true);
view.setUint16(34, 16, true);
writeAsciiString(view, 36, "data");
view.setUint32(40, dataSize, true);
let offset = 44;
for (let i = 0; i < left.length; i++) {
const l = Math.max(-1, Math.min(1, left[i]));
const r = Math.max(-1, Math.min(1, right[i]));
view.setInt16(offset, l < 0 ? l * 0x8000 : l * 0x7fff, true);
view.setInt16(offset + 2, r < 0 ? r * 0x8000 : r * 0x7fff, true);
offset += blockAlign;
}
return new Blob([buffer], { type: "audio/wav" });
}
/** 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 +239,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 +264,14 @@ export class AudioPlayer {
private nextTime = 0;
private destination: MediaStreamAudioDestinationNode;
private element: SinkableElement;
private gain: GainNode;
private context: AudioContext;
constructor(private context: AudioContext) {
constructor(context: AudioContext) {
this.context = context;
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 +294,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 +310,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") {
+3
View File
@@ -4,4 +4,7 @@ import react from '@vitejs/plugin-react'
// https://vite.dev/config/
export default defineConfig({
plugins: [react()],
// Set by the GitHub Pages workflow to the repo subpath (e.g. /webspeak3/);
// the normal Docker build serves from the domain root and leaves this unset.
base: process.env.VITE_BASE_PATH || '/',
})