mirror of
https://github.com/Moepchi/webspeak3.git
synced 2026-12-01 17:02:49 +08:00
Compare commits
34
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4afab66d6b | ||
|
|
e19ced1bd1 | ||
|
|
4e04ddb526 | ||
|
|
169d32a292 | ||
|
|
de94859a16 | ||
|
|
810d922b09 | ||
|
|
5e76bd3bdf | ||
|
|
bfe05a8b02 | ||
|
|
83877aaa76 | ||
|
|
6cce28aa9d | ||
|
|
0d8421692a | ||
|
|
3e84e18535 | ||
|
|
d3b0d8ccdd | ||
|
|
9878b1caf3 | ||
|
|
36f510b28e | ||
|
|
faef5c7d19 | ||
|
|
ecf0285f1c | ||
|
|
b11a7a73b8 | ||
|
|
b5e2ce3f7e | ||
|
|
e5cda8301d | ||
|
|
708ad72e59 | ||
|
|
85fa73c7d6 | ||
|
|
8a3e1c230e | ||
|
|
b50dc338df | ||
|
|
b40ada8cff | ||
|
|
fa2c68b622 | ||
|
|
54046d51fe | ||
|
|
9364a7d48a | ||
|
|
dab1a7637e | ||
|
|
a4da3409bc | ||
|
|
da985ef7d1 | ||
|
|
806de52382 | ||
|
|
d299343835 | ||
|
|
10ae24a99f |
No files matched your search
+1
-1
@@ -6,7 +6,7 @@ FROM --platform=$BUILDPLATFORM tonistiigi/xx:1.9.0@sha256:c64defb9ed5a91eacb37f9
|
||||
FROM --platform=$BUILDPLATFORM rust:1-bookworm AS connector-builder
|
||||
COPY --from=xx / /
|
||||
ARG TARGETPLATFORM
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends cmake clang && rm -rf /var/lib/apt/lists/*
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends cmake clang libclang-dev && rm -rf /var/lib/apt/lists/*
|
||||
RUN xx-apt-get update && xx-apt-get install -y libc6-dev gcc g++ && rm -rf /var/lib/apt/lists/*
|
||||
RUN rustup target add $(xx-cargo --print-target-triple)
|
||||
WORKDIR /src
|
||||
|
||||
@@ -31,6 +31,23 @@
|
||||
|
||||
---
|
||||
|
||||
## 📑 Contents
|
||||
|
||||
- [Preview](#-preview)
|
||||
- [Quick Start](#-quick-start)
|
||||
- [Features](#-features)
|
||||
- [Tech Stack](#-tech-stack)
|
||||
- [Browser Support](#-browser-support)
|
||||
- [Installation](#-installation)
|
||||
- [Docker (recommended)](#-docker-recommended)
|
||||
- [Account sync](#account-sync)
|
||||
- [Environment variables](#environment-variables)
|
||||
- [Auto-Connect Links](#-auto-connect-links)
|
||||
- [Translating](#translating)
|
||||
- [Credits](#credits)
|
||||
- [In Memory of Akimo](#-in-memory-of-akimo)
|
||||
- [Legal / Disclaimer](#legal--disclaimer)
|
||||
|
||||
## 📸 Preview
|
||||
|
||||
<table>
|
||||
@@ -39,8 +56,8 @@
|
||||
<th>Mobile</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="72%"><img src="docs/screenshots/webspeak_current.png" width="100%" alt="WebSpeak3 desktop client connected to a TeamSpeak server"></td>
|
||||
<td width="28%" align="center"><img src="docs/screenshots/webspeak_mobile.png" width="260" alt="WebSpeak3 mobile client connected to a TeamSpeak server"></td>
|
||||
<td width="72%"><img src="docs/screenshots/webspeak_desktop.png" width="100%" alt="WebSpeak3 desktop client connected to a TeamSpeak server"></td>
|
||||
<td width="28%" align="center"><img src="docs/screenshots/webspeak_mobile_phone.png" width="260" alt="WebSpeak3 mobile client connected to a TeamSpeak server"></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@@ -84,6 +101,7 @@ not need to be installed on the same machine, modified, or operated by you.
|
||||
| 🔁 **Seamless reconnect** | Switch or add connections mid-session without tearing down unrelated tabs; dropped connections come back on their own, with the channel tree intact |
|
||||
| ⌨️ **Keyboard & screen readers** | Arrow keys through the channel tree (exposed as an ARIA tree) and through menus, Enter joins, context-menu key opens the menu; focus-trapped dialogs, labelled toolbar buttons |
|
||||
| 🍵 **VoySpeak support** | Connects to real VoySpeak servers (formerly GreenTeaSpeak), not just TS3/TS6/TeaSpeak |
|
||||
| 📟 **TeamSpeak 2** | <sub>**EXPERIMENTAL**</sub> Voice, channels, private messages and server messages on old TS2 servers. Registered accounts work too, and the server type "Auto" detects TS2 on its own. Off by default, the gateway enables it with `ENABLE_TS2=1` |
|
||||
| 🖥️ **Screen streaming to/from TS6** | <sub>**ALPHA · UNSTABLE**</sub> Share your screen to native TeamSpeak 6 clients and watch theirs. Built on TS6's undocumented Stream/Call protocol — expect it to break; see [Roadmap](ROADMAP.md) |
|
||||
|
||||
## 🧱 Tech Stack
|
||||
@@ -225,12 +243,14 @@ All optional; add them under `environment:` in your compose override next to `PO
|
||||
| `TURN_URLS` | unset | Comma-separated TURN URLs (e.g. `turn:turn.example.com:3478`) offered to browsers for screen streams, for viewers or publishers behind NATs where direct P2P fails. Pair with `TURN_SECRET` (coturn's `use-auth-secret`; each browser gets its own credential valid for 24 h) or with static `TURN_USERNAME` / `TURN_CREDENTIAL`, which every visitor can read. |
|
||||
| `ALLOWED_ORIGINS` | unset (any origin) | Comma-separated list of web origins allowed to open `/ws` (e.g. `https://client.example.com`). Stops other websites from silently using your gateway as their relay. |
|
||||
| `MAX_CONNECTIONS_PER_IP` / `MAX_CONNECTIONS` | `10` / `60` | Concurrent `/ws` connections per client IP and in total (each can hold a live TeamSpeak session). `0` disables a limit. |
|
||||
| `TURNSTILE_SITE_KEY` / `TURNSTILE_SECRET` | *(unset)* | Optional [Cloudflare Turnstile](https://developers.cloudflare.com/turnstile/) bot check before connecting. With both set, a browser solves the (usually invisible) check once and gets a pass bound to its IP for 12 h. Keeps scripts from opening TeamSpeak connections through your gateway. |
|
||||
| `CONNECT_RATE_LIMIT` | `30` | Server connects per client IP per minute. Each one starts a new TeamSpeak session, so this stops anyone from flooding a server through your gateway. `0` disables it. |
|
||||
| `TRUST_PROXY` | off | Only when the gateway is reachable **solely** through a proxy/tunnel, so per-IP limits see the real client instead of the proxy: `cloudflare` (Cloudflare Tunnel or proxy) uses `CF-Connecting-IP`; `1` (your own nginx/Caddy/Traefik) uses the last `X-Forwarded-For` entry, the one your proxy appended. Don't set it on a directly exposed gateway - clients could then fake their IP. |
|
||||
| `TELEMETRY` | on | Set to `0` to turn off the anonymous usage ping (see below). |
|
||||
| `NEWS_TICKER` | on | Set to `0` to hide the news ticker at the bottom of the client. |
|
||||
| `NEWS_TICKER_CENTRAL` | on | Set to `0` to drop the official WebSpeak3 news (releases, new store designs, announcements) and only show your own messages. |
|
||||
| `NEWS_TICKER_MESSAGES` | – | Your own ticker messages, separated by `\|`, e.g. `Maintenance tonight at 10pm \| Welcome!` |
|
||||
| `ENABLE_TS2` | off | Set to `1` to offer **TeamSpeak 2** as a server type in the connect dialog. Experimental: voice (Speex), channel list, private messages and server messages work; channel chat depends on the server's permissions; file transfer, avatars, screen streams and admin functions aren't available on TS2. Also lets the server type "Auto" fall back to TS2 when a server gives no TS3 answer, and adds account name and password fields for registered TS2 logins. The code ships in every image, it just stays unused while this is off. |
|
||||
| `SYNC_URL` | official sync server | Account sync server your visitors use (Options → Account), e.g. `https://sync.example.com/api/sync`. Only needed if you run your own (see below). |
|
||||
|
||||
> **Anonymous usage ping:** when the gateway starts and then once a day, it sends a random instance ID (made up on first start, stored in `instance-id` in the working directory, used for nothing else) and its version number to `gateway.webspeak3.de`. That's the only way to tell whether anyone self-hosts WebSpeak3 at all, and how many instances still run an old version, e.g. after a security fix. Nothing else is sent: no hostnames, no TeamSpeak servers, no users, no settings. The receiving side doesn't store IP addresses. The startup log says when it's on. Turn it off with `TELEMETRY=0`.
|
||||
@@ -239,7 +259,7 @@ All optional; add them under `environment:` in your compose override next to `PO
|
||||
|
||||
> **Trust model:** the gateway speaks the TeamSpeak protocol on the user's behalf, so whoever runs it necessarily handles their identity key, server/channel passwords and privilege keys (they're kept out of process listings, but the operator can still see them). Only use gateways you trust, and serve them over HTTPS/WSS (`TLS_CERT`/`TLS_KEY` or a TLS-terminating proxy) - plain HTTP exposes all of that on the wire. File uploads are limited to 24 MiB, downloads to 25 MiB.
|
||||
|
||||
> **Stored in the browser:** identities (including their private keys), favorites with any passwords you typed into them, and settings live in the browser's `localStorage`, unencrypted - the same way the native client keeps them in its settings files. Anyone with access to your browser profile can read them; leave favorite password fields empty on shared machines and export identities you care about. Server banners load directly from the host the server admin configured; turn them off under Options → Application if you don't want that host to see your IP.
|
||||
> **Stored in the browser:** identities (including their private keys), favorites with any passwords you typed into them, and settings live in the browser's `localStorage`, unencrypted by default - the same way the native client keeps them in its settings files. Anyone with access to your browser profile can read them. To encrypt identities and saved passwords, set a master password under Options → Security; it's then asked for once per session (every reload or new tab), and without it that data can't be recovered, so export identities you care about first. Server banners load directly from the host the server admin configured; turn them off under Options → Application if you don't want that host to see your IP.
|
||||
|
||||
<details>
|
||||
<summary><b>🛠️ Manual installation (without Docker)</b></summary>
|
||||
@@ -365,10 +385,21 @@ A share link (above) always takes priority over the baked-in default when both a
|
||||
|
||||
Either way: on your own hosted instance, the mandatory first-visit Terms of Use is shown and accepted before anything auto-connects; and if the connection fails, the connect dialog opens prefilled so the visitor can fix it and retry by hand.
|
||||
|
||||
<a id="translating"></a>
|
||||
## 🌍 Translating
|
||||
|
||||
The UI texts live in flat JSON files in [`web/src/locales/`](web/src/locales/), one per language, with `en.json` as the reference. Untranslated keys fall back to English.
|
||||
|
||||
- **Fix or complete a language:** edit its file and open a pull request.
|
||||
- **Add a new language:** copy `en.json` to `<code>.json` (for example `it.json`), translate the values and open a pull request. Leave the keys and placeholders like `{count}` as they are. I'll wire the language into the selector.
|
||||
- **No GitHub account?** Send the file via the in-app feedback form or to feedback@webspeak3.de.
|
||||
|
||||
## 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.
|
||||
|
||||
Country flags use the [Twemoji Country Flags](https://github.com/talkjs/country-flag-emoji-polyfill) font, artwork from [Twemoji](https://github.com/twitter/twemoji) under [CC-BY 4.0](https://creativecommons.org/licenses/by/4.0/).
|
||||
|
||||
## 🌈 In Memory of Akimo
|
||||
|
||||
<!-- Permanent: never remove this section. -->
|
||||
|
||||
Generated
+181
-9
@@ -172,12 +172,41 @@ version = "1.8.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2af50177e190e07a26ab74f8b1efbfe2ef87da2116221318cb1c2e82baf7de06"
|
||||
|
||||
[[package]]
|
||||
name = "bindgen"
|
||||
version = "0.65.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cfdf7b466f9a4903edc73f95d6d2bcd5baf8ae620638762244d3f60143643cc5"
|
||||
dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
"cexpr",
|
||||
"clang-sys",
|
||||
"lazy_static",
|
||||
"lazycell",
|
||||
"log",
|
||||
"peeking_take_while",
|
||||
"prettyplease",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"regex",
|
||||
"rustc-hash 1.1.0",
|
||||
"shlex 1.3.0",
|
||||
"syn 2.0.119",
|
||||
"which",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bit-vec"
|
||||
version = "0.6.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb"
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "1.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "2.13.1"
|
||||
@@ -223,7 +252,16 @@ dependencies = [
|
||||
"find-msvc-tools",
|
||||
"jobserver",
|
||||
"libc",
|
||||
"shlex",
|
||||
"shlex 2.0.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cexpr"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766"
|
||||
dependencies = [
|
||||
"nom",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -259,6 +297,17 @@ dependencies = [
|
||||
"inout",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clang-sys"
|
||||
version = "1.9.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "157a8ba7b480713b56f4c09fd13fc3e0a22a5dfab8097ba61cbc5feef950788a"
|
||||
dependencies = [
|
||||
"glob",
|
||||
"libc",
|
||||
"libloading",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "4.6.4"
|
||||
@@ -623,6 +672,16 @@ version = "1.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
|
||||
|
||||
[[package]]
|
||||
name = "errno"
|
||||
version = "0.3.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ff"
|
||||
version = "0.13.1"
|
||||
@@ -808,6 +867,12 @@ dependencies = [
|
||||
"time",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "glob"
|
||||
version = "0.3.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e4eba85ea1d0a966a983acd07deee566e67395d2d96b6fb39e62b5a833f1eb0b"
|
||||
|
||||
[[package]]
|
||||
name = "group"
|
||||
version = "0.13.0"
|
||||
@@ -938,6 +1003,15 @@ dependencies = [
|
||||
"digest 0.10.7",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "home"
|
||||
version = "0.5.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cc627f471c528ff0c4a49e1d5e60450c8f6461dd6d10ba9dcd3a61d3dff7728d"
|
||||
dependencies = [
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "http"
|
||||
version = "1.4.2"
|
||||
@@ -1277,12 +1351,34 @@ version = "1.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
|
||||
|
||||
[[package]]
|
||||
name = "lazycell"
|
||||
version = "1.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.189"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3eaf3ede3fee6db1a4c2ee091bf8a8b4dccdc6d17f656fb07896ee72867612f2"
|
||||
|
||||
[[package]]
|
||||
name = "libloading"
|
||||
version = "0.8.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"windows-link",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "linux-raw-sys"
|
||||
version = "0.4.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab"
|
||||
|
||||
[[package]]
|
||||
name = "litemap"
|
||||
version = "0.8.2"
|
||||
@@ -1501,6 +1597,12 @@ dependencies = [
|
||||
"windows-link",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "peeking_take_while"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099"
|
||||
|
||||
[[package]]
|
||||
name = "pem-rfc7468"
|
||||
version = "0.7.0"
|
||||
@@ -1585,6 +1687,16 @@ dependencies = [
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "prettyplease"
|
||||
version = "0.2.37"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"syn 2.0.119",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "primeorder"
|
||||
version = "0.13.6"
|
||||
@@ -1625,7 +1737,7 @@ dependencies = [
|
||||
"pin-project-lite",
|
||||
"quinn-proto",
|
||||
"quinn-udp",
|
||||
"rustc-hash",
|
||||
"rustc-hash 2.1.3",
|
||||
"rustls",
|
||||
"socket2",
|
||||
"thiserror 2.0.19",
|
||||
@@ -1647,7 +1759,7 @@ dependencies = [
|
||||
"rand 0.10.2",
|
||||
"rand_pcg",
|
||||
"ring",
|
||||
"rustc-hash",
|
||||
"rustc-hash 2.1.3",
|
||||
"rustls",
|
||||
"rustls-pki-types",
|
||||
"slab",
|
||||
@@ -1748,7 +1860,7 @@ version = "0.5.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"bitflags 2.13.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1771,6 +1883,18 @@ dependencies = [
|
||||
"syn 3.0.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.13.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f020237b6c8eed93db2e2cb53c00c60a8e1bc73da7d073199a1180401450218d"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
"regex-automata",
|
||||
"regex-syntax",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex-automata"
|
||||
version = "0.4.16"
|
||||
@@ -1856,6 +1980,12 @@ dependencies = [
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustc-hash"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
|
||||
|
||||
[[package]]
|
||||
name = "rustc-hash"
|
||||
version = "2.1.3"
|
||||
@@ -1871,6 +2001,19 @@ dependencies = [
|
||||
"semver",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustix"
|
||||
version = "0.38.44"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154"
|
||||
dependencies = [
|
||||
"bitflags 2.13.1",
|
||||
"errno",
|
||||
"libc",
|
||||
"linux-raw-sys",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustls"
|
||||
version = "0.23.42"
|
||||
@@ -2002,7 +2145,7 @@ version = "3.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b7f4bc775c73d9a02cde8bf7b2ec4c9d12743edf609006c7facc23998404cd1d"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"bitflags 2.13.1",
|
||||
"core-foundation 0.10.1",
|
||||
"core-foundation-sys",
|
||||
"libc",
|
||||
@@ -2114,6 +2257,12 @@ dependencies = [
|
||||
"lazy_static",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "shlex"
|
||||
version = "1.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
|
||||
|
||||
[[package]]
|
||||
name = "shlex"
|
||||
version = "2.0.1"
|
||||
@@ -2180,6 +2329,16 @@ dependencies = [
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "speex-sys"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4acde4a315153e8586867cb7e974cb289fa9bc9caa0928f9dfac174f969284e0"
|
||||
dependencies = [
|
||||
"bindgen",
|
||||
"cc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "spki"
|
||||
version = "0.7.3"
|
||||
@@ -2262,7 +2421,7 @@ version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a13f3d0daba03132c0aa9767f98351b3488edc2c100cda2d2ec2b04f3d8d3c8b"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"bitflags 2.13.1",
|
||||
"core-foundation 0.9.4",
|
||||
"system-configuration-sys",
|
||||
]
|
||||
@@ -2520,7 +2679,7 @@ version = "0.6.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4cfcf7e2740e6fc6d4d688b4ef00650406bb94adf4731e43c096c3a19fe40840"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"bitflags 2.13.1",
|
||||
"bytes",
|
||||
"futures-util",
|
||||
"http",
|
||||
@@ -2642,6 +2801,7 @@ dependencies = [
|
||||
"num-traits",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"speex-sys",
|
||||
"time",
|
||||
"tokio",
|
||||
"tracing-subscriber",
|
||||
@@ -2710,7 +2870,7 @@ name = "tsproto-packets"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"base64",
|
||||
"bitflags",
|
||||
"bitflags 2.13.1",
|
||||
"num-derive",
|
||||
"num-traits",
|
||||
"omnom",
|
||||
@@ -2736,7 +2896,7 @@ name = "tsproto-types"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"base64",
|
||||
"bitflags",
|
||||
"bitflags 2.13.1",
|
||||
"curve25519-dalek-ng",
|
||||
"elliptic-curve",
|
||||
"generic-array",
|
||||
@@ -2930,6 +3090,18 @@ dependencies = [
|
||||
"rustls-pki-types",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "which"
|
||||
version = "4.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7"
|
||||
dependencies = [
|
||||
"either",
|
||||
"home",
|
||||
"once_cell",
|
||||
"rustix",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "widestring"
|
||||
version = "1.2.1"
|
||||
|
||||
@@ -7,7 +7,7 @@ edition = "2021"
|
||||
tsclientlib = { path = "../tsclientlib/tsclientlib", default-features = false, features = ["default-tls", "audio"] }
|
||||
tsproto-packets = { path = "../tsclientlib/utils/tsproto-packets" }
|
||||
audiopus = "0.3.0-rc.0"
|
||||
tokio = { version = "1", features = ["rt-multi-thread", "macros", "time", "io-std", "io-util"] }
|
||||
tokio = { version = "1", features = ["rt-multi-thread", "macros", "time", "io-std", "io-util", "net"] }
|
||||
futures = "0.3"
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
serde_json = "1"
|
||||
@@ -17,3 +17,4 @@ num-traits = "0.2"
|
||||
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
|
||||
base64 = "0.22"
|
||||
time = "0.3"
|
||||
speex-sys = "0.4"
|
||||
+34
-4
@@ -32,6 +32,8 @@ use tsclientlib::{
|
||||
ServerType, StreamItem, TextMessageTargetMode, TsError,
|
||||
};
|
||||
use tsproto_packets::commands::{CommandItem, CommandParser};
|
||||
mod ts2;
|
||||
|
||||
use tsproto_packets::packets::{AudioData, CodecType, Direction, Flags, OutAudio, OutCommand, PacketType};
|
||||
|
||||
/// 20ms frames at 48kHz, which is what TeamSpeak's Opus voice codec expects.
|
||||
@@ -70,7 +72,7 @@ const MAX_ICON_BYTES: u64 = 512 << 10;
|
||||
const MAX_AVATAR_BYTES: u64 = 512 << 10;
|
||||
const OUT_CHANNELS: usize = 2;
|
||||
|
||||
#[derive(Parser, Debug)]
|
||||
#[derive(Parser, Debug, Clone)]
|
||||
#[command(author, about = "One-shot bridge: connects to a real TeamSpeak server and reports events as JSON lines on stdout")]
|
||||
struct Args {
|
||||
/// Server address, e.g. "192.168.178.108" or "192.168.178.108:9987"
|
||||
@@ -98,12 +100,19 @@ struct Args {
|
||||
#[arg(long, env = "TS_IDENTITY", hide_env_values = true)]
|
||||
identity: Option<String>,
|
||||
/// Server flavour: `teamspeak` (skip TeaSpeak handshake), `teaspeak`
|
||||
/// (always handshake), or `auto` (handshake when server sends `teaspeak=1`).
|
||||
#[arg(long, default_value = "auto", value_parser = ["auto", "teamspeak", "teaspeak"])]
|
||||
/// (always handshake), `auto` (handshake when server sends `teaspeak=1`),
|
||||
/// or `ts2` for a TeamSpeak 2 server (experimental, see ts2.rs).
|
||||
#[arg(long, default_value = "auto", value_parser = ["auto", "teamspeak", "teaspeak", "ts2"])]
|
||||
server_type: String,
|
||||
/// Privilege key / token (`client_default_token` in clientinit).
|
||||
#[arg(long, alias = "token", env = "TS_PRIVILEGE_KEY", hide_env_values = true)]
|
||||
privilege_key: Option<String>,
|
||||
/// TeamSpeak 2 only: account name for a registered login (anonymous when omitted).
|
||||
#[arg(long, env = "TS_LOGIN_NAME", hide_env_values = true)]
|
||||
login_name: Option<String>,
|
||||
/// TeamSpeak 2 only: password of the registered account.
|
||||
#[arg(long, env = "TS_LOGIN_PASSWORD", hide_env_values = true)]
|
||||
login_password: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
@@ -867,7 +876,28 @@ fn send_server_get_variables(con: &mut tsclientlib::Connection) {
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
let args = Args::parse();
|
||||
if let Err(e) = run(args).await {
|
||||
// "auto" falls back to TeamSpeak 2 when the TS3 handshake gets no answer at
|
||||
// all; only if the gateway enables TS2 (ENABLE_TS2=1, inherited env).
|
||||
let ts2_fallback = args.server_type == "auto" && std::env::var("ENABLE_TS2").as_deref() == Ok("1");
|
||||
let result = if args.server_type == "ts2" {
|
||||
ts2::run(args).await
|
||||
} else if ts2_fallback {
|
||||
match run(args.clone()).await {
|
||||
Err(e) if e.to_string().contains("connection timed out") => {
|
||||
eprintln!("no TS3 answer, trying TeamSpeak 2");
|
||||
// Only the TS3 default port is swapped; an explicit other port is kept.
|
||||
let mut args = args;
|
||||
if let Some(host) = args.address.strip_suffix(":9987") {
|
||||
args.address = host.to_string();
|
||||
}
|
||||
ts2::run(args).await.map_err(|_| e)
|
||||
}
|
||||
r => r,
|
||||
}
|
||||
} else {
|
||||
run(args).await
|
||||
};
|
||||
if let Err(e) = result {
|
||||
emit(&Event::Error { message: e.to_string() });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,945 @@
|
||||
//! TeamSpeak 2 client (experimental, `--server-type=ts2`).
|
||||
//!
|
||||
//! TS2 is a plain UDP protocol, unrelated to TS3. Layouts come from the
|
||||
//! Wireshark dissector (`packet-teamspeak2.c`) and the soliloque-server
|
||||
//! reimplementation, checked against a real 2.0.24.1 server.
|
||||
//!
|
||||
//! Packet classes (all little endian):
|
||||
//! - `0xbef4` connection: class, type, session, client id, counter, CRC @16, payload @20
|
||||
//! - `0xbef0` reliable: same plus resend count @16, fragment @18, CRC @20, payload @24
|
||||
//! - `0xbef1` ACK: class, 0, session, client id, acked seq (16 bytes, no CRC)
|
||||
//! - `0xbef2`/`0xbef3` voice, client -> server / server -> client
|
||||
//!
|
||||
//! CRC is zlib CRC32 over the whole packet with the CRC field zeroed.
|
||||
//! Speaks the same stdout/stdin line protocol as the TS3 path in main.rs.
|
||||
|
||||
use std::collections::{BTreeMap, HashMap, HashSet, VecDeque};
|
||||
use std::mem::MaybeUninit;
|
||||
use std::net::SocketAddr;
|
||||
use std::os::raw::{c_char, c_int, c_void};
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
use anyhow::{Result, anyhow, bail};
|
||||
use base64::Engine;
|
||||
use tokio::io::{AsyncBufReadExt, BufReader};
|
||||
use tokio::net::UdpSocket;
|
||||
|
||||
use crate::{Args, ChannelInfo, ClientInfo, Event, emit};
|
||||
|
||||
const DEFAULT_PORT: u16 = 8767;
|
||||
const KEEPALIVE_EVERY: Duration = Duration::from_secs(3);
|
||||
const RESEND_AFTER: Duration = Duration::from_secs(1);
|
||||
const MAX_RESENDS: u16 = 10;
|
||||
const SERVER_TIMEOUT: Duration = Duration::from_secs(20);
|
||||
/// Speex narrowband: 20 ms frames of 160 samples at 8 kHz, 5 per voice packet.
|
||||
const SPEEX_FRAME: usize = 160;
|
||||
const FRAMES_PER_PACKET: usize = 5;
|
||||
/// Start playing a speaker once this many 8 kHz samples are queued. Packets
|
||||
/// carry 100 ms each, so this waits for the second packet - TS2 clients
|
||||
/// send in bursts and anything less underruns on ordinary jitter.
|
||||
const PREBUFFER: usize = SPEEX_FRAME * FRAMES_PER_PACKET + 1;
|
||||
|
||||
const ST_CHANNEL_COMMANDER: u16 = 1;
|
||||
const ST_AWAY: u16 = 8;
|
||||
const ST_MUTE_MIC: u16 = 16;
|
||||
const ST_MUTE_SPEAKERS: u16 = 32;
|
||||
const CH_PASSWORD: u8 = 4;
|
||||
|
||||
fn crc(pkt: &mut [u8], at: usize) {
|
||||
pkt[at..at + 4].fill(0);
|
||||
let h = crc32(pkt);
|
||||
pkt[at..at + 4].copy_from_slice(&h.to_le_bytes());
|
||||
}
|
||||
|
||||
/// zlib's CRC32 (IEEE, reflected). Small enough that a dependency isn't worth it.
|
||||
fn crc32(data: &[u8]) -> u32 {
|
||||
let mut c = !0u32;
|
||||
for &b in data {
|
||||
c ^= b as u32;
|
||||
for _ in 0..8 {
|
||||
c = if c & 1 != 0 { (c >> 1) ^ 0xEDB8_8320 } else { c >> 1 };
|
||||
}
|
||||
}
|
||||
!c
|
||||
}
|
||||
|
||||
/// TS2 strings are Latin-1. Fixed fields are a length byte plus 29 bytes.
|
||||
fn latin1(b: &[u8]) -> String {
|
||||
b.iter().map(|&c| c as char).collect()
|
||||
}
|
||||
fn to_latin1(s: &str) -> Vec<u8> {
|
||||
s.chars().map(|c| if (c as u32) < 256 { c as u8 } else { b'?' }).collect()
|
||||
}
|
||||
fn pstr(s: &str) -> [u8; 30] {
|
||||
let mut out = [0u8; 30];
|
||||
let b = to_latin1(s);
|
||||
let n = b.len().min(29);
|
||||
out[0] = n as u8;
|
||||
out[1..1 + n].copy_from_slice(&b[..n]);
|
||||
out
|
||||
}
|
||||
fn rpstr(b: &[u8], at: usize) -> String {
|
||||
let Some(&n) = b.get(at) else { return String::new() };
|
||||
let end = (at + 1 + (n as usize).min(29)).min(b.len());
|
||||
latin1(b.get(at + 1..end).unwrap_or(&[]))
|
||||
}
|
||||
/// Null-terminated string at `*at`, advancing past the terminator.
|
||||
fn rcstr(b: &[u8], at: &mut usize) -> String {
|
||||
let start = (*at).min(b.len());
|
||||
let end = b[start..].iter().position(|&c| c == 0).map_or(b.len(), |p| start + p);
|
||||
*at = end + 1;
|
||||
latin1(&b[start..end])
|
||||
}
|
||||
fn u16_at(b: &[u8], at: usize) -> u16 {
|
||||
b.get(at..at + 2).map_or(0, |s| u16::from_le_bytes([s[0], s[1]]))
|
||||
}
|
||||
fn u32_at(b: &[u8], at: usize) -> u32 {
|
||||
b.get(at..at + 4).map_or(0, |s| u32::from_le_bytes([s[0], s[1], s[2], s[3]]))
|
||||
}
|
||||
|
||||
fn codec_name(codec: u16) -> String {
|
||||
match codec {
|
||||
0 => "CELP 5.1",
|
||||
1 => "CELP 6.3",
|
||||
2 => "GSM 14.8",
|
||||
3 => "GSM 16.4",
|
||||
4 => "CELP Windows 5.2",
|
||||
5 => "Speex 3.4",
|
||||
6 => "Speex 5.2",
|
||||
7 => "Speex 7.2",
|
||||
8 => "Speex 9.3",
|
||||
9 => "Speex 12.3",
|
||||
10 => "Speex 16.3",
|
||||
11 => "Speex 19.5",
|
||||
12 => "Speex 25.9",
|
||||
_ => "unknown",
|
||||
}
|
||||
.into()
|
||||
}
|
||||
|
||||
/// Speex narrowband submode per TS2 codec id. Derived from the fixed voice
|
||||
/// payload sizes (e.g. 138 bytes = 5 frames of submode 4's 220 bits); the
|
||||
/// server rejects packets of any other size.
|
||||
fn speex_submode(codec: u8) -> Option<c_int> {
|
||||
Some(match codec {
|
||||
5 => 1,
|
||||
6 => 8,
|
||||
7 => 2,
|
||||
8 => 3,
|
||||
9 => 4,
|
||||
10 => 5,
|
||||
11 => 6,
|
||||
12 => 7,
|
||||
_ => return None,
|
||||
})
|
||||
}
|
||||
/// Bytes of Speex data per voice packet, indexed by codec id.
|
||||
const SPEEX_BYTES: [usize; 13] = [0, 0, 0, 0, 0, 27, 50, 75, 100, 138, 188, 228, 308];
|
||||
|
||||
// --- Speex -------------------------------------------------------------------
|
||||
|
||||
struct Bits(Box<speex_sys::SpeexBits>);
|
||||
impl Bits {
|
||||
fn new() -> Self {
|
||||
let mut b: Box<MaybeUninit<speex_sys::SpeexBits>> = Box::new(MaybeUninit::uninit());
|
||||
// SAFETY: speex_bits_init fully initialises the struct.
|
||||
unsafe {
|
||||
speex_sys::speex_bits_init(b.as_mut_ptr());
|
||||
Bits(Box::from_raw(Box::into_raw(b).cast()))
|
||||
}
|
||||
}
|
||||
}
|
||||
impl Drop for Bits {
|
||||
fn drop(&mut self) {
|
||||
unsafe { speex_sys::speex_bits_destroy(&mut *self.0) }
|
||||
}
|
||||
}
|
||||
// The raw state pointers are only ever touched from the one task that owns them.
|
||||
unsafe impl Send for Bits {}
|
||||
|
||||
struct Decoder {
|
||||
st: *mut c_void,
|
||||
bits: Bits,
|
||||
}
|
||||
unsafe impl Send for Decoder {}
|
||||
impl Decoder {
|
||||
fn new() -> Self {
|
||||
unsafe {
|
||||
let st = speex_sys::speex_decoder_init(speex_sys::speex_lib_get_mode(speex_sys::SPEEX_MODEID_NB));
|
||||
let mut on: c_int = 1;
|
||||
speex_sys::speex_decoder_ctl(st, speex_sys::SPEEX_SET_ENH, (&mut on as *mut c_int).cast());
|
||||
Decoder { st, bits: Bits::new() }
|
||||
}
|
||||
}
|
||||
/// Decodes one voice packet's worth of frames to 8 kHz samples.
|
||||
fn decode(&mut self, data: &[u8]) -> Vec<i16> {
|
||||
let mut out = vec![0i16; SPEEX_FRAME * FRAMES_PER_PACKET];
|
||||
unsafe {
|
||||
speex_sys::speex_bits_read_from(&mut *self.bits.0, data.as_ptr() as *mut c_char, data.len() as c_int);
|
||||
for frame in out.chunks_mut(SPEEX_FRAME) {
|
||||
if speex_sys::speex_decode_int(self.st, &mut *self.bits.0, frame.as_mut_ptr()) != 0 {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
out
|
||||
}
|
||||
}
|
||||
impl Drop for Decoder {
|
||||
fn drop(&mut self) {
|
||||
unsafe { speex_sys::speex_decoder_destroy(self.st) }
|
||||
}
|
||||
}
|
||||
|
||||
struct Encoder {
|
||||
st: *mut c_void,
|
||||
bits: Bits,
|
||||
codec: u8,
|
||||
frames: usize,
|
||||
}
|
||||
unsafe impl Send for Encoder {}
|
||||
impl Encoder {
|
||||
fn new(codec: u8) -> Option<Self> {
|
||||
let mut submode = speex_submode(codec)?;
|
||||
unsafe {
|
||||
let st = speex_sys::speex_encoder_init(speex_sys::speex_lib_get_mode(speex_sys::SPEEX_MODEID_NB));
|
||||
speex_sys::speex_encoder_ctl(st, speex_sys::SPEEX_SET_MODE, (&mut submode as *mut c_int).cast());
|
||||
Some(Encoder { st, bits: Bits::new(), codec, frames: 0 })
|
||||
}
|
||||
}
|
||||
/// Feeds one 8 kHz frame; returns a full packet payload every fifth frame.
|
||||
fn push(&mut self, frame: &mut [i16; SPEEX_FRAME]) -> Option<Vec<u8>> {
|
||||
unsafe { speex_sys::speex_encode_int(self.st, frame.as_mut_ptr(), &mut *self.bits.0) };
|
||||
self.frames += 1;
|
||||
if self.frames < FRAMES_PER_PACKET {
|
||||
return None;
|
||||
}
|
||||
self.frames = 0;
|
||||
let mut out = vec![0u8; SPEEX_BYTES[self.codec as usize]];
|
||||
debug_assert_eq!(unsafe { speex_sys::speex_bits_nbytes(&mut *self.bits.0) } as usize, out.len());
|
||||
unsafe {
|
||||
speex_sys::speex_bits_write(&mut *self.bits.0, out.as_mut_ptr() as *mut c_char, out.len() as c_int);
|
||||
speex_sys::speex_bits_reset(&mut *self.bits.0);
|
||||
}
|
||||
Some(out)
|
||||
}
|
||||
}
|
||||
impl Drop for Encoder {
|
||||
fn drop(&mut self) {
|
||||
unsafe { speex_sys::speex_encoder_destroy(self.st) }
|
||||
}
|
||||
}
|
||||
|
||||
// --- State ---------------------------------------------------------------------
|
||||
|
||||
struct Channel {
|
||||
id: u32,
|
||||
flags: u8,
|
||||
codec: u16,
|
||||
parent: u32,
|
||||
order: u16,
|
||||
max_users: u16,
|
||||
name: String,
|
||||
topic: String,
|
||||
}
|
||||
struct Player {
|
||||
channel: u32,
|
||||
status: u16,
|
||||
name: String,
|
||||
}
|
||||
|
||||
/// Parses one channel record (list and "created" share the layout).
|
||||
fn parse_channel(b: &[u8], at: &mut usize) -> Option<Channel> {
|
||||
let o = *at;
|
||||
if b.len() < o + 16 {
|
||||
return None;
|
||||
}
|
||||
*at += 16;
|
||||
let name = rcstr(b, at);
|
||||
let topic = rcstr(b, at);
|
||||
let _description = rcstr(b, at);
|
||||
Some(Channel {
|
||||
id: u32_at(b, o),
|
||||
flags: b[o + 4],
|
||||
codec: u16_at(b, o + 6),
|
||||
parent: u32_at(b, o + 8),
|
||||
order: u16_at(b, o + 12),
|
||||
max_users: u16_at(b, o + 14),
|
||||
name,
|
||||
topic,
|
||||
})
|
||||
}
|
||||
|
||||
struct Speaker {
|
||||
decoder: Decoder,
|
||||
queue: VecDeque<i16>,
|
||||
playing: bool,
|
||||
}
|
||||
|
||||
struct Ts2 {
|
||||
sock: UdpSocket,
|
||||
session: u32,
|
||||
client_id: u32,
|
||||
conn_counter: u32,
|
||||
seq: u32,
|
||||
/// Reliable packets waiting to go out. TS2 is stop-and-wait: only the
|
||||
/// front one is in flight until the server ACKs it.
|
||||
outbox: VecDeque<Vec<u8>>,
|
||||
in_flight: Option<(Instant, u16)>,
|
||||
next_in: u32,
|
||||
early: BTreeMap<u32, Vec<u8>>,
|
||||
fragments: Vec<u8>,
|
||||
fragment_type: u16,
|
||||
channels: BTreeMap<u32, Channel>,
|
||||
players: BTreeMap<u32, Player>,
|
||||
lists_done: bool,
|
||||
speakers: HashMap<u32, Speaker>,
|
||||
talking: HashSet<u32>,
|
||||
encoder: Option<Encoder>,
|
||||
voice_counter: u16,
|
||||
voice_conversation: u16,
|
||||
last_audio_in: Option<Instant>,
|
||||
codec_warned: bool,
|
||||
}
|
||||
|
||||
impl Ts2 {
|
||||
fn reliable(&mut self, typ: u16, payload: &[u8]) {
|
||||
let mut p = Vec::with_capacity(24 + payload.len());
|
||||
p.extend_from_slice(&0xbef0u16.to_le_bytes());
|
||||
p.extend_from_slice(&typ.to_le_bytes());
|
||||
p.extend_from_slice(&self.session.to_le_bytes());
|
||||
p.extend_from_slice(&self.client_id.to_le_bytes());
|
||||
p.extend_from_slice(&self.seq.to_le_bytes());
|
||||
p.extend_from_slice(&[0; 8]); // resend count, fragment, CRC
|
||||
p.extend_from_slice(payload);
|
||||
crc(&mut p, 20);
|
||||
self.seq += 1;
|
||||
self.outbox.push_back(p);
|
||||
}
|
||||
|
||||
async fn pump_outbox(&mut self) -> Result<()> {
|
||||
let Some(front) = self.outbox.front_mut() else { return Ok(()) };
|
||||
let resends = match self.in_flight {
|
||||
None => 0,
|
||||
Some((at, _)) if at.elapsed() < RESEND_AFTER => return Ok(()),
|
||||
Some((_, n)) if n >= MAX_RESENDS => bail!("The TeamSpeak 2 server stopped answering"),
|
||||
Some((_, n)) => n + 1,
|
||||
};
|
||||
front[16..18].copy_from_slice(&resends.to_le_bytes());
|
||||
crc(front, 20);
|
||||
self.sock.send(front).await?;
|
||||
self.in_flight = Some((Instant::now(), resends));
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Sends the logout, then waits (max 1.5 s) for the server's own "player left"
|
||||
/// for us and acks it. Until that ack the server keeps us half-present (it
|
||||
/// resends every 100 ms) and lists us to clients joining meanwhile, who never
|
||||
/// get a leave for that ghost.
|
||||
async fn logout(&mut self) {
|
||||
self.reliable(0x012c, &[]);
|
||||
let deadline = Instant::now() + Duration::from_millis(1500);
|
||||
let mut buf = [0u8; 2048];
|
||||
while Instant::now() < deadline {
|
||||
if self.pump_outbox().await.is_err() {
|
||||
return;
|
||||
}
|
||||
let Ok(Ok(n)) = tokio::time::timeout(Duration::from_millis(100), self.sock.recv(&mut buf)).await else { continue };
|
||||
let b = &buf[..n];
|
||||
match u16_at(b, 0) {
|
||||
0xbef0 if b.len() >= 24 => {
|
||||
let mut ack = Vec::with_capacity(16);
|
||||
ack.extend_from_slice(&0xbef1u16.to_le_bytes());
|
||||
ack.extend_from_slice(&0u16.to_le_bytes());
|
||||
ack.extend_from_slice(&self.session.to_le_bytes());
|
||||
ack.extend_from_slice(&self.client_id.to_le_bytes());
|
||||
ack.extend_from_slice(&b[12..16]);
|
||||
let _ = self.sock.send(&ack).await;
|
||||
if u16_at(b, 2) == 0x0065 && u32_at(b, 24) == self.client_id {
|
||||
return;
|
||||
}
|
||||
}
|
||||
_ => {
|
||||
let _ = self.on_datagram(b).await;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async fn keepalive(&mut self) -> Result<()> {
|
||||
let mut p = Vec::with_capacity(24);
|
||||
p.extend_from_slice(&0xbef4u16.to_le_bytes());
|
||||
p.extend_from_slice(&1u16.to_le_bytes());
|
||||
p.extend_from_slice(&self.session.to_le_bytes());
|
||||
p.extend_from_slice(&self.client_id.to_le_bytes());
|
||||
p.extend_from_slice(&self.conn_counter.to_le_bytes());
|
||||
p.extend_from_slice(&[0; 4]); // CRC
|
||||
crc(&mut p, 16);
|
||||
self.conn_counter += 1;
|
||||
self.sock.send(&p).await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn own_channel(&self) -> u32 {
|
||||
self.players.get(&self.client_id).map_or(0, |p| p.channel)
|
||||
}
|
||||
|
||||
fn set_status(&mut self, bit: u16, on: bool) {
|
||||
let mut status = self.players.get(&self.client_id).map_or(0, |p| p.status);
|
||||
status = if on { status | bit } else { status & !bit };
|
||||
if let Some(p) = self.players.get_mut(&self.client_id) {
|
||||
p.status = status;
|
||||
}
|
||||
self.reliable(0x0130, &status.to_le_bytes());
|
||||
self.snapshot();
|
||||
}
|
||||
|
||||
fn send_text(&mut self, kind: u8, target: u32, message: &str) {
|
||||
let mut p = Vec::new();
|
||||
p.extend_from_slice(&0u32.to_le_bytes()); // colour
|
||||
p.push(kind);
|
||||
p.extend_from_slice(&target.to_le_bytes());
|
||||
p.extend_from_slice(&to_latin1(message));
|
||||
p.push(0);
|
||||
self.reliable(0x01ae, &p);
|
||||
}
|
||||
|
||||
fn snapshot(&self) {
|
||||
if !self.lists_done {
|
||||
return;
|
||||
}
|
||||
let channels = self
|
||||
.channels
|
||||
.values()
|
||||
.map(|c| ChannelInfo {
|
||||
id: c.id as u64,
|
||||
parent: if c.parent == u32::MAX { 0 } else { c.parent as u64 },
|
||||
order: c.order as u64,
|
||||
name: c.name.clone(),
|
||||
topic: c.topic.clone(),
|
||||
codec: codec_name(c.codec),
|
||||
max_clients: (c.max_users > 0).then_some(c.max_users),
|
||||
has_password: c.flags & CH_PASSWORD != 0,
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
let clients = self
|
||||
.players
|
||||
.iter()
|
||||
.map(|(&id, p)| ClientInfo {
|
||||
id: id as u16,
|
||||
channel: p.channel as u64,
|
||||
name: p.name.clone(),
|
||||
input_muted: p.status & ST_MUTE_MIC != 0,
|
||||
output_muted: p.status & ST_MUTE_SPEAKERS != 0,
|
||||
input_hardware_enabled: true,
|
||||
away: p.status & ST_AWAY != 0,
|
||||
away_message: String::new(),
|
||||
is_channel_commander: p.status & ST_CHANNEL_COMMANDER != 0,
|
||||
country: String::new(),
|
||||
uid: String::new(),
|
||||
database_id: 0,
|
||||
channel_group: 0,
|
||||
server_groups: Vec::new(),
|
||||
has_talk_power: true,
|
||||
is_query: false,
|
||||
is_streaming: false,
|
||||
avatar_hash: String::new(),
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
emit(&Event::Channels {
|
||||
server_clients_online: clients.len() as u16,
|
||||
server_channels_online: channels.len() as u64,
|
||||
channels,
|
||||
clients,
|
||||
own_client_id: self.client_id as u16,
|
||||
server_max_clients: 0,
|
||||
});
|
||||
}
|
||||
|
||||
/// Handles one in-order reliable packet. Returns false once we are gone.
|
||||
fn handle(&mut self, typ: u16, b: &[u8]) -> bool {
|
||||
if std::env::var_os("TS2_DEBUG").is_some() { eprintln!("in {typ:#06x} {:02x?}", &b[..b.len().min(96)]); }
|
||||
match typ {
|
||||
0x0006 => {
|
||||
let n = u32_at(b, 0);
|
||||
let mut at = 4;
|
||||
for _ in 0..n {
|
||||
let Some(c) = parse_channel(b, &mut at) else { break };
|
||||
self.channels.insert(c.id, c);
|
||||
}
|
||||
}
|
||||
0x0007 => {
|
||||
let n = u32_at(b, 0) as usize;
|
||||
for i in 0..n {
|
||||
let o = 4 + i * 44;
|
||||
if b.len() < o + 44 {
|
||||
break;
|
||||
}
|
||||
let player = Player { channel: u32_at(b, o + 4), status: u16_at(b, o + 12), name: rpstr(b, o + 14) };
|
||||
self.players.insert(u32_at(b, o), player);
|
||||
}
|
||||
self.lists_done = true;
|
||||
}
|
||||
0x0064 => {
|
||||
let player = Player { channel: u32_at(b, 4), status: u16_at(b, 12), name: rpstr(b, 14) };
|
||||
self.players.insert(u32_at(b, 0), player);
|
||||
}
|
||||
0x0065 | 0x0066 => {
|
||||
let id = u32_at(b, 0);
|
||||
if id == self.client_id {
|
||||
let reason = if typ == 0x0066 { "kicked from the server" } else { "removed from the server" };
|
||||
emit(&Event::Disconnected { reason: reason.into() });
|
||||
return false;
|
||||
}
|
||||
self.players.remove(&id);
|
||||
self.speakers.remove(&id);
|
||||
}
|
||||
0x0067 | 0x006d => {
|
||||
if let Some(p) = self.players.get_mut(&u32_at(b, 0)) {
|
||||
p.channel = u32_at(b, 8);
|
||||
}
|
||||
if u32_at(b, 0) == self.client_id {
|
||||
self.encoder = None;
|
||||
self.speakers.clear();
|
||||
}
|
||||
}
|
||||
0x0068 => {
|
||||
if let Some(p) = self.players.get_mut(&u32_at(b, 0)) {
|
||||
p.status = u16_at(b, 4);
|
||||
}
|
||||
}
|
||||
0x006e => {
|
||||
let mut at = 4;
|
||||
if let Some(c) = parse_channel(b, &mut at) {
|
||||
self.channels.insert(c.id, c);
|
||||
}
|
||||
}
|
||||
0x006f | 0x0070 => {
|
||||
let mut at = 8;
|
||||
let text = rcstr(b, &mut at);
|
||||
if let Some(c) = self.channels.get_mut(&u32_at(b, 0)) {
|
||||
if typ == 0x006f { c.name = text } else { c.topic = text }
|
||||
}
|
||||
}
|
||||
0x0071 => {
|
||||
if let Some(c) = self.channels.get_mut(&u32_at(b, 0)) {
|
||||
c.flags = u16_at(b, 4) as u8;
|
||||
c.codec = u16_at(b, 6);
|
||||
}
|
||||
self.encoder = None;
|
||||
}
|
||||
// Channel deleted: u16 channel id, then the deleting player's u32 id.
|
||||
0x0073 => {
|
||||
self.channels.remove(&(u16_at(b, 0) as u32));
|
||||
}
|
||||
0x0074 | 0x0075 => {
|
||||
if let Some(c) = self.channels.get_mut(&u32_at(b, 0)) {
|
||||
if typ == 0x0074 { c.max_users = u16_at(b, 4) } else { c.order = u16_at(b, 4) }
|
||||
}
|
||||
}
|
||||
// The server refuses a command (seen for chat without the matching text permission).
|
||||
// The server refuses a request: function code u16, then a u16 error code
|
||||
// (seen: 0x012f channel switch into a channel that no longer exists).
|
||||
0xff9a => emit(&Event::Error { message: format!("The TeamSpeak 2 server refused this (error {:#x}).", u16_at(b, 2)) }),
|
||||
0xfc0f => emit(&Event::Error { message: "The TeamSpeak 2 server refused this: you lack the permission.".into() }),
|
||||
0x0082 => {
|
||||
let from = rpstr(b, 5);
|
||||
let mut at = 35;
|
||||
let message = rcstr(b, &mut at).trim_end().to_string();
|
||||
let own_name = self.players.get(&self.client_id).map(|p| p.name.as_str());
|
||||
match b.get(4) {
|
||||
Some(0) => emit(&Event::ServerMessage { from, message }),
|
||||
Some(2) => {
|
||||
// TS2 names the sender only; nicknames are unique per server.
|
||||
let partner_id = self.players.iter().find(|(_, p)| p.name == from).map_or(0, |(&id, _)| id as u16);
|
||||
let from_self = own_name == Some(from.as_str());
|
||||
emit(&Event::PrivateMessage { partner_id, partner_name: from, from_self, message });
|
||||
}
|
||||
Some(1) => emit(&Event::ChatMessage { from, message }),
|
||||
// Kind 0xce: admin broadcast (tcpquery msg), with an empty sender field.
|
||||
_ => emit(&Event::ServerMessage { from: String::new(), message }),
|
||||
}
|
||||
return true;
|
||||
}
|
||||
_ => return true,
|
||||
}
|
||||
self.snapshot();
|
||||
true
|
||||
}
|
||||
|
||||
fn on_voice(&mut self, b: &[u8]) {
|
||||
let codec = b.get(3).copied().unwrap_or(0);
|
||||
let Some(len) = SPEEX_BYTES.get(codec as usize).copied().filter(|&l| l > 0) else { return };
|
||||
// Server voice: 16 bytes header, sender id @16, counter @20, then one
|
||||
// codec-specific byte before the Speex data.
|
||||
let Some(data) = b.get(23..23 + len) else { return };
|
||||
let sender = u32_at(b, 16);
|
||||
let speaker = self.speakers.entry(sender).or_insert_with(|| Speaker {
|
||||
decoder: Decoder::new(),
|
||||
queue: VecDeque::new(),
|
||||
playing: false,
|
||||
});
|
||||
speaker.queue.extend(speaker.decoder.decode(data));
|
||||
}
|
||||
|
||||
/// 20 ms tick: mix one frame from every buffered speaker, upsample 8 -> 48 kHz.
|
||||
fn audio_tick(&mut self) {
|
||||
let mut mix = [0i32; SPEEX_FRAME];
|
||||
let mut talking = HashSet::new();
|
||||
for (&id, s) in &mut self.speakers {
|
||||
if !s.playing && s.queue.len() >= PREBUFFER {
|
||||
s.playing = true;
|
||||
}
|
||||
if !s.playing {
|
||||
continue;
|
||||
}
|
||||
if s.queue.len() < SPEEX_FRAME {
|
||||
s.playing = false;
|
||||
continue;
|
||||
}
|
||||
for m in mix.iter_mut() {
|
||||
*m += s.queue.pop_front().unwrap_or(0) as i32;
|
||||
}
|
||||
talking.insert(id);
|
||||
}
|
||||
if talking != self.talking {
|
||||
self.talking = talking;
|
||||
emit(&Event::Talkers { clients: self.talking.iter().map(|&id| id as u16).collect() });
|
||||
}
|
||||
if self.talking.is_empty() {
|
||||
return;
|
||||
}
|
||||
// ponytail: linear interpolation, swap for a proper resampler if it sounds dull.
|
||||
let mut bytes = Vec::with_capacity(SPEEX_FRAME * 6 * 4);
|
||||
for i in 0..SPEEX_FRAME {
|
||||
let a = mix[i];
|
||||
let b = mix.get(i + 1).copied().unwrap_or(a);
|
||||
for k in 0..6 {
|
||||
let v = (a + (b - a) * k / 6).clamp(i16::MIN as i32, i16::MAX as i32) as i16;
|
||||
bytes.extend_from_slice(&v.to_le_bytes());
|
||||
bytes.extend_from_slice(&v.to_le_bytes());
|
||||
}
|
||||
}
|
||||
emit(&Event::AudioOut { pcm: base64::engine::general_purpose::STANDARD.encode(bytes) });
|
||||
}
|
||||
|
||||
/// One 960-sample 48 kHz mono frame from the browser.
|
||||
async fn on_mic(&mut self, b64: &str) -> Result<()> {
|
||||
let Ok(raw) = base64::engine::general_purpose::STANDARD.decode(b64.trim()) else { return Ok(()) };
|
||||
let codec = self.channels.get(&self.own_channel()).map_or(0, |c| c.codec) as u8;
|
||||
if self.encoder.as_ref().is_none_or(|e| e.codec != codec) {
|
||||
self.encoder = Encoder::new(codec);
|
||||
if self.encoder.is_none() {
|
||||
if !self.codec_warned {
|
||||
self.codec_warned = true;
|
||||
emit(&Event::Error {
|
||||
message: format!("Sending voice in {} channels is not supported, only Speex.", codec_name(codec as u16)),
|
||||
});
|
||||
}
|
||||
return Ok(());
|
||||
}
|
||||
}
|
||||
if self.last_audio_in.is_none_or(|t| t.elapsed() > Duration::from_millis(200)) {
|
||||
self.voice_conversation = self.voice_conversation.wrapping_add(1);
|
||||
}
|
||||
self.last_audio_in = Some(Instant::now());
|
||||
// 48 -> 8 kHz by averaging each 6 samples, a cheap low-pass.
|
||||
let mut frame = [0i16; SPEEX_FRAME];
|
||||
for (i, chunk) in raw.chunks_exact(12).take(SPEEX_FRAME).enumerate() {
|
||||
let sum: i32 = chunk.chunks_exact(2).map(|s| i16::from_le_bytes([s[0], s[1]]) as i32).sum();
|
||||
frame[i] = (sum / 6) as i16;
|
||||
}
|
||||
let Some(data) = self.encoder.as_mut().and_then(|e| e.push(&mut frame)) else { return Ok(()) };
|
||||
let mut p = Vec::with_capacity(17 + data.len());
|
||||
p.extend_from_slice(&0xbef2u16.to_le_bytes());
|
||||
p.push(0);
|
||||
p.push(codec);
|
||||
p.extend_from_slice(&self.session.to_le_bytes());
|
||||
p.extend_from_slice(&self.client_id.to_le_bytes());
|
||||
// Native client 2.0.32 order (captured): packet counter, then conversation id.
|
||||
// Swapped, the native client sees every packet as a new conversation and stutters.
|
||||
p.extend_from_slice(&self.voice_counter.to_le_bytes());
|
||||
p.extend_from_slice(&self.voice_conversation.to_le_bytes());
|
||||
// Native client sends 5 here too (frames per packet).
|
||||
p.push(FRAMES_PER_PACKET as u8);
|
||||
p.extend_from_slice(&data);
|
||||
self.voice_counter = self.voice_counter.wrapping_add(1);
|
||||
self.sock.send(&p).await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn on_datagram(&mut self, b: &[u8]) -> Result<bool> {
|
||||
if b.len() < 16 {
|
||||
return Ok(true);
|
||||
}
|
||||
match u16_at(b, 0) {
|
||||
0xbef0 if b.len() >= 24 => {
|
||||
let seq = u32_at(b, 12);
|
||||
let mut ack = Vec::with_capacity(16);
|
||||
ack.extend_from_slice(&0xbef1u16.to_le_bytes());
|
||||
ack.extend_from_slice(&0u16.to_le_bytes());
|
||||
ack.extend_from_slice(&self.session.to_le_bytes());
|
||||
ack.extend_from_slice(&self.client_id.to_le_bytes());
|
||||
ack.extend_from_slice(&seq.to_le_bytes());
|
||||
self.sock.send(&ack).await?;
|
||||
if seq >= self.next_in {
|
||||
self.early.insert(seq, b.to_vec());
|
||||
}
|
||||
while let Some(p) = self.early.remove(&self.next_in) {
|
||||
self.next_in += 1;
|
||||
let typ = u16_at(&p, 2);
|
||||
let fragment = u16_at(&p, 18);
|
||||
// ponytail: assumes fragments count down to 0 on the last
|
||||
// one; only seen unfragmented so far (small test server).
|
||||
if fragment != 0 || !self.fragments.is_empty() {
|
||||
if self.fragments.is_empty() {
|
||||
self.fragment_type = typ;
|
||||
}
|
||||
self.fragments.extend_from_slice(&p[24..]);
|
||||
if fragment != 0 {
|
||||
continue;
|
||||
}
|
||||
let body = std::mem::take(&mut self.fragments);
|
||||
if !self.handle(self.fragment_type, &body) {
|
||||
return Ok(false);
|
||||
}
|
||||
} else if !self.handle(typ, &p[24..]) {
|
||||
return Ok(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
0xbef1 => {
|
||||
let seq = u32_at(b, 12);
|
||||
let front_seq = self.outbox.front().map(|p| u32_at(p, 12));
|
||||
if front_seq == Some(seq) {
|
||||
self.outbox.pop_front();
|
||||
self.in_flight = None;
|
||||
}
|
||||
}
|
||||
0xbef3 => self.on_voice(b),
|
||||
_ => {}
|
||||
}
|
||||
Ok(true)
|
||||
}
|
||||
}
|
||||
|
||||
async fn login(sock: &UdpSocket, args: &Args) -> Result<Vec<u8>> {
|
||||
let mut p = Vec::with_capacity(180);
|
||||
p.extend_from_slice(&0xbef4u16.to_le_bytes());
|
||||
p.extend_from_slice(&3u16.to_le_bytes());
|
||||
p.extend_from_slice(&[0; 8]); // session, client id
|
||||
p.extend_from_slice(&1u32.to_le_bytes());
|
||||
p.extend_from_slice(&[0; 4]); // CRC
|
||||
p.extend_from_slice(&pstr("TeamSpeak"));
|
||||
p.extend_from_slice(&pstr("Linux"));
|
||||
p.extend_from_slice(&[2, 0, 0, 0, 0x20, 0, 0x3c, 0, 1]);
|
||||
// Registered login (2): account name + its password. Anonymous (1): no
|
||||
// account name, the server password goes in the password field.
|
||||
match &args.login_name {
|
||||
Some(name) if !name.is_empty() => {
|
||||
p.push(2);
|
||||
p.extend_from_slice(&pstr(name));
|
||||
p.extend_from_slice(&pstr(args.login_password.as_deref().unwrap_or("")));
|
||||
}
|
||||
_ => {
|
||||
p.push(1);
|
||||
p.extend_from_slice(&pstr(""));
|
||||
p.extend_from_slice(&pstr(args.server_password.as_deref().unwrap_or("")));
|
||||
}
|
||||
}
|
||||
p.extend_from_slice(&pstr(&args.nickname));
|
||||
crc(&mut p, 16);
|
||||
let mut buf = [0u8; 2048];
|
||||
for _ in 0..5 {
|
||||
sock.send(&p).await?;
|
||||
let deadline = tokio::time::sleep(Duration::from_secs(2));
|
||||
tokio::pin!(deadline);
|
||||
loop {
|
||||
tokio::select! {
|
||||
r = sock.recv(&mut buf) => {
|
||||
let n = r?;
|
||||
if n >= 180 && u16_at(&buf, 0) == 0xbef4 && u16_at(&buf, 2) == 4 {
|
||||
return Ok(buf[..n].to_vec());
|
||||
}
|
||||
}
|
||||
_ = &mut deadline => break,
|
||||
}
|
||||
}
|
||||
}
|
||||
bail!("No answer from the TeamSpeak 2 server. Check the address and port (default 8767).")
|
||||
}
|
||||
|
||||
pub(crate) async fn run(args: Args) -> Result<()> {
|
||||
let target = if args.address.contains(':') { args.address.clone() } else { format!("{}:{DEFAULT_PORT}", args.address) };
|
||||
let addr: SocketAddr = tokio::net::lookup_host(&target)
|
||||
.await
|
||||
.map_err(|e| anyhow!("Could not resolve \"{}\": {e}", args.address))?
|
||||
.find(|a| a.is_ipv4())
|
||||
.ok_or_else(|| anyhow!("\"{}\" has no IPv4 address", args.address))?;
|
||||
if !tsclientlib::resolver::is_allowed_target(&addr.ip()) {
|
||||
bail!(
|
||||
"Could not connect to \"{}\": it points to a private/internal network address, \
|
||||
which this gateway does not connect to. (Self-hosting admin? Set ALLOW_PRIVATE_TARGETS=1 for LAN servers.)",
|
||||
args.address
|
||||
);
|
||||
}
|
||||
let sock = UdpSocket::bind("0.0.0.0:0").await?;
|
||||
sock.connect(addr).await?;
|
||||
|
||||
let reply = login(&sock, &args).await?;
|
||||
if reply[89..92] != [0, 0, 0] {
|
||||
bail!("The TeamSpeak 2 server rejected the login (wrong server password, wrong account name or password, or nickname not allowed).");
|
||||
}
|
||||
// Unlike the 30-byte fields, the welcome message's length byte can go up to 255.
|
||||
let welcome_len = reply[180] as usize;
|
||||
let welcome_message = latin1(&reply[181..(181 + welcome_len).min(reply.len())]);
|
||||
emit(&Event::Connected {
|
||||
welcome_message,
|
||||
server_name: rpstr(&reply, 20),
|
||||
server_max_clients: 0,
|
||||
server_version: "TeamSpeak 2".into(),
|
||||
server_license: String::new(),
|
||||
server_license_id: 0,
|
||||
server_banner_url: String::new(),
|
||||
identity: String::new(),
|
||||
});
|
||||
|
||||
let mut ts = Ts2 {
|
||||
sock,
|
||||
session: u32_at(&reply, 172),
|
||||
client_id: u32_at(&reply, 176),
|
||||
conn_counter: 2,
|
||||
seq: 1,
|
||||
outbox: VecDeque::new(),
|
||||
in_flight: None,
|
||||
next_in: 1,
|
||||
early: BTreeMap::new(),
|
||||
fragments: Vec::new(),
|
||||
fragment_type: 0,
|
||||
channels: BTreeMap::new(),
|
||||
players: BTreeMap::new(),
|
||||
lists_done: false,
|
||||
speakers: HashMap::new(),
|
||||
talking: HashSet::new(),
|
||||
encoder: None,
|
||||
voice_counter: 0,
|
||||
voice_conversation: 0,
|
||||
last_audio_in: None,
|
||||
codec_warned: false,
|
||||
};
|
||||
|
||||
// "Channel/Sub" picks a sub-channel; TS2 only nests one level deep.
|
||||
let (channel, sub) = args.default_channel.as_deref().unwrap_or("").split_once('/').unwrap_or((args.default_channel.as_deref().unwrap_or(""), ""));
|
||||
let mut part2 = vec![1, 0];
|
||||
part2.extend_from_slice(&pstr(channel));
|
||||
part2.extend_from_slice(&pstr(sub));
|
||||
// The password field is only 26 bytes (length + 25), followed by the login reply's CRC.
|
||||
let mut pw = pstr(args.channel_password.as_deref().unwrap_or(""));
|
||||
pw[0] = pw[0].min(25);
|
||||
part2.extend_from_slice(&pw[..26]);
|
||||
part2.extend_from_slice(&reply[16..20]);
|
||||
part2.extend_from_slice(&[0; 4]);
|
||||
ts.reliable(0x0005, &part2);
|
||||
|
||||
let mut stdin = BufReader::new(tokio::io::stdin()).lines();
|
||||
let mut keepalive = tokio::time::interval(KEEPALIVE_EVERY);
|
||||
let mut audio = tokio::time::interval(Duration::from_millis(20));
|
||||
let mut resend = tokio::time::interval(Duration::from_millis(100));
|
||||
let mut last_heard = Instant::now();
|
||||
let mut buf = [0u8; 4096];
|
||||
|
||||
loop {
|
||||
ts.pump_outbox().await?;
|
||||
tokio::select! {
|
||||
r = ts.sock.recv(&mut buf) => {
|
||||
let n = r?;
|
||||
last_heard = Instant::now();
|
||||
if !ts.on_datagram(&buf[..n]).await? {
|
||||
return Ok(());
|
||||
}
|
||||
}
|
||||
line = stdin.next_line() => {
|
||||
let Some(l) = line? else {
|
||||
ts.logout().await;
|
||||
return Ok(());
|
||||
};
|
||||
let l = l.trim();
|
||||
if l == "disconnect" || l.starts_with("disconnect ") {
|
||||
ts.logout().await;
|
||||
emit(&Event::Disconnected { reason: "client requested".into() });
|
||||
return Ok(());
|
||||
} else if let Some(rest) = l.strip_prefix("audio ") {
|
||||
ts.on_mic(rest).await?;
|
||||
} else if let Some(rest) = l.strip_prefix("switch ") {
|
||||
let mut parts = rest.trim().splitn(2, ' ');
|
||||
if let Ok(id) = parts.next().unwrap_or("").parse::<u32>() {
|
||||
let password = parts
|
||||
.next()
|
||||
.and_then(|p| base64::engine::general_purpose::STANDARD.decode(p).ok())
|
||||
.and_then(|b| String::from_utf8(b).ok())
|
||||
.unwrap_or_default();
|
||||
let mut p = id.to_le_bytes().to_vec();
|
||||
p.extend_from_slice(&pstr(&password));
|
||||
ts.reliable(0x012f, &p);
|
||||
}
|
||||
} else if let Some(message) = l.strip_prefix("chat ") {
|
||||
let own = ts.own_channel();
|
||||
ts.send_text(1, own, message);
|
||||
} else if let Some(message) = l.strip_prefix("serverchat ") {
|
||||
ts.send_text(0, 0, message);
|
||||
} else if let Some((id, message)) = l.strip_prefix("pm ").and_then(|r| r.trim().split_once(' ')) {
|
||||
if let Ok(id) = id.parse::<u32>() {
|
||||
ts.send_text(2, id, message);
|
||||
// TS2 doesn't echo private messages back to the sender.
|
||||
let partner_name = ts.players.get(&id).map(|p| p.name.clone()).unwrap_or_default();
|
||||
emit(&Event::PrivateMessage { partner_id: id as u16, partner_name, from_self: true, message: message.into() });
|
||||
}
|
||||
} else if l == "away" || l.starts_with("away ") {
|
||||
ts.set_status(ST_AWAY, true);
|
||||
} else if l == "unaway" {
|
||||
ts.set_status(ST_AWAY, false);
|
||||
} else if let Some(v) = l.strip_prefix("muteinput ") {
|
||||
ts.set_status(ST_MUTE_MIC, v.trim() == "1");
|
||||
} else if let Some(v) = l.strip_prefix("muteoutput ") {
|
||||
ts.set_status(ST_MUTE_SPEAKERS, v.trim() == "1");
|
||||
}
|
||||
// Everything else (permissions, files, streams, ...) has no TS2 equivalent.
|
||||
}
|
||||
_ = keepalive.tick() => {
|
||||
if last_heard.elapsed() > SERVER_TIMEOUT {
|
||||
emit(&Event::Disconnected { reason: "connection to the TeamSpeak 2 server timed out".into() });
|
||||
return Ok(());
|
||||
}
|
||||
ts.keepalive().await?;
|
||||
}
|
||||
_ = audio.tick() => ts.audio_tick(),
|
||||
_ = resend.tick() => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn crc_matches_zlib() {
|
||||
assert_eq!(crc32(b"123456789"), 0xCBF4_3926);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn speex_sizes_match_submodes() {
|
||||
// Encoding 5 frames must give exactly the size the server expects
|
||||
// (checked by the debug_assert in Encoder::push).
|
||||
for codec in 5..=12u8 {
|
||||
let mut enc = Encoder::new(codec).unwrap();
|
||||
let mut out = None;
|
||||
for _ in 0..FRAMES_PER_PACKET {
|
||||
out = enc.push(&mut [0; SPEEX_FRAME]);
|
||||
}
|
||||
let data = out.unwrap();
|
||||
let mut dec = Decoder::new();
|
||||
assert_eq!(dec.decode(&data).len(), SPEEX_FRAME * FRAMES_PER_PACKET);
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 421 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 115 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 59 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 98 KiB |
+30
-2
@@ -11,9 +11,12 @@ import { handleStore } from "./store.js";
|
||||
import { handleNewsConfig } from "./news.js";
|
||||
import { logFeedback, logConnectionEvent } from "./activity-log.js";
|
||||
import { clientIp, createRateLimiter } from "./net.js";
|
||||
import { TURNSTILE_ENABLED, TURNSTILE_SITE_KEY, isValidPass, issuePass, verifyToken } from "./turnstile.js";
|
||||
import "./telemetry.js";
|
||||
|
||||
const SERVER_TYPES = new Set<ServerType>(["teamspeak", "teaspeak", "auto"]);
|
||||
// TeamSpeak 2 support is experimental and opt-in (ENABLE_TS2=1).
|
||||
const TS2_ENABLED = process.env.ENABLE_TS2 === "1";
|
||||
const SERVER_TYPES = new Set<ServerType>(["teamspeak", "teaspeak", "auto", ...(TS2_ENABLED ? (["ts2"] as const) : [])]);
|
||||
|
||||
function parseServerType(value: unknown): ServerType | undefined {
|
||||
return typeof value === "string" && SERVER_TYPES.has(value as ServerType)
|
||||
@@ -124,7 +127,7 @@ const WEB_DIST = process.env.WEB_DIST ?? path.resolve(__dirname, "../../web/dist
|
||||
const SERVE_STATIC = process.env.WEB_STATIC !== "0";
|
||||
|
||||
// Sent to every browser in the "hello" message on socket open; see there.
|
||||
const GATEWAY_FEATURES = ["clientVolume", "keepalive", "chunkedUpload", "whisperPolicy", "transferLimit"];
|
||||
const GATEWAY_FEATURES = ["clientVolume", "keepalive", "chunkedUpload", "whisperPolicy", "transferLimit", ...(TS2_ENABLED ? ["ts2"] : [])];
|
||||
|
||||
// Optional TURN relay for screen streams, also handed out in "hello". With
|
||||
// TURN_SECRET (coturn's use-auth-secret) every socket gets its own credential,
|
||||
@@ -484,6 +487,13 @@ const requestHandler = (req: IncomingMessage, res: ServerResponse) => {
|
||||
await handleFeedback(req, res);
|
||||
return;
|
||||
}
|
||||
if (requestUrl.pathname === "/api/features") {
|
||||
// Same list as the "hello" message, readable before any connect
|
||||
// (the connect dialog offers TeamSpeak 2 only when it is enabled).
|
||||
res.writeHead(200, { "Content-Type": "application/json", "Access-Control-Allow-Origin": "*", "Cache-Control": "public, max-age=300" });
|
||||
res.end(JSON.stringify({ features: GATEWAY_FEATURES, ...(TURNSTILE_ENABLED ? { turnstileSiteKey: TURNSTILE_SITE_KEY } : {}) }));
|
||||
return;
|
||||
}
|
||||
if (requestUrl.pathname === "/api/news") {
|
||||
handleNewsConfig(res);
|
||||
return;
|
||||
@@ -574,6 +584,7 @@ const wss = new WebSocketServer({
|
||||
}
|
||||
const ip = clientIp(req);
|
||||
if (MAX_CONNECTIONS_PER_IP > 0 && (connectionsPerIp.get(ip) ?? 0) >= MAX_CONNECTIONS_PER_IP) {
|
||||
console.warn(`[ratelimit] too many open connections from one IP (limit ${MAX_CONNECTIONS_PER_IP})`);
|
||||
return done(false, 429, "Too many connections");
|
||||
}
|
||||
done(true);
|
||||
@@ -745,6 +756,21 @@ wss.on("connection", (socket: WebSocket, req: IncomingMessage) => {
|
||||
);
|
||||
break;
|
||||
}
|
||||
if (TURNSTILE_ENABLED && !isValidPass(msg.turnstilePass, ip)) {
|
||||
// No (valid) pass yet: ask the browser to solve the check, it
|
||||
// resends this connect with the token.
|
||||
if (msg.turnstileToken === undefined) {
|
||||
socket.send(JSON.stringify({ type: "turnstileRequired" }));
|
||||
break;
|
||||
}
|
||||
if (!(await verifyToken(msg.turnstileToken, ip))) {
|
||||
socket.send(
|
||||
JSON.stringify({ type: "error", code: "turnstile_failed", message: "Bot check failed. Please try again." }),
|
||||
);
|
||||
break;
|
||||
}
|
||||
socket.send(JSON.stringify({ type: "turnstilePass", pass: issuePass(ip) }));
|
||||
}
|
||||
// Replacing a connection on the same socket: tear down the previous
|
||||
// connector so we don't leak processes.
|
||||
if (connection) {
|
||||
@@ -765,6 +791,8 @@ wss.on("connection", (socket: WebSocket, req: IncomingMessage) => {
|
||||
identity: msg.identity,
|
||||
serverType: parseServerType(msg.serverType),
|
||||
privilegeKey: parsePrivilegeKey(msg),
|
||||
loginName: typeof msg.loginName === "string" ? msg.loginName.trim() || undefined : undefined,
|
||||
loginPassword: typeof msg.loginPassword === "string" ? msg.loginPassword || undefined : undefined,
|
||||
};
|
||||
connection = new Ts3Connection(options);
|
||||
liveConnections.add(connection);
|
||||
|
||||
@@ -213,7 +213,7 @@ export type Ts3ConnectionEvent =
|
||||
/** TS6 Stream/Call signaling, forwarded verbatim; `args` is already unescaped. */
|
||||
| { type: "streamEvent"; name: string; args: Record<string, string> };
|
||||
|
||||
export type ServerType = "teamspeak" | "teaspeak" | "auto";
|
||||
export type ServerType = "teamspeak" | "teaspeak" | "auto" | "ts2";
|
||||
|
||||
export interface Ts3ConnectOptions {
|
||||
host: string;
|
||||
@@ -228,6 +228,9 @@ export interface Ts3ConnectOptions {
|
||||
serverType?: ServerType;
|
||||
/** One-time privilege key / token to redeem on connect. */
|
||||
privilegeKey?: string;
|
||||
/** TeamSpeak 2 registered account (anonymous when omitted). */
|
||||
loginName?: string;
|
||||
loginPassword?: string;
|
||||
}
|
||||
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||
@@ -280,6 +283,8 @@ export class Ts3Connection {
|
||||
if (this.options.channelPassword) env.TS_CHANNEL_PASSWORD = this.options.channelPassword;
|
||||
if (this.options.identity) env.TS_IDENTITY = this.options.identity;
|
||||
if (this.options.privilegeKey) env.TS_PRIVILEGE_KEY = this.options.privilegeKey;
|
||||
if (this.options.loginName) env.TS_LOGIN_NAME = this.options.loginName;
|
||||
if (this.options.loginPassword) env.TS_LOGIN_PASSWORD = this.options.loginPassword;
|
||||
this.child = spawn(CONNECTOR_BIN, args, { env });
|
||||
|
||||
// The connector can exit on its own (e.g. the TS3 server drops it) and close
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
// Optional Cloudflare Turnstile bot check before a "connect". Off unless both
|
||||
// TURNSTILE_SITE_KEY and TURNSTILE_SECRET are set. A solved check earns a
|
||||
// signed pass (bound to the client IP, valid PASS_TTL_MS) that later connects
|
||||
// and silent reconnects present instead, so a real user sees the check at
|
||||
// most once in that window.
|
||||
import { createHmac, timingSafeEqual } from "node:crypto";
|
||||
|
||||
export const TURNSTILE_SITE_KEY = process.env.TURNSTILE_SITE_KEY ?? "";
|
||||
const SECRET = process.env.TURNSTILE_SECRET ?? "";
|
||||
export const TURNSTILE_ENABLED = TURNSTILE_SITE_KEY !== "" && SECRET !== "";
|
||||
|
||||
const PASS_TTL_MS = 12 * 60 * 60 * 1000;
|
||||
// Derived from the secret, so passes survive a gateway restart.
|
||||
const PASS_KEY = createHmac("sha256", SECRET).update("webspeak3-turnstile-pass").digest();
|
||||
|
||||
const sign = (ip: string, expires: number) =>
|
||||
createHmac("sha256", PASS_KEY).update(`${ip}|${expires}`).digest("base64url");
|
||||
|
||||
export function issuePass(ip: string): string {
|
||||
const expires = Date.now() + PASS_TTL_MS;
|
||||
return `${expires}.${sign(ip, expires)}`;
|
||||
}
|
||||
|
||||
export function isValidPass(pass: unknown, ip: string): boolean {
|
||||
if (typeof pass !== "string") return false;
|
||||
const [exp, mac] = pass.split(".");
|
||||
const expires = Number(exp);
|
||||
if (!Number.isFinite(expires) || expires < Date.now() || !mac) return false;
|
||||
const expected = Buffer.from(sign(ip, expires));
|
||||
const given = Buffer.from(mac);
|
||||
return given.length === expected.length && timingSafeEqual(given, expected);
|
||||
}
|
||||
|
||||
export async function verifyToken(token: unknown, ip: string): Promise<boolean> {
|
||||
if (typeof token !== "string" || token.length === 0 || token.length > 2048) return false;
|
||||
try {
|
||||
const res = await fetch("https://challenges.cloudflare.com/turnstile/v0/siteverify", {
|
||||
method: "POST",
|
||||
body: new URLSearchParams({ secret: SECRET, response: token, remoteip: ip }),
|
||||
signal: AbortSignal.timeout(10_000),
|
||||
});
|
||||
const data = (await res.json()) as { success?: boolean; "error-codes"?: string[] };
|
||||
if (!data.success) console.warn(`[turnstile] rejected: ${(data["error-codes"] ?? []).join(",")}`);
|
||||
return data.success === true;
|
||||
} catch (err) {
|
||||
console.warn(`[turnstile] siteverify failed: ${err}`);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
+1
-1
Submodule tsclientlib updated: 2e7794928f...cf074c091c.
+935
-10
@@ -43,6 +43,9 @@
|
||||
.ts-app.ts-force-mobile {
|
||||
max-width: 390px;
|
||||
margin: 0 auto;
|
||||
/* Makes position:fixed children (FABs, dialogs) stick to this phone frame
|
||||
instead of the browser window. */
|
||||
transform: translateZ(0);
|
||||
box-shadow:
|
||||
0 0 0 1px rgba(0, 0, 0, 0.4),
|
||||
0 0 40px rgba(0, 0, 0, 0.5);
|
||||
@@ -186,6 +189,11 @@
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/* Feedback is a plain button between Extras and Help; in the ☰ panel it goes last. */
|
||||
.ts-menubar-items.ts-nova-menu-panel-open > .ts-menubar-feedback {
|
||||
order: 1;
|
||||
}
|
||||
|
||||
/* The panel itself docks flush against the right viewport edge, so its nested
|
||||
submenus must open leftward instead of the default rightward - opening right
|
||||
here would run straight off-screen. */
|
||||
@@ -2314,6 +2322,25 @@
|
||||
display: block;
|
||||
}
|
||||
|
||||
/* Flags from the Twemoji Country Flags font (CC-BY 4.0), because Chromium on
|
||||
Windows has no flag emoji and shows the two letters instead. unicode-range
|
||||
keeps the font to flag characters and loads it only when one is shown. */
|
||||
@font-face {
|
||||
font-family: "Twemoji Country Flags";
|
||||
src: url("./assets/fonts/TwemojiCountryFlags.woff2") format("woff2");
|
||||
unicode-range: U+1F1E6-1F1FF, U+1F3F4, U+E0062-E0063, U+E0065, U+E0067, U+E006C, U+E006E, U+E0073-E0074, U+E0077, U+E007F;
|
||||
font-display: swap;
|
||||
}
|
||||
|
||||
.ts-flag {
|
||||
font-family: "Twemoji Country Flags", "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
|
||||
}
|
||||
|
||||
.ts-talk-lamp-away {
|
||||
font-size: 11px;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.ts-client-icons {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
@@ -2337,17 +2364,10 @@
|
||||
}
|
||||
|
||||
.ts-group-badge {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
border-radius: 50%;
|
||||
display: block;
|
||||
width: 15px;
|
||||
height: 15px;
|
||||
flex-shrink: 0;
|
||||
font-size: 9px;
|
||||
font-weight: 700;
|
||||
line-height: 1;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.ts-poke-button {
|
||||
@@ -4999,3 +5019,908 @@ input.ts-identities-uid {
|
||||
.ts-app .gts-connection-tab-close:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
Mobile shell (.ts-mobile is set from JS below 700px or via the demo toggle).
|
||||
Own layout instead of the squeezed desktop one: slim header with the menu
|
||||
behind ☰, one full-height panel at a time (channels / chat / info), big
|
||||
voice controls and tabs at the bottom. Touch targets are >= 44px.
|
||||
--------------------------------------------------------------------------- */
|
||||
|
||||
.ts-app.ts-mobile {
|
||||
height: 100dvh;
|
||||
font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
|
||||
--m-radius: 14px;
|
||||
}
|
||||
|
||||
.ts-app.ts-mobile > .ts-toolbar,
|
||||
.ts-app.ts-mobile > .ts-log,
|
||||
.ts-app.ts-mobile .ts-resize-handle-vertical,
|
||||
.ts-app.ts-mobile .ts-resize-handle-horizontal {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
/* Header */
|
||||
|
||||
.ts-app.ts-mobile > .ts-menubar {
|
||||
position: relative;
|
||||
min-height: 56px;
|
||||
padding: 0 8px 0 4px;
|
||||
gap: 6px;
|
||||
flex-wrap: nowrap;
|
||||
justify-content: flex-start;
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
.ts-app.ts-mobile > .ts-menubar .ts-nova-menu-dropdown {
|
||||
position: static;
|
||||
order: 0;
|
||||
}
|
||||
|
||||
.ts-app.ts-mobile .ts-nova-menu-toggle {
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
font-size: 22px;
|
||||
border-radius: 12px;
|
||||
border: none;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.ts-app.ts-mobile .ts-mobile-title {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-width: 0;
|
||||
flex: 1;
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
.ts-app.ts-mobile .ts-mobile-title-name {
|
||||
font-size: 17px;
|
||||
font-weight: 650;
|
||||
color: var(--text);
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.ts-app.ts-mobile .ts-mobile-title-status {
|
||||
font-size: 12px;
|
||||
color: var(--text-muted);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 5px;
|
||||
}
|
||||
|
||||
.ts-app.ts-mobile .ts-mobile-title-status::before {
|
||||
content: "";
|
||||
width: 7px;
|
||||
height: 7px;
|
||||
border-radius: 50%;
|
||||
background: var(--text-muted);
|
||||
}
|
||||
|
||||
.ts-app.ts-mobile .ts-mobile-title-status-on::before {
|
||||
background: #3ba55d;
|
||||
}
|
||||
|
||||
/* The ☰ panel becomes a full-width sheet with inline (accordion) submenus. */
|
||||
.ts-app.ts-mobile .ts-menubar-items.ts-nova-menu-panel.ts-nova-menu-panel-open {
|
||||
left: 8px;
|
||||
right: 8px;
|
||||
top: calc(100% + 4px);
|
||||
margin: 0;
|
||||
padding: 8px;
|
||||
max-height: calc(100dvh - 140px);
|
||||
overflow-y: auto;
|
||||
border-radius: var(--m-radius);
|
||||
box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
|
||||
}
|
||||
|
||||
.ts-app.ts-mobile .ts-menubar-items.ts-nova-menu-panel-open .ts-menubar-item,
|
||||
.ts-app.ts-mobile .ts-menubar-items.ts-nova-menu-panel-open .ts-menubar-item-active {
|
||||
min-height: 48px;
|
||||
padding: 0 14px;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
color: var(--text);
|
||||
text-align: left;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
.ts-app.ts-mobile .ts-menubar-items.ts-nova-menu-panel-open .ts-menu {
|
||||
position: static;
|
||||
margin: 0 0 6px 10px;
|
||||
width: auto;
|
||||
min-width: 0;
|
||||
max-height: none;
|
||||
border: none;
|
||||
border-left: 2px solid var(--border-soft);
|
||||
border-radius: 0;
|
||||
box-shadow: none;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.ts-app.ts-mobile .ts-menu-item {
|
||||
min-height: 44px;
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
/* Body: one panel at a time */
|
||||
|
||||
.ts-app.ts-mobile .ts-body {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.ts-app.ts-mobile .ts-upper {
|
||||
height: auto !important;
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.ts-app.ts-mobile .ts-tree-panel,
|
||||
.ts-app.ts-mobile .ts-side-panel {
|
||||
width: 100% !important;
|
||||
max-height: none;
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
overflow-y: auto;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.ts-app.ts-mobile .ts-chat-panel {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.ts-app.ts-mobile-tab-tree .ts-side-panel,
|
||||
.ts-app.ts-mobile-tab-tree .ts-chat-panel,
|
||||
.ts-app.ts-mobile-tab-info .ts-tree-panel,
|
||||
.ts-app.ts-mobile-tab-info .ts-chat-panel,
|
||||
.ts-app.ts-mobile-tab-chat .ts-upper {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
/* Tree: big, rounded rows */
|
||||
|
||||
.ts-app.ts-mobile .ts-tree-panel {
|
||||
padding: 6px 8px 12px;
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
.ts-app.ts-mobile .ts-tree-panel .ts-row {
|
||||
min-height: 44px;
|
||||
line-height: 1.3;
|
||||
padding-top: 0;
|
||||
padding-bottom: 0;
|
||||
padding-right: 10px;
|
||||
gap: 8px;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
.ts-app.ts-mobile .ts-tree-panel .ts-server-row {
|
||||
font-weight: 650;
|
||||
}
|
||||
|
||||
.ts-app.ts-mobile .ts-tree-search {
|
||||
min-height: 42px;
|
||||
margin: 6px 0;
|
||||
padding: 0 14px;
|
||||
font-size: 16px;
|
||||
border-radius: 12px;
|
||||
}
|
||||
|
||||
.ts-app.ts-mobile .ts-side-panel {
|
||||
padding: 8px 12px;
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
/* Chat */
|
||||
|
||||
.ts-app.ts-mobile .ts-chat-messages {
|
||||
font-size: 15px;
|
||||
padding: 8px 12px;
|
||||
}
|
||||
|
||||
.ts-app.ts-mobile .ts-chat-tabs {
|
||||
overflow-x: auto;
|
||||
gap: 6px;
|
||||
padding: 6px 8px;
|
||||
}
|
||||
|
||||
.ts-app.ts-mobile .ts-chat-tab {
|
||||
min-height: 36px;
|
||||
padding: 0 14px;
|
||||
border-radius: 999px;
|
||||
font-size: 14px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.ts-app.ts-mobile .ts-chat-input-row {
|
||||
padding: 8px;
|
||||
gap: 8px;
|
||||
align-items: flex-end;
|
||||
}
|
||||
|
||||
.ts-app.ts-mobile .ts-chat-input-row textarea {
|
||||
min-height: 44px;
|
||||
font-size: 16px; /* < 16px makes iOS zoom into the field */
|
||||
padding: 10px 14px;
|
||||
border-radius: 22px;
|
||||
}
|
||||
|
||||
.ts-app.ts-mobile .ts-chat-input-row button {
|
||||
min-height: 44px;
|
||||
padding: 0 18px;
|
||||
font-size: 15px;
|
||||
font-weight: 600;
|
||||
border: none;
|
||||
border-radius: 22px;
|
||||
background: var(--accent);
|
||||
color: var(--bg);
|
||||
}
|
||||
|
||||
/* Bottom: voice bar + tabs */
|
||||
|
||||
.ts-mobile-bottom {
|
||||
flex-shrink: 0;
|
||||
background: var(--bg-toolbar-1);
|
||||
border-top: 1px solid var(--border-soft);
|
||||
padding-bottom: env(safe-area-inset-bottom);
|
||||
}
|
||||
|
||||
.ts-mobile-voicebar {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
padding: 8px 10px 4px;
|
||||
}
|
||||
|
||||
.ts-mobile-voice-btn {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
min-height: 56px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 4px;
|
||||
border: none;
|
||||
border-radius: var(--m-radius, 14px);
|
||||
background: var(--input-bg);
|
||||
color: var(--text);
|
||||
cursor: pointer;
|
||||
touch-action: manipulation;
|
||||
-webkit-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.ts-mobile-voice-label {
|
||||
font-size: 11px;
|
||||
color: var(--text-muted);
|
||||
max-width: 100%;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.ts-mobile-voice-on {
|
||||
background: #3ba55d;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.ts-mobile-voice-off {
|
||||
background: #b3403a;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.ts-mobile-voice-on .ts-mobile-voice-label,
|
||||
.ts-mobile-voice-off .ts-mobile-voice-label,
|
||||
.ts-mobile-voice-hangup .ts-mobile-voice-label {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.ts-mobile-voice-hangup {
|
||||
flex: 0 0 72px;
|
||||
background: #d6403d;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.ts-mobile-ptt {
|
||||
flex: 2;
|
||||
}
|
||||
|
||||
.ts-mobile-connect-btn {
|
||||
flex: 1;
|
||||
min-height: 52px;
|
||||
border: none;
|
||||
border-radius: var(--m-radius, 14px);
|
||||
background: var(--accent);
|
||||
color: var(--bg);
|
||||
font-size: 16px;
|
||||
font-weight: 650;
|
||||
}
|
||||
|
||||
.ts-mobile-tabs {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.ts-mobile-tab {
|
||||
flex: 1;
|
||||
min-height: 52px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 2px;
|
||||
border: none;
|
||||
background: transparent;
|
||||
color: var(--text-muted);
|
||||
font-size: 11px;
|
||||
font-weight: 600;
|
||||
position: relative;
|
||||
touch-action: manipulation;
|
||||
margin: 4px 18px;
|
||||
border-radius: 16px;
|
||||
}
|
||||
|
||||
.ts-mobile-icon {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.ts-mobile-tab-active {
|
||||
color: var(--accent);
|
||||
}
|
||||
|
||||
.ts-mobile-tab-active {
|
||||
background: color-mix(in srgb, var(--accent) 18%, transparent);
|
||||
}
|
||||
|
||||
.ts-mobile-tab-unread::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: 8px;
|
||||
left: calc(50% + 10px);
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
border-radius: 50%;
|
||||
background: #d6403d;
|
||||
}
|
||||
|
||||
/* Floating buttons sit above the bottom bars instead of on top of them. */
|
||||
.ts-app.ts-mobile .ts-donate-fab {
|
||||
bottom: calc(150px + env(safe-area-inset-bottom));
|
||||
right: 12px;
|
||||
}
|
||||
|
||||
.ts-app.ts-mobile .ts-feedback-fab-wrap {
|
||||
bottom: calc(150px + env(safe-area-inset-bottom));
|
||||
right: 12px;
|
||||
}
|
||||
|
||||
.ts-app.ts-mobile .ts-feedback-fab-wrap-stacked {
|
||||
bottom: calc(200px + env(safe-area-inset-bottom));
|
||||
}
|
||||
|
||||
.ts-mobile-tab > * {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
/* In the chat tab the floating buttons would cover the send button. */
|
||||
.ts-app.ts-mobile-tab-chat .ts-donate-fab,
|
||||
.ts-app.ts-mobile-tab-chat .ts-feedback-fab-wrap {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.ts-app.ts-mobile .ts-chat-tabs {
|
||||
order: -1;
|
||||
border-bottom: 1px solid var(--border-soft);
|
||||
}
|
||||
|
||||
/* Disconnected: the header already says so, keep the panel calm and centered. */
|
||||
.ts-app.ts-mobile .ts-tree-panel > .ts-tree-empty:only-child {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-style: normal;
|
||||
font-size: 16px;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
/* --- Mobile: settings dialogs as full-screen pages ------------------------ */
|
||||
|
||||
.ts-options-back {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.ts-app.ts-mobile .ts-options-dialog {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
width: 100% !important;
|
||||
max-height: none;
|
||||
height: 100dvh;
|
||||
border: none;
|
||||
border-radius: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.ts-app.ts-mobile .ts-options-dialog .ts-dialog-titlebar {
|
||||
min-height: 56px;
|
||||
padding: 0 4px 0 16px;
|
||||
font-size: 17px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.ts-app.ts-mobile .ts-options-dialog .ts-dialog-titlebar > button:last-child {
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
.ts-app.ts-mobile .ts-options-dialog .ts-options-body {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
overflow-y: auto;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.ts-app.ts-mobile .ts-options-dialog .ts-dialog-buttons {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Section list */
|
||||
.ts-app.ts-mobile .ts-options-dialog-nav .ts-options-sidebar {
|
||||
flex-direction: column;
|
||||
flex-wrap: nowrap;
|
||||
width: 100%;
|
||||
padding: 8px 12px calc(16px + env(safe-area-inset-bottom));
|
||||
border: none;
|
||||
gap: 2px;
|
||||
}
|
||||
|
||||
.ts-app.ts-mobile .ts-options-dialog-nav .ts-options-sidebar-item {
|
||||
min-height: 52px;
|
||||
padding: 0 12px;
|
||||
gap: 14px;
|
||||
font-size: 16px;
|
||||
border-radius: 12px;
|
||||
background: none;
|
||||
border: none;
|
||||
outline: none;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.ts-app.ts-mobile .ts-options-dialog-nav .ts-options-sidebar-item::after {
|
||||
content: "›";
|
||||
margin-left: auto;
|
||||
font-size: 22px;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.ts-app.ts-mobile .ts-options-dialog-nav .ts-options-sidebar-icon {
|
||||
width: 34px;
|
||||
height: 34px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: 10px;
|
||||
background: var(--input-bg);
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.ts-app.ts-mobile .ts-options-dialog-nav:not(.ts-options-detail) .ts-options-content,
|
||||
.ts-app.ts-mobile .ts-options-dialog-nav.ts-options-detail .ts-options-sidebar,
|
||||
.ts-app.ts-mobile .ts-options-dialog-nav.ts-options-detail .ts-options-title {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.ts-app.ts-mobile .ts-options-detail .ts-options-back {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
min-height: 44px;
|
||||
padding: 0 8px 0 0;
|
||||
font-size: 17px;
|
||||
font-weight: 600;
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
.ts-app.ts-mobile .ts-options-back span {
|
||||
font-size: 0;
|
||||
}
|
||||
|
||||
/* Other dialogs sharing this layout (server edit): tabs as a scrolling pill row */
|
||||
.ts-app.ts-mobile .ts-options-dialog:not(.ts-options-dialog-nav) .ts-options-sidebar {
|
||||
flex-direction: row;
|
||||
flex-wrap: nowrap;
|
||||
overflow-x: auto;
|
||||
width: 100%;
|
||||
gap: 6px;
|
||||
padding: 8px 12px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.ts-app.ts-mobile .ts-options-dialog:not(.ts-options-dialog-nav) .ts-options-sidebar-item {
|
||||
min-height: 38px;
|
||||
padding: 0 14px;
|
||||
border-radius: 999px;
|
||||
white-space: nowrap;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.ts-app.ts-mobile .ts-options-dialog:not(.ts-options-dialog-nav) .ts-dialog-buttons {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
/* Page content: touch-sized controls */
|
||||
.ts-app.ts-mobile .ts-options-dialog .ts-options-content {
|
||||
padding: 16px 16px calc(24px + env(safe-area-inset-bottom));
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
.ts-app.ts-mobile .ts-options-dialog .ts-options-content select,
|
||||
.ts-app.ts-mobile .ts-options-dialog .ts-options-content input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
|
||||
.ts-app.ts-mobile .ts-options-dialog .ts-options-content textarea {
|
||||
min-height: 44px;
|
||||
font-size: 16px;
|
||||
border-radius: 10px;
|
||||
padding: 0 12px;
|
||||
}
|
||||
|
||||
.ts-app.ts-mobile .ts-options-dialog .ts-options-content button {
|
||||
min-height: 44px;
|
||||
border-radius: 10px;
|
||||
padding: 0 14px;
|
||||
}
|
||||
|
||||
.ts-app.ts-mobile .ts-options-dialog .ts-options-content input[type="checkbox"],
|
||||
.ts-app.ts-mobile .ts-options-dialog .ts-options-content input[type="radio"] {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.ts-app.ts-mobile .ts-options-dialog .ts-options-content fieldset {
|
||||
border-radius: 12px;
|
||||
}
|
||||
|
||||
.ts-app.ts-mobile .ts-options-dialog .ts-options-content label {
|
||||
min-height: 36px;
|
||||
}
|
||||
|
||||
/* --- Mobile: ☰ menu as drill-down (tap "Extras" -> only its items) ------- */
|
||||
|
||||
.ts-app.ts-mobile .ts-menubar-items.ts-nova-menu-panel.ts-nova-menu-panel-open {
|
||||
z-index: 600;
|
||||
}
|
||||
|
||||
.ts-app.ts-mobile:has(.ts-nova-menu-panel-open) .ts-donate-fab,
|
||||
.ts-app.ts-mobile:has(.ts-nova-menu-panel-open) .ts-feedback-fab-wrap {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.ts-app.ts-mobile .ts-nova-menu-panel-open .ts-menubar-dropdown > .ts-menubar-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.ts-app.ts-mobile .ts-nova-menu-panel-open .ts-menubar-dropdown > .ts-menubar-item::after {
|
||||
content: "›";
|
||||
margin-left: auto;
|
||||
font-size: 22px;
|
||||
font-weight: 400;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
/* One submenu open: hide its siblings, its trigger becomes the back row. */
|
||||
.ts-app.ts-mobile .ts-nova-menu-panel-open:has(> .ts-menubar-dropdown > .ts-menu) > .ts-menubar-dropdown:not(:has(> .ts-menu)),
|
||||
.ts-app.ts-mobile .ts-nova-menu-panel-open:has(> .ts-menubar-dropdown > .ts-menu) > .ts-menubar-feedback {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.ts-app.ts-mobile .ts-nova-menu-panel-open .ts-menubar-dropdown:has(> .ts-menu) > .ts-menubar-item {
|
||||
font-size: 17px;
|
||||
border-bottom: 1px solid var(--border-soft);
|
||||
border-radius: 10px 10px 0 0;
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
|
||||
.ts-app.ts-mobile .ts-nova-menu-panel-open .ts-menubar-dropdown:has(> .ts-menu) > .ts-menubar-item::before {
|
||||
content: "";
|
||||
margin-right: 12px;
|
||||
}
|
||||
|
||||
/* Back chevron drawn with borders: a glyph sits on the baseline and looks low. */
|
||||
.ts-app.ts-mobile .ts-options-back span,
|
||||
.ts-app.ts-mobile .ts-nova-menu-panel-open .ts-menubar-dropdown:has(> .ts-menu) > .ts-menubar-item::before {
|
||||
display: inline-block;
|
||||
flex: none;
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
margin-left: 6px;
|
||||
border-left: 2.5px solid var(--accent);
|
||||
border-bottom: 2.5px solid var(--accent);
|
||||
transform: rotate(45deg);
|
||||
}
|
||||
|
||||
.ts-app.ts-mobile .ts-nova-menu-panel-open .ts-menubar-dropdown:has(> .ts-menu) > .ts-menubar-item::after {
|
||||
content: none;
|
||||
}
|
||||
|
||||
.ts-app.ts-mobile .ts-menubar-items.ts-nova-menu-panel-open .ts-menu {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border-left: none;
|
||||
}
|
||||
|
||||
.ts-app.ts-mobile .ts-nova-menu-panel-open .ts-menu-item {
|
||||
min-height: 50px;
|
||||
padding: 0 10px;
|
||||
gap: 14px;
|
||||
border-radius: 12px;
|
||||
}
|
||||
|
||||
.ts-app.ts-mobile .ts-nova-menu-panel-open .ts-menu-item-icon {
|
||||
width: 34px;
|
||||
height: 34px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: 10px;
|
||||
background: var(--input-bg);
|
||||
font-size: 17px;
|
||||
flex-shrink: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* Keyboard shortcuts mean nothing on a phone. */
|
||||
.ts-app.ts-mobile .ts-nova-menu-panel-open .ts-menu-item-shortcut {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.ts-app.ts-mobile .ts-nova-menu-panel-open .ts-menu-separator {
|
||||
margin: 6px 10px;
|
||||
opacity: 0.6;
|
||||
}
|
||||
|
||||
/* An open submenu takes the whole screen, its back row acts as the title bar. */
|
||||
.ts-app.ts-mobile .ts-menubar-items.ts-nova-menu-panel.ts-nova-menu-panel-open:has(> .ts-menubar-dropdown > .ts-menu) {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
max-height: none;
|
||||
margin: 0;
|
||||
padding: 0 8px calc(16px + env(safe-area-inset-bottom));
|
||||
border: none;
|
||||
border-radius: 0;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.ts-app.ts-mobile .ts-nova-menu-panel-open .ts-menubar-dropdown:has(> .ts-menu) > .ts-menubar-item {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 1;
|
||||
min-height: 56px;
|
||||
margin: 0 -8px 6px;
|
||||
padding: env(safe-area-inset-top) 16px 0 12px;
|
||||
border-radius: 0;
|
||||
background: var(--bg-toolbar-1);
|
||||
}
|
||||
|
||||
/* --- Mobile: all other dialogs ------------------------------------------- */
|
||||
/* Small prompts slide up as a bottom sheet; list/admin dialogs fill the
|
||||
screen. :where() keeps this below the options-dialog rules above. */
|
||||
|
||||
.ts-app.ts-mobile .ts-dialog-backdrop {
|
||||
align-items: flex-end;
|
||||
}
|
||||
|
||||
.ts-app.ts-mobile :where(.ts-dialog) {
|
||||
width: 100% !important;
|
||||
min-width: 0 !important;
|
||||
max-width: none !important;
|
||||
max-height: 100dvh;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow-y: auto;
|
||||
overscroll-behavior: contain;
|
||||
border: none;
|
||||
border-radius: 20px 20px 0 0;
|
||||
padding-bottom: env(safe-area-inset-bottom);
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
.ts-app.ts-mobile :where(
|
||||
.ts-client-log-dialog, .ts-server-protocol-log-dialog, .ts-ban-list-dialog,
|
||||
.ts-complain-list-dialog, .ts-offline-messages-dialog, .ts-collected-urls-dialog,
|
||||
.ts-contacts-dialog, .ts-identities-dialog, .ts-favorites-dialog,
|
||||
.ts-file-browser-dialog, .ts-transfers-window, .ts-perms-editor-dialog,
|
||||
.ts-permission-overview-dialog, .ts-whisper-lists-dialog,
|
||||
.ts-whisper-history-dialog, .ts-server-icons-dialog, .ts-group-assign-dialog,
|
||||
.ts-tos-dialog, .ts-connection-info-dialog, .ts-feedback-dialog, .ts-about-dialog
|
||||
) {
|
||||
height: 100dvh;
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
.ts-app.ts-mobile :where(.ts-dialog) > .ts-dialog-titlebar {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 2;
|
||||
min-height: 56px;
|
||||
padding: 0 4px 0 16px;
|
||||
font-size: 17px;
|
||||
background: var(--bg-toolbar-1);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.ts-app.ts-mobile :where(.ts-dialog) > .ts-dialog-titlebar button {
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
.ts-app.ts-mobile :where(.ts-dialog) > .ts-dialog-buttons {
|
||||
position: sticky;
|
||||
bottom: 0;
|
||||
z-index: 2;
|
||||
margin-top: auto;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
padding: 10px 12px;
|
||||
background: var(--bg-toolbar-1);
|
||||
}
|
||||
|
||||
/* The scrolling list inside a full-screen dialog takes the free height. */
|
||||
.ts-app.ts-mobile :where(.ts-dialog) > :not(.ts-dialog-titlebar):not(.ts-dialog-buttons) {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.ts-app.ts-mobile :where(.ts-dialog) table {
|
||||
display: block;
|
||||
overflow-x: auto;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.ts-app.ts-mobile :where(.ts-dialog) button {
|
||||
min-height: 44px;
|
||||
padding: 0 16px;
|
||||
border-radius: 10px;
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
.ts-app.ts-mobile :where(.ts-dialog) :where(select, textarea,
|
||||
input:not([type="checkbox"]):not([type="radio"]):not([type="range"])) {
|
||||
min-height: 44px;
|
||||
font-size: 16px;
|
||||
border-radius: 10px;
|
||||
padding-left: 12px;
|
||||
padding-right: 12px;
|
||||
box-sizing: border-box;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.ts-app.ts-mobile :where(.ts-dialog) :where(input[type="checkbox"], input[type="radio"]) {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.ts-app.ts-mobile :where(.ts-dialog) .ts-dialog-field {
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
/* Mobile: buttons share each wrapped row evenly; log-level filters as a chip row. */
|
||||
.ts-app.ts-mobile :where(.ts-dialog) > .ts-dialog-buttons > div {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
flex: 1 1 100%;
|
||||
gap: 8px;
|
||||
}
|
||||
.ts-app.ts-mobile :where(.ts-dialog) > .ts-dialog-buttons button {
|
||||
flex: 1 1 auto;
|
||||
}
|
||||
.ts-app.ts-mobile :where(.ts-dialog) .ts-dialog-row {
|
||||
align-items: stretch;
|
||||
}
|
||||
.ts-app.ts-mobile .ts-log-level-row {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
justify-content: flex-start;
|
||||
gap: 6px 14px;
|
||||
}
|
||||
.ts-app.ts-mobile .ts-log-level-row > .ts-dialog-checkbox {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/* --- Mobile: ☰ top level as a left drawer, as wide as its longest entry ---- */
|
||||
.ts-app.ts-mobile .ts-menubar-items.ts-nova-menu-panel.ts-nova-menu-panel-open:not(:has(> .ts-menubar-dropdown > .ts-menu)) {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: auto;
|
||||
width: max-content;
|
||||
max-width: 85%;
|
||||
max-height: none;
|
||||
margin: 0;
|
||||
padding: calc(12px + env(safe-area-inset-top)) 8px calc(12px + env(safe-area-inset-bottom));
|
||||
border: none;
|
||||
border-radius: 0 20px 20px 0;
|
||||
box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.45), 8px 0 24px rgba(0, 0, 0, 0.3);
|
||||
animation: ts-mobile-drawer-in 0.2s ease-out;
|
||||
}
|
||||
|
||||
.ts-app.ts-mobile .ts-nova-menu-panel-open:not(:has(> .ts-menubar-dropdown > .ts-menu)) .ts-menubar-dropdown > .ts-menubar-item {
|
||||
gap: 28px;
|
||||
}
|
||||
|
||||
/* Feedback pinned to the drawer's bottom edge. */
|
||||
.ts-app.ts-mobile .ts-nova-menu-panel-open:not(:has(> .ts-menubar-dropdown > .ts-menu)) > .ts-menubar-feedback {
|
||||
margin-top: auto;
|
||||
border-top: 1px solid var(--border-soft);
|
||||
padding-top: 12px;
|
||||
}
|
||||
|
||||
@keyframes ts-mobile-drawer-in {
|
||||
from { transform: translateX(-100%); }
|
||||
}
|
||||
|
||||
/* --- Mobile × design themes: themes keep colours/fonts, the mobile layout wins */
|
||||
/* Nova/Pulse reorder the app's flex children; pin the mobile bar + ticker last. */
|
||||
.ts-app.ts-mobile > .ts-mobile-bottom {
|
||||
order: 10;
|
||||
}
|
||||
.ts-app.ts-mobile > .ts-news-ticker {
|
||||
order: 11;
|
||||
}
|
||||
|
||||
/* Nova/Pulse send buttons are icon-only; keep them round instead of the text pill. */
|
||||
.ts-app.ts-mobile:is(.ts-design-nova, .ts-design-pulse) .ts-chat-input-row button {
|
||||
width: 44px;
|
||||
min-width: 44px;
|
||||
padding: 0;
|
||||
font-size: 0;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
/* IDE: undo its floating hamburger and three-column grid. */
|
||||
.ts-app.ts-mobile.ts-design-ide > .ts-menubar {
|
||||
height: auto;
|
||||
padding: 0 12px;
|
||||
border-bottom: 1px solid var(--border-soft);
|
||||
}
|
||||
.ts-app.ts-mobile.ts-design-ide > .ts-menubar .ts-nova-menu-dropdown {
|
||||
position: static;
|
||||
order: 0;
|
||||
}
|
||||
.ts-app.ts-mobile.ts-design-ide > .ts-body {
|
||||
display: flex;
|
||||
}
|
||||
.ts-app.ts-mobile.ts-design-ide .ts-upper {
|
||||
display: flex;
|
||||
}
|
||||
.ts-app.ts-mobile.ts-design-ide .ts-tree-panel {
|
||||
max-height: none;
|
||||
}
|
||||
|
||||
/* Cloudflare Turnstile: empty unless Cloudflare wants an interaction. */
|
||||
.ts-turnstile {
|
||||
position: fixed;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
z-index: 10000;
|
||||
}
|
||||
+427
-67
@@ -391,11 +391,83 @@ const LAST_NICKNAME_KEY = "webspeak3:last-nickname";
|
||||
localStorage.removeItem("webspeak3:last-privilege-key");
|
||||
const LAST_SERVER_TYPE_KEY = "webspeak3:last-server-type";
|
||||
|
||||
type ServerType = "teamspeak" | "teaspeak" | "auto";
|
||||
type ServerType = "teamspeak" | "teaspeak" | "auto" | "ts2";
|
||||
|
||||
function loadServerType(): ServerType {
|
||||
const raw = localStorage.getItem(LAST_SERVER_TYPE_KEY);
|
||||
return raw === "teamspeak" || raw === "teaspeak" || raw === "auto" ? raw : "auto";
|
||||
return raw === "teamspeak" || raw === "teaspeak" || raw === "auto" || raw === "ts2" ? raw : "auto";
|
||||
}
|
||||
|
||||
// The gateway's feature list, readable before connecting. TeamSpeak 2 is
|
||||
// opt-in per gateway (ENABLE_TS2), so the connect dialog only offers it then.
|
||||
const FEATURES_URL = DEMO_MODE ? null : FEEDBACK_URL.replace(/\/api\/feedback$/, "/api/features");
|
||||
type GatewayInfo = { features?: unknown; turnstileSiteKey?: unknown };
|
||||
let gatewayInfoPromise: Promise<GatewayInfo> | null = null;
|
||||
function fetchGatewayInfo(): Promise<GatewayInfo> {
|
||||
if (!FEATURES_URL) return Promise.resolve({});
|
||||
gatewayInfoPromise ??= fetch(FEATURES_URL)
|
||||
.then((r) => (r.ok ? r.json() : {}))
|
||||
.catch(() => ({}));
|
||||
return gatewayInfoPromise;
|
||||
}
|
||||
function fetchGatewayFeatures(): Promise<string[]> {
|
||||
return fetchGatewayInfo().then((d) => (Array.isArray(d.features) ? d.features : []));
|
||||
}
|
||||
|
||||
// Cloudflare Turnstile bot check, only when the gateway asks for it
|
||||
// ("turnstileRequired"). Invisible for most visitors; the widget only shows
|
||||
// up when Cloudflare wants an interaction. The gateway then hands out a pass
|
||||
// (kept here) so later connects and reconnects skip the check.
|
||||
const TURNSTILE_PASS_KEY = "ws3.turnstilePass";
|
||||
type TurnstileApi = {
|
||||
render: (el: HTMLElement, opts: Record<string, unknown>) => string;
|
||||
remove: (id: string) => void;
|
||||
};
|
||||
let turnstileScript: Promise<TurnstileApi> | null = null;
|
||||
function loadTurnstile(): Promise<TurnstileApi> {
|
||||
turnstileScript ??= new Promise((resolve, reject) => {
|
||||
const s = document.createElement("script");
|
||||
s.src = "https://challenges.cloudflare.com/turnstile/v0/api.js?render=explicit";
|
||||
s.async = true;
|
||||
s.onload = () => {
|
||||
const api = (window as unknown as { turnstile?: TurnstileApi }).turnstile;
|
||||
if (api) resolve(api);
|
||||
else reject(new Error("turnstile missing"));
|
||||
};
|
||||
s.onerror = () => {
|
||||
turnstileScript = null;
|
||||
reject(new Error("turnstile blocked"));
|
||||
};
|
||||
document.head.appendChild(s);
|
||||
});
|
||||
return turnstileScript;
|
||||
}
|
||||
async function getTurnstileToken(): Promise<string> {
|
||||
const { turnstileSiteKey } = await fetchGatewayInfo();
|
||||
if (typeof turnstileSiteKey !== "string") return "";
|
||||
try {
|
||||
const api = await loadTurnstile();
|
||||
const box = document.createElement("div");
|
||||
box.className = "ts-turnstile";
|
||||
document.body.appendChild(box);
|
||||
return await new Promise<string>((resolve) => {
|
||||
let id = "";
|
||||
const done = (token: string) => {
|
||||
if (id) api.remove(id);
|
||||
box.remove();
|
||||
resolve(token);
|
||||
};
|
||||
id = api.render(box, {
|
||||
sitekey: turnstileSiteKey,
|
||||
appearance: "interaction-only",
|
||||
callback: done,
|
||||
"error-callback": () => done(""),
|
||||
"timeout-callback": () => done(""),
|
||||
});
|
||||
});
|
||||
} catch {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
/** Everything needed to (re)open a gateway connection for one session, kept
|
||||
@@ -408,6 +480,9 @@ type ConnectParams = {
|
||||
channelPassword: string;
|
||||
defaultChannel: string;
|
||||
privilegeKey: string;
|
||||
/** TeamSpeak 2 registered account (anonymous when empty). */
|
||||
loginName?: string;
|
||||
loginPassword?: string;
|
||||
serverType: ServerType;
|
||||
identityId: string | null;
|
||||
favoriteId: string | null;
|
||||
@@ -1293,15 +1368,30 @@ function ChannelIcon() {
|
||||
}
|
||||
|
||||
/** GTS2-style talk lamp: blue idle / green talking / muted mic. */
|
||||
/** Red "off" badge in the lamp's bottom-right corner, shared by the mute icons. */
|
||||
const OFF_BADGE = (
|
||||
<>
|
||||
<circle cx="10.35" cy="10.35" r="2.55" fill="#e53935" stroke="#1a1a1a" strokeWidth="0.55" />
|
||||
<path d="M9.35 9.35l2 2M11.35 9.35l-2 2" stroke="#fff" strokeWidth="1.1" strokeLinecap="round" />
|
||||
</>
|
||||
);
|
||||
|
||||
/** The status slot in front of a client's name. Like the native client, away
|
||||
* and mute replace the talk dot instead of being listed after the name.
|
||||
* Order as in TeamSpeak: away, sound muted, mic muted, talking/idle. */
|
||||
function TalkLamp({
|
||||
talking,
|
||||
inputMuted,
|
||||
inputHardwareEnabled,
|
||||
outputMuted = false,
|
||||
away = false,
|
||||
commander = false,
|
||||
}: {
|
||||
talking: boolean;
|
||||
inputMuted: boolean;
|
||||
inputHardwareEnabled: boolean;
|
||||
outputMuted?: boolean;
|
||||
away?: boolean;
|
||||
/** Channel commander: drawn as its own lamp when the design option asks for it. */
|
||||
commander?: boolean;
|
||||
}) {
|
||||
@@ -1310,40 +1400,57 @@ function TalkLamp({
|
||||
const muted = inputMuted || !inputHardwareEnabled;
|
||||
const asCommander = commander && tree.commanderLamp;
|
||||
|
||||
if (muted) {
|
||||
const icon = (title: string, packIcon: string, paths: React.ReactNode) => (
|
||||
<span className="ts-talk-lamp ts-talk-lamp-muted" title={title} aria-hidden="true" data-pack-icon={packIcon}>
|
||||
<svg width="14" height="14" viewBox="0 0 14 14" focusable="false">
|
||||
{paths}
|
||||
</svg>
|
||||
</span>
|
||||
);
|
||||
|
||||
if (away) {
|
||||
return (
|
||||
<span
|
||||
className="ts-talk-lamp ts-talk-lamp-muted"
|
||||
title={t("tree.micMuted")}
|
||||
aria-hidden="true"
|
||||
data-pack-icon={inputMuted ? "micMuted" : "hardwareMicMuted"}
|
||||
>
|
||||
<svg width="14" height="14" viewBox="0 0 14 14" focusable="false">
|
||||
<path
|
||||
d="M7 1.4c-1.15 0-2.05.9-2.05 2.05v3.1c0 1.15.9 2.05 2.05 2.05s2.05-.9 2.05-2.05v-3.1C9.05 2.3 8.15 1.4 7 1.4Z"
|
||||
fill="#9aa3ad"
|
||||
/>
|
||||
<path
|
||||
d="M3.2 6.4v.4c0 2 1.7 3.55 3.8 3.55s3.8-1.55 3.8-3.55v-.4"
|
||||
fill="none"
|
||||
stroke="#8a939c"
|
||||
strokeWidth="1.15"
|
||||
strokeLinecap="round"
|
||||
/>
|
||||
<path d="M7 10.35v2" stroke="#8a939c" strokeWidth="1.15" strokeLinecap="round" />
|
||||
<path d="M5.2 12.35h3.6" stroke="#8a939c" strokeWidth="1.15" strokeLinecap="round" />
|
||||
<circle cx="10.35" cy="10.35" r="2.55" fill="#e53935" stroke="#1a1a1a" strokeWidth="0.55" />
|
||||
<path
|
||||
d="M9.35 9.35l2 2M11.35 9.35l-2 2"
|
||||
stroke="#fff"
|
||||
strokeWidth="1.1"
|
||||
strokeLinecap="round"
|
||||
/>
|
||||
</svg>
|
||||
<span className="ts-talk-lamp ts-talk-lamp-muted ts-talk-lamp-away" title={t("tree.away")} aria-hidden="true" data-pack-icon="away">
|
||||
💤
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
if (outputMuted) {
|
||||
return icon(
|
||||
t("tree.soundMuted"),
|
||||
"soundMuted",
|
||||
<>
|
||||
<path d="M1.6 5h2.3l3.2-2.7v8.6L3.9 8.2H1.6Z" fill="#9aa3ad" stroke="#8a939c" strokeWidth="0.5" strokeLinejoin="round" />
|
||||
<path d="M8.6 4.6c.7.6 1 1.3 1 2s-.3 1.4-1 2" fill="none" stroke="#8a939c" strokeWidth="1.1" strokeLinecap="round" />
|
||||
{OFF_BADGE}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
if (muted) {
|
||||
return icon(
|
||||
t("tree.micMuted"),
|
||||
inputMuted ? "micMuted" : "hardwareMicMuted",
|
||||
<>
|
||||
<path
|
||||
d="M7 1.4c-1.15 0-2.05.9-2.05 2.05v3.1c0 1.15.9 2.05 2.05 2.05s2.05-.9 2.05-2.05v-3.1C9.05 2.3 8.15 1.4 7 1.4Z"
|
||||
fill="#9aa3ad"
|
||||
/>
|
||||
<path
|
||||
d="M3.2 6.4v.4c0 2 1.7 3.55 3.8 3.55s3.8-1.55 3.8-3.55v-.4"
|
||||
fill="none"
|
||||
stroke="#8a939c"
|
||||
strokeWidth="1.15"
|
||||
strokeLinecap="round"
|
||||
/>
|
||||
<path d="M7 10.35v2" stroke="#8a939c" strokeWidth="1.15" strokeLinecap="round" />
|
||||
<path d="M5.2 12.35h3.6" stroke="#8a939c" strokeWidth="1.15" strokeLinecap="round" />
|
||||
{OFF_BADGE}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
if (talking) {
|
||||
return (
|
||||
<span
|
||||
@@ -1367,15 +1474,13 @@ function TalkLamp({
|
||||
function ClientStatusIcons({ client }: { client: ClientInfo }) {
|
||||
const t = useT();
|
||||
const { tree } = useContext(DisplayPrefsContext);
|
||||
// Mute is shown on the TalkLamp; keep secondary flags here.
|
||||
// Away and mute are shown on the TalkLamp; keep secondary flags here.
|
||||
return (
|
||||
<span className="ts-status-icons">
|
||||
{client.isChannelCommander && !tree.commanderLamp && <span title={t("tree.channelCommander")}>⭐</span>}
|
||||
{client.away && <span title={t("tree.away")} data-pack-icon="away">💤</span>}
|
||||
{!client.inputMuted && client.inputHardwareEnabled && !client.hasTalkPower && (
|
||||
<span title={t("tree.noTalkPower")}>🔒</span>
|
||||
)}
|
||||
{client.outputMuted && <span title={t("tree.soundMuted")} data-pack-icon="soundMuted">🔕</span>}
|
||||
{client.isStreaming && <span title={t("tree.streaming")}>📺</span>}
|
||||
</span>
|
||||
);
|
||||
@@ -1397,9 +1502,15 @@ function GroupIcon({ group, images }: { group: GroupEntry; images: Record<string
|
||||
const base64 = group.iconId >= CUSTOM_ICON_ID_THRESHOLD ? images[`/icon_${group.iconId}`] : undefined;
|
||||
if (base64) return <img className="ts-group-icon" src={iconDataUrl(base64)} alt="" title={group.name} />;
|
||||
return (
|
||||
<span className="ts-group-badge" style={{ background: groupBadgeColor(group.iconId) }} title={group.name}>
|
||||
{group.name.trim().charAt(0).toUpperCase() || "?"}
|
||||
</span>
|
||||
<svg className="ts-group-badge" width="16" height="16" viewBox="0 0 16 16" role="img" aria-label={group.name}>
|
||||
<title>{group.name}</title>
|
||||
<circle cx="6.5" cy="4.6" r="2.9" fill="#8b95a1" />
|
||||
<path d="M1 14.6c0-3.3 2.4-5.6 5.5-5.6s5.5 2.3 5.5 5.6Z" fill="#8b95a1" />
|
||||
<circle cx="11.6" cy="11.4" r="4.1" fill={groupBadgeColor(group.iconId)} stroke="var(--bg, #fff)" strokeWidth="0.9" />
|
||||
<text x="11.6" y="13.95" textAnchor="middle" fontSize="7" fontWeight="700" fill="#fff" fontFamily="system-ui, sans-serif">
|
||||
{group.name.trim().charAt(0).toUpperCase() || "?"}
|
||||
</text>
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1437,6 +1548,7 @@ function ChannelTree({
|
||||
ownClientId,
|
||||
talkers,
|
||||
serverGroups,
|
||||
channelGroups = null,
|
||||
groupIconImages,
|
||||
selected,
|
||||
sessionKey,
|
||||
@@ -1455,6 +1567,8 @@ function ChannelTree({
|
||||
ownClientId: number | null;
|
||||
talkers: Set<number>;
|
||||
serverGroups: GroupEntry[] | null;
|
||||
/** For the channel group icon, shown after the server group icons like in the native client. */
|
||||
channelGroups?: GroupEntry[] | null;
|
||||
groupIconImages: Record<string, string>;
|
||||
selected: SelectedItem | null;
|
||||
/** Identifies which multi-join tab this tree belongs to, so the manual
|
||||
@@ -1481,12 +1595,12 @@ function ChannelTree({
|
||||
const children = channels.filter((c) => c.parent === parent).sort((a, b) => a.order - b.order);
|
||||
if (children.length === 0) return null;
|
||||
|
||||
// Server group icons, then the channel group icon (the flag follows last).
|
||||
const clientGroupBadges = (client: ClientInfo): GroupEntry[] =>
|
||||
serverGroups
|
||||
? client.serverGroups
|
||||
.map((gid) => serverGroups.find((g) => g.id === gid))
|
||||
.filter((g): g is GroupEntry => !!g && g.iconId !== 0)
|
||||
: [];
|
||||
[
|
||||
...(serverGroups ? client.serverGroups.map((gid) => serverGroups.find((g) => g.id === gid)) : []),
|
||||
channelGroups?.find((g) => g.id === client.channelGroup),
|
||||
].filter((g): g is GroupEntry => !!g && g.iconId !== 0);
|
||||
|
||||
// "Own channel" mode keeps the own channel and the channels above it open.
|
||||
const ownPath = new Set<number>();
|
||||
@@ -1559,6 +1673,7 @@ function ChannelTree({
|
||||
ownClientId={ownClientId}
|
||||
talkers={talkers}
|
||||
serverGroups={serverGroups}
|
||||
channelGroups={channelGroups}
|
||||
groupIconImages={groupIconImages}
|
||||
selected={selected}
|
||||
sessionKey={sessionKey}
|
||||
@@ -1738,6 +1853,8 @@ function ChannelTree({
|
||||
}
|
||||
inputMuted={c.inputMuted}
|
||||
inputHardwareEnabled={c.inputHardwareEnabled}
|
||||
outputMuted={c.outputMuted}
|
||||
away={c.away}
|
||||
commander={c.isChannelCommander}
|
||||
/>
|
||||
<span className="ts-client-status-leading">
|
||||
@@ -1749,7 +1866,6 @@ function ChannelTree({
|
||||
className="ts-client-avatar"
|
||||
isSelf={c.id === ownClientId}
|
||||
/>
|
||||
{tree.flags && countryFlag(c.country) && <span title={c.country}>{countryFlag(c.country)}</span>}
|
||||
<span className="ts-tree-label">{c.name}</span>
|
||||
{tree.awayMessage && c.away && c.awayMessage && (
|
||||
<span className="ts-client-away-message">({c.awayMessage})</span>
|
||||
@@ -1758,6 +1874,9 @@ function ChannelTree({
|
||||
{clientGroupBadges(c).map((g) => (
|
||||
<GroupIcon key={g.id} group={g} images={groupIconImages} />
|
||||
))}
|
||||
{tree.flags && countryFlag(c.country) && (
|
||||
<span className="ts-flag" title={c.country}>{countryFlag(c.country)}</span>
|
||||
)}
|
||||
</span>
|
||||
</div>
|
||||
</li>
|
||||
@@ -1954,6 +2073,8 @@ function InfoPanel({
|
||||
talking={false}
|
||||
inputMuted={client.inputMuted}
|
||||
inputHardwareEnabled={client.inputHardwareEnabled}
|
||||
outputMuted={client.outputMuted}
|
||||
away={client.away}
|
||||
/>
|
||||
<span>{client.name}</span>
|
||||
</div>
|
||||
@@ -1964,7 +2085,7 @@ function InfoPanel({
|
||||
<div className="ts-info-row">
|
||||
<span>{t("info.country")}</span>{" "}
|
||||
<span>
|
||||
{countryFlag(client.country) ? `${countryFlag(client.country)} ` : ""}
|
||||
{countryFlag(client.country) && <span className="ts-flag">{countryFlag(client.country)} </span>}
|
||||
{client.country}
|
||||
</span>
|
||||
</div>
|
||||
@@ -2093,6 +2214,8 @@ function ConnectDialog({
|
||||
defaultChannel,
|
||||
privilegeKey,
|
||||
serverType,
|
||||
loginName,
|
||||
loginPassword,
|
||||
expanded,
|
||||
connecting,
|
||||
identities,
|
||||
@@ -2104,6 +2227,8 @@ function ConnectDialog({
|
||||
onDefaultChannelChange,
|
||||
onPrivilegeKeyChange,
|
||||
onServerTypeChange,
|
||||
onLoginNameChange,
|
||||
onLoginPasswordChange,
|
||||
onActiveIdentityChange,
|
||||
onToggleExpanded,
|
||||
onConnect,
|
||||
@@ -2120,6 +2245,8 @@ function ConnectDialog({
|
||||
defaultChannel: string;
|
||||
privilegeKey: string;
|
||||
serverType: ServerType;
|
||||
loginName: string;
|
||||
loginPassword: string;
|
||||
expanded: boolean;
|
||||
connecting: boolean;
|
||||
identities: Identity[];
|
||||
@@ -2130,6 +2257,8 @@ function ConnectDialog({
|
||||
onChannelPasswordChange: (v: string) => void;
|
||||
onDefaultChannelChange: (v: string) => void;
|
||||
onPrivilegeKeyChange: (v: string) => void;
|
||||
onLoginNameChange: (v: string) => void;
|
||||
onLoginPasswordChange: (v: string) => void;
|
||||
onServerTypeChange: (v: ServerType) => void;
|
||||
onActiveIdentityChange: (id: string) => void;
|
||||
onToggleExpanded: () => void;
|
||||
@@ -2146,6 +2275,10 @@ function ConnectDialog({
|
||||
}) {
|
||||
const t = useT();
|
||||
const backdrop = useBackdropDismiss(onCancel);
|
||||
const [ts2Available, setTs2Available] = useState(false);
|
||||
useEffect(() => {
|
||||
void fetchGatewayFeatures().then((f) => setTs2Available(f.includes("ts2")));
|
||||
}, []);
|
||||
|
||||
// Nova-theme-only: the "Erweiterte Optionen" toggle moves from the footer
|
||||
// (Standard) to right under the nickname field, with a rotating chevron -
|
||||
@@ -2278,8 +2411,32 @@ function ConnectDialog({
|
||||
<option value="auto">{t("connect.serverType.auto")}</option>
|
||||
<option value="teamspeak">{t("connect.serverType.teamspeak")}</option>
|
||||
<option value="teaspeak">{t("connect.serverType.teaspeak")}</option>
|
||||
{(ts2Available || serverType === "ts2") && (
|
||||
<option value="ts2">{t("connect.serverType.ts2")}</option>
|
||||
)}
|
||||
</select>
|
||||
</label>
|
||||
{serverType === "ts2" && (
|
||||
<>
|
||||
<label className="ts-dialog-field">
|
||||
{t("connect.ts2LoginName")}
|
||||
<input
|
||||
value={loginName}
|
||||
onChange={(e) => onLoginNameChange(e.target.value)}
|
||||
autoComplete="username"
|
||||
/>
|
||||
</label>
|
||||
<label className="ts-dialog-field">
|
||||
{t("connect.ts2LoginPassword")}
|
||||
<input
|
||||
type="password"
|
||||
value={loginPassword}
|
||||
onChange={(e) => onLoginPasswordChange(e.target.value)}
|
||||
autoComplete="current-password"
|
||||
/>
|
||||
</label>
|
||||
</>
|
||||
)}
|
||||
<label className="ts-dialog-field">
|
||||
{t("connect.hotkeyProfile")}
|
||||
<select disabled defaultValue="Standard">
|
||||
@@ -2588,17 +2745,18 @@ function SegmentedChoice<T extends string | number>({
|
||||
}
|
||||
|
||||
function StreamSettingsDialog({
|
||||
defaultName,
|
||||
ownName,
|
||||
onStart,
|
||||
onCancel,
|
||||
}: {
|
||||
defaultName: string;
|
||||
ownName: string;
|
||||
onStart: (options: StreamPublishOptions) => void;
|
||||
onCancel: () => void;
|
||||
}) {
|
||||
const t = useT();
|
||||
const backdrop = useBackdropDismiss(onCancel);
|
||||
const [preset, setPreset] = useState<string | null>("720");
|
||||
const [source, setSource] = useState<"display" | "camera">("display");
|
||||
const [audio, setAudio] = useState(true);
|
||||
const [accessibility, setAccessibility] = useState<number>(StreamAccess.PUBLIC);
|
||||
const [advanced, setAdvanced] = useState(false);
|
||||
@@ -2644,6 +2802,18 @@ function StreamSettingsDialog({
|
||||
<p className="ts-alpha-note">{t("publish.alphaNote")}</p>
|
||||
<h4 className="ts-stream-settings-section">{t("publish.dialog.basic")}</h4>
|
||||
|
||||
<div className="ts-stream-settings-row">
|
||||
<span>{t("publish.kind")}</span>
|
||||
<SegmentedChoice
|
||||
value={source}
|
||||
onChange={setSource}
|
||||
options={[
|
||||
{ value: "display", label: `🖥️ ${t("publish.kind.display")}` },
|
||||
{ value: "camera", label: `📷 ${t("publish.camera")}` },
|
||||
]}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="ts-stream-settings-row">
|
||||
<span>{t("publish.preset")}</span>
|
||||
<SegmentedChoice
|
||||
@@ -2659,8 +2829,16 @@ function StreamSettingsDialog({
|
||||
|
||||
<div className="ts-stream-settings-row">
|
||||
<span>{t("publish.audio")}</span>
|
||||
<label className="ts-stream-settings-toggle">
|
||||
<input type="checkbox" checked={audio} onChange={(e) => setAudio(e.target.checked)} />
|
||||
<label
|
||||
className="ts-stream-settings-toggle"
|
||||
title={source === "camera" ? t("publish.audio.cameraHint") : undefined}
|
||||
>
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={audio && source === "display"}
|
||||
disabled={source === "camera"}
|
||||
onChange={(e) => setAudio(e.target.checked)}
|
||||
/>
|
||||
<span />
|
||||
</label>
|
||||
</div>
|
||||
@@ -2731,7 +2909,7 @@ function StreamSettingsDialog({
|
||||
<SegmentedChoice
|
||||
value={audioBitrateKbps}
|
||||
onChange={custom(setAudioBitrateKbps)}
|
||||
disabled={!audio}
|
||||
disabled={!audio || source === "camera"}
|
||||
options={AUDIO_BITRATE_CHOICES.map((v) => ({ value: v, label: String(v) }))}
|
||||
/>
|
||||
</div>
|
||||
@@ -2787,8 +2965,9 @@ function StreamSettingsDialog({
|
||||
className="ts-stream-settings-go"
|
||||
onClick={() =>
|
||||
onStart({
|
||||
name: defaultName,
|
||||
audio,
|
||||
name: `${ownName} - ${t(source === "camera" ? "publish.camera" : "publish.screen")}`,
|
||||
source,
|
||||
audio: audio && source === "display",
|
||||
accessibility,
|
||||
mode,
|
||||
viewerLimit,
|
||||
@@ -3128,6 +3307,27 @@ function NewsTicker() {
|
||||
);
|
||||
}
|
||||
|
||||
/** Line icons for the mobile shell (24px grid, stroke = currentColor). */
|
||||
const MOBILE_ICONS = {
|
||||
mic: "M12 3a3 3 0 0 0-3 3v6a3 3 0 0 0 6 0V6a3 3 0 0 0-3-3zM5 11a7 7 0 0 0 14 0M12 18v3",
|
||||
micOff: "M3 3l18 18M9 9v3a3 3 0 0 0 5.1 2.1M15 9.3V6a3 3 0 0 0-5.7-1.3M5 11a7 7 0 0 0 11.9 4.9M19 11a7 7 0 0 1-.6 2.8M12 18v3",
|
||||
sound: "M11 5L6 9H3v6h3l5 4zM15.5 8.5a5 5 0 0 1 0 7M18.5 5.5a9 9 0 0 1 0 13",
|
||||
soundOff: "M11 5L6 9H3v6h3l5 4zM22 9l-6 6M16 9l6 6",
|
||||
leave: "M3.6 13.4c4.6-4.5 12.2-4.5 16.8 0l-2.3 2.3-3-1.3v-2.1a11 11 0 0 0-6.2 0v2.1l-3 1.3z",
|
||||
talk: "M12 3a3 3 0 0 0-3 3v6a3 3 0 0 0 6 0V6a3 3 0 0 0-3-3zM5 11a7 7 0 0 0 14 0M12 18v3M2 8v4M22 8v4",
|
||||
tree: "M4 5h16M8 10h12M8 15h12M4 5v15M4 10h4M4 15h4M8 20h12M4 20h4",
|
||||
chat: "M21 12a8 8 0 0 1-11.6 7.1L4 20l1-4.6A8 8 0 1 1 21 12z",
|
||||
info: "M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zM12 11v6M12 7.5v.5",
|
||||
} as const;
|
||||
|
||||
function MobileIcon({ name }: { name: keyof typeof MOBILE_ICONS }) {
|
||||
return (
|
||||
<svg className="ts-mobile-icon" viewBox="0 0 24 24" aria-hidden="true" fill="none" stroke="currentColor" strokeWidth={2} strokeLinecap="round" strokeLinejoin="round">
|
||||
<path d={MOBILE_ICONS[name]} />
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
|
||||
function DonateFab() {
|
||||
const t = useT();
|
||||
if (!DONATE_URL) return null;
|
||||
@@ -6448,10 +6648,11 @@ function AnwendungPanel({
|
||||
<option value="zh-CN">{t("app.language.zh-CN")}</option>
|
||||
<option value="fa">{t("app.language.fa")}</option>
|
||||
<option value="cs-CZ">{t("app.language.cs-CZ")}</option>
|
||||
<option value="ru">{t("app.language.ru")}</option>
|
||||
</select>
|
||||
</label>
|
||||
<p className="ts-options-hint">
|
||||
<a href="https://hosted.weblate.org/projects/webspeak3/" target="_blank" rel="noreferrer">
|
||||
<a href="https://github.com/WebSpeak3/webspeak3#translating" target="_blank" rel="noreferrer">
|
||||
{t("app.language.helpTranslate")}
|
||||
</a>
|
||||
</p>
|
||||
@@ -8418,11 +8619,19 @@ function OptionsDialog({
|
||||
const t = useT();
|
||||
const active = OPTIONS_SECTIONS.find((s) => s.id === section) ?? OPTIONS_SECTIONS[0];
|
||||
const backdrop = useBackdropDismiss(onClose);
|
||||
// Mobile only (CSS): list of sections first, tapping one shows just that page.
|
||||
const [mobileDetail, setMobileDetail] = useState(false);
|
||||
return (
|
||||
<div className="ts-dialog-backdrop" {...backdrop}>
|
||||
<div className="ts-dialog ts-options-dialog" onClick={(e) => e.stopPropagation()}>
|
||||
<div
|
||||
className={`ts-dialog ts-options-dialog ts-options-dialog-nav${mobileDetail ? " ts-options-detail" : ""}`}
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
>
|
||||
<div className="ts-dialog-titlebar">
|
||||
<span>{t("options.title")}</span>
|
||||
<button className="ts-options-back" onClick={() => setMobileDetail(false)}>
|
||||
<span aria-hidden="true">‹</span> {t(`options.section.${active.id}`)}
|
||||
</button>
|
||||
<span className="ts-options-title">{t("options.title")}</span>
|
||||
<button onClick={onClose} title={t("dialog.close")} aria-label={t("dialog.close")}>
|
||||
✕
|
||||
</button>
|
||||
@@ -8433,7 +8642,10 @@ function OptionsDialog({
|
||||
<button
|
||||
key={s.id}
|
||||
className={`ts-options-sidebar-item${s.id === active.id ? " ts-options-sidebar-item-active" : ""}`}
|
||||
onClick={() => onSectionChange(s.id)}
|
||||
onClick={() => {
|
||||
onSectionChange(s.id);
|
||||
setMobileDetail(true);
|
||||
}}
|
||||
>
|
||||
<span className="ts-options-sidebar-icon">{s.icon}</span>
|
||||
<span>{t(`options.section.${s.id}`)}</span>
|
||||
@@ -8749,6 +8961,8 @@ function AppInner() {
|
||||
const [channelPassword, setChannelPassword] = useState("");
|
||||
const [defaultChannel, setDefaultChannel] = useState("");
|
||||
const [privilegeKey, setPrivilegeKey] = useState("");
|
||||
const [loginName, setLoginName] = useState("");
|
||||
const [loginPassword, setLoginPassword] = useState("");
|
||||
const [serverType, setServerType] = useState<ServerType>(loadServerType);
|
||||
// Prompt shown when switching into a password-protected channel mid-session
|
||||
// (the initial-connect "default channel" password above is a separate field).
|
||||
@@ -8883,6 +9097,17 @@ function AppInner() {
|
||||
const [banSeconds, setBanSeconds] = useState("0");
|
||||
const banBackdrop = useBackdropDismiss(() => setBanTarget(null));
|
||||
const [demoForceMobile, setDemoForceMobile] = useState(false);
|
||||
// Phones get their own shell (header + big tree + bottom voice bar/tabs)
|
||||
// instead of the squeezed desktop layout.
|
||||
const [narrowScreen, setNarrowScreen] = useState(() => window.matchMedia("(max-width: 700px)").matches);
|
||||
useEffect(() => {
|
||||
const mq = window.matchMedia("(max-width: 700px)");
|
||||
const onChange = () => setNarrowScreen(mq.matches);
|
||||
mq.addEventListener("change", onChange);
|
||||
return () => mq.removeEventListener("change", onChange);
|
||||
}, []);
|
||||
const mobile = narrowScreen || demoForceMobile;
|
||||
const [mobileTab, setMobileTab] = useState<"tree" | "chat" | "info">("tree");
|
||||
const [clientContextMenu, setClientContextMenu] = useState<{
|
||||
x: number;
|
||||
y: number;
|
||||
@@ -9821,10 +10046,17 @@ function AppInner() {
|
||||
const connectFavoriteId = params.favoriteId;
|
||||
const connectIdentityBlob = identities.find((i) => i.id === connectIdentityId)?.blob ?? undefined;
|
||||
|
||||
const onopen = () => {
|
||||
logClient("info", "Connection", `Connecting to ${connectHost}…`);
|
||||
const sendConnect = (extra: Record<string, unknown> = {}) => {
|
||||
let turnstilePass: string | undefined;
|
||||
try {
|
||||
turnstilePass = localStorage.getItem(TURNSTILE_PASS_KEY) ?? undefined;
|
||||
} catch {
|
||||
/* storage blocked */
|
||||
}
|
||||
socket.send(
|
||||
JSON.stringify({
|
||||
...extra,
|
||||
turnstilePass,
|
||||
type: "connect",
|
||||
host: connectHost,
|
||||
nickname: connectNickname,
|
||||
@@ -9834,9 +10066,15 @@ function AppInner() {
|
||||
identity: connectIdentityBlob || undefined,
|
||||
privilegeKey: connectPrivilegeKey.trim() || undefined,
|
||||
serverType: connectServerType || "auto",
|
||||
loginName: (connectServerType === "ts2" && params.loginName?.trim()) || undefined,
|
||||
loginPassword: (connectServerType === "ts2" && params.loginPassword) || undefined,
|
||||
})
|
||||
);
|
||||
};
|
||||
const onopen = () => {
|
||||
logClient("info", "Connection", `Connecting to ${connectHost}…`);
|
||||
sendConnect();
|
||||
};
|
||||
|
||||
// Downloads arrive in pieces (see the connector's TRANSFER_CHUNK_BYTES),
|
||||
// keyed by channel + path; every piece but the last is a whole number of
|
||||
@@ -9876,6 +10114,20 @@ function AppInner() {
|
||||
setTurnServers(Array.isArray(data.iceServers) ? data.iceServers : []);
|
||||
return;
|
||||
}
|
||||
if (data.type === "turnstileRequired") {
|
||||
void getTurnstileToken().then((turnstileToken) => {
|
||||
if (socket.readyState === WebSocket.OPEN) sendConnect({ turnstileToken });
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (data.type === "turnstilePass") {
|
||||
try {
|
||||
localStorage.setItem(TURNSTILE_PASS_KEY, String(data.pass));
|
||||
} catch {
|
||||
/* storage blocked: the check just runs again next time */
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Inactive tab: update parked snapshot only (no audio playback).
|
||||
if (sessionId !== activeSessionIdRef.current) {
|
||||
@@ -10256,7 +10508,13 @@ function AppInner() {
|
||||
appendLog({ text: data.message, kind: "error" });
|
||||
} else {
|
||||
setConnecting(false);
|
||||
setConnectError(data.code === "gateway_full" ? t("connectError.gatewayFull") : data.message);
|
||||
setConnectError(
|
||||
data.code === "gateway_full"
|
||||
? t("connectError.gatewayFull")
|
||||
: data.code === "turnstile_failed"
|
||||
? t("connectError.botCheck")
|
||||
: data.message
|
||||
);
|
||||
updateTabMeta(sessionId, { connecting: false, connected: false });
|
||||
}
|
||||
break;
|
||||
@@ -10508,6 +10766,8 @@ function AppInner() {
|
||||
defaultChannel: overrides?.defaultChannel ?? defaultChannel,
|
||||
privilegeKey: overrides?.privilegeKey ?? privilegeKey,
|
||||
serverType: overrides?.serverType ?? serverType,
|
||||
loginName,
|
||||
loginPassword,
|
||||
identityId: activeIdentityId,
|
||||
favoriteId: overrides?.favoriteId !== undefined ? overrides.favoriteId : null,
|
||||
};
|
||||
@@ -10982,6 +11242,10 @@ function AppInner() {
|
||||
if (!connected || serverGroups) return;
|
||||
socketRef.current?.send(JSON.stringify({ type: "getServerGroupList" }));
|
||||
}, [connected, serverGroups]);
|
||||
useEffect(() => {
|
||||
if (!connected || channelGroups) return;
|
||||
socketRef.current?.send(JSON.stringify({ type: "getChannelGroupList" }));
|
||||
}, [connected, channelGroups]);
|
||||
|
||||
// Same icon-file cache as the server icons dialog (fileDownloadData for
|
||||
// cid 0 always lands in serverIconImages, regardless of who asked) - fetch
|
||||
@@ -10995,13 +11259,14 @@ function AppInner() {
|
||||
useEffect(() => {
|
||||
if (!serverGroups) return;
|
||||
const iconById = new Map(serverGroups.map((g) => [g.id, g.iconId]));
|
||||
const channelIconById = new Map((channelGroups ?? []).map((g) => [g.id, g.iconId]));
|
||||
// Plus every group listed in an open group menu, so unassigned ones show their icon too.
|
||||
const menuGroups = !groupAssignTarget
|
||||
? []
|
||||
: ((groupAssignTarget.kind === "channel" ? channelGroups : serverGroups) ?? []);
|
||||
const wantedIconIds = new Set(
|
||||
clients
|
||||
.flatMap((c) => c.serverGroups.map((gid) => iconById.get(gid) ?? 0))
|
||||
.flatMap((c) => [...c.serverGroups.map((gid) => iconById.get(gid) ?? 0), channelIconById.get(c.channelGroup) ?? 0])
|
||||
.concat(menuGroups.map((g) => g.iconId))
|
||||
.filter((id) => id >= CUSTOM_ICON_ID_THRESHOLD)
|
||||
);
|
||||
@@ -12545,7 +12810,7 @@ function AppInner() {
|
||||
: treeClients.length;
|
||||
const novaSplash = designTheme === "nova" && !connected;
|
||||
// Nova and IDE collapse the menubar behind a hamburger button.
|
||||
const compactMenu = designTheme === "nova" || designTheme === "ide";
|
||||
const compactMenu = designTheme === "nova" || designTheme === "ide" || mobile;
|
||||
const micLabel = !micOn ? t("toolbar.micEnable") : inputMuted ? t("toolbar.micUnmute") : t("toolbar.micMute");
|
||||
const streamLabel = DEMO_MODE
|
||||
? t("publish.demoUnavailable")
|
||||
@@ -12556,7 +12821,7 @@ function AppInner() {
|
||||
<div
|
||||
className={`ts-app ts-theme-${theme}${designThemeClassName(designTheme)}${
|
||||
activeCustomTheme ? " ts-design-custom" : ""
|
||||
}${demoForceMobile ? " ts-force-mobile" : ""}${novaSplash ? " ts-nova-splash" : ""}${
|
||||
}${demoForceMobile ? " ts-force-mobile" : ""}${mobile ? ` ts-mobile ts-mobile-tab-${mobileTab}` : ""}${novaSplash ? " ts-nova-splash" : ""}${
|
||||
designTheme === "ide" && !idePixelFont ? " ts-ide-plain-font" : ""
|
||||
}`}
|
||||
data-custom-theme={activeCustomTheme?.id}
|
||||
@@ -12568,9 +12833,9 @@ function AppInner() {
|
||||
<a href="https://github.com/WebSpeak3/webspeak3" target="_blank" rel="noreferrer">
|
||||
Get WebSpeak3
|
||||
</a>
|
||||
<button className="ts-demo-mobile-toggle" onClick={() => setDemoForceMobile((v) => !v)}>
|
||||
{!narrowScreen && <button className="ts-demo-mobile-toggle" onClick={() => setDemoForceMobile((v) => !v)}>
|
||||
{demoForceMobile ? "🖥 Desktop view" : "📱 Mobile view"}
|
||||
</button>
|
||||
</button>}
|
||||
</div>
|
||||
)}
|
||||
<div className="ts-menubar">
|
||||
@@ -12589,6 +12854,11 @@ function AppInner() {
|
||||
className={`ts-menubar-items${compactMenu ? " ts-nova-menu-panel" : ""}${
|
||||
novaMenuOpen ? " ts-nova-menu-panel-open" : ""
|
||||
}`}
|
||||
// Picking an entry closes the whole ☰ panel, not just the submenu -
|
||||
// otherwise it stays on top of the dialog the entry just opened.
|
||||
onClick={(e) => {
|
||||
if (compactMenu && (e.target as HTMLElement).closest(".ts-menu-item")) setNovaMenuOpen(false);
|
||||
}}
|
||||
>
|
||||
<div className="ts-menubar-dropdown" ref={connectionsMenuRef}>
|
||||
<button
|
||||
@@ -13043,7 +13313,7 @@ function AppInner() {
|
||||
{IS_OWN_HOSTED_INSTANCE && (
|
||||
<button
|
||||
type="button"
|
||||
className="ts-menubar-item ts-plain-button"
|
||||
className="ts-menubar-item ts-plain-button ts-menubar-feedback"
|
||||
onClick={() => setFeedbackOpen(true)}
|
||||
>
|
||||
💬 {t("menu.extras.feedback")}
|
||||
@@ -13092,7 +13362,7 @@ function AppInner() {
|
||||
</a>
|
||||
<a
|
||||
className="ts-menu-item"
|
||||
href="https://hosted.weblate.org/projects/webspeak3/"
|
||||
href="https://github.com/WebSpeak3/webspeak3#translating"
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
onClick={() => setHelpMenuOpen(false)}
|
||||
@@ -13118,6 +13388,14 @@ function AppInner() {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{mobile && designTheme !== "nova" && (
|
||||
<div className="ts-mobile-title">
|
||||
<span className="ts-mobile-title-name">{connected ? serverName || host : "WebSpeak3"}</span>
|
||||
<span className={`ts-mobile-title-status${connected ? " ts-mobile-title-status-on" : ""}`}>
|
||||
{connected ? ownClient?.name ?? t("design.status.connected") : t("tree.notConnected")}
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
{designTheme === "nova" && (
|
||||
<div className="ts-nova-topbar-server">
|
||||
<span className="ts-nova-topbar-logo">W</span>
|
||||
@@ -13382,7 +13660,7 @@ function AppInner() {
|
||||
|
||||
</div>
|
||||
|
||||
{sessionTabs.length > 0 ? (
|
||||
{sessionTabs.length > (mobile ? 1 : 0) ? (
|
||||
<ConnectionTabs
|
||||
tabs={sessionTabs}
|
||||
activeTabId={activeSessionId}
|
||||
@@ -13400,6 +13678,8 @@ function AppInner() {
|
||||
defaultChannel={defaultChannel}
|
||||
privilegeKey={privilegeKey}
|
||||
serverType={serverType}
|
||||
loginName={loginName}
|
||||
loginPassword={loginPassword}
|
||||
expanded={connectDialogExpanded}
|
||||
connecting={connecting}
|
||||
identities={identities}
|
||||
@@ -13411,6 +13691,8 @@ function AppInner() {
|
||||
onDefaultChannelChange={setDefaultChannel}
|
||||
onPrivilegeKeyChange={setPrivilegeKey}
|
||||
onServerTypeChange={setServerType}
|
||||
onLoginNameChange={setLoginName}
|
||||
onLoginPasswordChange={setLoginPassword}
|
||||
onActiveIdentityChange={handleActiveIdentityChange}
|
||||
onToggleExpanded={() => setConnectDialogExpanded((v) => !v)}
|
||||
onConnect={() => handleConnect({ host: dialogHost })}
|
||||
@@ -13975,7 +14257,7 @@ function AppInner() {
|
||||
|
||||
{streamSettingsOpen && (
|
||||
<StreamSettingsDialog
|
||||
defaultName={`${ownClient?.name ?? "WebSpeak3"} - ${t("publish.screen")}`}
|
||||
ownName={ownClient?.name ?? "WebSpeak3"}
|
||||
onStart={handleStartPublishing}
|
||||
onCancel={() => setStreamSettingsOpen(false)}
|
||||
/>
|
||||
@@ -14431,6 +14713,7 @@ function AppInner() {
|
||||
ownClientId={ownClientId ?? ownClient?.id ?? null}
|
||||
talkers={displayTalkers}
|
||||
serverGroups={serverGroups}
|
||||
channelGroups={channelGroups}
|
||||
groupIconImages={serverIconImages}
|
||||
selected={selected}
|
||||
sessionKey={activeSessionId ?? ""}
|
||||
@@ -14634,6 +14917,83 @@ function AppInner() {
|
||||
</div>
|
||||
</main>
|
||||
|
||||
{mobile && (
|
||||
<div className="ts-mobile-bottom">
|
||||
{connected ? (
|
||||
<div className="ts-mobile-voicebar">
|
||||
{pushToTalk && micOn && (
|
||||
<button
|
||||
className={`ts-mobile-voice-btn ts-mobile-ptt${pttPressed ? " ts-mobile-voice-on" : ""}`}
|
||||
onPointerDown={(e) => {
|
||||
e.currentTarget.setPointerCapture(e.pointerId);
|
||||
setPttPressed(true);
|
||||
}}
|
||||
onPointerUp={() => setPttPressed(false)}
|
||||
onPointerCancel={() => setPttPressed(false)}
|
||||
onContextMenu={(e) => e.preventDefault()}
|
||||
aria-label={t("toolbar.pushToTalk")}
|
||||
aria-pressed={pttPressed}
|
||||
>
|
||||
<MobileIcon name="talk" />
|
||||
<span className="ts-mobile-voice-label">{t("mobile.talk")}</span>
|
||||
</button>
|
||||
)}
|
||||
<button
|
||||
className={`ts-mobile-voice-btn${micOn && !inputMuted ? " ts-mobile-voice-on" : ""}${
|
||||
micOn && inputMuted ? " ts-mobile-voice-off" : ""
|
||||
}`}
|
||||
onClick={handleToggleMic}
|
||||
aria-label={micLabel}
|
||||
>
|
||||
<MobileIcon name={micOn && !inputMuted ? "mic" : "micOff"} />
|
||||
<span className="ts-mobile-voice-label">{t("mobile.mic")}</span>
|
||||
</button>
|
||||
<button
|
||||
className={`ts-mobile-voice-btn${outputMuted ? " ts-mobile-voice-off" : ""}`}
|
||||
onClick={handleToggleOutputMuted}
|
||||
aria-label={outputMuted ? t("toolbar.unmuteSound") : t("toolbar.muteSound")}
|
||||
>
|
||||
<MobileIcon name={outputMuted ? "soundOff" : "sound"} />
|
||||
<span className="ts-mobile-voice-label">{t("mobile.sound")}</span>
|
||||
</button>
|
||||
<button className="ts-mobile-voice-btn ts-mobile-voice-hangup" onClick={handleDisconnect} aria-label={t("menu.connections.disconnectCurrent")}>
|
||||
<MobileIcon name="leave" />
|
||||
<span className="ts-mobile-voice-label">{t("mobile.leave")}</span>
|
||||
</button>
|
||||
</div>
|
||||
) : (
|
||||
<div className="ts-mobile-voicebar">
|
||||
<button className="ts-mobile-connect-btn" onClick={() => setConnectDialogOpen(true)} disabled={connecting}>
|
||||
{t("menu.connections.connect")}
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
<nav className="ts-mobile-tabs">
|
||||
{(
|
||||
[
|
||||
["tree", t("mobile.tab.channels")],
|
||||
["chat", t("mobile.tab.chat")],
|
||||
["info", t("mobile.tab.info")],
|
||||
] as const
|
||||
).map(([id, label]) => (
|
||||
<button
|
||||
key={id}
|
||||
className={`ts-mobile-tab${mobileTab === id ? " ts-mobile-tab-active" : ""}${
|
||||
id === "chat" && (chatUnread.server || chatUnread.channel || Object.values(pmThreads).some((p) => p.unread))
|
||||
? " ts-mobile-tab-unread"
|
||||
: ""
|
||||
}`}
|
||||
onClick={() => setMobileTab(id)}
|
||||
aria-current={mobileTab === id ? "page" : undefined}
|
||||
>
|
||||
<MobileIcon name={id} />
|
||||
{label}
|
||||
</button>
|
||||
))}
|
||||
</nav>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="ts-log">
|
||||
{log.slice(-50).map((entry, i) => {
|
||||
let text = entry.text;
|
||||
|
||||
Binary file not shown.
+6
-3
@@ -5,8 +5,9 @@ import en from "./locales/en.json";
|
||||
import zhCN from "./locales/zh-CN.json";
|
||||
import fa from "./locales/fa.json";
|
||||
import csCZ from "./locales/cs-CZ.json";
|
||||
import ru from "./locales/ru.json";
|
||||
|
||||
export type Lang = "de" | "en" | "zh-CN" | "fa" | "cs-CZ";
|
||||
export type Lang = "de" | "en" | "zh-CN" | "fa" | "cs-CZ" | "ru";
|
||||
const RTL_LANGS = new Set<Lang>(["fa"]);
|
||||
export type LangPref = "auto" | Lang;
|
||||
|
||||
@@ -16,7 +17,7 @@ const LANGUAGE_KEY = "webspeak3:language";
|
||||
// user-facing string in the app should have an entry in every file - falls
|
||||
// back to the English string (or the raw key) if a translation is missing,
|
||||
// so a partial dictionary never blanks out the UI. Plain JSON (not inline
|
||||
// TS objects) so translation tools like Weblate can read/write these files
|
||||
// TS objects) so translation tools can read/write these files
|
||||
// directly.
|
||||
const translations: Record<Lang, Record<string, string>> = {
|
||||
de,
|
||||
@@ -24,6 +25,7 @@ const translations: Record<Lang, Record<string, string>> = {
|
||||
"zh-CN": zhCN,
|
||||
fa,
|
||||
"cs-CZ": csCZ,
|
||||
ru,
|
||||
};
|
||||
|
||||
function detectSystemLang(): Lang {
|
||||
@@ -32,6 +34,7 @@ function detectSystemLang(): Lang {
|
||||
if (normalized.startsWith("zh")) return "zh-CN";
|
||||
if (normalized.startsWith("fa")) return "fa";
|
||||
if (normalized.startsWith("cs")) return "cs-CZ";
|
||||
if (normalized.startsWith("ru")) return "ru";
|
||||
return normalized.startsWith("de") ? "de" : "en";
|
||||
}
|
||||
|
||||
@@ -41,7 +44,7 @@ export function resolveLang(pref: LangPref): Lang {
|
||||
|
||||
export function loadLangPref(): LangPref {
|
||||
const raw = localStorage.getItem(LANGUAGE_KEY);
|
||||
return raw === "de" || raw === "en" || raw === "zh-CN" || raw === "fa" || raw === "cs-CZ" || raw === "auto" ? raw : "auto";
|
||||
return raw === "de" || raw === "en" || raw === "zh-CN" || raw === "fa" || raw === "cs-CZ" || raw === "ru" || raw === "auto" ? raw : "auto";
|
||||
}
|
||||
|
||||
export function saveLangPref(pref: LangPref) {
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
"menu.help.about": "O WebSpeak3",
|
||||
"menu.help.github": "GitHub",
|
||||
"menu.help.changelog": "Seznam změn",
|
||||
"menu.help.translate": "Pomozte s překladem (Weblate)",
|
||||
"menu.help.translate": "Pomozte s překladem (GitHub)",
|
||||
"menu.extras.identities": "Identity",
|
||||
"menu.extras.contacts": "Kontakty",
|
||||
"menu.extras.collectedUrls": "Shromážděné URL",
|
||||
@@ -125,6 +125,9 @@
|
||||
"connect.serverType.auto": "Automaticky",
|
||||
"connect.serverType.teamspeak": "TeamSpeak",
|
||||
"connect.serverType.teaspeak": "TeaSpeak",
|
||||
"connect.serverType.ts2": "TeamSpeak 2 (experimentální)",
|
||||
"connect.ts2LoginName": "Název účtu TS2 (prázdné = anonymně):",
|
||||
"connect.ts2LoginPassword": "Heslo účtu TS2:",
|
||||
"connect.hotkeyProfile": "Profil klávesových zkratek:",
|
||||
"connect.soundPack": "Balíček zvuků:",
|
||||
"connect.more": "Více",
|
||||
@@ -407,7 +410,8 @@
|
||||
"app.language.zh-CN": "简体中文",
|
||||
"app.language.fa": "فارسی (بتا)",
|
||||
"app.language.cs-CZ": "Čeština",
|
||||
"app.language.helpTranslate": "Missing your language or spotted wrong translation? Help out on Weblate →",
|
||||
"app.language.ru": "Русский (бета)",
|
||||
"app.language.helpTranslate": "Chybí váš jazyk nebo jste našli chybu v překladu? Takto můžete pomoct →",
|
||||
"app.serverBanner": "Zobrazovat bannery serveru",
|
||||
"app.serverBanner.hint": "Banner se načítá přímo z adresy nastavené administrátorem serveru a tento hostitel vidí vaši IP adresu.",
|
||||
"app.chatImages": "Načítat obrázky v chatu",
|
||||
@@ -489,10 +493,13 @@
|
||||
"publish.alphaTitle": "Alfa – nestabilní, může se kdykoli změnit nebo přestat fungovat",
|
||||
"publish.demoUnavailable": "Streamování není v demu dostupné – vyžaduje skutečný server TeamSpeak 6.",
|
||||
"publish.alphaNote": "Streamování je ve fázi alfa. Používá nezdokumentovaný protokol Stream/Call služby TeamSpeak 6, takže připojení, kvalita obrazu i práce s diváky mohou selhat nebo se bez upozornění změnit. Není určeno pro produkční použití.",
|
||||
"publish.start": "Sdílet obrazovku",
|
||||
"publish.start": "Sdílet obrazovku nebo kameru",
|
||||
"publish.stop": "Zastavit sdílení",
|
||||
"publish.title": "Vaše vysílání",
|
||||
"publish.screen": "Obrazovka",
|
||||
"publish.camera": "Kamera",
|
||||
"publish.kind": "Sdílet",
|
||||
"publish.kind.display": "Obrazovka / okno",
|
||||
"publish.starting": "Spouštění…",
|
||||
"publish.viewers": "Sleduje {count} diváků",
|
||||
"publish.request.allow": "Povolit",
|
||||
@@ -507,6 +514,7 @@
|
||||
"publish.preset": "Předvolba",
|
||||
"publish.preset.presentation": "Prezentace",
|
||||
"publish.audio": "Snímat zvuk",
|
||||
"publish.audio.cameraHint": "U kamery jde tvůj zvuk jako obvykle přes mikrofon.",
|
||||
"publish.privacy": "Soukromí",
|
||||
"publish.privacy.public": "Veřejné",
|
||||
"publish.privacy.contacts": "Kontakty",
|
||||
@@ -710,6 +718,7 @@
|
||||
"serverContext.disconnect": "Odpojit",
|
||||
"connectError.dismiss": "Zavřít",
|
||||
"connectError.gatewayFull": "Brána je právě plná. Zkus to za pár minut znovu – nebo si WebSpeak3 hostuj sám: github.com/WebSpeak3/webspeak3",
|
||||
"connectError.botCheck": "Kontrola proti botům selhala. Obnov stránku a zkus to znovu. Blokátory reklam nebo skriptů mohou kontrole bránit.",
|
||||
"dialog.close": "Zavřít",
|
||||
"sounds.title": "Zvuky",
|
||||
"sounds.subtitle": "Nastavit zvuková upozornění na události",
|
||||
@@ -930,7 +939,7 @@
|
||||
"securitySettings.masterNew": "Nové hlavní heslo",
|
||||
"securitySettings.masterRepeat": "Zopakovat",
|
||||
"securitySettings.masterMismatch": "Hesla se neshodují.",
|
||||
"securitySettings.masterNote": "Dobře si ho zapamatujte: bez něj přijdete o identity a uložená hesla.",
|
||||
"securitySettings.masterNote": "Budete ho muset zadat znovu v každé nové relaci (po obnovení stránky nebo v nové kartě). Dobře si ho zapamatujte: bez něj přijdete o identity a uložená hesla.",
|
||||
"sync.subtitle": "Tvá data na všech zařízeních",
|
||||
"sync.intro": "Účet je jen náhodné číslo, volitelně s heslem. Žádný e-mail, žádné jméno. Vše se před nahráním zašifruje na tvém zařízení. Server vidí jen nečitelná data.",
|
||||
"sync.create.title": "Nový účet",
|
||||
@@ -994,5 +1003,12 @@
|
||||
"sync.error.pow_required": "Bezpečnostní kontrola selhala, zkus to znovu.",
|
||||
"sync.error.conflict": "Jiné zařízení mezitím něco změnilo.",
|
||||
"sync.error.payload_too_large": "Příliš mnoho dat pro synchronizaci (max. 1 MB).",
|
||||
"sync.error.generic": "Synchronizace selhala."
|
||||
"sync.error.generic": "Synchronizace selhala.",
|
||||
"mobile.tab.channels": "Kanály",
|
||||
"mobile.tab.chat": "Chat",
|
||||
"mobile.tab.info": "Info",
|
||||
"mobile.mic": "Mikrofon",
|
||||
"mobile.sound": "Zvuk",
|
||||
"mobile.leave": "Odpojit",
|
||||
"mobile.talk": "Mluvit"
|
||||
}
|
||||
+21
-5
@@ -19,7 +19,7 @@
|
||||
"menu.help.about": "Über WebSpeak3",
|
||||
"menu.help.github": "GitHub",
|
||||
"menu.help.changelog": "Changelog",
|
||||
"menu.help.translate": "Mitübersetzen (Weblate)",
|
||||
"menu.help.translate": "Mitübersetzen (GitHub)",
|
||||
"menu.extras.identities": "Identitäten",
|
||||
"menu.extras.contacts": "Kontakte",
|
||||
"menu.extras.collectedUrls": "Gesammelte URLs",
|
||||
@@ -125,6 +125,9 @@
|
||||
"connect.serverType.auto": "Auto",
|
||||
"connect.serverType.teamspeak": "TeamSpeak",
|
||||
"connect.serverType.teaspeak": "TeaSpeak",
|
||||
"connect.serverType.ts2": "TeamSpeak 2 (experimentell)",
|
||||
"connect.ts2LoginName": "TS2-Kontoname (leer = anonym):",
|
||||
"connect.ts2LoginPassword": "TS2-Kontopasswort:",
|
||||
"connect.hotkeyProfile": "Hotkeyprofil:",
|
||||
"connect.soundPack": "Sound Pack:",
|
||||
"connect.more": "Mehr",
|
||||
@@ -407,7 +410,8 @@
|
||||
"app.language.zh-CN": "简体中文",
|
||||
"app.language.fa": "فارسی (بتا)",
|
||||
"app.language.cs-CZ": "Čeština",
|
||||
"app.language.helpTranslate": "Fehlt deine Sprache oder eine Übersetzung ist ungenau? Hilf mit auf Weblate →",
|
||||
"app.language.ru": "Русский (бета)",
|
||||
"app.language.helpTranslate": "Fehlt deine Sprache oder eine Übersetzung ist ungenau? So hilfst du mit →",
|
||||
"app.serverBanner": "Server-Banner anzeigen",
|
||||
"app.serverBanner.hint": "Das Banner lädt direkt von der Adresse, die der Serverbetreiber eingetragen hat. Dieser Host sieht dabei deine IP-Adresse.",
|
||||
"app.chatImages": "Bilder im Chat laden",
|
||||
@@ -489,10 +493,13 @@
|
||||
"publish.alphaTitle": "Alpha – instabil, kann sich jederzeit ändern oder brechen",
|
||||
"publish.demoUnavailable": "Übertragen ist in der Demo nicht verfügbar – dafür braucht es einen echten TeamSpeak-6-Server.",
|
||||
"publish.alphaNote": "Streaming ist Alpha. Es spricht TeamSpeak 6s Stream/Call-Protokoll, das nicht dokumentiert ist – Verbindungsaufbau, Bildqualität und Zuschauerverwaltung können fehlschlagen oder sich ohne Vorankündigung ändern. Nicht für produktive Nutzung gedacht.",
|
||||
"publish.start": "Bildschirm übertragen",
|
||||
"publish.start": "Bildschirm oder Kamera übertragen",
|
||||
"publish.stop": "Übertragung beenden",
|
||||
"publish.title": "Deine Übertragung",
|
||||
"publish.screen": "Bildschirm",
|
||||
"publish.camera": "Kamera",
|
||||
"publish.kind": "Übertragen",
|
||||
"publish.kind.display": "Bildschirm / Fenster",
|
||||
"publish.starting": "Wird gestartet…",
|
||||
"publish.viewers": "{count} Zuschauer",
|
||||
"publish.request.allow": "Zulassen",
|
||||
@@ -507,6 +514,7 @@
|
||||
"publish.preset": "Voreinstellung",
|
||||
"publish.preset.presentation": "Präsentation",
|
||||
"publish.audio": "Audio aufnehmen",
|
||||
"publish.audio.cameraHint": "Bei der Kamera läuft dein Ton wie gewohnt übers Mikrofon.",
|
||||
"publish.privacy": "Privatsphäre",
|
||||
"publish.privacy.public": "Öffentlich",
|
||||
"publish.privacy.contacts": "Kontakte",
|
||||
@@ -710,6 +718,7 @@
|
||||
"serverContext.disconnect": "Verbindung trennen",
|
||||
"connectError.dismiss": "Schließen",
|
||||
"connectError.gatewayFull": "Das Gateway ist gerade voll. Versuch es in ein paar Minuten nochmal – oder hoste WebSpeak3 selbst: github.com/WebSpeak3/webspeak3",
|
||||
"connectError.botCheck": "Bot-Prüfung fehlgeschlagen. Bitte lade die Seite neu und versuch es noch mal. Werbe- oder Skriptblocker können die Prüfung stören.",
|
||||
"dialog.close": "Schließen",
|
||||
"sounds.title": "Sounds",
|
||||
"sounds.subtitle": "Sound-Benachrichtigungen für Ereignisse festlegen",
|
||||
@@ -930,7 +939,7 @@
|
||||
"securitySettings.masterNew": "Neues Master Passwort",
|
||||
"securitySettings.masterRepeat": "Wiederholen",
|
||||
"securitySettings.masterMismatch": "Die Passwörter stimmen nicht überein.",
|
||||
"securitySettings.masterNote": "Merk es dir gut: Ohne das Passwort sind Identitäten und gespeicherte Passwörter weg.",
|
||||
"securitySettings.masterNote": "Du musst es bei jeder neuen Sitzung (Neuladen oder neuer Tab) wieder eingeben. Merk es dir gut: Ohne das Passwort sind Identitäten und gespeicherte Passwörter weg.",
|
||||
"sync.subtitle": "Deine Daten auf allen Geräten",
|
||||
"sync.intro": "Ein Konto besteht nur aus einer zufälligen Nummer, optional mit Passwort. Keine Mail, kein Name. Alles wird auf deinem Gerät verschlüsselt, bevor es hochgeladen wird. Der Server sieht nur unlesbare Daten.",
|
||||
"sync.create.title": "Neues Konto",
|
||||
@@ -994,5 +1003,12 @@
|
||||
"sync.error.pow_required": "Sicherheitsprüfung fehlgeschlagen, bitte nochmal versuchen.",
|
||||
"sync.error.conflict": "Ein anderes Gerät hat inzwischen etwas geändert.",
|
||||
"sync.error.payload_too_large": "Zu viele Daten für die Synchronisierung (max. 1 MB).",
|
||||
"sync.error.generic": "Synchronisierung fehlgeschlagen."
|
||||
"sync.error.generic": "Synchronisierung fehlgeschlagen.",
|
||||
"mobile.tab.channels": "Kanäle",
|
||||
"mobile.tab.chat": "Chat",
|
||||
"mobile.tab.info": "Info",
|
||||
"mobile.mic": "Mikro",
|
||||
"mobile.sound": "Ton",
|
||||
"mobile.leave": "Trennen",
|
||||
"mobile.talk": "Sprechen"
|
||||
}
|
||||
+21
-5
@@ -19,7 +19,7 @@
|
||||
"menu.help.about": "About WebSpeak3",
|
||||
"menu.help.github": "GitHub",
|
||||
"menu.help.changelog": "Changelog",
|
||||
"menu.help.translate": "Help translate (Weblate)",
|
||||
"menu.help.translate": "Help translate (GitHub)",
|
||||
"menu.extras.identities": "Identities",
|
||||
"menu.extras.contacts": "Contacts",
|
||||
"menu.extras.collectedUrls": "Collected URLs",
|
||||
@@ -125,6 +125,9 @@
|
||||
"connect.serverType.auto": "Auto",
|
||||
"connect.serverType.teamspeak": "TeamSpeak",
|
||||
"connect.serverType.teaspeak": "TeaSpeak",
|
||||
"connect.serverType.ts2": "TeamSpeak 2 (experimental)",
|
||||
"connect.ts2LoginName": "TS2 account name (empty = anonymous):",
|
||||
"connect.ts2LoginPassword": "TS2 account password:",
|
||||
"connect.hotkeyProfile": "Hotkey profile:",
|
||||
"connect.soundPack": "Sound pack:",
|
||||
"connect.more": "More",
|
||||
@@ -407,7 +410,8 @@
|
||||
"app.language.zh-CN": "简体中文",
|
||||
"app.language.fa": "فارسی (بتا)",
|
||||
"app.language.cs-CZ": "Čeština",
|
||||
"app.language.helpTranslate": "Missing your language or spotted a wrong translation? Help out on Weblate →",
|
||||
"app.language.ru": "Русский (бета)",
|
||||
"app.language.helpTranslate": "Missing your language or spotted a wrong translation? Here's how to help →",
|
||||
"app.serverBanner": "Show server banners",
|
||||
"app.serverBanner.hint": "The banner loads straight from the address the server admin set, and that host sees your IP address.",
|
||||
"app.chatImages": "Load images in chat",
|
||||
@@ -489,10 +493,13 @@
|
||||
"publish.alphaTitle": "Alpha - unstable, may change or break at any time",
|
||||
"publish.demoUnavailable": "Streaming is not available in the demo - it needs a real TeamSpeak 6 server.",
|
||||
"publish.alphaNote": "Streaming is alpha. It speaks TeamSpeak 6's undocumented Stream/Call protocol, so connecting, picture quality and viewer handling can fail or change without notice. Not meant for production use.",
|
||||
"publish.start": "Share your screen",
|
||||
"publish.start": "Share your screen or camera",
|
||||
"publish.stop": "Stop sharing",
|
||||
"publish.title": "Your broadcast",
|
||||
"publish.screen": "Screen",
|
||||
"publish.camera": "Camera",
|
||||
"publish.kind": "Share",
|
||||
"publish.kind.display": "Screen / window",
|
||||
"publish.starting": "Starting…",
|
||||
"publish.viewers": "{count} watching",
|
||||
"publish.request.allow": "Allow",
|
||||
@@ -507,6 +514,7 @@
|
||||
"publish.preset": "Preset",
|
||||
"publish.preset.presentation": "Presentation",
|
||||
"publish.audio": "Capture audio",
|
||||
"publish.audio.cameraHint": "With the camera, your sound goes out through your microphone as usual.",
|
||||
"publish.privacy": "Privacy",
|
||||
"publish.privacy.public": "Public",
|
||||
"publish.privacy.contacts": "Contacts",
|
||||
@@ -710,6 +718,7 @@
|
||||
"serverContext.disconnect": "Disconnect",
|
||||
"connectError.dismiss": "Dismiss",
|
||||
"connectError.gatewayFull": "The gateway is full right now. Try again in a few minutes – or host WebSpeak3 yourself: github.com/WebSpeak3/webspeak3",
|
||||
"connectError.botCheck": "Bot check failed. Please reload the page and try again. Ad or script blockers can get in the way of the check.",
|
||||
"dialog.close": "Close",
|
||||
"sounds.title": "Sounds",
|
||||
"sounds.subtitle": "Configure sound notifications for events",
|
||||
@@ -930,7 +939,7 @@
|
||||
"securitySettings.masterNew": "New master password",
|
||||
"securitySettings.masterRepeat": "Repeat",
|
||||
"securitySettings.masterMismatch": "The passwords don't match.",
|
||||
"securitySettings.masterNote": "Remember it well: without it, identities and saved passwords are lost.",
|
||||
"securitySettings.masterNote": "You'll have to enter it again in every new session (reload or new tab). Remember it well: without it, identities and saved passwords are lost.",
|
||||
"sync.subtitle": "Your data on all your devices",
|
||||
"sync.intro": "An account is just a random number, optionally with a password. No email, no name. Everything is encrypted on your device before it is uploaded. The server only sees unreadable data.",
|
||||
"sync.create.title": "New account",
|
||||
@@ -994,5 +1003,12 @@
|
||||
"sync.error.pow_required": "Security check failed, please try again.",
|
||||
"sync.error.conflict": "Another device changed something in the meantime.",
|
||||
"sync.error.payload_too_large": "Too much data to sync (max. 1 MB).",
|
||||
"sync.error.generic": "Sync failed."
|
||||
"sync.error.generic": "Sync failed.",
|
||||
"mobile.tab.channels": "Channels",
|
||||
"mobile.tab.chat": "Chat",
|
||||
"mobile.tab.info": "Info",
|
||||
"mobile.mic": "Mic",
|
||||
"mobile.sound": "Sound",
|
||||
"mobile.leave": "Leave",
|
||||
"mobile.talk": "Talk"
|
||||
}
|
||||
+21
-5
@@ -19,7 +19,7 @@
|
||||
"menu.help.about": "درباره WebSpeak3",
|
||||
"menu.help.github": "گیتهاب",
|
||||
"menu.help.changelog": "تاریخچه تغییرات",
|
||||
"menu.help.translate": "کمک به ترجمه (Weblate)",
|
||||
"menu.help.translate": "کمک به ترجمه (GitHub)",
|
||||
"menu.extras.identities": "هویتها",
|
||||
"menu.extras.contacts": "مخاطبین",
|
||||
"menu.extras.collectedUrls": "لینکهای جمعآوریشده",
|
||||
@@ -125,6 +125,9 @@
|
||||
"connect.serverType.auto": "خودکار",
|
||||
"connect.serverType.teamspeak": "TeamSpeak",
|
||||
"connect.serverType.teaspeak": "TeaSpeak",
|
||||
"connect.serverType.ts2": "TeamSpeak 2 (آزمایشی)",
|
||||
"connect.ts2LoginName": "نام حساب TS2 (خالی = ناشناس):",
|
||||
"connect.ts2LoginPassword": "رمز حساب TS2:",
|
||||
"connect.hotkeyProfile": "پروفایل کلید میانبر:",
|
||||
"connect.soundPack": "بسته صوتی:",
|
||||
"connect.more": "بیشتر",
|
||||
@@ -407,7 +410,8 @@
|
||||
"app.language.zh-CN": "简体中文",
|
||||
"app.language.fa": "فارسی (بتا)",
|
||||
"app.language.cs-CZ": "Čeština",
|
||||
"app.language.helpTranslate": "زبان شما موجود نیست یا ترجمهای اشتباه دیدید؟ در Weblate کمک کنید →",
|
||||
"app.language.ru": "Русский (бета)",
|
||||
"app.language.helpTranslate": "زبان شما موجود نیست یا ترجمهای اشتباه دیدید؟ روش کمک کردن →",
|
||||
"app.serverBanner": "نمایش بنر سرور",
|
||||
"app.serverBanner.hint": "بنر مستقیماً از نشانیای بارگیری میشود که مدیر سرور تعیین کرده است و آن میزبان نشانی IP شما را میبیند.",
|
||||
"app.chatImages": "بارگیری تصاویر در گفتگو",
|
||||
@@ -488,10 +492,13 @@
|
||||
"publish.alphaTitle": "آلفا - ناپایدار، ممکن است هر زمان تغییر کند یا از کار بیفتد",
|
||||
"publish.demoUnavailable": "پخش زنده در حالت دمو در دسترس نیست - به یک سرور واقعی TeamSpeak 6 نیاز دارد.",
|
||||
"publish.alphaNote": "پخش زنده در مرحله آلفا است. این ویژگی از پروتکل مستندنشده Stream/Call در TeamSpeak 6 استفاده میکند، بنابراین اتصال، کیفیت تصویر و مدیریت بینندگان ممکن است بدون اطلاع قبلی دچار خطا شوند یا تغییر کنند. برای استفاده تولیدی مناسب نیست.",
|
||||
"publish.start": "اشتراکگذاری صفحه",
|
||||
"publish.start": "اشتراکگذاری صفحه یا دوربین",
|
||||
"publish.stop": "توقف اشتراکگذاری",
|
||||
"publish.title": "پخش زنده تو",
|
||||
"publish.screen": "صفحه نمایش",
|
||||
"publish.camera": "دوربین",
|
||||
"publish.kind": "اشتراکگذاری",
|
||||
"publish.kind.display": "صفحه / پنجره",
|
||||
"publish.starting": "در حال شروع…",
|
||||
"publish.viewers": "{count} بیننده",
|
||||
"publish.request.allow": "اجازه دادن",
|
||||
@@ -506,6 +513,7 @@
|
||||
"publish.preset": "پیشتنظیم",
|
||||
"publish.preset.presentation": "ارائه",
|
||||
"publish.audio": "ضبط صدا",
|
||||
"publish.audio.cameraHint": "با دوربین، صدای شما مثل همیشه از طریق میکروفون ارسال میشود.",
|
||||
"publish.privacy": "حریم خصوصی",
|
||||
"publish.privacy.public": "عمومی",
|
||||
"publish.privacy.contacts": "مخاطبین",
|
||||
@@ -709,6 +717,7 @@
|
||||
"serverContext.disconnect": "قطع اتصال",
|
||||
"connectError.dismiss": "رد کردن",
|
||||
"connectError.gatewayFull": "گیتوی در حال حاضر پر است. چند دقیقه دیگر دوباره امتحان کنید – یا WebSpeak3 را خودتان میزبانی کنید: github.com/WebSpeak3/webspeak3",
|
||||
"connectError.botCheck": "بررسی ضد ربات ناموفق بود. لطفاً صفحه را دوباره بارگذاری کنید و دوباره امتحان کنید. مسدودکنندههای تبلیغات یا اسکریپت ممکن است مانع بررسی شوند.",
|
||||
"dialog.close": "بستن",
|
||||
"sounds.title": "صداها",
|
||||
"sounds.subtitle": "پیکربندی اعلانهای صوتی برای رویدادها",
|
||||
@@ -929,7 +938,7 @@
|
||||
"securitySettings.masterNew": "رمز اصلی جدید",
|
||||
"securitySettings.masterRepeat": "تکرار",
|
||||
"securitySettings.masterMismatch": "رمزها یکسان نیستند.",
|
||||
"securitySettings.masterNote": "آن را به خاطر بسپارید: بدون آن، هویتها و رمزهای ذخیرهشده از دست میروند.",
|
||||
"securitySettings.masterNote": "باید آن را در هر جلسهٔ جدید (بارگذاری دوباره یا زبانهٔ جدید) دوباره وارد کنید. آن را به خاطر بسپارید: بدون آن، هویتها و رمزهای ذخیرهشده از دست میروند.",
|
||||
"sync.subtitle": "دادههای تو روی همه دستگاهها",
|
||||
"sync.intro": "حساب فقط یک شماره تصادفی است، در صورت تمایل با رمز عبور. بدون ایمیل، بدون نام. همه چیز پیش از بارگذاری روی دستگاه تو رمزگذاری میشود. سرور فقط دادههای ناخوانا میبیند.",
|
||||
"sync.create.title": "حساب جدید",
|
||||
@@ -993,5 +1002,12 @@
|
||||
"sync.error.pow_required": "بررسی امنیتی ناموفق بود، دوباره امتحان کن.",
|
||||
"sync.error.conflict": "دستگاه دیگری در این فاصله چیزی را تغییر داده است.",
|
||||
"sync.error.payload_too_large": "داده برای همگامسازی بیش از حد است (حداکثر ۱ مگابایت).",
|
||||
"sync.error.generic": "همگامسازی ناموفق بود."
|
||||
"sync.error.generic": "همگامسازی ناموفق بود.",
|
||||
"mobile.tab.channels": "کانالها",
|
||||
"mobile.tab.chat": "گفتگو",
|
||||
"mobile.tab.info": "اطلاعات",
|
||||
"mobile.mic": "میکروفون",
|
||||
"mobile.sound": "صدا",
|
||||
"mobile.leave": "خروج",
|
||||
"mobile.talk": "صحبت"
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -69,6 +69,9 @@
|
||||
"connect.serverType.auto": "自动",
|
||||
"connect.serverType.teamspeak": "TeamSpeak",
|
||||
"connect.serverType.teaspeak": "TeaSpeak",
|
||||
"connect.serverType.ts2": "TeamSpeak 2(实验性)",
|
||||
"connect.ts2LoginName": "TS2 账户名(留空 = 匿名):",
|
||||
"connect.ts2LoginPassword": "TS2 账户密码:",
|
||||
"connect.hotkeyProfile": "快捷键配置:",
|
||||
"connect.soundPack": "声音包:",
|
||||
"connect.more": "更多",
|
||||
@@ -301,7 +304,8 @@
|
||||
"app.language.zh-CN": "简体中文",
|
||||
"app.language.fa": "فارسی (بتا)",
|
||||
"app.language.cs-CZ": "Čeština",
|
||||
"app.language.helpTranslate": "没有你的语言,或发现翻译有误?欢迎到 Weblate 参与改进 →",
|
||||
"app.language.ru": "Русский (бета)",
|
||||
"app.language.helpTranslate": "没有你的语言,或发现翻译有误?了解如何参与 →",
|
||||
"app.serverBanner": "显示服务器横幅",
|
||||
"app.serverBanner.hint": "横幅直接从服务器管理员设置的地址加载,该主机会看到你的 IP 地址。",
|
||||
"app.chatImages": "在聊天中加载图片",
|
||||
@@ -555,6 +559,7 @@
|
||||
"serverContext.disconnect": "断开连接",
|
||||
"connectError.dismiss": "关闭",
|
||||
"connectError.gatewayFull": "网关当前已满。请几分钟后再试,或自行部署 WebSpeak3:github.com/WebSpeak3/webspeak3",
|
||||
"connectError.botCheck": "人机验证失败。请刷新页面后重试。广告或脚本拦截器可能会干扰验证。",
|
||||
"dialog.close": "关闭",
|
||||
"sounds.title": "声音",
|
||||
"sounds.subtitle": "配置事件提示音",
|
||||
@@ -592,7 +597,7 @@
|
||||
"menu.help.about": "关于 WebSpeak3",
|
||||
"menu.help.github": "GitHub",
|
||||
"menu.help.changelog": "更新日志",
|
||||
"menu.help.translate": "参与翻译(Weblate)",
|
||||
"menu.help.translate": "参与翻译(GitHub)",
|
||||
"menu.extras.feedback": "发送反馈",
|
||||
"feedback.fab.nudge": "你觉得 WebSpeak3 怎么样?欢迎反馈!",
|
||||
"donate.label": "捐助",
|
||||
@@ -701,10 +706,13 @@
|
||||
"publish.alphaTitle": "内测阶段 —— 不稳定,可能随时变更或失效",
|
||||
"publish.demoUnavailable": "演示模式下无法使用直播功能 —— 需要真实的 TeamSpeak 6 服务器。",
|
||||
"publish.alphaNote": "直播功能处于内测阶段,使用的是 TeamSpeak 6 未公开文档的 Stream/Call 协议,因此连接、画质和观众处理可能会出错或在无预警的情况下发生变化,不建议用于正式场合。",
|
||||
"publish.start": "共享屏幕",
|
||||
"publish.start": "共享屏幕或摄像头",
|
||||
"publish.stop": "停止共享",
|
||||
"publish.title": "你的直播",
|
||||
"publish.screen": "屏幕",
|
||||
"publish.camera": "摄像头",
|
||||
"publish.kind": "共享内容",
|
||||
"publish.kind.display": "屏幕 / 窗口",
|
||||
"publish.starting": "启动中…",
|
||||
"publish.viewers": "{count} 人观看",
|
||||
"publish.request.allow": "允许",
|
||||
@@ -719,6 +727,7 @@
|
||||
"publish.preset": "预设",
|
||||
"publish.preset.presentation": "演示",
|
||||
"publish.audio": "采集音频",
|
||||
"publish.audio.cameraHint": "使用摄像头时,你的声音照常通过麦克风发送。",
|
||||
"publish.privacy": "可见范围",
|
||||
"publish.privacy.public": "公开",
|
||||
"publish.privacy.contacts": "联系人",
|
||||
@@ -929,7 +938,7 @@
|
||||
"securitySettings.masterNew": "新主密码",
|
||||
"securitySettings.masterRepeat": "重复",
|
||||
"securitySettings.masterMismatch": "两次密码不一致。",
|
||||
"securitySettings.masterNote": "请牢记:没有它,身份和已保存的密码将丢失。",
|
||||
"securitySettings.masterNote": "每次新会话(重新加载或新标签页)都需要重新输入。请牢记:没有它,身份和已保存的密码将丢失。",
|
||||
"sync.subtitle": "在所有设备上使用你的数据",
|
||||
"sync.intro": "账户只是一个随机号码,可选附加密码。无需邮箱,无需姓名。所有数据在上传前都会在你的设备上加密,服务器只能看到无法读取的数据。",
|
||||
"sync.create.title": "新账户",
|
||||
@@ -993,5 +1002,12 @@
|
||||
"sync.error.pow_required": "安全检查失败,请重试。",
|
||||
"sync.error.conflict": "另一台设备在此期间做了更改。",
|
||||
"sync.error.payload_too_large": "同步数据过多(最多 1 MB)。",
|
||||
"sync.error.generic": "同步失败。"
|
||||
"sync.error.generic": "同步失败。",
|
||||
"mobile.tab.channels": "频道",
|
||||
"mobile.tab.chat": "聊天",
|
||||
"mobile.tab.info": "信息",
|
||||
"mobile.mic": "麦克风",
|
||||
"mobile.sound": "声音",
|
||||
"mobile.leave": "断开",
|
||||
"mobile.talk": "说话"
|
||||
}
|
||||
+15
-9
@@ -46,6 +46,8 @@ export const StreamMode = {
|
||||
|
||||
export interface StreamPublishOptions {
|
||||
name: string;
|
||||
/** Screen/window via the browser's picker, or the webcam. */
|
||||
source: "display" | "camera";
|
||||
/** Send the capture's audio track too, when the source has one. */
|
||||
audio: boolean;
|
||||
/** One of StreamAccess. */
|
||||
@@ -112,15 +114,16 @@ export class StreamPublisher {
|
||||
}
|
||||
|
||||
/**
|
||||
* Captures a screen and announces the stream.
|
||||
* Captures a screen or the webcam and announces the stream.
|
||||
*
|
||||
* `getDisplayMedia` is secure-context-only, so this throws on a plain-http
|
||||
* Both capture APIs are secure-context-only, so this fails on a plain-http
|
||||
* origin - the same limitation the microphone already has.
|
||||
*/
|
||||
async start(options: StreamPublishOptions): Promise<void> {
|
||||
if (this.state === "live" || this.state === "starting") return;
|
||||
if (!navigator.mediaDevices?.getDisplayMedia) {
|
||||
this.fail("Screen sharing requires HTTPS (or localhost) - the site is not a secure context.");
|
||||
const camera = options.source === "camera";
|
||||
if (!(camera ? navigator.mediaDevices?.getUserMedia : navigator.mediaDevices?.getDisplayMedia)) {
|
||||
this.fail("Streaming requires HTTPS (or localhost) - the site is not a secure context.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -132,13 +135,15 @@ export class StreamPublisher {
|
||||
if (options.fps > 0) video.frameRate = { ideal: options.fps };
|
||||
|
||||
try {
|
||||
this.media = await navigator.mediaDevices.getDisplayMedia({
|
||||
video: Object.keys(video).length > 0 ? video : true,
|
||||
audio: options.audio,
|
||||
});
|
||||
const constraints = { video: Object.keys(video).length > 0 ? video : true };
|
||||
// A camera's "audio" would be the microphone, which already goes out as
|
||||
// voice - sending it again would only echo.
|
||||
this.media = camera
|
||||
? await navigator.mediaDevices.getUserMedia({ ...constraints, audio: false })
|
||||
: await navigator.mediaDevices.getDisplayMedia({ ...constraints, audio: options.audio });
|
||||
} catch (err) {
|
||||
this.setState("idle");
|
||||
this.fail(`Could not capture the screen: ${describe(err)}`);
|
||||
this.fail(`Could not capture the ${camera ? "camera" : "screen"}: ${describe(err)}`);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -423,6 +428,7 @@ export class StreamPublisher {
|
||||
* advance. A browser tab has no TS6 equivalent and reads closest to a window.
|
||||
*/
|
||||
private detectSourceType(): number {
|
||||
if (this.options?.source === "camera") return StreamSource.CAMERA;
|
||||
const surface = this.media?.getVideoTracks()[0]?.getSettings().displaySurface;
|
||||
return surface === "monitor" ? StreamSource.SCREEN : StreamSource.WINDOW;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user