Compare commits

...
Author SHA1 Message Date
MoepchiandClaude Sonnet 5 77e147cc27 Add Hilfe dropdown menu (About, GitHub, Changelog, ToS)
Replaces the inert "Hilfe" label with a real dropdown, folding the
standalone ToS menubar item into it.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Hu2cuPLqpuKVfd9wWFFakU
2026-09-14 18:42:57 +00:00
MoepchiandClaude Sonnet 5 b0495367cb Link ToS modal to legal pages, add report feedback category
- ToS modal: Datenschutzerklärung/Impressum words are now real links
- Feedback form: new "report" category (abuse/violation), hidden
  GitHub-issue option since reports must stay private
- Gateways: accept "report" in FEEDBACK_CATEGORIES

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Hu2cuPLqpuKVfd9wWFFakU
2026-09-14 18:33:27 +00:00
MoepchiandClaude Sonnet 5 73303e1229 Add SIGTERM restart-warning broadcast and first-visit ToS modal
- Gateway: on SIGTERM, broadcast a "notice" event to every connected
  socket before shutting down, so an active call/stream doesn't just
  silently drop during a redeploy.
- Web client: new "notice" event handling shows a non-dismissable
  restart-warning dialog; new ToS modal shown on first visit to the
  own-hosted instance (client.webspeak3.de only), versioned via
  localStorage, reopenable from the menu.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Hu2cuPLqpuKVfd9wWFFakU
