feat(voice): support Cloudflare Tunnel deployments and WebRTC fallback

Route page and signaling traffic through Cloudflare Tunnel while sending
WebRTC media over direct UDP, with optional TURN REST as a fallback.
When WebRTC was already offered and then fails, stay in the current
session, automatically resume compatibility audio, and keep a Reconnect
WebRTC control. A reconnect retries WebRTC only, leaves compatibility
running until it succeeds, and stays on compatibility if it fails again.

Database schema 14 adds nullable voice override columns and is a one-way
boundary: older binaries reject this database. This change is for review,
not a production rollout.
This commit is contained in:
OddTurtleHead committed 2026-11-26 23:47:50 +08:00
1 parent 9a12e2ee7b
commit b6e7b1e4da
68 files changed
+3525 -189

No files matched your search

+9
View File
@@ -60,12 +60,21 @@ test("every current gateway message survives JSON transport and shared validatio
}
});
test("voice profile is optional and invalid values are rejected", () => {
const adaptive = parseServerMessage({ type: "connected", tsClientId: 1, voiceProfile: "adaptive" });
assert.equal(adaptive?.type === "connected" ? adaptive.voiceProfile : undefined, "adaptive");
const legacy = parseServerMessage({ type: "connected", tsClientId: 1, voiceProfile: "legacy" });
assert.equal(legacy?.type === "connected" ? legacy.voiceProfile : undefined, "legacy");
assert.equal(parseServerMessage({ type: "connected", tsClientId: 1, voiceProfile: "future" }), null);
});
test("malformed nested directory and event data is rejected before client state changes", () => {
for (const message of [
null, [], {}, { type: "toString" }, { type: "futureMessage" },
{ type: "connected", tsClientId: 1, members: [null] },
{ type: "connected", tsClientId: 1, members: [{ id: "1", nickname: "bad id" }] },
{ type: "connected", tsClientId: 1, serverEventLog: [{ id: "incomplete" }] },
{ type: "connected", tsClientId: 1, voiceProfile: "future" },
{ type: "serverInfo", name: "TeamSpeak", icon: "https://example.com/icon.png" },
{ type: "serverInfo", name: "TeamSpeak", bannerUrl: "javascript:alert(1)" },
{ type: "serverInfo", name: "TeamSpeak", welcomeMessage: "x".repeat(4_097) },