mirror of
https://github.com/Moepchi/webspeak3.git
synced 2026-12-03 01:42:50 +08:00
Compare commits
12
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4afab66d6b | ||
|
|
e19ced1bd1 | ||
|
|
4e04ddb526 | ||
|
|
169d32a292 | ||
|
|
de94859a16 | ||
|
|
810d922b09 | ||
|
|
5e76bd3bdf | ||
|
|
bfe05a8b02 | ||
|
|
83877aaa76 | ||
|
|
6cce28aa9d | ||
|
|
0d8421692a | ||
|
|
3e84e18535 |
No files matched your search
@@ -101,7 +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. Off by default, the gateway enables it with `ENABLE_TS2=1` |
|
||||
| 📟 **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
|
||||
@@ -243,13 +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. The code ships in every image, it just stays unused while this is off. |
|
||||
| `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`.
|
||||
@@ -397,6 +398,8 @@ The UI texts live in flat JSON files in [`web/src/locales/`](web/src/locales/),
|
||||
|
||||
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. -->
|
||||
|
||||
+28
-2
@@ -72,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"
|
||||
@@ -107,6 +107,12 @@ struct Args {
|
||||
/// 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)]
|
||||
@@ -870,7 +876,27 @@ fn send_server_get_variables(con: &mut tsclientlib::Connection) {
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
let args = Args::parse();
|
||||
let result = if args.server_type == "ts2" { ts2::run(args).await } else { 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() });
|
||||
}
|
||||
|
||||
+61
-14
@@ -332,6 +332,40 @@ impl Ts2 {
|
||||
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());
|
||||
@@ -494,8 +528,9 @@ impl Ts2 {
|
||||
}
|
||||
self.encoder = None;
|
||||
}
|
||||
// Channel deleted: u16 channel id, then the deleting player's u32 id.
|
||||
0x0073 => {
|
||||
self.channels.remove(&u32_at(b, 0));
|
||||
self.channels.remove(&(u16_at(b, 0) as u32));
|
||||
}
|
||||
0x0074 | 0x0075 => {
|
||||
if let Some(c) = self.channels.get_mut(&u32_at(b, 0)) {
|
||||
@@ -503,6 +538,9 @@ impl Ts2 {
|
||||
}
|
||||
}
|
||||
// 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);
|
||||
@@ -618,10 +656,11 @@ impl Ts2 {
|
||||
p.push(codec);
|
||||
p.extend_from_slice(&self.session.to_le_bytes());
|
||||
p.extend_from_slice(&self.client_id.to_le_bytes());
|
||||
p.extend_from_slice(&self.voice_conversation.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());
|
||||
// ponytail: meaning of this byte unknown (soliloque passes it through);
|
||||
// 5 = frame count is a guess. Check against a native client capture.
|
||||
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);
|
||||
@@ -693,11 +732,21 @@ async fn login(sock: &UdpSocket, args: &Args) -> Result<Vec<u8>> {
|
||||
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, 1]);
|
||||
// Anonymous login: no account name, the server password goes in the
|
||||
// password field.
|
||||
p.extend_from_slice(&pstr(""));
|
||||
p.extend_from_slice(&pstr(args.server_password.as_deref().unwrap_or("")));
|
||||
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];
|
||||
@@ -739,7 +788,7 @@ which this gateway does not connect to. (Self-hosting admin? Set ALLOW_PRIVATE_T
|
||||
|
||||
let reply = login(&sock, &args).await?;
|
||||
if reply[89..92] != [0, 0, 0] {
|
||||
bail!("The TeamSpeak 2 server rejected the login (wrong server password, or nickname not allowed).");
|
||||
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;
|
||||
@@ -811,14 +860,12 @@ which this gateway does not connect to. (Self-hosting admin? Set ALLOW_PRIVATE_T
|
||||
}
|
||||
line = stdin.next_line() => {
|
||||
let Some(l) = line? else {
|
||||
ts.reliable(0x012c, &[]);
|
||||
ts.pump_outbox().await?;
|
||||
ts.logout().await;
|
||||
return Ok(());
|
||||
};
|
||||
let l = l.trim();
|
||||
if l == "disconnect" || l.starts_with("disconnect ") {
|
||||
ts.reliable(0x012c, &[]);
|
||||
ts.pump_outbox().await?;
|
||||
ts.logout().await;
|
||||
emit(&Event::Disconnected { reason: "client requested".into() });
|
||||
return Ok(());
|
||||
} else if let Some(rest) = l.strip_prefix("audio ") {
|
||||
|
||||
+20
-1
@@ -11,6 +11,7 @@ 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";
|
||||
|
||||
// TeamSpeak 2 support is experimental and opt-in (ENABLE_TS2=1).
|
||||
@@ -490,7 +491,7 @@ const requestHandler = (req: IncomingMessage, res: ServerResponse) => {
|
||||
// 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 }));
|
||||
res.end(JSON.stringify({ features: GATEWAY_FEATURES, ...(TURNSTILE_ENABLED ? { turnstileSiteKey: TURNSTILE_SITE_KEY } : {}) }));
|
||||
return;
|
||||
}
|
||||
if (requestUrl.pathname === "/api/news") {
|
||||
@@ -583,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);
|
||||
@@ -754,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) {
|
||||
@@ -774,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);
|
||||
|
||||
@@ -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.
+45
-11
@@ -189,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. */
|
||||
@@ -2317,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;
|
||||
@@ -2340,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 {
|
||||
@@ -5604,7 +5621,8 @@ input.ts-identities-uid {
|
||||
}
|
||||
|
||||
/* 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-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;
|
||||
}
|
||||
|
||||
@@ -5849,6 +5867,13 @@ input.ts-identities-uid {
|
||||
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%); }
|
||||
}
|
||||
@@ -5890,3 +5915,12 @@ input.ts-identities-uid {
|
||||
.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;
|
||||
}
|
||||
+238
-54
@@ -401,14 +401,73 @@ function loadServerType(): ServerType {
|
||||
// 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");
|
||||
let gatewayFeaturesPromise: Promise<string[]> | null = null;
|
||||
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[]> {
|
||||
if (!FEATURES_URL) return Promise.resolve([]);
|
||||
gatewayFeaturesPromise ??= fetch(FEATURES_URL)
|
||||
.then((r) => (r.ok ? r.json() : { features: [] }))
|
||||
.then((d) => (Array.isArray(d.features) ? d.features : []))
|
||||
.catch(() => []);
|
||||
return gatewayFeaturesPromise;
|
||||
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
|
||||
@@ -421,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;
|
||||
@@ -1306,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;
|
||||
}) {
|
||||
@@ -1323,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
|
||||
@@ -1380,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>
|
||||
);
|
||||
@@ -1410,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>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1450,6 +1548,7 @@ function ChannelTree({
|
||||
ownClientId,
|
||||
talkers,
|
||||
serverGroups,
|
||||
channelGroups = null,
|
||||
groupIconImages,
|
||||
selected,
|
||||
sessionKey,
|
||||
@@ -1468,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
|
||||
@@ -1494,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>();
|
||||
@@ -1572,6 +1673,7 @@ function ChannelTree({
|
||||
ownClientId={ownClientId}
|
||||
talkers={talkers}
|
||||
serverGroups={serverGroups}
|
||||
channelGroups={channelGroups}
|
||||
groupIconImages={groupIconImages}
|
||||
selected={selected}
|
||||
sessionKey={sessionKey}
|
||||
@@ -1751,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">
|
||||
@@ -1762,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>
|
||||
@@ -1771,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>
|
||||
@@ -1967,6 +2073,8 @@ function InfoPanel({
|
||||
talking={false}
|
||||
inputMuted={client.inputMuted}
|
||||
inputHardwareEnabled={client.inputHardwareEnabled}
|
||||
outputMuted={client.outputMuted}
|
||||
away={client.away}
|
||||
/>
|
||||
<span>{client.name}</span>
|
||||
</div>
|
||||
@@ -1977,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>
|
||||
@@ -2106,6 +2214,8 @@ function ConnectDialog({
|
||||
defaultChannel,
|
||||
privilegeKey,
|
||||
serverType,
|
||||
loginName,
|
||||
loginPassword,
|
||||
expanded,
|
||||
connecting,
|
||||
identities,
|
||||
@@ -2117,6 +2227,8 @@ function ConnectDialog({
|
||||
onDefaultChannelChange,
|
||||
onPrivilegeKeyChange,
|
||||
onServerTypeChange,
|
||||
onLoginNameChange,
|
||||
onLoginPasswordChange,
|
||||
onActiveIdentityChange,
|
||||
onToggleExpanded,
|
||||
onConnect,
|
||||
@@ -2133,6 +2245,8 @@ function ConnectDialog({
|
||||
defaultChannel: string;
|
||||
privilegeKey: string;
|
||||
serverType: ServerType;
|
||||
loginName: string;
|
||||
loginPassword: string;
|
||||
expanded: boolean;
|
||||
connecting: boolean;
|
||||
identities: Identity[];
|
||||
@@ -2143,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;
|
||||
@@ -2300,6 +2416,27 @@ function ConnectDialog({
|
||||
)}
|
||||
</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">
|
||||
@@ -8824,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).
|
||||
@@ -9907,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,
|
||||
@@ -9920,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
|
||||
@@ -9962,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) {
|
||||
@@ -10342,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;
|
||||
@@ -10594,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,
|
||||
};
|
||||
@@ -11068,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
|
||||
@@ -11081,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)
|
||||
);
|
||||
@@ -13134,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")}
|
||||
@@ -13499,6 +13678,8 @@ function AppInner() {
|
||||
defaultChannel={defaultChannel}
|
||||
privilegeKey={privilegeKey}
|
||||
serverType={serverType}
|
||||
loginName={loginName}
|
||||
loginPassword={loginPassword}
|
||||
expanded={connectDialogExpanded}
|
||||
connecting={connecting}
|
||||
identities={identities}
|
||||
@@ -13510,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 })}
|
||||
@@ -14530,6 +14713,7 @@ function AppInner() {
|
||||
ownClientId={ownClientId ?? ownClient?.id ?? null}
|
||||
talkers={displayTalkers}
|
||||
serverGroups={serverGroups}
|
||||
channelGroups={channelGroups}
|
||||
groupIconImages={serverIconImages}
|
||||
selected={selected}
|
||||
sessionKey={activeSessionId ?? ""}
|
||||
|
||||
Binary file not shown.
@@ -126,6 +126,8 @@
|
||||
"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",
|
||||
@@ -716,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",
|
||||
|
||||
@@ -126,6 +126,8 @@
|
||||
"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",
|
||||
@@ -716,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",
|
||||
|
||||
@@ -126,6 +126,8 @@
|
||||
"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",
|
||||
@@ -716,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",
|
||||
|
||||
@@ -126,6 +126,8 @@
|
||||
"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": "بیشتر",
|
||||
@@ -715,6 +717,7 @@
|
||||
"serverContext.disconnect": "قطع اتصال",
|
||||
"connectError.dismiss": "رد کردن",
|
||||
"connectError.gatewayFull": "گیتوی در حال حاضر پر است. چند دقیقه دیگر دوباره امتحان کنید – یا WebSpeak3 را خودتان میزبانی کنید: github.com/WebSpeak3/webspeak3",
|
||||
"connectError.botCheck": "بررسی ضد ربات ناموفق بود. لطفاً صفحه را دوباره بارگذاری کنید و دوباره امتحان کنید. مسدودکنندههای تبلیغات یا اسکریپت ممکن است مانع بررسی شوند.",
|
||||
"dialog.close": "بستن",
|
||||
"sounds.title": "صداها",
|
||||
"sounds.subtitle": "پیکربندی اعلانهای صوتی برای رویدادها",
|
||||
|
||||
@@ -126,6 +126,8 @@
|
||||
"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": "Больше",
|
||||
@@ -716,6 +718,7 @@
|
||||
"serverContext.disconnect": "Отключиться",
|
||||
"connectError.dismiss": "Закрыть",
|
||||
"connectError.gatewayFull": "Шлюз сейчас переполнен. Попробуйте через несколько минут – или разверните WebSpeak3 у себя: github.com/WebSpeak3/webspeak3",
|
||||
"connectError.botCheck": "Проверка на бота не пройдена. Обновите страницу и попробуйте снова. Блокировщики рекламы или скриптов могут мешать проверке.",
|
||||
"dialog.close": "Закрыть",
|
||||
"sounds.title": "Звуки",
|
||||
"sounds.subtitle": "Настройка звуковых уведомлений о событиях",
|
||||
|
||||
@@ -70,6 +70,8 @@
|
||||
"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": "更多",
|
||||
@@ -557,6 +559,7 @@
|
||||
"serverContext.disconnect": "断开连接",
|
||||
"connectError.dismiss": "关闭",
|
||||
"connectError.gatewayFull": "网关当前已满。请几分钟后再试,或自行部署 WebSpeak3:github.com/WebSpeak3/webspeak3",
|
||||
"connectError.botCheck": "人机验证失败。请刷新页面后重试。广告或脚本拦截器可能会干扰验证。",
|
||||
"dialog.close": "关闭",
|
||||
"sounds.title": "声音",
|
||||
"sounds.subtitle": "配置事件提示音",
|
||||
|
||||
Reference in new issue
Block a user