2026-09-14 18:15:15 +00:00
MoepchiandClaude Opus 4.8 741528220e Bump tsclientlib: SRV on exact host only, no apex fallback (#9)
Pulls in the resolver fix so a subdomain with its own A record (e.g.
ts6.rush-zone.com) is no longer hijacked onto a different server's apex
SRV. Fixes #9.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Hu2cuPLqpuKVfd9wWFFakU
2026-09-14 15:02:42 +00:00
MoepchiandClaude Opus 5 0b34e7ecfb web: put the donation pill below the feedback button
The two floating buttons swap places: the Ko-fi pill now sits in the
corner at bottom: 5.5rem and the feedback button stacks above it at
8.5rem, which keeps the same 12px gap the previous arrangement had.

The offset still follows the instance rather than the dialog, it just
moved to the other element: the feedback button only shifts up where the
donation pill is actually rendered, and takes the corner spot where the
build dropped it via VITE_DONATE_URL=.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Hu2cuPLqpuKVfd9wWFFakU
2026-09-11 16:28:18 +00:00
MoepchiandClaude Opus 5 6ebc3e22e0 web: add a Ko-fi donation button
A small pill in the bottom right corner, in Ko-fi's own red rather than
the theme colors so it reads as what it is. It sits above the feedback
button where that one exists and takes its place where it does not; the
offset follows the instance rather than the dialog, so opening feedback
does not make it jump.

Unlike the feedback button this is not limited to the maintainer's own
instance - it ships in every build, the Docker image included. Since
that means self-hosters carry someone else's donation link, there is a
way out: VITE_DONATE_URL= (empty) drops the button, any other value
retargets it, and the Dockerfile passes it through as --build-arg
DONATE_URL. The "keep" sentinel there is not decoration - an unset and
an empty build arg are indistinguishable inside RUN, so without it
"not passed" would silently mean "remove".

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Hu2cuPLqpuKVfd9wWFFakU
2026-09-11 16:12:58 +00:00
MoepchiandClaude Opus 5 fa4daf7831 gateway: serve nothing to browsers when WEB_STATIC=0
The notice page at "/" was the last thing a browser could get from a
host that only exists to answer /ws and /api/feedback. It is gone; every
path now 404s, so the gateway hostname has no web presence at all.

That broke the container healthcheck, which probed "/" and required a
200 - a correctly configured gateway would have reported itself
unhealthy. The probe now has its own route, /healthz, served before the
WEB_STATIC branch so it answers in either mode.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Hu2cuPLqpuKVfd9wWFFakU
2026-09-11 15:34:16 +00:00
MoepchiandClaude Opus 5 f48c1cc91a Say what WEB_STATIC=0 actually does in the startup log
The line pointed at the Vite dev server, which is only ever right on a
developer's machine - on a deployed gateway it reads like a bug report
waiting to happen.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Hu2cuPLqpuKVfd9wWFFakU
2026-09-11 12:45:02 +00:00
MoepchiandClaude Opus 5 cc715e24b2 Fix the feedback URL and stop serving a UI when WEB_STATIC=0
VITE_GATEWAY_URL names a WebSocket origin, and FEEDBACK_URL was derived
from it verbatim - so with VITE_GATEWAY_URL=wss://gateway.example the
form posted to wss://gateway.example/api/feedback, which fetch() refuses
outright ("TypeError: unknown scheme"). Every submission from a
separately hosted frontend failed before it left the browser. Map the
scheme back to http(s); an already-http VITE_GATEWAY_URL is untouched.

While there: WEB_STATIC=0 answered every path with the dev hint page,
which talks about localhost:5173 and npm run dev. That page is wrong for
a gateway that is reachable publicly, and an SPA-shaped answer on every
path makes the host look like a second, stale copy of the app. Serve a
short deployment-neutral notice at "/" and 404 everywhere else; the dev
hint stays for the case it is actually about, a missing web/dist.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Hu2cuPLqpuKVfd9wWFFakU
2026-09-11 12:39:50 +00:00
MoepchiandClaude Opus 5 2ee6d1f0b5 Stop the service worker from stranding clients
Between 48f5e35 (07.09., registerType: 'autoUpdate') and 5b5f4ca (10.09.,
switched to 'prompt') every client that cached the app froze: the new
worker sits in `waiting` and the only code that could release it - the
update toast - lives in the build behind that worker. Their next update
never arrives, and Pages deletes the hashed assets they still run from,
so the bundle they serve does not exist on the server any more. That is
how the feedback form went missing on client.webspeak3.de.

- Back to 'autoUpdate', with skipWaiting/clientsClaim spelled out: the
  plugin only sets them when it also injects registerSW.js, so with
  injectRegister: false the generated worker was byte-identical to the
  'prompt' one. Verified in dist/sw.js.
- onNeedReload instead of onNeedRefresh: the worker takes over on its
  own, the toast only decides *when* to reload, so nobody is thrown out
  of a running connection.
- version.json plus a __BUILD_ID__ baked into the bundle, checked every
  30 min and on tab focus, deliberately routed around the worker (not in
  globPatterns, so never precached). If the server is on another build
  and no new worker turns up, the worker is wedged and the button clears
  registrations and caches instead of reloading into the same cache.
- Dismissing the toast snoozes for 30 min rather than for good.

Verified in headless Chromium against simulated deploys: a client stuck
on the old worker lands on the new bundle at the first plain F5.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Hu2cuPLqpuKVfd9wWFFakU
2026-09-11 12:20:53 +00:00
MoepchiandClaude Opus 5 06f38b4582 Switch the streaming UI back on
The gateway on the VPS was rebuilt on the v0.11.0-beta.1 image and now
answers setupStream/joinStream/sendStreamSignal, so the condition the kill
switch was waiting for is met. Verified against the live gateway rather
than assumed: a WebSocket connect through gateway.webspeak3.de reached a
real TS6 server, and all five stream commands are present in the running
dist.

The switch itself stays - it is the lever for the next time the frontend
ships a stream feature before the gateway has it. The durable fix is still
a capability handshake; see ROADMAP.md.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Hu2cuPLqpuKVfd9wWFFakU
2026-09-11 11:23:54 +00:00
MoepchiandClaude Opus 5 5024bf9856 Switch the streaming UI off until the gateway catches up
client.webspeak3.de is rebuilt by Cloudflare Pages on every push to main, but
the gateway and connector are a Docker image that has to be pulled onto the
host by hand. v0.11.0-beta.1 therefore put a browser that knows setupStream in
front of a gateway that does not - and an unsupported setupStream is not an
error, it is silence: the publish panel waits at "starting" forever, after the
browser has already asked the user to share a screen. That reads as a broken
feature, which is worse than an absent one.

Both entry points are gated on one flag: the toolbar button and the "watch
stream" context-menu item. The publisher is tree-shaken out of the bundle as a
result, so nothing can reach the gateway by accident. Flip it back once the
deployed gateway is on v0.11.0-beta.1 or newer.

The durable fix is a capability handshake so the client can tell what its
gateway supports instead of assuming; noted in the roadmap.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Hu2cuPLqpuKVfd9wWFFakU
2026-09-11 06:39:13 +00:00
MoepchiandClaude Opus 5 478e5c0384 Merge: TS6 screen streaming (alpha)
Adds screen streaming to and from TeamSpeak 6, marked alpha and unstable in
the UI and the docs because it speaks a protocol TeamSpeak does not publish.
Also repoints both submodules at Moepchi forks, so a fresh clone resolves
every pinned commit.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Hu2cuPLqpuKVfd9wWFFakU
2026-09-11 06:27:35 +00:00
10 changed files with 625 additions and 45 deletions

No files matched your search

+9 -2
View File
@@ -23,9 +23,16 @@ RUN npm ci
RUN node -e "require('@rolldown/binding-linux-x64-gnu')" \
|| (rm -rf node_modules package-lock.json && npm install)
COPY web/ ./
# The UI carries a small Ko-fi donation button (see web/src/App.tsx).
# `--build-arg DONATE_URL=` (empty) drops it, any other value points it
# elsewhere; left alone, the project default is used. The "keep" sentinel
# exists because an unset build arg and an empty one are indistinguishable
# inside RUN - without it, "not passed" would silently mean "remove".
ARG DONATE_URL=keep
# tsc -b currently fails on pre-existing type errors unrelated to this build;
# vite build alone is enough to produce the production bundle.
RUN npx vite build
RUN if [ "$DONATE_URL" = "keep" ]; then npx vite build; \
else VITE_DONATE_URL="$DONATE_URL" npx vite build; fi
# --- Gateway ----------------------------------------------------------------
FROM node:22-bookworm-slim AS gateway-builder
@@ -60,6 +67,6 @@ ENV CONNECTOR_BIN=/app/connector-bin/ts-connector
EXPOSE 8080
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD ["node", "-e", "fetch('http://127.0.0.1:8080/').then(r => { if (!r.ok) process.exit(1) }).catch(() => process.exit(1))"]
CMD ["node", "-e", "fetch('http://127.0.0.1:8080/healthz').then(r => { if (!r.ok) process.exit(1) }).catch(() => process.exit(1))"]
CMD ["node", "dist/index.js"]
+2
View File
@@ -178,6 +178,8 @@ Prefer to skip the build entirely? A prebuilt image is published on [Docker Hub]
docker run -d -p 8080:8080 --name webspeak3 moepchi/webspeak3:latest
```
The UI shows a small **Ko-fi donation button** in the bottom right corner. Building it yourself and would rather not carry someone else's donation link? `docker compose build --build-arg DONATE_URL=` removes it (any other value points it somewhere else). Outside Docker the same thing is a build-time variable: `VITE_DONATE_URL= npm run build` in `web/`.
<details>
<summary><b>🛠️ Manual installation (without Docker)</b></summary>
+7 -1
View File
@@ -25,7 +25,13 @@ This roadmap is intentionally outcome-focused. It does not promise fixed dates.
does not document, so the wire format was derived from observed behavior and
may break with any TS6 update. Connection setup, picture quality, and viewer
admission are not yet dependable. The "Server" connection mode (TS6's SFU) is
not implemented; only direct P2P works.
not implemented; only direct P2P works. The UI is currently switched off by a
build-time flag, because the hosted client updates on every push while the
gateway image is deployed by hand, and a browser that offers streaming to a
gateway too old to answer waits forever instead of reporting an error. The
fix is a capability handshake so the client can detect what its gateway
supports rather than assuming; until then the flag is flipped by hand after
the gateway has been updated.
- Safari and Mobile Safari audio/microphone behavior
- Uncommon TeamSpeak permission combinations and large permission sets
- Very large servers and long-running browser sessions
+37 -5
View File
@@ -82,7 +82,7 @@ const FEEDBACK_LOG_FILE = process.env.FEEDBACK_LOG_FILE ?? path.resolve(process.
// fresh file is started. Keeps disk usage bounded on a plain JSON-lines
// file with no other retention policy.
const FEEDBACK_LOG_MAX_BYTES = 5 * 1024 * 1024;
const FEEDBACK_CATEGORIES = new Set(["bug", "idea", "other"]);
const FEEDBACK_CATEGORIES = new Set(["bug", "idea", "report", "other"]);
const FEEDBACK_MESSAGE_MAX_LENGTH = 4000;
async function rotateFeedbackLogIfNeeded(): Promise<void> {
@@ -245,7 +245,7 @@ async function handleFeedback(req: IncomingMessage, res: ServerResponse) {
const DEV_HINT = `<!doctype html><html><body style="font:14px system-ui;padding:2rem;max-width:40rem">
<h1>WebSpeak3 gateway</h1>
<p>WebSocket: <code>/ws</code></p>
<p>Static UI is disabled (<code>WEB_STATIC=0</code>) or <code>web/dist</code> is missing.</p>
<p><code>web/dist</code> is missing — the UI has not been built yet.</p>
<p>For local development open the Vite app at <a href="http://localhost:5173/">http://localhost:5173/</a>
(run <code>npm run dev</code> in <code>web/</code>). Rebuild with <code>npm run build</code> in <code>web/</code>
to serve the UI from this port again.</p>
@@ -279,9 +279,24 @@ const requestHandler = (req: IncomingMessage, res: ServerResponse) => {
return;
}
// Container healthcheck target (see Dockerfile). Deliberately its own
// route rather than "/": with WEB_STATIC=0 every browser-facing path
// answers 404, and a probe against "/" would then report the process as
// unhealthy for doing exactly what it was configured to do.
if (requestUrl.pathname === "/healthz") {
res.writeHead(200, { "Content-Type": "text/plain; charset=utf-8" });
res.end("ok\n");
return;
}
if (!SERVE_STATIC) {
res.writeHead(200, { "Content-Type": "text/html; charset=utf-8" });
res.end(DEV_HINT);
// With the UI hosted elsewhere this process is an API endpoint and
// nothing else: no SPA fallback, and not even a notice page at "/",
// which would only put a second, stale-looking "app" on a hostname
// that is meant to answer /ws and /api/feedback. Everything a browser
// asks for is simply absent.
res.writeHead(404, { "Content-Type": "text/plain; charset=utf-8" });
res.end("Not found\n");
return;
}
let filePath = path.join(WEB_DIST, decodeURIComponent(requestUrl.pathname));
@@ -345,6 +360,23 @@ const heartbeatTimer = setInterval(() => {
wss.on("close", () => clearInterval(heartbeatTimer));
// Docker sends SIGTERM on `docker stop`/`docker compose up -d` (redeploy)
// before the default ~10s grace period elapses. Warn every connected
// browser tab so an active call/stream doesn't just silently drop, then
// exit quickly rather than waiting out the grace period doing nothing.
process.on("SIGTERM", () => {
const payload = JSON.stringify({ type: "notice", messageKey: "restartNotice.body" });
for (const socket of wss.clients) {
try {
socket.send(payload);
} catch {
/* socket already gone */
}
}
console.log(`[gateway] SIGTERM received, notified ${wss.clients.size} client(s), shutting down`);
setTimeout(() => process.exit(0), 500);
});
server.listen(PORT, () => {
const scheme = tlsOptions ? "https" : "http";
console.log(
@@ -354,7 +386,7 @@ server.listen(PORT, () => {
console.log(`Serving static UI from ${WEB_DIST}`);
console.log(`Dev tip: use http://localhost:5173/ for live UI; rebuild web/dist after UI changes if you open :${PORT}`);
} else {
console.log(`Static UI disabled (WEB_STATIC=0) — open http://localhost:5173/ for the Vite dev UI`);
console.log(`Static UI disabled (WEB_STATIC=0): WebSocket and /api/feedback only, no UI served from this host`);
}
});
+42
View File
@@ -1383,6 +1383,7 @@
cursor: pointer;
font-size: 12px;
text-align: left;
text-decoration: none;
}
.ts-menu-item:hover:not(:disabled) {
@@ -3717,6 +3718,11 @@
gap: 0.5rem;
}
/* Ueber der Spenden-Pille (2.25rem hoch, bottom: 5.5rem) statt darauf. */
.ts-feedback-fab-wrap-stacked {
bottom: 8.5rem;
}
.ts-feedback-fab {
width: 3rem;
height: 3rem;
@@ -3739,6 +3745,42 @@
box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}
/* Spenden-Pille. Bewusst nicht in den Theme-Farben: sie soll auffallen, ohne
gross zu sein - Ko-fi-Rot, feste Hoehe, Text nur als Beiwerk zum Symbol. */
.ts-donate-fab {
position: fixed;
right: 1.25rem;
bottom: 5.5rem;
z-index: 500;
display: inline-flex;
align-items: center;
gap: 0.4rem;
height: 2.25rem;
padding: 0 0.85rem;
border-radius: 999px;
border: 1px solid rgba(255, 255, 255, 0.18);
background: #ff5e5b;
color: #fff;
font-size: 12px;
font-weight: 600;
letter-spacing: 0.01em;
text-decoration: none;
white-space: nowrap;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}
.ts-donate-fab:hover {
background: #ff4b47;
transform: scale(1.06);
box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}
.ts-donate-fab-icon {
font-size: 14px;
line-height: 1;
}
.ts-feedback-bubble {
position: relative;
max-width: 13rem;
+410 -28
View File
@@ -86,13 +86,23 @@ const GATEWAY_URL = import.meta.env.DEV
// Same derivation as GATEWAY_URL above, but for a plain HTTP POST (the
// feedback form) instead of the WebSocket - see gateway/src/index.ts's
// /api/feedback handler.
// /api/feedback handler. VITE_GATEWAY_URL names a WebSocket origin, so its
// scheme has to be mapped back to http(s) here: fetch() refuses anything
// else outright ("TypeError: unknown scheme"), so with VITE_GATEWAY_URL set
// the form could not submit at all.
const FEEDBACK_URL = import.meta.env.DEV
? "http://localhost:8080/api/feedback"
: import.meta.env.VITE_GATEWAY_URL
? `${import.meta.env.VITE_GATEWAY_URL.replace(/\/$/, "")}/api/feedback`
? `${import.meta.env.VITE_GATEWAY_URL.replace(/\/$/, "").replace(/^ws(s?):\/\//, "http$1://")}/api/feedback`
: `${window.location.protocol}//${window.location.host}/api/feedback`;
// Ko-fi page of the project (.github/FUNDING.yml). Unlike the feedback button
// below this is not limited to the maintainer's own instance: it ships in
// every build, the Docker image included. Self-hosters who would rather not
// carry someone else's donation link can build with VITE_DONATE_URL= (empty)
// to drop the button, or point it somewhere else.
const DONATE_URL = import.meta.env.VITE_DONATE_URL ?? "https://ko-fi.com/moepchi";
// This file's frontend is deployed as multiple Cloudflare Pages projects
// from the same repo/build (see mem:deployment) - only the maintainer's own
// production instance talks to a gateway they actually operate and read
@@ -105,6 +115,15 @@ const FEEDBACK_URL = import.meta.env.DEV
const OWN_HOSTED_HOSTNAMES = new Set(["client.webspeak3.de"]);
const IS_OWN_HOSTED_INSTANCE = !DEMO_MODE && OWN_HOSTED_HOSTNAMES.has(window.location.hostname);
// Terms of use, own-hosted instance only (see TODO.md #2/#7.1). Versioned so
// a rule change can re-surface the modal: bump TOS_VERSION and everyone who
// accepted an older version is asked again.
const TOS_VERSION = "v1";
const TOS_KEY = "webspeak3-tos-accepted";
function hasAcceptedToS(): boolean {
return (localStorage.getItem(TOS_KEY) ?? "").startsWith(TOS_VERSION + ":");
}
// One-time migration from the pre-rename "ts-web-client:*" localStorage
// namespace so existing users don't lose their favorites/preferences.
(function migrateLegacyStorageKeys() {
@@ -1539,6 +1558,84 @@ function ConnectDialog({
);
}
// Shown when the gateway broadcasts a "notice" event (currently: a SIGTERM
// 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.
function RestartNoticeDialog({ message, onAck }: { message: string; onAck: () => void }) {
const t = useT();
return (
<div className="ts-dialog-backdrop">
<div className="ts-dialog ts-restart-notice-dialog" onClick={(e) => e.stopPropagation()}>
<div className="ts-dialog-titlebar">
<span>{t("restartNotice.title")}</span>
</div>
<div className="ts-dialog-body">
<p>{message}</p>
</div>
<div className="ts-dialog-buttons">
<div className="ts-dialog-buttons-right">
<button type="button" onClick={onAck}>
{t("restartNotice.ack")}
</button>
</div>
</div>
</div>
</div>
);
}
// Mandatory (first visit, own-hosted instance): backdrop-click does nothing,
// only "Accept" closes it. Reopened from the menu afterwards: an ordinary
// dismissable dialog, since acceptance already happened.
function ToSDialog({ mandatory, onAccept, onClose }: { mandatory: boolean; onAccept: () => void; onClose: () => void }) {
const t = useT();
return (
<div className="ts-dialog-backdrop" onClick={mandatory ? undefined : onClose}>
<div className="ts-dialog ts-tos-dialog" onClick={(e) => e.stopPropagation()}>
<div className="ts-dialog-titlebar">
<span>{t("tos.title")}</span>
</div>
<div className="ts-dialog-body">
<ol className="ts-tos-rules">
<li>{t("tos.rule1")}</li>
<li>{t("tos.rule2")}</li>
<li>{t("tos.rule3")}</li>
<li>
{t("tos.rule4Pre")}
<a href="https://webspeak3.de/datenschutz.html" target="_blank" rel="noreferrer">
{t("tos.privacyLinkText")}
</a>
{t("tos.rule4Post")}
</li>
<li>
{t("tos.rule5Pre")}
<a href="https://webspeak3.de/impressum.html" target="_blank" rel="noreferrer">
{t("tos.legalLinkText")}
</a>
{t("tos.rule5Post")}
</li>
<li>{t("tos.rule6")}</li>
</ol>
</div>
<div className="ts-dialog-buttons">
<div className="ts-dialog-buttons-right">
{mandatory ? (
<button type="button" onClick={onAccept}>
{t("tos.accept")}
</button>
) : (
<button type="button" onClick={onClose}>
{t("tos.close")}
</button>
)}
</div>
</div>
</div>
</div>
);
}
function ChannelPasswordDialog({
channelName,
wrongPassword,
@@ -1615,6 +1712,25 @@ const RESOLUTION_CHOICES = [360, 480, 720, 1080, 1440, 0];
const FPS_CHOICES = [5, 30, 60];
const AUDIO_BITRATE_CHOICES = [64, 96, 128, 192, 256, 320];
// Kill switch for the streaming UI.
//
// The frontend and the gateway ship on different schedules: client.webspeak3.de
// is rebuilt by Cloudflare Pages on every push to main, while the gateway and
// connector are a Docker image that has to be pulled onto the host by hand. So
// right after a release the browser can already know about setupStream while
// the gateway it talks to does not - and an unsupported setupStream is not an
// error, it is silence: the publish panel waits at "starting" forever, after
// the browser has already asked the user to share a screen.
//
// Flip this to false again whenever the frontend gains a stream feature the
// deployed gateway does not have yet, and back once it has caught up. The
// durable fix is a capability handshake so the client can tell on its own;
// see ROADMAP.md.
//
// On since 2026-09-11: the gateway on client.webspeak3.de was rebuilt on the
// v0.11.0-beta.1 image and answers setupStream/joinStream/sendStreamSignal.
const STREAM_UI_ENABLED = true;
// Streaming talks to TS6 over a protocol nobody published, so it is marked
// alpha everywhere the user can reach it: the settings dialog, both stream
// panels, and the toolbar button's tooltip.
@@ -1878,32 +1994,141 @@ function StreamSettingsDialog({
);
}
const SW_UPDATE_CHECK_INTERVAL_MS = 60 * 60 * 1000;
const VERSION_CHECK_INTERVAL_MS = 30 * 60 * 1000;
/** Floor between two version.json fetches, so tab-switching doesn't poll. */
const VERSION_CHECK_MIN_GAP_MS = 5 * 60 * 1000;
const UPDATE_TOAST_SNOOZE_MS = 30 * 60 * 1000;
/** What the server actually has right now. Deliberately routed around the
* service worker: version.json is not in Workbox's globPatterns, so it is
* never precached, and the cache-busting query plus `no-store` keeps any
* intermediate cache out of the answer too. */
async function fetchServerBuildId(): Promise<string | null> {
try {
const res = await fetch(`${import.meta.env.BASE_URL}version.json?t=${Date.now()}`, {
cache: "no-store",
});
if (!res.ok) return null;
const data: unknown = await res.json();
const id = (data as { buildId?: unknown }).buildId;
return typeof id === "string" ? id : null;
} catch {
return null;
}
}
/** Throw away the worker and everything it cached, then reload from the
* network. Only for a client that is provably stale but isn't being handed
* an update — see `stranded` below. */
async function resetServiceWorkerAndReload() {
try {
const registrations = await navigator.serviceWorker.getRegistrations();
await Promise.all(registrations.map((registration) => registration.unregister()));
const cacheKeys = await caches.keys();
await Promise.all(cacheKeys.map((key) => caches.delete(key)));
} catch {
// Reloading without the cleanup is still better than staying stale.
}
window.location.reload();
}
function UpdatePrompt() {
const t = useT();
const {
needRefresh: [needRefresh, setNeedRefresh],
updateServiceWorker,
} = useRegisterSW({
const [visible, setVisible] = useState(false);
/** An update is waiting to be applied, whether or not the toast is showing. */
const pending = useRef(false);
/** Set when the server is on a different build than we are *and* no new
* service worker turned up to deliver it. Then the worker is wedged and a
* plain reload would just serve the same cached shell again, so the button
* has to clear it out instead. */
const stranded = useRef(false);
const snoozeTimer = useRef<number | null>(null);
const lastVersionCheck = useRef(0);
const announce = (isStranded: boolean) => {
if (isStranded) stranded.current = true;
pending.current = true;
// While snoozed the timer owns the toast; don't pop it back up early.
if (snoozeTimer.current === null) setVisible(true);
};
const snooze = () => {
setVisible(false);
// Never a permanent dismissal: a client that misses the prompt for good is
// exactly how clients ended up stranded on a bundle the server no longer
// even serves.
snoozeTimer.current = window.setTimeout(() => {
snoozeTimer.current = null;
if (pending.current) setVisible(true);
}, UPDATE_TOAST_SNOOZE_MS);
};
useRegisterSW({
onNeedReload() {
// autoUpdate: the new worker has already taken over, we only choose the
// moment to reload — mid-call is the user's decision, not ours.
announce(false);
},
onRegisteredSW(_url, registration) {
// Poll for a new service worker in the background — otherwise an app
// left open for hours/days only checks for updates on next full load.
if (!registration) return;
const CHECK_INTERVAL_MS = 60 * 60 * 1000;
window.setInterval(() => {
registration.update().catch(() => {});
}, CHECK_INTERVAL_MS);
}, SW_UPDATE_CHECK_INTERVAL_MS);
},
});
if (!needRefresh) return null;
useEffect(() => {
const checkVersion = async () => {
const now = Date.now();
if (now - lastVersionCheck.current < VERSION_CHECK_MIN_GAP_MS) return;
lastVersionCheck.current = now;
const serverBuildId = await fetchServerBuildId();
if (!serverBuildId || serverBuildId === __BUILD_ID__) return;
// We are demonstrably behind. Give the service worker the first shot at
// fixing it; only if it produces no new worker at all is it wedged.
let registration: ServiceWorkerRegistration | undefined;
try {
registration = await navigator.serviceWorker?.getRegistration();
await registration?.update();
} catch {
// An update check that throws is itself a sign of a wedged worker.
}
announce(!registration?.installing && !registration?.waiting);
};
void checkVersion();
const interval = window.setInterval(() => void checkVersion(), VERSION_CHECK_INTERVAL_MS);
const onVisibilityChange = () => {
if (document.visibilityState === "visible") void checkVersion();
};
document.addEventListener("visibilitychange", onVisibilityChange);
return () => {
window.clearInterval(interval);
document.removeEventListener("visibilitychange", onVisibilityChange);
};
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
if (!visible) return null;
return (
<div className="ts-update-toast">
<span>{t("pwa.updateAvailable")}</span>
<button type="button" onClick={() => updateServiceWorker(true)}>
<button
type="button"
onClick={() => {
if (stranded.current) void resetServiceWorkerAndReload();
else window.location.reload();
}}
>
{t("pwa.reload")}
</button>
<button type="button" className="ts-update-toast-dismiss" onClick={() => setNeedRefresh(false)}>
<button type="button" className="ts-update-toast-dismiss" onClick={snooze}>
✕
</button>
</div>
@@ -1915,7 +2140,7 @@ const FEEDBACK_BUBBLE_MIN_INTERVAL_MS = 3 * 24 * 60 * 60 * 1000; // don't nag mo
const FEEDBACK_BUBBLE_INITIAL_DELAY_MS = 45_000;
const FEEDBACK_BUBBLE_AUTO_HIDE_MS = 14_000;
function FeedbackFab({ onOpen }: { onOpen: () => void }) {
function FeedbackFab({ onOpen, stacked }: { onOpen: () => void; stacked: boolean }) {
const t = useT();
const [bubbleVisible, setBubbleVisible] = useState(false);
@@ -1948,7 +2173,7 @@ function FeedbackFab({ onOpen }: { onOpen: () => void }) {
}, [bubbleVisible]);
return (
<div className="ts-feedback-fab-wrap">
<div className={`ts-feedback-fab-wrap${stacked ? " ts-feedback-fab-wrap-stacked" : ""}`}>
{bubbleVisible && (
<div className="ts-feedback-bubble" onClick={onOpen}>
<button
@@ -1980,7 +2205,25 @@ function FeedbackFab({ onOpen }: { onOpen: () => void }) {
);
}
type FeedbackCategory = "bug" | "idea" | "other";
/** Small donation pill, pinned to the bottom right corner. */
function DonateFab() {
const t = useT();
if (!DONATE_URL) return null;
return (
<a
className="ts-donate-fab"
href={DONATE_URL}
target="_blank"
rel="noopener noreferrer"
title={t("donate.title")}
>
<span className="ts-donate-fab-icon" aria-hidden="true">☕</span>
{t("donate.label")}
</a>
);
}
type FeedbackCategory = "bug" | "idea" | "other" | "report";
function FeedbackDialog({ onClose }: { onClose: () => void }) {
const t = useT();
@@ -1988,7 +2231,10 @@ function FeedbackDialog({ onClose }: { onClose: () => void }) {
const [category, setCategory] = useState<FeedbackCategory>("bug");
const [message, setMessage] = useState("");
const [email, setEmail] = useState("");
const [publishAsIssue, setPublishAsIssue] = useState(false);
// 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
// initial value has to agree with the initial category.
const [publishAsIssue, setPublishAsIssue] = useState(true);
// Honeypot: real users never see or fill this (hidden via CSS, no label,
// excluded from tab order); bots that blindly fill every field do. Kept
// in sync with the gateway's "website" field name.
@@ -2068,9 +2314,20 @@ function FeedbackDialog({ onClose }: { onClose: () => void }) {
/>
<label className="ts-dialog-field">
{t("feedback.dialog.category")}
<select value={category} onChange={(e) => setCategory(e.target.value as FeedbackCategory)}>
<select
value={category}
onChange={(e) => {
const next = e.target.value as FeedbackCategory;
setCategory(next);
if (next === "bug") setPublishAsIssue(true);
// Reports (e.g. ToS violations) never become a public
// GitHub issue - they may name another user's server.
else if (next === "report") setPublishAsIssue(false);
}}
>
<option value="bug">{t("feedback.dialog.category.bug")}</option>
<option value="idea">{t("feedback.dialog.category.idea")}</option>
<option value="report">{t("feedback.dialog.category.report")}</option>
<option value="other">{t("feedback.dialog.category.other")}</option>
</select>
</label>
@@ -2088,15 +2345,24 @@ function FeedbackDialog({ onClose }: { onClose: () => void }) {
{t("feedback.dialog.email")}
<input type="email" value={email} onChange={(e) => setEmail(e.target.value)} />
</label>
<label className="ts-feedback-checkbox-field">
<input
type="checkbox"
checked={publishAsIssue}
onChange={(e) => setPublishAsIssue(e.target.checked)}
/>
{t("feedback.dialog.publishAsIssue")}
</label>
<p className="ts-feedback-hint">{t("feedback.dialog.publishAsIssueHint")}</p>
{category === "report" ? (
<p className="ts-feedback-hint">{t("feedback.dialog.reportHint")}</p>
) : (
<>
<label className="ts-feedback-checkbox-field">
<input
type="checkbox"
checked={publishAsIssue}
disabled={category === "bug"}
onChange={(e) => setPublishAsIssue(e.target.checked)}
/>
{t("feedback.dialog.publishAsIssue")}
</label>
<p className="ts-feedback-hint">
{t(category === "bug" ? "feedback.dialog.publishAsIssueHintBug" : "feedback.dialog.publishAsIssueHint")}
</p>
</>
)}
{status === "error" && <p className="ts-feedback-error">{t("feedback.dialog.error")}</p>}
</>
)}
@@ -5659,6 +5925,19 @@ function AppInner() {
} | null>(null);
const [connectDialogOpen, setConnectDialogOpen] = useState(false);
const [feedbackOpen, setFeedbackOpen] = useState(false);
// Gateway-broadcast "notice" (currently: SIGTERM restart warning). Global,
// not per-session - it should show no matter which tab is active.
const [restartNotice, setRestartNotice] = useState<string | null>(null);
// 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);
const [tosMandatory, setTosMandatory] = useState(false);
useEffect(() => {
if (IS_OWN_HOSTED_INSTANCE && !hasAcceptedToS()) {
setTosMandatory(true);
setTosOpen(true);
}
}, []);
const [connectDialogExpanded, setConnectDialogExpanded] = useState(false);
const [log, setLog] = useState<LogEntry[]>([]);
const [connected, setConnected] = useState(false);
@@ -5863,6 +6142,7 @@ function AppInner() {
const [awayDialogMessage, setAwayDialogMessage] = useState("");
const [awayPresets, setAwayPresets] = useState<MessagePreset[]>(() => loadAwayPresets());
const [extrasMenuOpen, setExtrasMenuOpen] = useState(false);
const [helpMenuOpen, setHelpMenuOpen] = useState(false);
const [collectedUrls, setCollectedUrls] = useState<CollectedUrl[]>(() => loadCollectedUrls());
const [collectedUrlsOpen, setCollectedUrlsOpen] = useState(false);
const [inviteFriendOpen, setInviteFriendOpen] = useState(false);
@@ -5924,6 +6204,7 @@ function AppInner() {
const favoritesMenuRef = useRef<HTMLDivElement | null>(null);
const awayMenuRef = useRef<HTMLDivElement | null>(null);
const extrasMenuRef = useRef<HTMLDivElement | null>(null);
const helpMenuRef = useRef<HTMLDivElement | null>(null);
const chatEndRef = useRef<HTMLDivElement | null>(null);
const audioContextRef = useRef<AudioContext | null>(null);
const audioPlayerRef = useRef<AudioPlayer | null>(null);
@@ -6404,6 +6685,17 @@ function AppInner() {
socket.onmessage = (event) => {
const data = JSON.parse(event.data);
// Broadcast, not tied to any one session - show it regardless of which
// tab is active, and regardless of which tab's socket it arrived on
// (every open session gets its own copy of the same broadcast).
if (data.type === "notice") {
// messageKey lets the gateway send a fixed, translated notice (e.g.
// the SIGTERM restart warning) without knowing the client's language;
// message is a plain-text fallback for anything else.
setRestartNotice(data.messageKey ? t(data.messageKey) : String(data.message || ""));
return;
}
// Inactive tab: update parked snapshot only (no audio playback).
if (sessionId !== activeSessionIdRef.current) {
const rec = sessionsRef.current.get(sessionId);
@@ -7343,6 +7635,22 @@ function AppInner() {
};
}, [extrasMenuOpen]);
useEffect(() => {
if (!helpMenuOpen) return;
const onPointerDown = (e: MouseEvent) => {
if (!helpMenuRef.current?.contains(e.target as Node)) setHelpMenuOpen(false);
};
const onKeyDown = (e: KeyboardEvent) => {
if (e.key === "Escape") setHelpMenuOpen(false);
};
window.addEventListener("mousedown", onPointerDown);
window.addEventListener("keydown", onKeyDown);
return () => {
window.removeEventListener("mousedown", onPointerDown);
window.removeEventListener("keydown", onKeyDown);
};
}, [helpMenuOpen]);
useEffect(() => {
if (!selfMenuOpen) return;
const onPointerDown = (e: MouseEvent) => {
@@ -8915,7 +9223,61 @@ function AppInner() {
💬 {t("menu.extras.feedback")}
</span>
)}
<span className="ts-menubar-item">{t("menu.help")}</span>
<div className="ts-menubar-dropdown" ref={helpMenuRef}>
<span
className="ts-menubar-item ts-menubar-item-active"
onClick={() => setHelpMenuOpen((v) => !v)}
>
{t("menu.help")}
</span>
{helpMenuOpen && (
<div className="ts-menu">
<a
className="ts-menu-item"
href="https://webspeak3.de"
target="_blank"
rel="noreferrer"
onClick={() => setHelpMenuOpen(false)}
>
<span className="ts-menu-item-icon">ℹ️</span>
<span className="ts-menu-item-label">{t("menu.help.about")}</span>
</a>
<a
className="ts-menu-item"
href="https://github.com/Moepchi/webspeak3"
target="_blank"
rel="noreferrer"
onClick={() => setHelpMenuOpen(false)}
>
<span className="ts-menu-item-icon">🐙</span>
<span className="ts-menu-item-label">{t("menu.help.github")}</span>
</a>
<a
className="ts-menu-item"
href="https://github.com/Moepchi/webspeak3/releases"
target="_blank"
rel="noreferrer"
onClick={() => setHelpMenuOpen(false)}
>
<span className="ts-menu-item-icon">📋</span>
<span className="ts-menu-item-label">{t("menu.help.changelog")}</span>
</a>
{IS_OWN_HOSTED_INSTANCE && (
<button
className="ts-menu-item"
onClick={() => {
setTosMandatory(false);
setTosOpen(true);
setHelpMenuOpen(false);
}}
>
<span className="ts-menu-item-icon">📜</span>
<span className="ts-menu-item-label">{t("menu.extras.tos")}</span>
</button>
)}
</div>
)}
</div>
</div>
</div>
{designTheme === "nova" && (
@@ -9085,6 +9447,7 @@ function AppInner() {
onChange={(e) => setVadThreshold(Number(e.target.value))}
/>
</label>
{STREAM_UI_ENABLED && (
<button
className={`ts-icon-button${publishState === "live" ? " ts-mic-on" : ""}`}
onClick={handleStreamButton}
@@ -9100,6 +9463,7 @@ function AppInner() {
>
{publishState === "live" ? "🛑" : "🖥️"}
</button>
)}
<span className="ts-toolbar-sep" />
<button
className={`ts-icon-button${outputMuted ? " ts-muted-on" : ""}`}
@@ -9191,10 +9555,14 @@ function AppInner() {
<UpdatePrompt />
{/* The feedback button sits above the donation pill where that one is
shown, and takes its spot where it is not. */}
{IS_OWN_HOSTED_INSTANCE && !feedbackOpen && (
<FeedbackFab onOpen={() => setFeedbackOpen(true)} />
<FeedbackFab onOpen={() => setFeedbackOpen(true)} stacked={!!DONATE_URL} />
)}
<DonateFab />
{feedbackOpen && <FeedbackDialog onClose={() => setFeedbackOpen(false)} />}
{favoritesDialogMode && (
@@ -9214,6 +9582,20 @@ function AppInner() {
/>
)}
{restartNotice && <RestartNoticeDialog message={restartNotice} onAck={() => setRestartNotice(null)} />}
{tosOpen && (
<ToSDialog
mandatory={tosMandatory}
onAccept={() => {
localStorage.setItem(TOS_KEY, `${TOS_VERSION}:${new Date().toISOString().slice(0, 10)}`);
setTosOpen(false);
setTosMandatory(false);
}}
onClose={() => setTosOpen(false)}
/>
)}
{channelPasswordPrompt && (
<ChannelPasswordDialog
channelName={channelPasswordPrompt.channelName}
@@ -9748,7 +10130,7 @@ function AppInner() {
<span className="ts-menu-item-icon">👉</span>
<span className="ts-menu-item-label">{t("clientContext.poke")}</span>
</button>
{!clientContextMenu.isSelf && streamInfos[clientContextMenu.clientId] && (
{STREAM_UI_ENABLED && !clientContextMenu.isSelf && streamInfos[clientContextMenu.clientId] && (
<button
className="ts-menu-item"
onClick={() => {
+52
View File
@@ -29,6 +29,9 @@ const translations: Record<Lang, Record<string, string>> = {
"menu.rights.myRights": "Eigene Rechte anzeigen",
"menu.extras": "Extras",
"menu.help": "Hilfe",
"menu.help.about": "Über WebSpeak3",
"menu.help.github": "GitHub",
"menu.help.changelog": "Changelog",
"menu.extras.identities": "Identitäten",
"menu.extras.contacts": "Kontakte",
"menu.extras.collectedUrls": "Gesammelte URLs",
@@ -48,6 +51,9 @@ const translations: Record<Lang, Record<string, string>> = {
"menu.extras.feedback": "Feedback geben",
"feedback.fab.nudge": "Was denkst du über WebSpeak3? Feedback ist willkommen!",
"donate.label": "Spenden",
"donate.title": "WebSpeak3 auf Ko-fi unterstützen",
"pwa.updateAvailable": "Neue Version verfügbar",
"pwa.reload": "Neu laden",
@@ -56,14 +62,34 @@ const translations: Record<Lang, Record<string, string>> = {
"feedback.dialog.category": "Kategorie",
"feedback.dialog.category.bug": "Fehler",
"feedback.dialog.category.idea": "Idee",
"feedback.dialog.category.report": "Meldung (Verstoß/Missbrauch)",
"feedback.dialog.category.other": "Sonstiges",
"feedback.dialog.reportHint": "Meldungen bleiben privat und werden nie als GitHub-Issue veröffentlicht. Gib bei Bedarf den betroffenen Server mit an.",
"feedback.dialog.message": "Nachricht",
"feedback.dialog.messagePlaceholder": "Was ist passiert, oder was schlägst du vor?",
"feedback.dialog.email": "E-Mail (optional, für Rückfragen)",
"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.send": "Senden",
"feedback.dialog.cancel": "Abbrechen",
"restartNotice.title": "Kurze Unterbrechung",
"restartNotice.body": "Der Server wird gleich kurz neu gestartet. Deine Verbindung wird dabei kurz unterbrochen.",
"restartNotice.ack": "Verstanden",
"menu.extras.tos": "Nutzungsbedingungen",
"tos.title": "Nutzungsbedingungen für client.webspeak3.de",
"tos.rule1": "Dieser Client dient der privaten, nicht-kommerziellen Nutzung von TeamSpeak-/TeaSpeak-/GreenTeaSpeak-Servern über den Browser.",
"tos.rule2": "Verboten sind insbesondere: Straftaten jeder Art, Belästigung und Hassrede, Spam und Flooding, Störung des Dienstes sowie die Umgehung von Sperren.",
"tos.rule3": "Bei Verstößen kann der Zugang ohne Vorwarnung gesperrt werden; schwerwiegende Fälle werden ggf. an die zuständigen Behörden gemeldet.",
"tos.rule4Pre": "Zur Betriebssicherheit und Missbrauchserkennung werden Verbindungen protokolliert (Serveradresse, Servername, Zeitpunkt) und nach 90 Tagen automatisch gelöscht – siehe ",
"tos.rule4Post": ".",
"tos.privacyLinkText": "Datenschutzerklärung",
"tos.rule5Pre": "Bei Missbrauch oder Beschwerden: siehe ",
"tos.rule5Post": ".",
"tos.legalLinkText": "Impressum",
"tos.rule6": "Mit Klick auf „Akzeptieren\" stimmst du diesen Bedingungen zu. Die Zustimmung wird nur lokal in deinem Browser gespeichert; bei Regeländerungen wirst du erneut gefragt.",
"tos.accept": "Akzeptieren",
"tos.close": "Schließen",
"feedback.dialog.sending": "Wird gesendet…",
"feedback.dialog.success": "Danke für dein Feedback!",
"feedback.dialog.successWithIssue": "Danke! Issue erstellt:",
@@ -667,6 +693,9 @@ const translations: Record<Lang, Record<string, string>> = {
"menu.rights.myRights": "Show my permissions",
"menu.extras": "Tools",
"menu.help": "Help",
"menu.help.about": "About WebSpeak3",
"menu.help.github": "GitHub",
"menu.help.changelog": "Changelog",
"menu.extras.identities": "Identities",
"menu.extras.contacts": "Contacts",
"menu.extras.collectedUrls": "Collected URLs",
@@ -686,6 +715,9 @@ const translations: Record<Lang, Record<string, string>> = {
"menu.extras.feedback": "Send Feedback",
"feedback.fab.nudge": "What do you think of WebSpeak3? Feedback welcome!",
"donate.label": "Donate",
"donate.title": "Support WebSpeak3 on Ko-fi",
"pwa.updateAvailable": "New version available",
"pwa.reload": "Reload",
@@ -694,13 +726,33 @@ const translations: Record<Lang, Record<string, string>> = {
"feedback.dialog.category": "Category",
"feedback.dialog.category.bug": "Bug",
"feedback.dialog.category.idea": "Idea",
"feedback.dialog.category.report": "Report (violation/abuse)",
"feedback.dialog.category.other": "Other",
"feedback.dialog.reportHint": "Reports stay private and are never published as a GitHub issue. Feel free to name the affected server.",
"feedback.dialog.message": "Message",
"feedback.dialog.messagePlaceholder": "What happened, or what are you suggesting?",
"feedback.dialog.email": "Email (optional, for follow-up)",
"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.send": "Send",
"restartNotice.title": "Brief interruption",
"restartNotice.body": "The server is about to restart briefly. Your connection will drop for a moment.",
"restartNotice.ack": "Got it",
"menu.extras.tos": "Terms of use",
"tos.title": "Terms of use for client.webspeak3.de",
"tos.rule1": "This client is for private, non-commercial use of TeamSpeak/TeaSpeak/GreenTeaSpeak servers via the browser.",
"tos.rule2": "Prohibited in particular: any criminal activity, harassment and hate speech, spam and flooding, disrupting the service, and circumventing bans.",
"tos.rule3": "Violations may result in access being blocked without warning; serious cases may be reported to the relevant authorities.",
"tos.rule4Pre": "For operational security and abuse detection, connections are logged (server address, server name, timestamp) and automatically deleted after 90 days – see the ",
"tos.rule4Post": ".",
"tos.privacyLinkText": "privacy policy",
"tos.rule5Pre": "For abuse or complaints: see the ",
"tos.rule5Post": ".",
"tos.legalLinkText": "legal notice (Impressum)",
"tos.rule6": "By clicking \"Accept\" you agree to these terms. Your acceptance is stored only locally in your browser; you'll be asked again if the rules change.",
"tos.accept": "Accept",
"tos.close": "Close",
"feedback.dialog.cancel": "Cancel",
"feedback.dialog.sending": "Sending…",
"feedback.dialog.success": "Thanks for your feedback!",
+3
View File
@@ -1,3 +1,6 @@
/// <reference types="vite/client" />
/// <reference types="vite-plugin-pwa/client" />
/// <reference types="vite-plugin-pwa/react" />
/** Injected by vite.config.ts; matches the `buildId` in version.json. */
declare const __BUILD_ID__: string
+62 -8
View File
@@ -1,19 +1,65 @@
import { defineConfig } from 'vite'
import { execSync } from 'node:child_process'
import { defineConfig, type Plugin } from 'vite'
import react from '@vitejs/plugin-react'
import { VitePWA } from 'vite-plugin-pwa'
// Identifies the build a bundle came from. Only has to differ between two
// builds — the client compares its own baked-in value against version.json to
// notice when it is running something the server no longer serves.
function resolveBuildId(): string {
const fromCi = process.env.CF_PAGES_COMMIT_SHA || process.env.GITHUB_SHA
if (fromCi) return fromCi.slice(0, 12)
try {
return execSync('git rev-parse --short=12 HEAD', { stdio: ['ignore', 'pipe', 'ignore'] })
.toString()
.trim()
} catch {
// No git checkout (the Docker build copies sources in without .git).
return String(Date.now())
}
}
const buildId = resolveBuildId()
// version.json must never be precached, or a stuck client would ask the very
// cache it is stuck in what the server has. `.json` is not in globPatterns
// below, so Workbox leaves it alone and the fetch always hits the network.
function versionManifest(): Plugin {
return {
name: 'webspeak3-version-manifest',
apply: 'build',
generateBundle() {
this.emitFile({
type: 'asset',
fileName: 'version.json',
source: `${JSON.stringify({ buildId })}\n`,
})
},
}
}
// https://vite.dev/config/
export default defineConfig({
define: {
__BUILD_ID__: JSON.stringify(buildId),
},
plugins: [
react(),
versionManifest(),
VitePWA({
registerType: 'prompt',
// We register the service worker ourselves (see useSwUpdatePrompt in
// App.tsx) via the virtual:pwa-register/react module so we can show a
// "new version available" toast instead of updating silently — a
// stale-cache tab would otherwise keep running old JS/CSS until the
// user manually reloads (or worse, clears storage), which bit us
// repeatedly while verifying deploys.
// The generated worker takes over as soon as it has installed
// (skipWaiting + clientsClaim). It must NOT wait for the page to ask it
// to: between 2026-09-07 and 2026-09-10 this was `prompt`, and every
// client cached in that window froze — the new worker sat in `waiting`
// forever because the only code that could have released it (the update
// toast) lived in the version behind that worker. Deciding *when* to
// reload is a UI concern and stays one: `onNeedReload` in App.tsx shows
// the toast instead of pulling the page out from under an active
// connection.
registerType: 'autoUpdate',
// We register from inside the app (virtual:pwa-register/react) rather
// than through an injected registerSW.js, because that script would
// reload the page on its own the moment a new worker activates.
injectRegister: false,
// Dev-time Workbox would sit in front of Vite's own HMR/WS traffic and
// stale-cache the app shell while iterating — only ever ship the SW in
@@ -35,6 +81,14 @@ export default defineConfig({
],
},
workbox: {
// Both are what `registerType: 'autoUpdate'` is supposed to imply, but
// the plugin only sets them when it also injects registerSW.js (see
// resolveOptions: `injectRegister === 'auto' || injectRegister == null`)
// — with injectRegister: false they have to be spelled out, or the
// generated worker is byte-identical to the `prompt` one and strands
// clients all over again. Verified in dist/sw.js after building.
skipWaiting: true,
clientsClaim: true,
// Precache the built app shell (JS/CSS/HTML/icons) only. The gateway's
// /ws endpoint and any file-transfer/API traffic must never be
// intercepted or cached — Workbox's default fetch handler already