Experimental TeamSpeak 2 support behind ENABLE_TS2

New connector module (connector/src/ts2.rs) speaks the TS2 UDP protocol:
login, channel and player lists, Speex voice both ways, status flags,
channel switching, private messages and server messages. Channel/server
chat goes through too but the server only delivers it when the user has
the text permission; a refusal shows up as an error.

Off by default. ENABLE_TS2=1 on the gateway adds "ts2" as a server type
and feature; the connect dialog offers it only then, read from the new
GET /api/features. Documented in the README.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Hu2cuPLqpuKVfd9wWFFakU
This commit is contained in:
MoepchiandClaude Opus 5.5 committed 2026-11-10 10:11:25 +00:00
1 parent 9878b1caf3
commit d3b0d8ccdd
15 files changed
+1131 -19

No files matched your search

+11 -2
View File
@@ -13,7 +13,9 @@ import { logFeedback, logConnectionEvent } from "./activity-log.js";
import { clientIp, createRateLimiter } from "./net.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 +126,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 +486,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 }));
return;
}
if (requestUrl.pathname === "/api/news") {
handleNewsConfig(res);
return;
+1 -1
View File
@@ -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;