mirror of
https://github.com/Moepchi/webspeak3.git
synced 2026-12-01 00:42:49 +08:00
Compare commits
18
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ced63fdb2a | ||
|
|
d860aa61e5 | ||
|
|
341a1644a6 | ||
|
|
97421ff2de | ||
|
|
d64b25f22f | ||
|
|
be7247f3f6 | ||
|
|
bcdbabe201 | ||
|
|
3c24ddc7d3 | ||
|
|
94b290fa06 | ||
|
|
bf6008f857 | ||
|
|
632e77ccc8 | ||
|
|
aa324274a4 | ||
|
|
00c8cfac06 | ||
|
|
ff570d9131 | ||
|
|
b5a5ec5236 | ||
|
|
5a639628a9 | ||
|
|
7a0a64b518 | ||
|
|
935b867c76 |
No files matched your search
@@ -1,5 +1,5 @@
|
||||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: Question / Discussion
|
||||
url: https://github.com/Moepchi/webspeak3/discussions
|
||||
url: https://github.com/WebSpeak3/webspeak3/discussions
|
||||
about: Ask a question or discuss an idea before filing an issue.
|
||||
@@ -9,7 +9,7 @@
|
||||
<a href="Dockerfile"><img src="https://img.shields.io/badge/docker-build%20passing-2496ED?logo=docker&logoColor=white" alt="Docker Build"></a>
|
||||
<a href="gateway/package.json"><img src="https://img.shields.io/badge/node-%3E%3D18-339933?logo=node.js&logoColor=white" alt="Node Version"></a>
|
||||
<a href="connector/Cargo.toml"><img src="https://img.shields.io/badge/rust-2021-000000?logo=rust&logoColor=white" alt="Rust Version"></a>
|
||||
<a href="https://github.com/Moepchi/webspeak3/releases"><img src="https://img.shields.io/github/v/release/Moepchi/webspeak3?include_prereleases&label=release" alt="Latest Release"></a>
|
||||
<a href="https://github.com/WebSpeak3/webspeak3/releases"><img src="https://img.shields.io/github/v/release/WebSpeak3/webspeak3?include_prereleases&label=release" alt="Latest Release"></a>
|
||||
<img src="https://img.shields.io/badge/status-public%20beta-f0b429" alt="Project Status">
|
||||
</p>
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<a href="#-quick-start">🚀 Quick Start</a> ·
|
||||
<a href="#-installation">📖 Installation</a> ·
|
||||
<a href="ROADMAP.md">🗺️ Roadmap</a> ·
|
||||
<a href="https://github.com/Moepchi/webspeak3/issues">🐛 Report Bug</a>
|
||||
<a href="https://github.com/WebSpeak3/webspeak3/issues">🐛 Report Bug</a>
|
||||
</p>
|
||||
|
||||
> The [live demo](https://demo.webspeak3.de) runs entirely in your browser with simulated data — no real TeamSpeak server involved. It's there to show the UI, not the real connection.
|
||||
@@ -147,7 +147,7 @@ scope, known limitations, and the next milestones.
|
||||
Clone the repo (the Rust connector depends on a git submodule, so pull it in too):
|
||||
|
||||
```bash
|
||||
git clone --recurse-submodules https://github.com/Moepchi/webspeak3.git
|
||||
git clone --recurse-submodules https://github.com/WebSpeak3/webspeak3.git
|
||||
cd webspeak3
|
||||
```
|
||||
|
||||
@@ -187,7 +187,7 @@ The **Design Store** (browse/upload community themes) points at the maintainer's
|
||||
|
||||
#### Environment variables
|
||||
|
||||
All optional; add them under `environment:` in your compose override next to `PORT`. These are the common ones - the full list (logging, feedback form, Design Store details, build-time variables) is on the wiki's [Configuration & Environment Variables](https://github.com/Moepchi/webspeak3/wiki/Configuration-and-Environment-Variables) page.
|
||||
All optional; add them under `environment:` in your compose override next to `PORT`. These are the common ones - the full list (logging, feedback form, Design Store details, build-time variables) is on the wiki's [Configuration & Environment Variables](https://github.com/WebSpeak3/webspeak3/wiki/Configuration-and-Environment-Variables) page.
|
||||
|
||||
| Variable | Default | Purpose |
|
||||
|---|---|---|
|
||||
@@ -210,9 +210,14 @@ All optional; add them under `environment:` in your compose override next to `PO
|
||||
| `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!` |
|
||||
|
||||
> **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`.
|
||||
|
||||
> **News ticker:** like the native TS3 client, a small scrolling line at the bottom shows news. Your users' browsers load the official news straight from `gateway.webspeak3.de`, the same way the Design Store works. Your own messages come from `NEWS_TICKER_MESSAGES`. Users can hide the ticker with ✕ until something new comes in.
|
||||
|
||||
> **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.
|
||||
@@ -234,7 +239,7 @@ All optional; add them under `environment:` in your compose override next to `PO
|
||||
The Rust connector depends on the `tsclientlib` crate, vendored as a git submodule — make sure to pull it in too:
|
||||
|
||||
```bash
|
||||
git clone --recurse-submodules https://github.com/Moepchi/webspeak3.git
|
||||
git clone --recurse-submodules https://github.com/WebSpeak3/webspeak3.git
|
||||
cd webspeak3
|
||||
```
|
||||
|
||||
@@ -345,6 +350,25 @@ Either way: on your own hosted instance, the mandatory first-visit Terms of Use
|
||||
|
||||
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.
|
||||
|
||||
## 🌈 In Memory of Akimo
|
||||
|
||||
<!-- Permanent: never remove this section. -->
|
||||
<img src="web/src/assets/akimo.jpg" alt="Akimo" width="120" align="left" />
|
||||
|
||||
WebSpeak3 is dedicated to Akimo, the project owner's dog, who crossed the rainbow bridge on October 21, 2026. 🐾
|
||||
|
||||
<br clear="left" />
|
||||
|
||||
## Star History
|
||||
|
||||
<a href="https://www.star-history.com/?repos=webspeak3%2Fwebspeak3&type=date&legend=bottom-right">
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/chart?repos=webspeak3/webspeak3&type=date&theme=dark&legend=bottom-right" />
|
||||
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/chart?repos=webspeak3/webspeak3&type=date&legend=bottom-right" />
|
||||
<img alt="Star History Chart" src="https://api.star-history.com/chart?repos=webspeak3/webspeak3&type=date&legend=bottom-right" />
|
||||
</picture>
|
||||
</a>
|
||||
|
||||
---
|
||||
|
||||
### Legal / Disclaimer
|
||||
|
||||
+1
-1
@@ -77,7 +77,7 @@ best practices and GreenTeaSpeak's native selection colours. Still to do:
|
||||
|
||||
## Feedback
|
||||
|
||||
Please use [GitHub Issues](https://github.com/Moepchi/webspeak3/issues) for
|
||||
Please use [GitHub Issues](https://github.com/WebSpeak3/webspeak3/issues) for
|
||||
reproducible bugs and feature requests. Include the browser and version,
|
||||
operating system, deployment method, and whether the issue affects voice,
|
||||
microphone access, or only the interface.
|
||||
|
||||
+16
-3
@@ -8,6 +8,7 @@ import { fileURLToPath } from "node:url";
|
||||
import { WebSocketServer, type WebSocket } from "ws";
|
||||
import { Ts3Connection, type ServerType, type Ts3ConnectOptions } from "./ts3/connection.js";
|
||||
import { handleStore } from "./store.js";
|
||||
import { handleNewsConfig } from "./news.js";
|
||||
import { logFeedback, logConnectionEvent } from "./activity-log.js";
|
||||
import { clientIp, createRateLimiter } from "./net.js";
|
||||
import "./telemetry.js";
|
||||
@@ -191,7 +192,7 @@ const FEEDBACK_ALLOWED_ORIGIN = process.env.FEEDBACK_ALLOWED_ORIGIN ?? "*";
|
||||
// A token with "Issues: write" access on the target repo. Without it,
|
||||
// feedback is still accepted and logged, just never turned into an issue.
|
||||
const GITHUB_TOKEN = process.env.GITHUB_TOKEN;
|
||||
const GITHUB_REPO = process.env.GITHUB_REPO ?? "Moepchi/webspeak3";
|
||||
const GITHUB_REPO = process.env.GITHUB_REPO ?? "WebSpeak3/webspeak3";
|
||||
const FEEDBACK_CATEGORIES = new Set(["bug", "idea", "report", "other"]);
|
||||
const FEEDBACK_MESSAGE_MAX_LENGTH = 4000;
|
||||
|
||||
@@ -365,7 +366,7 @@ async function handleFeedback(req: IncomingMessage, res: ServerResponse) {
|
||||
}
|
||||
}
|
||||
|
||||
let body: { category?: unknown; message?: unknown; email?: unknown; publishAsIssue?: unknown; website?: unknown };
|
||||
let body: { category?: unknown; message?: unknown; email?: unknown; server?: unknown; publishAsIssue?: unknown; website?: unknown };
|
||||
try {
|
||||
body = JSON.parse(raw || "{}");
|
||||
} catch {
|
||||
@@ -388,6 +389,9 @@ async function handleFeedback(req: IncomingMessage, res: ServerResponse) {
|
||||
const message =
|
||||
typeof body.message === "string" ? body.message.trim().slice(0, FEEDBACK_MESSAGE_MAX_LENGTH) : "";
|
||||
const email = typeof body.email === "string" ? body.email.trim().slice(0, 200) || undefined : undefined;
|
||||
// Like the e-mail: private log only, never in the public issue - it may
|
||||
// name someone else's server.
|
||||
const server = typeof body.server === "string" ? body.server.trim().slice(0, 200) : "";
|
||||
const publishAsIssue = body.publishAsIssue === true;
|
||||
|
||||
if (!message) {
|
||||
@@ -396,7 +400,12 @@ async function handleFeedback(req: IncomingMessage, res: ServerResponse) {
|
||||
return;
|
||||
}
|
||||
|
||||
await logFeedback({ at: new Date().toISOString(), category, message, email });
|
||||
await logFeedback({
|
||||
at: new Date().toISOString(),
|
||||
category,
|
||||
message: server ? `${message}\n**Server:** ${server}` : message,
|
||||
email,
|
||||
});
|
||||
|
||||
let githubIssueUrl: string | undefined;
|
||||
if (publishAsIssue) {
|
||||
@@ -471,6 +480,10 @@ const requestHandler = (req: IncomingMessage, res: ServerResponse) => {
|
||||
await handleFeedback(req, res);
|
||||
return;
|
||||
}
|
||||
if (requestUrl.pathname === "/api/news") {
|
||||
handleNewsConfig(res);
|
||||
return;
|
||||
}
|
||||
if (requestUrl.pathname === "/api/broadcast") {
|
||||
await handleBroadcast(req, res);
|
||||
return;
|
||||
|
||||
@@ -0,0 +1,150 @@
|
||||
// --- News ticker -----------------------------------------------------------
|
||||
//
|
||||
// Two halves:
|
||||
// * handleNewsFeed - the central feed every client shows by default. Served
|
||||
// by store-server.ts at /api/store/news, so it rides the existing
|
||||
// /api/store tunnel route. Manual items live in NEWS_DATA_FILE and are
|
||||
// managed with STORE_ADMIN_TOKEN (the stats panel); the latest release and
|
||||
// the newest store design are added automatically.
|
||||
// * handleNewsConfig - every gateway's /api/news. Tells its own client
|
||||
// whether to show the ticker at all (NEWS_TICKER=0 turns it off), whether
|
||||
// to include the central feed (NEWS_TICKER_CENTRAL=0 drops it), and the
|
||||
// instance's own messages (NEWS_TICKER_MESSAGES, separated by "|").
|
||||
//
|
||||
// Like store.ts, this file has zero private modifications.
|
||||
import type { IncomingMessage, ServerResponse } from "node:http";
|
||||
import { readFile, rename, writeFile } from "node:fs/promises";
|
||||
import { randomUUID } from "node:crypto";
|
||||
import { isAdminRequest, latestPublicTheme } from "./store.js";
|
||||
|
||||
type NewsItem =
|
||||
| { id: string; kind: "text"; text: string; url?: string; at: string }
|
||||
| { id: string; kind: "release"; version: string; url: string; at: string }
|
||||
| { id: string; kind: "theme"; name: string; author: string; at: string };
|
||||
type TextItem = Extract<NewsItem, { kind: "text" }>;
|
||||
|
||||
const NEWS_DATA_FILE = process.env.NEWS_DATA_FILE;
|
||||
const GITHUB_REPO = process.env.GITHUB_REPO ?? "WebSpeak3/webspeak3";
|
||||
const MAX_ITEMS = 20;
|
||||
const MAX_TEXT = 300;
|
||||
const AUTO_MAX_AGE_MS = 30 * 24 * 60 * 60 * 1000;
|
||||
|
||||
let cache: TextItem[] | null = null;
|
||||
|
||||
async function load(): Promise<TextItem[]> {
|
||||
if (cache) return cache;
|
||||
if (!NEWS_DATA_FILE) return (cache = []);
|
||||
try {
|
||||
cache = JSON.parse(await readFile(NEWS_DATA_FILE, "utf-8")) as TextItem[];
|
||||
} catch (err) {
|
||||
if ((err as NodeJS.ErrnoException).code !== "ENOENT") throw err;
|
||||
cache = [];
|
||||
}
|
||||
return cache;
|
||||
}
|
||||
|
||||
async function save(items: TextItem[]) {
|
||||
const tmp = `${NEWS_DATA_FILE}.tmp`;
|
||||
await writeFile(tmp, JSON.stringify(items), "utf-8");
|
||||
await rename(tmp, NEWS_DATA_FILE!);
|
||||
cache = items;
|
||||
}
|
||||
|
||||
// Unauthenticated GitHub API allows 60 requests/hour; one per hour is plenty.
|
||||
let release: { item: NewsItem | null; fetchedAt: number } = { item: null, fetchedAt: 0 };
|
||||
|
||||
async function latestRelease(): Promise<NewsItem | null> {
|
||||
if (Date.now() - release.fetchedAt < 60 * 60 * 1000) return release.item;
|
||||
release.fetchedAt = Date.now();
|
||||
try {
|
||||
const res = await fetch(`https://api.github.com/repos/${GITHUB_REPO}/releases?per_page=1`, {
|
||||
headers: { Accept: "application/vnd.github+json", "User-Agent": "webspeak3-store" },
|
||||
});
|
||||
if (!res.ok) return release.item;
|
||||
const [r] = (await res.json()) as { tag_name: string; html_url: string; published_at: string }[];
|
||||
release.item = r ? { id: `release-${r.tag_name}`, kind: "release", version: r.tag_name, url: r.html_url, at: r.published_at } : null;
|
||||
} catch (err) {
|
||||
console.error("[news] Release lookup failed:", err);
|
||||
}
|
||||
return release.item;
|
||||
}
|
||||
|
||||
function isRecent(item: NewsItem | null | undefined): item is NewsItem {
|
||||
return item != null && Date.now() - Date.parse(item.at) < AUTO_MAX_AGE_MS;
|
||||
}
|
||||
|
||||
function json(res: ServerResponse, status: number, body: unknown) {
|
||||
res.writeHead(status, { "Content-Type": "application/json" });
|
||||
res.end(JSON.stringify(body));
|
||||
}
|
||||
|
||||
async function readBody(req: IncomingMessage): Promise<Record<string, unknown> | null> {
|
||||
let raw = "";
|
||||
for await (const chunk of req) {
|
||||
raw += chunk;
|
||||
if (raw.length > 5_000) return null;
|
||||
}
|
||||
try {
|
||||
const parsed = JSON.parse(raw) as unknown;
|
||||
return parsed && typeof parsed === "object" ? (parsed as Record<string, unknown>) : null;
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
export async function handleNewsFeed(req: IncomingMessage, res: ServerResponse, pathname: string) {
|
||||
res.setHeader("Access-Control-Allow-Origin", "*");
|
||||
res.setHeader("Access-Control-Allow-Methods", "GET, POST, OPTIONS");
|
||||
res.setHeader("Access-Control-Allow-Headers", "Content-Type, Authorization");
|
||||
if (req.method === "OPTIONS") {
|
||||
res.writeHead(204);
|
||||
res.end();
|
||||
return;
|
||||
}
|
||||
|
||||
if (pathname === "/api/store/news") {
|
||||
const theme = await latestPublicTheme();
|
||||
const auto = [
|
||||
await latestRelease(),
|
||||
theme && ({ id: `theme-${theme.id}`, kind: "theme", name: theme.name, author: theme.author, at: theme.createdAt } as NewsItem),
|
||||
].filter(isRecent);
|
||||
res.setHeader("Cache-Control", "public, max-age=300");
|
||||
json(res, 200, { items: [...(await load()), ...auto] });
|
||||
return;
|
||||
}
|
||||
|
||||
// /api/store/news/admin: GET lists, POST {action:"add",text,url?} or {action:"delete",id}.
|
||||
if (!NEWS_DATA_FILE) return json(res, 404, { error: "not_found" });
|
||||
if (!isAdminRequest(req)) return json(res, 401, { error: "unauthorized" });
|
||||
if (req.method === "GET") return json(res, 200, { items: await load() });
|
||||
if (req.method !== "POST") return json(res, 405, { error: "method_not_allowed" });
|
||||
|
||||
const body = await readBody(req);
|
||||
const items = [...(await load())];
|
||||
if (body?.action === "delete" && typeof body.id === "string") {
|
||||
await save(items.filter((i) => i.id !== body.id));
|
||||
return json(res, 200, { ok: true });
|
||||
}
|
||||
if (body?.action === "add" && typeof body.text === "string" && body.text.trim()) {
|
||||
const url = typeof body.url === "string" && /^https:\/\/\S+$/.test(body.url.trim()) ? body.url.trim() : undefined;
|
||||
if (items.length >= MAX_ITEMS) return json(res, 400, { error: "too_many_items" });
|
||||
items.push({ id: randomUUID(), kind: "text", text: body.text.trim().slice(0, MAX_TEXT), url, at: new Date().toISOString() });
|
||||
await save(items);
|
||||
return json(res, 200, { ok: true });
|
||||
}
|
||||
json(res, 400, { error: "bad_request" });
|
||||
}
|
||||
|
||||
const NEWS_TICKER = process.env.NEWS_TICKER !== "0";
|
||||
const NEWS_TICKER_CENTRAL = process.env.NEWS_TICKER_CENTRAL !== "0";
|
||||
const LOCAL_ITEMS: NewsItem[] = (process.env.NEWS_TICKER_MESSAGES ?? "")
|
||||
.split("|")
|
||||
.map((text) => text.trim().slice(0, MAX_TEXT))
|
||||
.filter(Boolean)
|
||||
.map((text, i) => ({ id: `local-${i}-${text}`, kind: "text", text, at: "" }));
|
||||
|
||||
export function handleNewsConfig(res: ServerResponse) {
|
||||
res.setHeader("Access-Control-Allow-Origin", "*");
|
||||
res.setHeader("Cache-Control", "public, max-age=300");
|
||||
json(res, 200, NEWS_TICKER ? { enabled: true, central: NEWS_TICKER_CENTRAL, items: LOCAL_ITEMS } : { enabled: false });
|
||||
}
|
||||
@@ -7,6 +7,7 @@
|
||||
import { createServer } from "node:http";
|
||||
import { handleStore } from "./store.js";
|
||||
import { handlePing } from "./ping.js";
|
||||
import { handleNewsFeed } from "./news.js";
|
||||
|
||||
const PORT = Number(process.env.PORT ?? 8080);
|
||||
|
||||
@@ -28,6 +29,16 @@ createServer((req, res) => {
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (pathname === "/api/store/news" || pathname === "/api/store/news/admin") {
|
||||
handleNewsFeed(req, res, pathname).catch((err) => {
|
||||
console.error("[news] Request failed:", err);
|
||||
if (!res.headersSent) {
|
||||
res.writeHead(500, { "Content-Type": "application/json" });
|
||||
res.end(JSON.stringify({ error: "internal" }));
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (pathname === "/api/ping" || pathname === "/api/ping/stats") {
|
||||
handlePing(req, res, pathname).catch((err) => {
|
||||
console.error("[ping] Request failed:", err);
|
||||
|
||||
@@ -147,6 +147,11 @@ function isPublic(theme: StoreTheme): boolean {
|
||||
return theme.status === "approved" && isSafeThemeCss(theme.css);
|
||||
}
|
||||
|
||||
/** Newest public design, for the news ticker (news.ts). */
|
||||
export async function latestPublicTheme(): Promise<StoreTheme | undefined> {
|
||||
return (await loadStoreThemes()).filter(isPublic).sort((a, b) => b.createdAt.localeCompare(a.createdAt))[0];
|
||||
}
|
||||
|
||||
// Same in-memory-per-IP approach as FEEDBACK_RATE_LIMIT in index.ts; kept as a
|
||||
// separate map since the two endpoints are independent.
|
||||
const STORE_RATE_LIMIT = 5;
|
||||
|
||||
@@ -2605,6 +2605,74 @@
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
.ts-news-ticker {
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
border-top: 1px solid var(--border-soft);
|
||||
background: var(--log-bg);
|
||||
color: var(--log-text);
|
||||
padding: 0.15rem 0.6rem;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
.ts-news-label {
|
||||
font-weight: 600;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.ts-news-track {
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.ts-news-scroll {
|
||||
display: inline-block;
|
||||
/* Starts just off the right edge and runs until fully off the left one,
|
||||
so every message is on screen exactly once per pass. */
|
||||
padding-left: 100%;
|
||||
animation: ts-news-scroll linear infinite;
|
||||
}
|
||||
|
||||
.ts-news-ticker:hover .ts-news-scroll {
|
||||
animation-play-state: paused;
|
||||
}
|
||||
|
||||
.ts-news-item {
|
||||
padding-right: 3rem;
|
||||
}
|
||||
|
||||
.ts-news-item a {
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
.ts-news-close {
|
||||
flex-shrink: 0;
|
||||
background: none;
|
||||
border: none;
|
||||
color: inherit;
|
||||
cursor: pointer;
|
||||
padding: 0 0.2rem;
|
||||
}
|
||||
|
||||
@keyframes ts-news-scroll {
|
||||
from {
|
||||
transform: translateX(0);
|
||||
}
|
||||
to {
|
||||
transform: translateX(-100%);
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.ts-news-scroll {
|
||||
padding-left: 0;
|
||||
animation: none;
|
||||
}
|
||||
}
|
||||
|
||||
.ts-log-info {
|
||||
color: var(--log-text);
|
||||
}
|
||||
@@ -2675,6 +2743,33 @@
|
||||
width: 520px;
|
||||
}
|
||||
|
||||
.ts-about-dialog {
|
||||
width: 440px;
|
||||
}
|
||||
|
||||
.ts-about-memorial {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
margin: 16px 0 0;
|
||||
padding-top: 16px;
|
||||
border-top: 1px solid var(--border-soft);
|
||||
}
|
||||
|
||||
.ts-about-memorial img {
|
||||
width: 120px;
|
||||
height: 120px;
|
||||
border-radius: 50%;
|
||||
object-fit: cover;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.ts-about-memorial figcaption {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.ts-client-log-dialog {
|
||||
width: 760px;
|
||||
}
|
||||
|
||||
+381
-31
@@ -148,6 +148,7 @@ import {
|
||||
} from "./themes/greenteaspeak";
|
||||
import { BARE_URL_REGEX, renderBbcode, wrapUrls } from "./lib/bbcode";
|
||||
import { parseChannelName, spacerDisplayName } from "./lib/spacer";
|
||||
import akimoPhoto from "./assets/akimo.jpg";
|
||||
import {
|
||||
applyParkedGatewayEvent,
|
||||
emptyParkedState,
|
||||
@@ -187,6 +188,14 @@ const FEEDBACK_URL = import.meta.env.DEV
|
||||
? `${import.meta.env.VITE_GATEWAY_URL.replace(/\/$/, "").replace(/^ws(s?):\/\//, "http$1://")}/api/feedback`
|
||||
: `${window.location.protocol}//${window.location.host}/api/feedback`;
|
||||
|
||||
// News ticker: the instance's own gateway says whether it's on and adds its
|
||||
// own messages (gateway/src/news.ts); the central feed is fetched directly,
|
||||
// like the store. The demo has no gateway and only shows the central feed.
|
||||
const NEWS_CONFIG_URL = DEMO_MODE ? null : FEEDBACK_URL.replace(/\/api\/feedback$/, "/api/news");
|
||||
const NEWS_FEED_URL = import.meta.env.DEV
|
||||
? "http://localhost:8080/api/store/news"
|
||||
: import.meta.env.VITE_NEWS_URL || "https://gateway.webspeak3.de/api/store/news";
|
||||
|
||||
// Unlike GATEWAY_URL/FEEDBACK_URL above, the design store is NOT per-instance:
|
||||
// it's a single, centrally curated catalog run on the maintainer's own VPS
|
||||
// (see gateway/src/store.ts), so every build - official and self-hosted
|
||||
@@ -389,9 +398,14 @@ const PLAYBACK_VOLUME_KEY = "webspeak3:playback-volume";
|
||||
const NOISE_SUPPRESSION_KEY = "webspeak3:noise-suppression";
|
||||
const ECHO_CANCELLATION_KEY = "webspeak3:echo-cancellation";
|
||||
const AUTO_GAIN_CONTROL_KEY = "webspeak3:auto-gain-control";
|
||||
const AUTO_VOLUME_KEY = "webspeak3:auto-volume";
|
||||
const OWN_MIC_CLICKS_KEY = "webspeak3:own-mic-clicks";
|
||||
const OTHER_MIC_CLICKS_KEY = "webspeak3:other-mic-clicks";
|
||||
const AEC3_ENABLED_KEY = "webspeak3:aec3-enabled";
|
||||
const VAD_HANGOVER_KEY = "webspeak3:vad-hangover";
|
||||
const PUSH_TO_TALK_KEY = "webspeak3:push-to-talk";
|
||||
const CONTINUOUS_KEY = "webspeak3:continuous-transmission";
|
||||
const TYPING_ATTENUATION_KEY = "webspeak3:typing-attenuation";
|
||||
const PTT_BINDING_KEY = "webspeak3:ptt-key";
|
||||
const DESIGN_THEME_KEY = "webspeak3:design-theme";
|
||||
// The user's actual pick - "standard" | "nova" | "greenteaspeak" | "custom:<id>".
|
||||
@@ -1917,6 +1931,43 @@ function ConnectDialog({
|
||||
// restart warning). Deliberately no backdrop-click-to-close - the point is
|
||||
// the user actually reads it before the connection drops, not that it's
|
||||
// invisible-easy to swipe away like a cookie banner.
|
||||
// In memory of Akimo, the project owner's dog (†21.10.2026). Permanent:
|
||||
// never remove or hide this, no matter what else changes in the dialog.
|
||||
function AboutDialog({ onClose }: { onClose: () => void }) {
|
||||
const t = useT();
|
||||
return (
|
||||
<div className="ts-dialog-backdrop" onClick={onClose}>
|
||||
<div className="ts-dialog ts-about-dialog" onClick={(e) => e.stopPropagation()}>
|
||||
<div className="ts-dialog-titlebar">
|
||||
<span>{t("menu.help.about")}</span>
|
||||
</div>
|
||||
<div className="ts-dialog-body">
|
||||
<p>{t("about.text")}</p>
|
||||
<p>
|
||||
<a href="https://webspeak3.de" target="_blank" rel="noreferrer">webspeak3.de</a>
|
||||
{" · "}
|
||||
<a href="https://github.com/WebSpeak3/webspeak3" target="_blank" rel="noreferrer">GitHub</a>
|
||||
</p>
|
||||
<figure className="ts-about-memorial">
|
||||
<img src={akimoPhoto} alt="Akimo" width={120} height={120} />
|
||||
<figcaption>
|
||||
<strong>{t("about.memorial.title")}</strong>
|
||||
<span>{t("about.memorial.text")}</span>
|
||||
</figcaption>
|
||||
</figure>
|
||||
</div>
|
||||
<div className="ts-dialog-buttons">
|
||||
<div className="ts-dialog-buttons-right">
|
||||
<button type="button" onClick={onClose}>
|
||||
{t("about.close")}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function RestartNoticeDialog({ message, onAck }: { message: string; onAck: () => void }) {
|
||||
const t = useT();
|
||||
return (
|
||||
@@ -2542,6 +2593,106 @@ function FeedbackFab({ onOpen, stacked }: { onOpen: () => void; stacked: boolean
|
||||
}
|
||||
|
||||
/** Small donation pill, pinned to the bottom right corner. */
|
||||
type NewsItem =
|
||||
| { id: string; kind: "text"; text: string; url?: string }
|
||||
| { id: string; kind: "release"; version: string; url: string }
|
||||
| { id: string; kind: "theme"; name: string; author: string };
|
||||
|
||||
const NEWS_DISMISSED_STORAGE_KEY = "webspeak3.newsTicker.dismissed";
|
||||
|
||||
// Like the scrolling news line at the bottom of the native TS3 client.
|
||||
// Dismissing hides the current set of items until a new one shows up.
|
||||
function NewsTicker() {
|
||||
const t = useT();
|
||||
const [items, setItems] = useState<NewsItem[]>([]);
|
||||
const [dismissed, setDismissed] = useState(() => {
|
||||
try {
|
||||
return localStorage.getItem(NEWS_DISMISSED_STORAGE_KEY) ?? "";
|
||||
} catch {
|
||||
return "";
|
||||
}
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
const getJson = async (url: string) => {
|
||||
const res = await fetch(url);
|
||||
if (!res.ok) throw new Error(String(res.status));
|
||||
return res.json();
|
||||
};
|
||||
const load = async () => {
|
||||
// A gateway older than the ticker answers 404: treat it as the default.
|
||||
const config = (NEWS_CONFIG_URL ? await getJson(NEWS_CONFIG_URL).catch(() => null) : null) ?? {
|
||||
enabled: true,
|
||||
central: true,
|
||||
items: [],
|
||||
};
|
||||
if (!config.enabled) return setItems([]);
|
||||
const central = config.central ? ((await getJson(NEWS_FEED_URL).catch(() => null))?.items ?? []) : [];
|
||||
setItems([...config.items, ...central]);
|
||||
};
|
||||
void load();
|
||||
const timer = window.setInterval(() => void load(), 15 * 60 * 1000);
|
||||
return () => window.clearInterval(timer);
|
||||
}, []);
|
||||
|
||||
const key = items.map((i) => i.id).join(",");
|
||||
if (!items.length || key === dismissed) return null;
|
||||
|
||||
const label = (item: NewsItem) =>
|
||||
item.kind === "release"
|
||||
? t("news.release", { version: item.version })
|
||||
: item.kind === "theme"
|
||||
? t("news.theme", { name: item.name, author: item.author })
|
||||
: item.text;
|
||||
const entries = items.map((item) => {
|
||||
const url = item.kind === "theme" ? undefined : item.url;
|
||||
return (
|
||||
<span key={item.id} className="ts-news-item">
|
||||
{url ? (
|
||||
<a href={url} target="_blank" rel="noopener noreferrer">
|
||||
{label(item)}
|
||||
</a>
|
||||
) : (
|
||||
label(item)
|
||||
)}
|
||||
</span>
|
||||
);
|
||||
});
|
||||
|
||||
return (
|
||||
<div className="ts-news-ticker">
|
||||
<span className="ts-news-label">{t("news.label")}</span>
|
||||
<div className="ts-news-track">
|
||||
{/* Duration from the distance travelled (track + text), so the speed is
|
||||
the same ~45 px/s on every screen width. */}
|
||||
<div
|
||||
className="ts-news-scroll"
|
||||
ref={(el) => {
|
||||
if (el) el.style.animationDuration = `${el.scrollWidth / 45}s`;
|
||||
}}
|
||||
>
|
||||
{entries}
|
||||
</div>
|
||||
</div>
|
||||
<button
|
||||
className="ts-news-close"
|
||||
title={t("dialog.close")}
|
||||
aria-label={t("dialog.close")}
|
||||
onClick={() => {
|
||||
setDismissed(key);
|
||||
try {
|
||||
localStorage.setItem(NEWS_DISMISSED_STORAGE_KEY, key);
|
||||
} catch {
|
||||
// ignore
|
||||
}
|
||||
}}
|
||||
>
|
||||
✕
|
||||
</button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function DonateFab() {
|
||||
const t = useT();
|
||||
if (!DONATE_URL) return null;
|
||||
@@ -2561,11 +2712,52 @@ function DonateFab() {
|
||||
|
||||
type FeedbackCategory = "bug" | "idea" | "other" | "report";
|
||||
|
||||
function FeedbackDialog({ onClose }: { onClose: () => void }) {
|
||||
/** Best-effort "Chrome 141 · Windows" from the UA, prefilled into bug reports
|
||||
* so users don't have to know it themselves - they can still correct it. */
|
||||
function detectBrowserAndOs(): string {
|
||||
const ua = navigator.userAgent;
|
||||
const pick = (re: RegExp, name: string) => {
|
||||
const m = re.exec(ua);
|
||||
return m ? `${name} ${m[1]}` : null;
|
||||
};
|
||||
const browser =
|
||||
pick(/Edg\/(\d+)/, "Edge") ??
|
||||
pick(/OPR\/(\d+)/, "Opera") ??
|
||||
pick(/Firefox\/(\d+)/, "Firefox") ??
|
||||
pick(/Chrome\/(\d+)/, "Chrome") ??
|
||||
pick(/Version\/([\d.]+).*Safari/, "Safari") ??
|
||||
"?";
|
||||
const os = /iPhone|iPad/.test(ua)
|
||||
? "iOS"
|
||||
: /Android/.test(ua)
|
||||
? "Android"
|
||||
: /Windows/.test(ua)
|
||||
? "Windows"
|
||||
: /Mac OS X/.test(ua)
|
||||
? "macOS"
|
||||
: /Linux/.test(ua)
|
||||
? "Linux"
|
||||
: "?";
|
||||
return `${browser} · ${os}`;
|
||||
}
|
||||
|
||||
function FeedbackDialog({ onClose, audioState }: { onClose: () => void; audioState: string }) {
|
||||
const t = useT();
|
||||
const backdrop = useBackdropDismiss(onClose);
|
||||
const [category, setCategory] = useState<FeedbackCategory>("bug");
|
||||
const [message, setMessage] = useState("");
|
||||
// Bug-only extras, appended to the message so neither the gateway nor the
|
||||
// private storage needs a schema change.
|
||||
const [environment, setEnvironment] = useState(detectBrowserAndOs);
|
||||
const [bugServer, setBugServer] = useState("");
|
||||
const [steps, setSteps] = useState("");
|
||||
const diagnostics = [
|
||||
`Page: ${window.location.host}`,
|
||||
`User agent: ${navigator.userAgent}`,
|
||||
`Language: ${navigator.language}`,
|
||||
`Audio: ${audioState}`,
|
||||
`Output device switching: ${"setSinkId" in HTMLMediaElement.prototype ? "yes" : "no"}`,
|
||||
].join("\n");
|
||||
const [email, setEmail] = useState("");
|
||||
// Bugs always get filed as a GitHub issue - the checkbox is forced on and
|
||||
// locked while "bug" is selected (see the select's onChange below), so the
|
||||
@@ -2588,8 +2780,20 @@ function FeedbackDialog({ onClose }: { onClose: () => void }) {
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({
|
||||
category,
|
||||
message: trimmed,
|
||||
message:
|
||||
category === "bug"
|
||||
? [
|
||||
trimmed,
|
||||
"",
|
||||
"---",
|
||||
`**Browser / OS:** ${environment.trim() || "?"}`,
|
||||
...(steps.trim() ? [`**Steps:** ${steps.trim()}`] : []),
|
||||
"",
|
||||
diagnostics,
|
||||
].join("\n")
|
||||
: trimmed,
|
||||
email: email.trim() || undefined,
|
||||
server: category === "bug" ? bugServer.trim() || undefined : undefined,
|
||||
publishAsIssue,
|
||||
website,
|
||||
}),
|
||||
@@ -2677,6 +2881,31 @@ function FeedbackDialog({ onClose }: { onClose: () => void }) {
|
||||
onChange={(e) => setMessage(e.target.value)}
|
||||
/>
|
||||
</label>
|
||||
{category === "bug" && (
|
||||
<>
|
||||
<label className="ts-dialog-field">
|
||||
{t("feedback.dialog.bug.environment")}
|
||||
<input type="text" value={environment} onChange={(e) => setEnvironment(e.target.value)} />
|
||||
</label>
|
||||
<label className="ts-dialog-field">
|
||||
{t("feedback.dialog.bug.server")}
|
||||
<input type="text" value={bugServer} onChange={(e) => setBugServer(e.target.value)} />
|
||||
</label>
|
||||
<label className="ts-dialog-field">
|
||||
{t("feedback.dialog.bug.steps")}
|
||||
<textarea
|
||||
rows={3}
|
||||
value={steps}
|
||||
placeholder={t("feedback.dialog.bug.stepsPlaceholder")}
|
||||
onChange={(e) => setSteps(e.target.value)}
|
||||
/>
|
||||
</label>
|
||||
<details className="ts-feedback-hint">
|
||||
<summary>{t("feedback.dialog.bug.diagnostics")}</summary>
|
||||
<pre style={{ whiteSpace: "pre-wrap", wordBreak: "break-all" }}>{diagnostics}</pre>
|
||||
</details>
|
||||
</>
|
||||
)}
|
||||
<label className="ts-dialog-field">
|
||||
{t("feedback.dialog.email")}
|
||||
<input type="email" value={email} onChange={(e) => setEmail(e.target.value)} />
|
||||
@@ -5301,6 +5530,12 @@ interface AudioSettings {
|
||||
onRefreshOutputDevices: () => void;
|
||||
playbackVolume: number;
|
||||
onPlaybackVolumeChange: (v: number) => void;
|
||||
autoVolume: boolean;
|
||||
onAutoVolumeChange: (v: boolean) => void;
|
||||
ownMicClicks: boolean;
|
||||
onOwnMicClicksChange: (v: boolean) => void;
|
||||
otherMicClicks: boolean;
|
||||
onOtherMicClicksChange: (v: boolean) => void;
|
||||
onPlayTestTone: () => void;
|
||||
inputDevices: MediaDeviceInfo[];
|
||||
inputDeviceId: string;
|
||||
@@ -5316,6 +5551,10 @@ interface AudioSettings {
|
||||
onVadHangoverChange: (v: number) => void;
|
||||
pushToTalk: boolean;
|
||||
onPushToTalkChange: (on: boolean) => void;
|
||||
continuous: boolean;
|
||||
onContinuousChange: (on: boolean) => void;
|
||||
typingAttenuation: boolean;
|
||||
onTypingAttenuationChange: (on: boolean) => void;
|
||||
pttBinding: PttBinding | null;
|
||||
onPttBindingChange: (binding: PttBinding) => void;
|
||||
noiseSuppressionEnabled: boolean;
|
||||
@@ -5487,15 +5726,15 @@ function WiedergabePanel({ audio }: { audio: AudioSettings }) {
|
||||
<fieldset className="ts-options-fieldset">
|
||||
<legend>{t("playback.options")}</legend>
|
||||
<label className="ts-options-checkbox">
|
||||
<input type="checkbox" checked disabled readOnly />
|
||||
<input type="checkbox" checked={audio.autoVolume} onChange={(e) => audio.onAutoVolumeChange(e.target.checked)} />
|
||||
{t("playback.autoVolume")}
|
||||
</label>
|
||||
<label className="ts-options-checkbox">
|
||||
<input type="checkbox" checked disabled readOnly />
|
||||
<input type="checkbox" checked={audio.ownMicClicks} onChange={(e) => audio.onOwnMicClicksChange(e.target.checked)} />
|
||||
{t("playback.ownMicClicks")}
|
||||
</label>
|
||||
<label className="ts-options-checkbox">
|
||||
<input type="checkbox" disabled readOnly />
|
||||
<input type="checkbox" checked={audio.otherMicClicks} onChange={(e) => audio.onOtherMicClicksChange(e.target.checked)} />
|
||||
{t("playback.otherMicClicks")}
|
||||
</label>
|
||||
</fieldset>
|
||||
@@ -5552,15 +5791,26 @@ function AufnahmePanel({ audio }: { audio: AudioSettings }) {
|
||||
</>
|
||||
)}
|
||||
<label className="ts-options-radio">
|
||||
<input type="radio" name="activation" disabled readOnly />
|
||||
<input
|
||||
type="radio"
|
||||
name="activation"
|
||||
checked={!audio.pushToTalk && audio.continuous}
|
||||
onChange={() => {
|
||||
audio.onPushToTalkChange(false);
|
||||
audio.onContinuousChange(true);
|
||||
}}
|
||||
/>
|
||||
{t("recording.continuous")}
|
||||
</label>
|
||||
<label className="ts-options-radio">
|
||||
<input
|
||||
type="radio"
|
||||
name="activation"
|
||||
checked={!audio.pushToTalk}
|
||||
onChange={() => audio.onPushToTalkChange(false)}
|
||||
checked={!audio.pushToTalk && !audio.continuous}
|
||||
onChange={() => {
|
||||
audio.onPushToTalkChange(false);
|
||||
audio.onContinuousChange(false);
|
||||
}}
|
||||
/>
|
||||
{t("recording.voiceActivation")}
|
||||
</label>
|
||||
@@ -5599,7 +5849,11 @@ function AufnahmePanel({ audio }: { audio: AudioSettings }) {
|
||||
<legend>{t("recording.dsp")}</legend>
|
||||
<div className="ts-options-dsp-grid">
|
||||
<label className="ts-options-checkbox">
|
||||
<input type="checkbox" disabled readOnly />
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={audio.typingAttenuation}
|
||||
onChange={(e) => audio.onTypingAttenuationChange(e.target.checked)}
|
||||
/>
|
||||
{t("recording.typingAttenuation")}
|
||||
</label>
|
||||
<label className="ts-options-checkbox">
|
||||
@@ -6860,6 +7114,8 @@ function AppInner() {
|
||||
// Terms of use, own-hosted instance only (see IS_OWN_HOSTED_INSTANCE): shown
|
||||
// mandatorily on first visit, reopenable any time from the menu afterwards.
|
||||
const [tosOpen, setTosOpen] = useState(false);
|
||||
// client.webspeak3.de/#about opens the About dialog directly (shareable link).
|
||||
const [aboutOpen, setAboutOpen] = useState(() => window.location.hash === "#about");
|
||||
const [tosMandatory, setTosMandatory] = useState(false);
|
||||
useEffect(() => {
|
||||
if (IS_OWN_HOSTED_INSTANCE && !hasAcceptedToS()) {
|
||||
@@ -7051,6 +7307,11 @@ function AppInner() {
|
||||
const [vadThreshold, setVadThreshold] = useState(0.02);
|
||||
const [vadHangover, setVadHangover] = useState(() => loadNumberPref(VAD_HANGOVER_KEY, 0.3));
|
||||
const [pushToTalk, setPushToTalk] = useState(() => loadBoolPref(PUSH_TO_TALK_KEY, false));
|
||||
// Only matters while pushToTalk is off: send all the time instead of voice activation.
|
||||
const [continuous, setContinuous] = useState(() => loadBoolPref(CONTINUOUS_KEY, false));
|
||||
const continuousRef = useRef(continuous);
|
||||
const [typingAttenuation, setTypingAttenuation] = useState(() => loadBoolPref(TYPING_ATTENUATION_KEY, false));
|
||||
const typingAttenuationRef = useRef(typingAttenuation);
|
||||
const [pttBinding, setPttBinding] = useState<PttBinding | null>(loadPttBinding);
|
||||
const [pttPressed, setPttPressed] = useState(false);
|
||||
// Read when a new MicCapture is created, which happens outside render.
|
||||
@@ -7071,8 +7332,15 @@ function AppInner() {
|
||||
loadBoolPref(AUTO_GAIN_CONTROL_KEY, true)
|
||||
);
|
||||
// Off by default: a heavier, opt-in alternative/supplement to native AEC for
|
||||
// speaker+mic (no headset) setups (github.com/Moepchi/webspeak3 issue #2).
|
||||
// speaker+mic (no headset) setups (github.com/WebSpeak3/webspeak3 issue #2).
|
||||
const [aec3Enabled, setAec3Enabled] = useState(() => loadBoolPref(AEC3_ENABLED_KEY, false));
|
||||
// Playback options. The clicks themselves are sounds (micClickOn/Off).
|
||||
const [autoVolume, setAutoVolume] = useState(() => loadBoolPref(AUTO_VOLUME_KEY, true));
|
||||
const [ownMicClicks, setOwnMicClicks] = useState(() => loadBoolPref(OWN_MIC_CLICKS_KEY, false));
|
||||
const [otherMicClicks, setOtherMicClicks] = useState(() => loadBoolPref(OTHER_MIC_CLICKS_KEY, false));
|
||||
// Read from the socket handler, which only sees the first render's state.
|
||||
const otherMicClicksRef = useRef(otherMicClicks);
|
||||
const talkersRef = useRef<Set<number>>(new Set());
|
||||
const [aec3Loading, setAec3Loading] = useState(false);
|
||||
const aec3Ref = useRef<Aec3Instance | null>(null);
|
||||
// Mirrors aec3Enabled but updates immediately, for startMic() calls made in
|
||||
@@ -7281,6 +7549,25 @@ function AppInner() {
|
||||
localStorage.setItem(PUSH_TO_TALK_KEY, pushToTalk ? "1" : "0");
|
||||
}, [pushToTalk]);
|
||||
|
||||
useEffect(() => {
|
||||
continuousRef.current = continuous;
|
||||
if (micCaptureRef.current) micCaptureRef.current.continuous = continuous;
|
||||
localStorage.setItem(CONTINUOUS_KEY, continuous ? "1" : "0");
|
||||
}, [continuous]);
|
||||
|
||||
useEffect(() => {
|
||||
typingAttenuationRef.current = typingAttenuation;
|
||||
if (micCaptureRef.current) micCaptureRef.current.typingAttenuation = typingAttenuation;
|
||||
localStorage.setItem(TYPING_ATTENUATION_KEY, typingAttenuation ? "1" : "0");
|
||||
if (!typingAttenuation) return;
|
||||
const onKeyDown = (e: KeyboardEvent) => {
|
||||
// The push-to-talk key is not typing.
|
||||
if (e.code !== pttBinding?.code) micCaptureRef.current?.noteTyping();
|
||||
};
|
||||
window.addEventListener("keydown", onKeyDown, true);
|
||||
return () => window.removeEventListener("keydown", onKeyDown, true);
|
||||
}, [typingAttenuation, pttBinding]);
|
||||
|
||||
useEffect(() => {
|
||||
pttPressedRef.current = pttPressed;
|
||||
if (micCaptureRef.current) micCaptureRef.current.pttPressed = pttPressed;
|
||||
@@ -7338,6 +7625,20 @@ function AppInner() {
|
||||
localStorage.setItem(PLAYBACK_VOLUME_KEY, String(playbackVolume));
|
||||
}, [playbackVolume]);
|
||||
|
||||
useEffect(() => {
|
||||
audioPlayerRef.current?.setAutoVolume(autoVolume);
|
||||
localStorage.setItem(AUTO_VOLUME_KEY, autoVolume ? "1" : "0");
|
||||
}, [autoVolume]);
|
||||
|
||||
useEffect(() => {
|
||||
localStorage.setItem(OWN_MIC_CLICKS_KEY, ownMicClicks ? "1" : "0");
|
||||
}, [ownMicClicks]);
|
||||
|
||||
useEffect(() => {
|
||||
otherMicClicksRef.current = otherMicClicks;
|
||||
localStorage.setItem(OTHER_MIC_CLICKS_KEY, otherMicClicks ? "1" : "0");
|
||||
}, [otherMicClicks]);
|
||||
|
||||
useEffect(() => {
|
||||
localStorage.setItem(NOISE_SUPPRESSION_KEY, noiseSuppressionEnabled ? "1" : "0");
|
||||
}, [noiseSuppressionEnabled]);
|
||||
@@ -7472,6 +7773,7 @@ function AppInner() {
|
||||
// that existed at the time - a fresh one (first use, or after
|
||||
// disposeAudioIfIdle) has to be brought up to the current settings.
|
||||
player.setVolume(playbackVolume);
|
||||
player.setAutoVolume(autoVolume);
|
||||
if (outputDeviceId) {
|
||||
player.setOutputDevice(outputDeviceId).catch((error: Error) =>
|
||||
appendLog({ text: `Output device error: ${error.message}`, kind: "error" }),
|
||||
@@ -7484,16 +7786,22 @@ function AppInner() {
|
||||
// Browsers keep an AudioContext created without a user gesture (auto-mic
|
||||
// on page load, a reconnect) "suspended" - silent - until one happens. The
|
||||
// mic permission prompt used to be the only thing resuming it, so with the
|
||||
// mic denied or absent you'd never hear anyone. Any click/keypress does it.
|
||||
// mic denied or absent you'd never hear anyone. Any click/keypress does it,
|
||||
// and also starts the player's hidden <audio> element (see unlock()).
|
||||
useEffect(() => {
|
||||
const resume = () => {
|
||||
const ctx = audioContextRef.current;
|
||||
if (ctx?.state === "suspended") ctx.resume().catch(() => {});
|
||||
audioPlayerRef.current?.unlock();
|
||||
};
|
||||
// pointerup too: on touch screens pointerdown doesn't count as a user
|
||||
// gesture, so resume()/play() from it alone are refused on phones.
|
||||
window.addEventListener("pointerdown", resume, true);
|
||||
window.addEventListener("pointerup", resume, true);
|
||||
window.addEventListener("keydown", resume, true);
|
||||
return () => {
|
||||
window.removeEventListener("pointerdown", resume, true);
|
||||
window.removeEventListener("pointerup", resume, true);
|
||||
window.removeEventListener("keydown", resume, true);
|
||||
};
|
||||
}, []);
|
||||
@@ -7559,7 +7867,8 @@ function AppInner() {
|
||||
setPokes(parked.pokes);
|
||||
setActiveFavoriteId(parked.favoriteId);
|
||||
setActiveTab(parked.chatTab);
|
||||
setTalkers(new Set(parked.talkers));
|
||||
talkersRef.current = new Set(parked.talkers);
|
||||
setTalkers(talkersRef.current);
|
||||
setWhisperChannelIds(new Set(parked.whisperChannelIds));
|
||||
setWhisperClientIds(new Set(parked.whisperClientIds));
|
||||
setWhisperLog(parked.whisperLog);
|
||||
@@ -7601,7 +7910,8 @@ function AppInner() {
|
||||
setPmThreads({});
|
||||
setPokes([]);
|
||||
setActiveTab("channel");
|
||||
setTalkers(new Set());
|
||||
talkersRef.current = new Set();
|
||||
setTalkers(talkersRef.current);
|
||||
setWhisperChannelIds(new Set());
|
||||
setWhisperClientIds(new Set());
|
||||
setWhisperLog([]);
|
||||
@@ -7963,9 +8273,18 @@ function AppInner() {
|
||||
// Audio only for the active session tab.
|
||||
if (!outputMutedRef.current) audioPlayerRef.current?.playFrame(data.pcm);
|
||||
break;
|
||||
case "talkers":
|
||||
setTalkers(new Set<number>(data.clients));
|
||||
case "talkers": {
|
||||
const next = new Set<number>(data.clients);
|
||||
const prev = talkersRef.current;
|
||||
if (otherMicClicksRef.current && !outputMutedRef.current) {
|
||||
// One click per update, even if several people start at once.
|
||||
if ([...next].some((id) => !prev.has(id))) void playSound("micClickOn");
|
||||
else if ([...prev].some((id) => !next.has(id))) void playSound("micClickOff");
|
||||
}
|
||||
talkersRef.current = next;
|
||||
setTalkers(next);
|
||||
break;
|
||||
}
|
||||
case "reconnecting":
|
||||
// The gateway lost the TS server and is reconnecting by itself.
|
||||
appendLog({ text: t("log.serverReconnecting"), kind: "error" });
|
||||
@@ -9065,6 +9384,8 @@ function AppInner() {
|
||||
micCaptureRef.current?.stop();
|
||||
micCaptureRef.current = mic;
|
||||
mic.pushToTalk = pushToTalkRef.current;
|
||||
mic.continuous = continuousRef.current;
|
||||
mic.typingAttenuation = typingAttenuationRef.current;
|
||||
mic.pttPressed = pttPressedRef.current;
|
||||
mic.setExtraAudio(tabAudioRef.current);
|
||||
setMicOn(true);
|
||||
@@ -9328,7 +9649,9 @@ function AppInner() {
|
||||
};
|
||||
|
||||
const handlePlayTestTone = () => {
|
||||
ensureAudioContext();
|
||||
const ctx = ensureAudioContext();
|
||||
if (ctx.state === "suspended") ctx.resume().catch(() => {});
|
||||
audioPlayerRef.current?.unlock();
|
||||
audioPlayerRef.current?.playTestTone();
|
||||
};
|
||||
|
||||
@@ -10133,10 +10456,17 @@ function AppInner() {
|
||||
const isAway = ownClient?.away ?? false;
|
||||
const inputMuted = ownClient?.inputMuted ?? false;
|
||||
const outputMuted = ownClient?.outputMuted ?? false;
|
||||
const displayTalkers =
|
||||
selfActive && !inputMuted && ownClient?.hasTalkPower
|
||||
? new Set(talkers).add(ownClient.id)
|
||||
: talkers;
|
||||
const selfTalking = Boolean(selfActive && !inputMuted && ownClient?.hasTalkPower);
|
||||
const displayTalkers = selfTalking && ownClient ? new Set(talkers).add(ownClient.id) : talkers;
|
||||
const selfTalkingSeenRef = useRef(false);
|
||||
useEffect(() => {
|
||||
// Skip the initial render so opening the client doesn't click.
|
||||
if (!selfTalkingSeenRef.current) {
|
||||
selfTalkingSeenRef.current = true;
|
||||
return;
|
||||
}
|
||||
if (ownMicClicks && !outputMuted) void playSound(selfTalking ? "micClickOn" : "micClickOff");
|
||||
}, [selfTalking]); // eslint-disable-line react-hooks/exhaustive-deps
|
||||
const showServerQueryClients =
|
||||
activeFavoriteId != null &&
|
||||
favorites.some((f) => f.id === activeFavoriteId && f.showServerQueryClients);
|
||||
@@ -10197,7 +10527,7 @@ function AppInner() {
|
||||
{DEMO_MODE && (
|
||||
<div className="ts-demo-banner">
|
||||
Demo mode — simulated data only, no real TeamSpeak server involved.{" "}
|
||||
<a href="https://github.com/Moepchi/webspeak3" target="_blank" rel="noreferrer">
|
||||
<a href="https://github.com/WebSpeak3/webspeak3" target="_blank" rel="noreferrer">
|
||||
Get WebSpeak3
|
||||
</a>
|
||||
<button className="ts-demo-mobile-toggle" onClick={() => setDemoForceMobile((v) => !v)}>
|
||||
@@ -10682,19 +11012,19 @@ function AppInner() {
|
||||
</button>
|
||||
{helpMenuOpen && (
|
||||
<div className="ts-menu" ref={focusFirstItem} onKeyDown={handleMenuKeyDown}>
|
||||
<a
|
||||
<button
|
||||
className="ts-menu-item"
|
||||
href="https://webspeak3.de"
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
onClick={() => setHelpMenuOpen(false)}
|
||||
onClick={() => {
|
||||
setAboutOpen(true);
|
||||
setHelpMenuOpen(false);
|
||||
}}
|
||||
>
|
||||
<span className="ts-menu-item-icon">ℹ️</span>
|
||||
<span className="ts-menu-item-label">{t("menu.help.about")}</span>
|
||||
</a>
|
||||
</button>
|
||||
<a
|
||||
className="ts-menu-item"
|
||||
href="https://github.com/Moepchi/webspeak3"
|
||||
href="https://github.com/WebSpeak3/webspeak3"
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
onClick={() => setHelpMenuOpen(false)}
|
||||
@@ -10704,7 +11034,7 @@ function AppInner() {
|
||||
</a>
|
||||
<a
|
||||
className="ts-menu-item"
|
||||
href="https://github.com/Moepchi/webspeak3/releases"
|
||||
href="https://github.com/WebSpeak3/webspeak3/releases"
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
onClick={() => setHelpMenuOpen(false)}
|
||||
@@ -10923,7 +11253,7 @@ function AppInner() {
|
||||
>
|
||||
🗣️
|
||||
</button>
|
||||
) : (
|
||||
) : continuous ? null : (
|
||||
<label className="ts-icon-slider" title={t("toolbar.vadSensitivity")}>
|
||||
🎚️
|
||||
<input
|
||||
@@ -11062,7 +11392,7 @@ function AppInner() {
|
||||
|
||||
<DonateFab />
|
||||
|
||||
{feedbackOpen && <FeedbackDialog onClose={() => setFeedbackOpen(false)} />}
|
||||
{feedbackOpen && <FeedbackDialog onClose={() => setFeedbackOpen(false)} audioState={audioContextRef.current?.state ?? "not started"} />}
|
||||
|
||||
{favoritesDialogMode && (
|
||||
<FavoritesDialog
|
||||
@@ -11083,6 +11413,15 @@ function AppInner() {
|
||||
|
||||
{restartNotice && <RestartNoticeDialog message={restartNotice} onAck={() => setRestartNotice(null)} />}
|
||||
|
||||
{aboutOpen && (
|
||||
<AboutDialog
|
||||
onClose={() => {
|
||||
setAboutOpen(false);
|
||||
if (window.location.hash === "#about") window.history.replaceState(null, "", window.location.pathname + window.location.search);
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
|
||||
{tosOpen && (
|
||||
<ToSDialog
|
||||
mandatory={tosMandatory}
|
||||
@@ -11365,6 +11704,12 @@ function AppInner() {
|
||||
onRefreshOutputDevices: refreshOutputDevices,
|
||||
playbackVolume,
|
||||
onPlaybackVolumeChange: setPlaybackVolume,
|
||||
autoVolume,
|
||||
onAutoVolumeChange: setAutoVolume,
|
||||
ownMicClicks,
|
||||
onOwnMicClicksChange: setOwnMicClicks,
|
||||
otherMicClicks,
|
||||
onOtherMicClicksChange: setOtherMicClicks,
|
||||
onPlayTestTone: handlePlayTestTone,
|
||||
inputDevices,
|
||||
inputDeviceId,
|
||||
@@ -11379,6 +11724,10 @@ function AppInner() {
|
||||
vadHangover,
|
||||
onVadHangoverChange: setVadHangover,
|
||||
pushToTalk,
|
||||
continuous,
|
||||
onContinuousChange: setContinuous,
|
||||
typingAttenuation,
|
||||
onTypingAttenuationChange: setTypingAttenuation,
|
||||
onPushToTalkChange: setPushToTalk,
|
||||
pttBinding,
|
||||
onPttBindingChange: setPttBinding,
|
||||
@@ -12204,6 +12553,7 @@ function AppInner() {
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
<NewsTicker />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
// Lazy loader for Google WebRTC's AEC3 (compiled to WASM via
|
||||
// @ennuicastr/webrtcaec3.js), an opt-in, stronger alternative to the browser's
|
||||
// native echo cancellation for speaker+mic (no headset) setups where native
|
||||
// AEC often isn't enough (github.com/Moepchi/webspeak3 issue #2). Loaded as a
|
||||
// AEC often isn't enough (github.com/WebSpeak3/webspeak3 issue #2). Loaded as a
|
||||
// plain <script> tag rather than bundled: the module's own glue code resolves
|
||||
// its .wasm file next to its own <script src>, by a name it decides itself -
|
||||
// see scripts/sync-aec3-assets.mjs for how that file gets there.
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 24 KiB |
+1
-1
@@ -172,7 +172,7 @@ const DEMO_CHAT_LINES = [
|
||||
"my mic was muted, sorry",
|
||||
"back",
|
||||
"who's hosting tonight?",
|
||||
"check out https://github.com/Moepchi/webspeak3",
|
||||
"check out https://github.com/WebSpeak3/webspeak3",
|
||||
];
|
||||
const DEMO_PM_LINES = [
|
||||
"hey, got a sec?",
|
||||
|
||||
@@ -42,6 +42,9 @@
|
||||
"donate.title": "Podpořit WebSpeak3 na Ko-fi",
|
||||
"pwa.updateAvailable": "Je k dispozici nová verze",
|
||||
"pwa.reload": "Načíst znovu",
|
||||
"news.label": "Novinky",
|
||||
"news.release": "Vyšel WebSpeak3 {version}",
|
||||
"news.theme": "Nový vzhled v obchodě: „{name}“ od {author}",
|
||||
"feedback.dialog.title": "Zpětná vazba",
|
||||
"feedback.dialog.intro": "Report bug or share idea to help improve WebSpeak3.",
|
||||
"feedback.dialog.category": "Kategorie",
|
||||
@@ -56,6 +59,11 @@
|
||||
"feedback.dialog.publishAsIssue": "Publikovat jako veřejný problém na GitHubu",
|
||||
"feedback.dialog.publishAsIssueHint": "Ponechte nezaškrtnuté, pokud chcete, aby vaše zpětná vazba zůstala soukromá a viditelná pouze správci.",
|
||||
"feedback.dialog.publishAsIssueHintBug": "Hlášení chyb jsou vždy zveřejněna jako veřejný problém na GitHubu.",
|
||||
"feedback.dialog.bug.environment": "Prohlížeč a operační systém",
|
||||
"feedback.dialog.bug.server": "TeamSpeak server (volitelné – zůstává soukromé, nikdy se nezveřejní)",
|
||||
"feedback.dialog.bug.steps": "Co jste dělali těsně předtím? (volitelné)",
|
||||
"feedback.dialog.bug.stepsPlaceholder": "např. vstup do kanálu, změna výstupního zařízení… Pomohlo znovu načíst stránku?",
|
||||
"feedback.dialog.bug.diagnostics": "Odesílané technické údaje",
|
||||
"feedback.dialog.send": "Odeslat",
|
||||
"restartNotice.title": "Krátké přerušení",
|
||||
"restartNotice.body": "Server se za chvíli krátce restartuje. Vaše připojení bude na okamžik přerušeno.",
|
||||
@@ -659,6 +667,8 @@
|
||||
"sounds.event.message": "Přijata zpráva",
|
||||
"sounds.event.poke": "Přijato šťouchnutí",
|
||||
"sounds.event.mute": "Přepnutí ztlumení",
|
||||
"sounds.event.micClickOn": "Kliknutí mikrofonu zap.",
|
||||
"sounds.event.micClickOff": "Kliknutí mikrofonu vyp.",
|
||||
"sounds.default": "Výchozí",
|
||||
"sounds.custom": "Vlastní soubor: {name}",
|
||||
"sounds.test": "▶ Test",
|
||||
@@ -685,5 +695,9 @@
|
||||
"log.fileTransferInvalidAddress": "Přenos souboru selhal (neplatná adresa)",
|
||||
"sounds.importFailed": "Balíček zvuků se nepodařilo načíst – je to platný soubor .ts3soundpack/ZIP?",
|
||||
"tabs.connections": "Připojení k serverům",
|
||||
"shortcut.ctrl": "Ctrl"
|
||||
"shortcut.ctrl": "Ctrl",
|
||||
"about.text": "WebSpeak3 je TeamSpeak klient pro prohlížeč, open source a bez instalace.",
|
||||
"about.memorial.title": "Na památku Akima",
|
||||
"about.memorial.text": "Odešel přes duhový most 21. 10. 2026. 🌈🐾",
|
||||
"about.close": "Zavřít"
|
||||
}
|
||||
+15
-1
@@ -42,6 +42,9 @@
|
||||
"donate.title": "WebSpeak3 auf Ko-fi unterstützen",
|
||||
"pwa.updateAvailable": "Neue Version verfügbar",
|
||||
"pwa.reload": "Neu laden",
|
||||
"news.label": "News",
|
||||
"news.release": "WebSpeak3 {version} ist erschienen",
|
||||
"news.theme": "Neues Design im Store: „{name}“ von {author}",
|
||||
"feedback.dialog.title": "Feedback",
|
||||
"feedback.dialog.intro": "Melde einen Fehler oder teile eine Idee zur Weiterentwicklung von WebSpeak3 mit.",
|
||||
"feedback.dialog.category": "Kategorie",
|
||||
@@ -56,6 +59,11 @@
|
||||
"feedback.dialog.publishAsIssue": "Als öffentliches GitHub-Issue veröffentlichen",
|
||||
"feedback.dialog.publishAsIssueHint": "Ohne Haken bleibt dein Feedback privat und geht nur an den Betreiber.",
|
||||
"feedback.dialog.publishAsIssueHintBug": "Fehlermeldungen werden immer als öffentliches GitHub-Issue veröffentlicht.",
|
||||
"feedback.dialog.bug.environment": "Browser & Betriebssystem",
|
||||
"feedback.dialog.bug.server": "TeamSpeak-Server (optional – bleibt privat, wird nie veröffentlicht)",
|
||||
"feedback.dialog.bug.steps": "Was hast du direkt davor gemacht? (optional)",
|
||||
"feedback.dialog.bug.stepsPlaceholder": "z. B. Channel betreten, Ausgabegerät gewechselt… Hat Neuladen der Seite geholfen?",
|
||||
"feedback.dialog.bug.diagnostics": "Mitgesendete technische Details",
|
||||
"feedback.dialog.send": "Senden",
|
||||
"feedback.dialog.cancel": "Abbrechen",
|
||||
"restartNotice.title": "Kurze Unterbrechung",
|
||||
@@ -659,6 +667,8 @@
|
||||
"sounds.event.message": "Nachricht empfangen",
|
||||
"sounds.event.poke": "Anstupsen erhalten",
|
||||
"sounds.event.mute": "Stummschaltung umgeschaltet",
|
||||
"sounds.event.micClickOn": "Mikro Klick an",
|
||||
"sounds.event.micClickOff": "Mikro Klick aus",
|
||||
"sounds.default": "Standard",
|
||||
"sounds.custom": "Eigene Datei: {name}",
|
||||
"sounds.test": "▶ Testen",
|
||||
@@ -685,5 +695,9 @@
|
||||
"log.fileTransferInvalidAddress": "Dateiübertragung fehlgeschlagen (ungültige Adresse)",
|
||||
"sounds.importFailed": "Das Soundpack konnte nicht gelesen werden – ist es eine gültige .ts3soundpack-/ZIP-Datei?",
|
||||
"tabs.connections": "Server-Verbindungen",
|
||||
"shortcut.ctrl": "Strg"
|
||||
"shortcut.ctrl": "Strg",
|
||||
"about.text": "WebSpeak3 ist ein TeamSpeak-Client für den Browser, quelloffen und ohne Installation.",
|
||||
"about.memorial.title": "In Erinnerung an Akimo",
|
||||
"about.memorial.text": "Am 21.10.2026 über die Regenbogenbrücke gegangen. 🌈🐾",
|
||||
"about.close": "Schließen"
|
||||
}
|
||||
+15
-1
@@ -42,6 +42,9 @@
|
||||
"donate.title": "Support WebSpeak3 on Ko-fi",
|
||||
"pwa.updateAvailable": "New version available",
|
||||
"pwa.reload": "Reload",
|
||||
"news.label": "News",
|
||||
"news.release": "WebSpeak3 {version} is out",
|
||||
"news.theme": "New design in the store: \"{name}\" by {author}",
|
||||
"feedback.dialog.title": "Feedback",
|
||||
"feedback.dialog.intro": "Report a bug or share an idea to help improve WebSpeak3.",
|
||||
"feedback.dialog.category": "Category",
|
||||
@@ -56,6 +59,11 @@
|
||||
"feedback.dialog.publishAsIssue": "Publish as a public GitHub issue",
|
||||
"feedback.dialog.publishAsIssueHint": "Leave unchecked to keep your feedback private, visible only to the maintainer.",
|
||||
"feedback.dialog.publishAsIssueHintBug": "Bug reports are always published as a public GitHub issue.",
|
||||
"feedback.dialog.bug.environment": "Browser & operating system",
|
||||
"feedback.dialog.bug.server": "TeamSpeak server (optional – stays private, never published)",
|
||||
"feedback.dialog.bug.steps": "What did you do right before? (optional)",
|
||||
"feedback.dialog.bug.stepsPlaceholder": "e.g. joined a channel, switched output device… Did reloading the page help?",
|
||||
"feedback.dialog.bug.diagnostics": "Technical details sent along",
|
||||
"feedback.dialog.send": "Send",
|
||||
"restartNotice.title": "Brief interruption",
|
||||
"restartNotice.body": "The server is about to restart briefly. Your connection will drop for a moment.",
|
||||
@@ -659,6 +667,8 @@
|
||||
"sounds.event.message": "Message received",
|
||||
"sounds.event.poke": "Poke received",
|
||||
"sounds.event.mute": "Mute toggled",
|
||||
"sounds.event.micClickOn": "Mic click on",
|
||||
"sounds.event.micClickOff": "Mic click off",
|
||||
"sounds.default": "Default",
|
||||
"sounds.custom": "Custom file: {name}",
|
||||
"sounds.test": "▶ Test",
|
||||
@@ -685,5 +695,9 @@
|
||||
"log.fileTransferInvalidAddress": "File transfer failed (invalid address)",
|
||||
"sounds.importFailed": "Could not read this soundpack - is it a valid .ts3soundpack/ZIP file?",
|
||||
"tabs.connections": "Server connections",
|
||||
"shortcut.ctrl": "Ctrl"
|
||||
"shortcut.ctrl": "Ctrl",
|
||||
"about.text": "WebSpeak3 is a TeamSpeak client for the browser, open source and with nothing to install.",
|
||||
"about.memorial.title": "In memory of Akimo",
|
||||
"about.memorial.text": "Crossed the rainbow bridge on October 21, 2026. 🌈🐾",
|
||||
"about.close": "Close"
|
||||
}
|
||||
+15
-1
@@ -42,6 +42,9 @@
|
||||
"donate.title": "حمایت از WebSpeak3 در Ko-fi",
|
||||
"pwa.updateAvailable": "نسخه جدید موجود است",
|
||||
"pwa.reload": "بارگذاری مجدد",
|
||||
"news.label": "اخبار",
|
||||
"news.release": "WebSpeak3 {version} منتشر شد",
|
||||
"news.theme": "طرح جدید در فروشگاه: «{name}» از {author}",
|
||||
"feedback.dialog.title": "بازخورد",
|
||||
"feedback.dialog.intro": "یک اشکال گزارش بده یا ایدهای برای بهبود WebSpeak3 به اشتراک بگذار.",
|
||||
"feedback.dialog.category": "دسته",
|
||||
@@ -56,6 +59,11 @@
|
||||
"feedback.dialog.publishAsIssue": "بهصورت Issue عمومی در گیتهاب منتشر شود",
|
||||
"feedback.dialog.publishAsIssueHint": "اگر تیک نزنی، بازخوردت خصوصی میماند و فقط برای مدیر پروژه قابل مشاهده است.",
|
||||
"feedback.dialog.publishAsIssueHintBug": "گزارش اشکالها همیشه بهصورت Issue عمومی در گیتهاب منتشر میشوند.",
|
||||
"feedback.dialog.bug.environment": "مرورگر و سیستمعامل",
|
||||
"feedback.dialog.bug.server": "سرور TeamSpeak (اختیاری – خصوصی میماند و هرگز منتشر نمیشود)",
|
||||
"feedback.dialog.bug.steps": "درست قبل از آن چه کاری کردید؟ (اختیاری)",
|
||||
"feedback.dialog.bug.stepsPlaceholder": "مثلاً ورود به کانال، تغییر دستگاه خروجی… آیا بارگذاری مجدد صفحه کمک کرد؟",
|
||||
"feedback.dialog.bug.diagnostics": "جزئیات فنی ارسالشده",
|
||||
"feedback.dialog.send": "ارسال",
|
||||
"restartNotice.title": "وقفه کوتاه",
|
||||
"restartNotice.body": "سرور بهزودی برای مدت کوتاهی مجدداً راهاندازی میشود. اتصال شما لحظهای قطع خواهد شد.",
|
||||
@@ -658,6 +666,8 @@
|
||||
"sounds.event.message": "پیام دریافت شد",
|
||||
"sounds.event.poke": "سقلمه دریافت شد",
|
||||
"sounds.event.mute": "تغییر حالت بیصدا",
|
||||
"sounds.event.micClickOn": "کلیک میکروفون روشن",
|
||||
"sounds.event.micClickOff": "کلیک میکروفون خاموش",
|
||||
"sounds.default": "پیشفرض",
|
||||
"sounds.custom": "فایل سفارشی: {name}",
|
||||
"sounds.test": "▶ آزمایش",
|
||||
@@ -684,5 +694,9 @@
|
||||
"log.fileTransferInvalidAddress": "انتقال فایل ناموفق بود (نشانی نامعتبر)",
|
||||
"sounds.importFailed": "این بسته صدا خوانده نشد - آیا یک فایل .ts3soundpack/ZIP معتبر است؟",
|
||||
"tabs.connections": "اتصالهای سرور",
|
||||
"shortcut.ctrl": "Ctrl"
|
||||
"shortcut.ctrl": "Ctrl",
|
||||
"about.text": "WebSpeak3 یک کلاینت TeamSpeak برای مرورگر است، متنباز و بدون نیاز به نصب.",
|
||||
"about.memorial.title": "به یاد Akimo",
|
||||
"about.memorial.text": "در ۲۱ اکتبر ۲۰۲۶ از پل رنگینکمان گذشت. 🌈🐾",
|
||||
"about.close": "بستن"
|
||||
}
|
||||
@@ -512,6 +512,8 @@
|
||||
"sounds.event.message": "收到消息",
|
||||
"sounds.event.poke": "收到戳一戳",
|
||||
"sounds.event.mute": "切换静音",
|
||||
"sounds.event.micClickOn": "麦克风开启提示音",
|
||||
"sounds.event.micClickOff": "麦克风关闭提示音",
|
||||
"sounds.default": "默认",
|
||||
"sounds.custom": "自定义文件:{name}",
|
||||
"sounds.test": "▶ 测试",
|
||||
@@ -540,6 +542,9 @@
|
||||
"donate.title": "在 Ko-fi 上支持 WebSpeak3",
|
||||
"pwa.updateAvailable": "有新版本可用",
|
||||
"pwa.reload": "重新加载",
|
||||
"news.label": "新闻",
|
||||
"news.release": "WebSpeak3 {version} 已发布",
|
||||
"news.theme": "商店新设计:“{name}”,作者 {author}",
|
||||
"feedback.dialog.title": "反馈",
|
||||
"feedback.dialog.intro": "报告一个问题,或分享改进 WebSpeak3 的想法。",
|
||||
"feedback.dialog.category": "类别",
|
||||
@@ -554,6 +559,11 @@
|
||||
"feedback.dialog.publishAsIssue": "作为公开的 GitHub Issue 发布",
|
||||
"feedback.dialog.publishAsIssueHint": "不勾选则反馈保持私密,仅维护者可见。",
|
||||
"feedback.dialog.publishAsIssueHintBug": "错误报告将始终作为公开的 GitHub Issue 发布。",
|
||||
"feedback.dialog.bug.environment": "浏览器和操作系统",
|
||||
"feedback.dialog.bug.server": "TeamSpeak 服务器(可选——保密,绝不公开)",
|
||||
"feedback.dialog.bug.steps": "出问题前你做了什么?(可选)",
|
||||
"feedback.dialog.bug.stepsPlaceholder": "例如:进入频道、切换输出设备…… 刷新页面后是否恢复?",
|
||||
"feedback.dialog.bug.diagnostics": "一并发送的技术信息",
|
||||
"feedback.dialog.send": "发送",
|
||||
"feedback.dialog.cancel": "取消",
|
||||
"feedback.dialog.sending": "发送中…",
|
||||
@@ -684,5 +694,9 @@
|
||||
"log.fileTransferInvalidAddress": "文件传输失败(地址无效)",
|
||||
"sounds.importFailed": "无法读取此音效包——它是有效的 .ts3soundpack/ZIP 文件吗?",
|
||||
"tabs.connections": "服务器连接",
|
||||
"shortcut.ctrl": "Ctrl"
|
||||
"shortcut.ctrl": "Ctrl",
|
||||
"about.text": "WebSpeak3 是一款浏览器 TeamSpeak 客户端,开源且无需安装。",
|
||||
"about.memorial.title": "纪念 Akimo",
|
||||
"about.memorial.text": "于 2026 年 10 月 21 日走过彩虹桥。🌈🐾",
|
||||
"about.close": "关闭"
|
||||
}
|
||||
@@ -24,6 +24,8 @@ const EVENT_KEYWORDS: Record<SoundEventId, string[]> = {
|
||||
message: ["textmessagereceived", "chatmessage", "newmessage", "message"],
|
||||
poke: ["gotpoked", "poke"],
|
||||
mute: ["micmuted", "microphonemuted", "micactivated", "microphoneactivated"],
|
||||
micClickOn: ["micclickon"],
|
||||
micClickOff: ["micclickoff"],
|
||||
};
|
||||
|
||||
function normalize(filename: string): string {
|
||||
|
||||
+29
-2
@@ -1,6 +1,25 @@
|
||||
export type SoundEventId = "connect" | "disconnect" | "clientJoin" | "clientLeave" | "message" | "poke" | "mute";
|
||||
export type SoundEventId =
|
||||
| "connect"
|
||||
| "disconnect"
|
||||
| "clientJoin"
|
||||
| "clientLeave"
|
||||
| "message"
|
||||
| "poke"
|
||||
| "mute"
|
||||
| "micClickOn"
|
||||
| "micClickOff";
|
||||
|
||||
export const SOUND_EVENTS: SoundEventId[] = ["connect", "disconnect", "clientJoin", "clientLeave", "message", "poke", "mute"];
|
||||
export const SOUND_EVENTS: SoundEventId[] = [
|
||||
"connect",
|
||||
"disconnect",
|
||||
"clientJoin",
|
||||
"clientLeave",
|
||||
"message",
|
||||
"poke",
|
||||
"mute",
|
||||
"micClickOn",
|
||||
"micClickOff",
|
||||
];
|
||||
|
||||
/** "ide" swaps the default chimes for synthetic terminal blips (Command Center layout). */
|
||||
type SoundStyle = "classic" | "ide";
|
||||
@@ -215,6 +234,10 @@ function synthNotes(event: SoundEventId): SynthNote[] {
|
||||
];
|
||||
case "mute":
|
||||
return [{ delay: 0, freq: 660, duration: 0.06, gain: 0.3 }];
|
||||
case "micClickOn":
|
||||
return [{ delay: 0, freq: 1400, duration: 0.03, gain: 0.15 }];
|
||||
case "micClickOff":
|
||||
return [{ delay: 0, freq: 900, duration: 0.03, gain: 0.15 }];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -247,6 +270,10 @@ function ideNotes(event: SoundEventId): SynthNote[] {
|
||||
];
|
||||
case "mute":
|
||||
return [{ delay: 0, freq: 300, endFreq: 50, duration: 0.04, gain: 0.15, type: "square" }];
|
||||
case "micClickOn":
|
||||
return [{ delay: 0, freq: 1600, duration: 0.02, gain: 0.08, type: "square" }];
|
||||
case "micClickOff":
|
||||
return [{ delay: 0, freq: 1000, duration: 0.02, gain: 0.08, type: "square" }];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+67
-11
@@ -87,6 +87,12 @@ export class MicCapture {
|
||||
/** Push-to-talk: send while `pttPressed` instead of voice activation. */
|
||||
pushToTalk = false;
|
||||
pttPressed = false;
|
||||
/** Send all the time, no voice activation (ignored while pushToTalk). */
|
||||
continuous = false;
|
||||
/** Damp the mic right after a keystroke, so typing doesn't trigger
|
||||
* voice activation and is quieter while talking. See noteTyping(). */
|
||||
typingAttenuation = false;
|
||||
private typingUntil = 0;
|
||||
|
||||
constructor(context: AudioContext, options: MicCaptureOptions) {
|
||||
this.context = context;
|
||||
@@ -139,6 +145,10 @@ export class MicCapture {
|
||||
this.aec3.process(this.aec3Out, captureIn);
|
||||
input = this.aec3Out[0];
|
||||
}
|
||||
if (this.typingAttenuation && this.context.currentTime < this.typingUntil) {
|
||||
// Copy first: `raw` is the input buffer, not ours to change.
|
||||
input = input.map((v) => v * 0.1);
|
||||
}
|
||||
// Mirrors the (possibly AEC3-cancelled) signal to the output buffer, so
|
||||
// setMonitoring() below can tap what's actually being sent rather than
|
||||
// the raw pre-cancellation mic feed - a self-test through the raw feed
|
||||
@@ -152,7 +162,7 @@ export class MicCapture {
|
||||
|
||||
const now = this.context.currentTime;
|
||||
if (rms >= this.threshold) this.activeUntil = now + this.hangoverSeconds;
|
||||
const talking = this.pushToTalk ? this.pttPressed : now < this.activeUntil;
|
||||
const talking = this.pushToTalk ? this.pttPressed : this.continuous || now < this.activeUntil;
|
||||
// Shared audio (music, a video) has its own pauses; keep sending throughout.
|
||||
const shouldBeActive = this.extra !== null || talking;
|
||||
if (shouldBeActive !== this.active) {
|
||||
@@ -201,6 +211,11 @@ export class MicCapture {
|
||||
this.silence.connect(this.context.destination);
|
||||
}
|
||||
|
||||
/** Call on every keystroke; with typingAttenuation on, the next ~0.2 s are damped. */
|
||||
noteTyping(): void {
|
||||
this.typingUntil = this.context.currentTime + 0.2;
|
||||
}
|
||||
|
||||
/** Mixes a second stream (e.g. a shared tab's audio) into what is sent, or
|
||||
* removes it with null. The caller keeps ownership of the stream. */
|
||||
setExtraAudio(stream: MediaStream | null): void {
|
||||
@@ -347,21 +362,44 @@ type SinkableContext = AudioContext & { setSinkId?: (id: string) => Promise<void
|
||||
* `AudioContext.setSinkId` (Chrome 110+) only retargets the context itself,
|
||||
* while `HTMLMediaElement.setSinkId` (Chrome, and Firefox 130+) only works on
|
||||
* a media element. Routing through the element lets `setOutputDevice` use
|
||||
* whichever one the browser actually supports.
|
||||
* whichever one the browser actually supports. Browsers without
|
||||
* `HTMLMediaElement.setSinkId` (mobile ones) play straight to the context.
|
||||
*/
|
||||
export class AudioPlayer {
|
||||
private nextTime = 0;
|
||||
private destination: MediaStreamAudioDestinationNode;
|
||||
private element: SinkableElement;
|
||||
// null where media elements can't switch devices (Android Chrome/Firefox):
|
||||
// there the detour buys nothing and its <audio> element stays silent.
|
||||
private destination: MediaStreamAudioDestinationNode | null = null;
|
||||
private element: SinkableElement | null = null;
|
||||
private gain: GainNode;
|
||||
// Voice frames only (not test tone, clicks or mic monitoring), so the
|
||||
// leveler can sit between them and the volume gain.
|
||||
private voice: GainNode;
|
||||
private leveler: DynamicsCompressorNode;
|
||||
private context: AudioContext;
|
||||
private aecTap: ScriptProcessorNode | null = null;
|
||||
private aecSink: GainNode | null = null;
|
||||
|
||||
constructor(context: AudioContext) {
|
||||
this.context = context;
|
||||
this.destination = context.createMediaStreamDestination();
|
||||
this.gain = context.createGain();
|
||||
this.voice = context.createGain();
|
||||
// "Automatic volume leveling": evens out loud and quiet speakers. Browsers
|
||||
// add their own makeup gain, so quiet voices come up too.
|
||||
// ponytail: one compressor for the whole mix, not per speaker like TS3.
|
||||
this.leveler = context.createDynamicsCompressor();
|
||||
this.leveler.threshold.value = -30;
|
||||
this.leveler.knee.value = 10;
|
||||
this.leveler.ratio.value = 4;
|
||||
this.leveler.attack.value = 0.005;
|
||||
this.leveler.release.value = 0.3;
|
||||
this.leveler.connect(this.gain);
|
||||
this.voice.connect(this.gain);
|
||||
if (!("setSinkId" in HTMLMediaElement.prototype)) {
|
||||
this.gain.connect(context.destination);
|
||||
return;
|
||||
}
|
||||
this.destination = context.createMediaStreamDestination();
|
||||
this.gain.connect(this.destination);
|
||||
this.element = document.createElement("audio") as SinkableElement;
|
||||
this.element.autoplay = true;
|
||||
@@ -370,6 +408,12 @@ export class AudioPlayer {
|
||||
document.body.appendChild(this.element);
|
||||
}
|
||||
|
||||
/** Mobile browsers ignore `autoplay` for audible media, so the hidden
|
||||
* element stays paused (silent) until play() runs inside a user gesture. */
|
||||
unlock(): void {
|
||||
if (this.element?.paused) this.element.play().catch(() => {});
|
||||
}
|
||||
|
||||
playFrame(base64Pcm: string): void {
|
||||
const int16 = base64ToInt16(base64Pcm);
|
||||
const frames = int16.length / 2;
|
||||
@@ -385,7 +429,7 @@ export class AudioPlayer {
|
||||
|
||||
const source = this.context.createBufferSource();
|
||||
source.buffer = buffer;
|
||||
source.connect(this.gain);
|
||||
source.connect(this.voice);
|
||||
|
||||
const now = this.context.currentTime;
|
||||
if (this.nextTime < now + 0.02) {
|
||||
@@ -406,6 +450,11 @@ export class AudioPlayer {
|
||||
this.gain.gain.value = gain;
|
||||
}
|
||||
|
||||
setAutoVolume(enabled: boolean): void {
|
||||
this.voice.disconnect();
|
||||
this.voice.connect(enabled ? this.leveler : this.gain);
|
||||
}
|
||||
|
||||
/** The node all voice/test audio ultimately reaches - use as a mic-monitoring target so it also respects volume/output device. */
|
||||
getInputNode(): AudioNode {
|
||||
return this.gain;
|
||||
@@ -417,12 +466,15 @@ export class AudioPlayer {
|
||||
osc.type = "sine";
|
||||
osc.frequency.value = 440;
|
||||
const toneGain = this.context.createGain();
|
||||
toneGain.gain.value = 0.3;
|
||||
const now = this.context.currentTime;
|
||||
// Soft fade in and decay instead of a flat, hard-edged beep.
|
||||
toneGain.gain.setValueAtTime(0, now);
|
||||
toneGain.gain.linearRampToValueAtTime(0.15, now + 0.03);
|
||||
toneGain.gain.exponentialRampToValueAtTime(0.0001, now + 0.8);
|
||||
osc.connect(toneGain);
|
||||
toneGain.connect(this.gain);
|
||||
const now = this.context.currentTime;
|
||||
osc.start(now);
|
||||
osc.stop(now + 0.6);
|
||||
osc.stop(now + 0.85);
|
||||
osc.onended = () => {
|
||||
osc.disconnect();
|
||||
toneGain.disconnect();
|
||||
@@ -461,7 +513,7 @@ export class AudioPlayer {
|
||||
|
||||
/** Routes playback to a specific device (empty string = system default). */
|
||||
async setOutputDevice(deviceId: string): Promise<void> {
|
||||
if (typeof this.element.setSinkId === "function") {
|
||||
if (typeof this.element?.setSinkId === "function") {
|
||||
await this.element.setSinkId(deviceId);
|
||||
return;
|
||||
}
|
||||
@@ -474,9 +526,13 @@ export class AudioPlayer {
|
||||
|
||||
dispose(): void {
|
||||
this.detachAecRenderTap();
|
||||
this.voice.disconnect();
|
||||
this.leveler.disconnect();
|
||||
this.gain.disconnect();
|
||||
if (!this.element) return;
|
||||
this.element.pause();
|
||||
this.element.srcObject = null;
|
||||
this.element.remove();
|
||||
this.destination.stream.getTracks().forEach((t) => t.stop());
|
||||
this.destination?.stream.getTracks().forEach((t) => t.stop());
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user