Web: smaller review fixes (A10-A19, S10, S11, lint)

- A10: drop labels of unimplemented shortcuts, localize "Ctrl", never
  fire shortcuts (Ctrl+D!) while typing in a field
- A11: in-memory localStorage stand-in when storage is blocked instead
  of a blank page
- A12: invite link falls back to selecting the text without clipboard API
- A13: AEC3 script honors BASE_URL, failed loads are retried
- A14: shared downloadBlob helper, object URLs revoked with a delay
- A15: remaining hardcoded German/English strings moved to the locales
- A16: broken soundpack files show an error instead of failing silently
- A17: connect buttons no longer pass the click event as overrides
- A18: design base persisted from the resolved theme
- A19: no audio send() while the socket is still connecting
- S10: privilege keys are no longer persisted in localStorage
- S11: share links can carry the token in the fragment (#token=)
- oxlint: 0 warnings

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Hu2cuPLqpuKVfd9wWFFakU
This commit is contained in:
MoepchiandClaude Opus 5.5 committed 2026-09-27 19:20:47 +00:00
1 parent 034be9cc77
commit eba1e1af92
12 files changed
+182 -98

No files matched your search

+2 -2
View File
@@ -293,7 +293,7 @@ Skip the connect dialog entirely and drop visitors straight into a TeamSpeak ser
Add a `connect` parameter to your instance's URL and send that link out — in a Discord post, a landing page button, a QR code, wherever:
```
https://your-instance/?connect=voice.example.com&nickname=Guest&channel=Lobby&token=abc123
https://your-instance/?connect=voice.example.com&nickname=Guest&channel=Lobby#token=abc123
```
| Parameter | Required | What it does |
@@ -301,7 +301,7 @@ https://your-instance/?connect=voice.example.com&nickname=Guest&channel=Lobby&to
| `connect` | yes | Server address to join, `host` or `host:port` |
| `nickname` | no | Nickname to connect with — omit it and the visitor gets an auto-generated `Guest-XXXX` |
| `channel` | no | Default channel to join |
| `token` | no | Server/channel privilege key, if the target requires one |
| `token` | no | Server/channel privilege key, if the target requires one. Put it after `#` (as above) so it never reaches server logs or `Referer` headers; `?token=` still works too |
This works on **any** deployment — no rebuild, no configuration. WebSpeak3 connects as soon as the page loads and immediately strips these parameters from the address bar, so refreshing the tab (or someone screenshotting/forwarding the URL later) won't silently reconnect off a stale link.
+95 -84
View File
@@ -137,17 +137,25 @@ const IS_OWN_HOSTED_INSTANCE = !DEMO_MODE && OWN_HOSTED_HOSTNAMES.has(window.loc
// reconnect off a stale link sitting in the address bar or browser history.
const AUTO_CONNECT_FROM_URL = (() => {
const params = new URLSearchParams(window.location.search);
// The token may also sit in the fragment (#token=...), which - unlike the
// query - never reaches server logs or Referer headers.
const hashParams = new URLSearchParams(window.location.hash.slice(1));
const connectHost = params.get("connect");
if (!connectHost) return null;
const target = {
host: connectHost,
nickname: params.get("nickname") || undefined,
defaultChannel: params.get("channel") || undefined,
privilegeKey: params.get("token") || undefined,
privilegeKey: hashParams.get("token") || params.get("token") || undefined,
};
for (const key of ["connect", "nickname", "channel", "token"]) params.delete(key);
let hash = window.location.hash;
if (hashParams.has("token")) {
hashParams.delete("token");
hash = hashParams.size ? `#${hashParams}` : "";
}
const rest = params.toString();
window.history.replaceState(null, "", window.location.pathname + (rest ? `?${rest}` : "") + window.location.hash);
window.history.replaceState(null, "", window.location.pathname + (rest ? `?${rest}` : "") + hash);
return target;
})();
@@ -184,7 +192,9 @@ function hasAcceptedToS(): boolean {
const LAST_HOST_KEY = "webspeak3:last-host";
const LAST_NICKNAME_KEY = "webspeak3:last-nickname";
const LAST_PRIVILEGE_KEY = "webspeak3:last-privilege-key";
// Privilege keys are one-shot grants, so they're no longer remembered across
// reloads; drop what older versions stored in plain text.
localStorage.removeItem("webspeak3:last-privilege-key");
const LAST_SERVER_TYPE_KEY = "webspeak3:last-server-type";
type ServerType = "teamspeak" | "teaspeak" | "auto";
@@ -715,15 +725,19 @@ function triggerBrowserDownload(filename: string, base64Data: string): void {
const binary = atob(base64Data);
const bytes = new Uint8Array(binary.length);
for (let i = 0; i < binary.length; i++) bytes[i] = binary.charCodeAt(i);
const blob = new Blob([bytes]);
downloadBlob(new Blob([bytes]), filename);
}
function downloadBlob(blob: Blob, filename: string) {
const url = URL.createObjectURL(blob);
const a = document.createElement("a");
a.href = url;
a.download = filename;
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
URL.revokeObjectURL(url);
a.remove();
// Revoking right after click() can cancel the download in some browsers.
setTimeout(() => URL.revokeObjectURL(url), 60_000);
}
function formatDurationSecs(totalSeconds: number): string {
@@ -874,7 +888,6 @@ function ChannelTree({
onSelectItem,
onSwitchChannel,
onOpenPrivateChat,
onPokeClient,
onMoveClient,
onClientContextMenu,
onChannelContextMenu,
@@ -893,7 +906,6 @@ function ChannelTree({
onSelectItem: (item: SelectedItem) => void;
onSwitchChannel: (channelId: number) => void;
onOpenPrivateChat: (clientId: number, clientName: string) => void;
onPokeClient: (clientId: number, clientName: string) => void;
onMoveClient: (clientId: number, channelId: number) => void;
onClientContextMenu: (e: React.MouseEvent, clientId: number, clientName: string, isSelf: boolean) => void;
onChannelContextMenu: (e: React.MouseEvent, channelId: number, channelName: string) => void;
@@ -989,7 +1001,7 @@ function ChannelTree({
className={`ts-tree-expander${hasChildren ? "" : " ts-tree-expander-empty"}${
isCollapsed ? " ts-tree-expander-collapsed" : ""
}`}
aria-label={isCollapsed ? "aufklappen" : "zuklappen"}
aria-label={isCollapsed ? t("tree.expand") : t("tree.collapse")}
tabIndex={-1}
onMouseDown={(e) => {
// Keep focus on the row so a nearby double-click still joins.
@@ -1131,7 +1143,6 @@ function ChannelTree({
onSelectItem={onSelectItem}
onSwitchChannel={onSwitchChannel}
onOpenPrivateChat={onOpenPrivateChat}
onPokeClient={onPokeClient}
onMoveClient={onMoveClient}
onClientContextMenu={onClientContextMenu}
onChannelContextMenu={onChannelContextMenu}
@@ -1498,7 +1509,7 @@ function ConnectDialog({
<div className="ts-dialog-grid">
<label className="ts-dialog-field">
{t("connect.phoneticNickname")}
<input disabled title="Not supported yet" />
<input disabled title={t("clientContext.notSupported")} />
</label>
<label className="ts-dialog-field">
{t("connect.identity")}
@@ -2557,7 +2568,7 @@ function FavoritesDialog({
</label>
<label className="ts-dialog-field">
{t("connect.phoneticNickname")}
<input disabled title="Not supported yet" />
<input disabled title={t("clientContext.notSupported")} />
</label>
<label className="ts-dialog-field">
{t("connect.serverAddress")}
@@ -2636,7 +2647,7 @@ function FavoritesDialog({
{t("favorites.showServerQueryClients")}
</label>
<label className="ts-dialog-checkbox">
<input type="checkbox" disabled title="Not supported yet" />
<input type="checkbox" disabled title={t("clientContext.notSupported")} />
{t("favorites.connectOnStartup")}
</label>
</div>
@@ -2748,6 +2759,7 @@ function InviteFriendDialog({
const t = useT();
const [includeChannel, setIncludeChannel] = useState(false);
const [copied, setCopied] = useState(false);
const linkInputRef = useRef<HTMLInputElement>(null);
const backdrop = useBackdropDismiss(onClose);
const link = `ts3server://${host}${includeChannel && channelId !== null ? `?channel=${channelId}` : ""}`;
@@ -2781,7 +2793,7 @@ function InviteFriendDialog({
</div>
<label className="ts-dialog-field">
{t("inviteFriend.link")}
<input readOnly value={link} onFocus={(e) => e.target.select()} />
<input ref={linkInputRef} readOnly value={link} onFocus={(e) => e.target.select()} />
</label>
</div>
<div className="ts-dialog-buttons">
@@ -2791,9 +2803,15 @@ function InviteFriendDialog({
<div className="ts-dialog-buttons-right">
<button
onClick={() => {
void navigator.clipboard.writeText(link);
setCopied(true);
setTimeout(() => setCopied(false), 1500);
// No clipboard API on plain-http origins - select the link
// instead so it can be copied by hand.
(navigator.clipboard?.writeText(link) ?? Promise.reject()).then(
() => {
setCopied(true);
setTimeout(() => setCopied(false), 1500);
},
() => linkInputRef.current?.select()
);
}}
>
{copied ? t("inviteFriend.copied") : t("inviteFriend.copyToClipboard")}
@@ -5299,12 +5317,7 @@ function DesignPanel({
[JSON.stringify({ name: theme.name, baseTheme: theme.baseTheme, css: theme.css }, null, 2)],
{ type: "application/json" }
);
const url = URL.createObjectURL(blob);
const a = document.createElement("a");
a.href = url;
a.download = `${theme.name.replace(/[^a-z0-9-_]+/gi, "_") || "theme"}.webspeak3theme.json`;
a.click();
URL.revokeObjectURL(url);
downloadBlob(blob, `${theme.name.replace(/[^a-z0-9-_]+/gi, "_") || "theme"}.webspeak3theme.json`);
};
const handleImportSelected = async (e: React.ChangeEvent<HTMLInputElement>) => {
@@ -5757,6 +5770,7 @@ function SoundsPanel() {
matchedCount: number;
unmatchedFiles: string[];
} | null>(null);
const [soundpackFailed, setSoundpackFailed] = useState(false);
useEffect(() => {
let cancelled = false;
@@ -5821,7 +5835,15 @@ function SoundsPanel() {
e.target.value = "";
if (!file) return;
setSoundpackResult(null);
const { matched, unmatchedFiles } = await parseSoundpack(file);
setSoundpackFailed(false);
let parsed: Awaited<ReturnType<typeof parseSoundpack>>;
try {
parsed = await parseSoundpack(file);
} catch {
setSoundpackFailed(true);
return;
}
const { matched, unmatchedFiles } = parsed;
for (const [event, sound] of Object.entries(matched) as [SoundEventId, { name: string; blob: Blob }][]) {
await saveCustomSound(event, new File([sound.blob], sound.name, { type: sound.blob.type }));
}
@@ -5858,6 +5880,7 @@ function SoundsPanel() {
<div className="ts-options-field-row">
<button onClick={handleImportSoundpackClick}>{t("sounds.importSoundpack")}</button>
</div>
{soundpackFailed && <p className="ts-options-subtitle">{t("sounds.importFailed")}</p>}
{soundpackResult && (
<p className="ts-options-subtitle">
{t("sounds.importResult", {
@@ -6337,9 +6360,7 @@ function AppInner() {
const [serverPassword, setServerPassword] = useState("");
const [channelPassword, setChannelPassword] = useState("");
const [defaultChannel, setDefaultChannel] = useState("");
const [privilegeKey, setPrivilegeKey] = useState(
() => localStorage.getItem(LAST_PRIVILEGE_KEY) ?? ""
);
const [privilegeKey, setPrivilegeKey] = useState("");
const [serverType, setServerType] = useState<ServerType>(loadServerType);
// Prompt shown when switching into a password-protected channel mid-session
// (the initial-connect "default channel" password above is a separate field).
@@ -6499,8 +6520,12 @@ function AppInner() {
const handleDesignSelectionChange = (next: string) => {
setDesignSelection(next);
localStorage.setItem(DESIGN_SELECTION_KEY, next);
localStorage.setItem(DESIGN_THEME_KEY, resolveDesignThemeBase(next, customThemes));
};
// Persisted from the resolved value, not in the handler: a theme selected
// right after being created/installed isn't in the handler's customThemes yet.
useEffect(() => {
localStorage.setItem(DESIGN_THEME_KEY, designTheme);
}, [designTheme]);
const handleSaveCustomTheme = (nextTheme: CustomTheme) => {
setCustomThemes((prev) => {
const idx = prev.findIndex((th) => th.id === nextTheme.id);
@@ -6799,15 +6824,16 @@ function AppInner() {
}, [activeSessionId]);
useEffect(() => {
const sessions = sessionsRef.current;
return () => {
for (const rec of sessionsRef.current.values()) {
for (const rec of sessions.values()) {
try {
rec.socket?.close();
} catch {
/* ignore */
}
}
sessionsRef.current.clear();
sessions.clear();
};
}, []);
@@ -7103,7 +7129,7 @@ function AppInner() {
}
if (rec) {
try {
rec.socket && ((rec.socket as WebSocket).onmessage = null);
if (rec.socket) (rec.socket as WebSocket).onmessage = null;
} catch {
/* ignore */
}
@@ -7242,7 +7268,6 @@ function AppInner() {
});
localStorage.setItem(LAST_HOST_KEY, connectHost);
localStorage.setItem(LAST_NICKNAME_KEY, connectNickname);
localStorage.setItem(LAST_PRIVILEGE_KEY, connectPrivilegeKey);
localStorage.setItem(LAST_SERVER_TYPE_KEY, connectServerType);
if (connectIdentityId) {
setIdentities((prev) =>
@@ -8159,6 +8184,9 @@ function AppInner() {
...prevLog,
{ id: ++whisperLogIdRef.current, timestamp: Date.now(), description },
]);
// Only a change of whisper targets should log; channels/clients/t are
// read for the description but must not re-trigger it (renames, joins).
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [whisperChannelIds, whisperClientIds, connected]);
useEffect(() => {
@@ -8241,23 +8269,30 @@ function AppInner() {
};
}, [rightsMenuOpen]);
// Rebuilt each render and read through the ref, so the listener below is
// registered once yet always sees current state.
const shortcutHandlerRef = useRef<(e: KeyboardEvent) => void>(() => {});
shortcutHandlerRef.current = (e: KeyboardEvent) => {
if (!e.ctrlKey) return;
// Typing in a field (chat, dialogs) must never trigger e.g. Ctrl+D.
const el = e.target as HTMLElement | null;
if (el && (el.isContentEditable || /^(INPUT|TEXTAREA|SELECT)$/.test(el.tagName))) return;
if (e.key.toLowerCase() === "s" && !connecting) {
e.preventDefault();
setConnectDialogOpen(true);
} else if (e.key.toLowerCase() === "d" && (connected || sessionTabs.length > 0)) {
e.preventDefault();
handleDisconnect();
} else if (e.key.toLowerCase() === "b") {
e.preventDefault();
openAddFavorite();
}
};
useEffect(() => {
const onKeyDown = (e: KeyboardEvent) => {
if (!e.ctrlKey) return;
if (e.key.toLowerCase() === "s" && !connecting) {
e.preventDefault();
setConnectDialogOpen(true);
} else if (e.key.toLowerCase() === "d" && (connected || sessionTabs.length > 0)) {
e.preventDefault();
handleDisconnect();
} else if (e.key.toLowerCase() === "b") {
e.preventDefault();
openAddFavorite();
}
};
const onKeyDown = (e: KeyboardEvent) => shortcutHandlerRef.current(e);
window.addEventListener("keydown", onKeyDown);
return () => window.removeEventListener("keydown", onKeyDown);
}, [connected, connecting, sessionTabs.length, host, nickname, serverPassword, defaultChannel, channelPassword]);
}, []);
// Nova-theme-only: the connect dialog IS the app until a connection exists -
// it's forced open on load and after every disconnect, and closes itself the
@@ -8299,7 +8334,10 @@ function AppInner() {
try {
mic = new MicCapture(audioContext, {
onFrame: (pcm) => {
if (!inputMutedRef.current) socketRef.current?.send(JSON.stringify({ type: "sendAudio", pcm }));
// A reconnecting socket is still CONNECTING, where send() throws.
if (!inputMutedRef.current && socketRef.current?.readyState === WebSocket.OPEN) {
socketRef.current.send(JSON.stringify({ type: "sendAudio", pcm }));
}
},
onActivity: (active) => setSelfActive(active),
onLevel: (rms) => {
@@ -8499,14 +8537,7 @@ function AppInner() {
const blob = encodeWavStereo(mergedLeft, mergedRight, audioContextRef.current?.sampleRate ?? SAMPLE_RATE);
const safeServerName = (serverName || "session").replace(/[\\/:*?"<>|]+/g, "_").trim() || "session";
const filename = `webspeak3-${safeServerName}-${new Date().toISOString().replace(/[:.]/g, "-")}.wav`;
const url = URL.createObjectURL(blob);
const a = document.createElement("a");
a.href = url;
a.download = filename;
document.body.appendChild(a);
a.click();
a.remove();
URL.revokeObjectURL(url);
downloadBlob(blob, filename);
logClient("info", "Recording", `Saved recording as ${filename}`);
};
@@ -8702,14 +8733,7 @@ function AppInner() {
const identity = identities.find((i) => i.id === id);
if (!identity?.blob) return;
const blob = new Blob([identity.blob], { type: "application/json" });
const url = URL.createObjectURL(blob);
const a = document.createElement("a");
a.href = url;
a.download = `${identity.name.replace(/[^a-z0-9_-]+/gi, "_") || "identity"}.ts3identity.json`;
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
URL.revokeObjectURL(url);
downloadBlob(blob, `${identity.name.replace(/[^a-z0-9_-]+/gi, "_") || "identity"}.ts3identity.json`);
};
/** Parses the native client's identity .ini format:
@@ -8799,7 +8823,7 @@ function AppInner() {
try {
JSON.parse(text);
} catch {
logClient("error", "Identitäten", `"${file.name}" ist keine gültige Identitätsdatei.`);
logClient("error", "Identities", t("identity.importInvalid", { file: file.name }));
return;
}
const name = file.name.replace(/\.(ts3identity\.)?json$/i, "") || t("identities.newName");
@@ -9431,7 +9455,7 @@ function AppInner() {
>
<span className="ts-menu-item-icon">🟢</span>
<span className="ts-menu-item-label">{t("menu.connections.connect")}</span>
<span className="ts-menu-item-shortcut">Strg+S</span>
<span className="ts-menu-item-shortcut">{t("shortcut.ctrl")}+S</span>
</button>
<button
className="ts-menu-item"
@@ -9443,7 +9467,7 @@ function AppInner() {
>
<span className="ts-menu-item-icon">🔴</span>
<span className="ts-menu-item-label">{t("menu.connections.disconnectCurrent")}</span>
<span className="ts-menu-item-shortcut">Strg+D</span>
<span className="ts-menu-item-shortcut">{t("shortcut.ctrl")}+D</span>
</button>
<button
className="ts-menu-item"
@@ -9471,7 +9495,7 @@ function AppInner() {
<button className="ts-menu-item" onClick={openAddFavorite}>
<span className="ts-menu-item-icon">⭐</span>
<span className="ts-menu-item-label">{t("menu.favorites.add")}</span>
<span className="ts-menu-item-shortcut">Strg+B</span>
<span className="ts-menu-item-shortcut">{t("shortcut.ctrl")}+B</span>
</button>
<button className="ts-menu-item" onClick={openManageFavorites}>
<span className="ts-menu-item-icon">🗂️</span>
@@ -9685,7 +9709,6 @@ function AppInner() {
>
<span className="ts-menu-item-icon">🪪</span>
<span className="ts-menu-item-label">{t("menu.extras.identities")}</span>
<span className="ts-menu-item-shortcut">Strg+I</span>
</button>
<button
className="ts-menu-item"
@@ -9696,7 +9719,6 @@ function AppInner() {
>
<span className="ts-menu-item-icon">📇</span>
<span className="ts-menu-item-label">{t("menu.extras.contacts")}</span>
<span className="ts-menu-item-shortcut">Strg+Umschalt+O</span>
</button>
<button
className="ts-menu-item"
@@ -9707,7 +9729,6 @@ function AppInner() {
>
<span className="ts-menu-item-icon">🔗</span>
<span className="ts-menu-item-label">{t("menu.extras.collectedUrls")}</span>
<span className="ts-menu-item-shortcut">Strg+U</span>
</button>
<button
className="ts-menu-item"
@@ -9730,7 +9751,6 @@ function AppInner() {
>
<span className="ts-menu-item-icon">🗒️</span>
<span className="ts-menu-item-label">{t("menu.extras.whisperLists")}</span>
<span className="ts-menu-item-shortcut">Strg+Umschalt+W</span>
</button>
<button
className="ts-menu-item"
@@ -9741,7 +9761,6 @@ function AppInner() {
>
<span className="ts-menu-item-icon">🕓</span>
<span className="ts-menu-item-label">{t("menu.extras.whisperHistory")}</span>
<span className="ts-menu-item-shortcut">Strg+Umschalt+H</span>
</button>
<button
className="ts-menu-item"
@@ -9752,7 +9771,6 @@ function AppInner() {
>
<span className="ts-menu-item-icon">📜</span>
<span className="ts-menu-item-label">{t("menu.extras.clientLog")}</span>
<span className="ts-menu-item-shortcut">Strg+L</span>
</button>
<div className="ts-menu-separator" />
<button
@@ -9764,7 +9782,6 @@ function AppInner() {
>
<span className="ts-menu-item-icon">🚫</span>
<span className="ts-menu-item-label">{t("menu.extras.banList")}</span>
<span className="ts-menu-item-shortcut">Strg+Umschalt+B</span>
</button>
<button
className="ts-menu-item"
@@ -9775,7 +9792,6 @@ function AppInner() {
>
<span className="ts-menu-item-icon">⚠️</span>
<span className="ts-menu-item-label">{t("menu.extras.complaintList")}</span>
<span className="ts-menu-item-shortcut">Strg+Umschalt+C</span>
</button>
<button
className="ts-menu-item"
@@ -9808,7 +9824,6 @@ function AppInner() {
>
<span className="ts-menu-item-icon">📄</span>
<span className="ts-menu-item-label">{t("menu.extras.serverLog")}</span>
<span className="ts-menu-item-shortcut">Strg+Umschalt+L</span>
</button>
<div className="ts-menu-separator" />
<button
@@ -9821,7 +9836,6 @@ function AppInner() {
>
<span className="ts-menu-item-icon">🔴</span>
<span className="ts-menu-item-label">{t("menu.extras.startRecording")}</span>
<span className="ts-menu-item-shortcut">Strg+Umschalt+R</span>
</button>
<button className="ts-menu-item" disabled>
<span className="ts-menu-item-icon">🔴</span>
@@ -9837,7 +9851,6 @@ function AppInner() {
>
<span className="ts-menu-item-icon">⏹️</span>
<span className="ts-menu-item-label">{t("menu.extras.stopRecording")}</span>
<span className="ts-menu-item-shortcut">Strg+Umschalt+T</span>
</button>
<div className="ts-menu-separator" />
<button
@@ -9849,7 +9862,6 @@ function AppInner() {
>
<span className="ts-menu-item-icon">⚙️</span>
<span className="ts-menu-item-label">{t("menu.extras.options")}</span>
<span className="ts-menu-item-shortcut">Alt+P</span>
</button>
</div>
)}
@@ -10193,8 +10205,8 @@ function AppInner() {
onServerTypeChange={setServerType}
onActiveIdentityChange={handleActiveIdentityChange}
onToggleExpanded={() => setConnectDialogExpanded((v) => !v)}
onConnect={handleConnect}
onConnectNewTab={handleConnect}
onConnect={() => handleConnect()}
onConnectNewTab={() => handleConnect()}
canOpenNewTab={sessionTabs.length > 0 || connected}
onCancel={novaSplash ? () => {} : () => setConnectDialogOpen(false)}
nova={designTheme === "nova"}
@@ -11078,7 +11090,6 @@ function AppInner() {
onSelectItem={handleSelectItem}
onSwitchChannel={handleSwitchChannel}
onOpenPrivateChat={handleOpenPrivateChat}
onPokeClient={handlePokeClient}
onMoveClient={handleMoveClient}
onClientContextMenu={handleClientContextMenu}
onChannelContextMenu={handleChannelContextMenu}
@@ -11231,9 +11242,9 @@ function AppInner() {
{log.slice(-50).map((entry, i) => {
let text = entry.text;
if (/os[- ]?error\s*10049/i.test(text) || /angeforderte Adresse ist in diesem Kontext ungültig/i.test(text)) {
text = "File-Transfer fehlgeschlagen (ungültige Adresse)";
text = t("log.fileTransferInvalidAddress");
} else {
text = text.replace(/^(file transfer failed:\s*)+/i, "File-Transfer fehlgeschlagen: ");
text = text.replace(/^(file transfer failed:\s*)+/i, `${t("log.fileTransferFailed")} `);
}
return (
<div key={i} className={entry.kind === "error" ? "ts-log-error" : "ts-log-info"}>
+11 -4
View File
@@ -37,10 +37,17 @@ function loadScript(src: string): Promise<void> {
function loadModule(): Promise<Aec3Module> {
if (!modulePromise) {
modulePromise = loadScript("/vendor/webrtcaec3.js").then(() => {
if (!window.WebRtcAec3) throw new Error("AEC3 script loaded but did not register window.WebRtcAec3");
return window.WebRtcAec3();
});
// BASE_URL keeps sub-path deployments (VITE_BASE_PATH) working; a failed
// load is forgotten so the next attempt retries instead of reusing it.
modulePromise = loadScript(`${import.meta.env.BASE_URL}vendor/webrtcaec3.js`)
.then(() => {
if (!window.WebRtcAec3) throw new Error("AEC3 script loaded but did not register window.WebRtcAec3");
return window.WebRtcAec3();
})
.catch((err) => {
modulePromise = null;
throw err;
});
}
return modulePromise;
}
+1
View File
@@ -1,3 +1,4 @@
/* eslint-disable react/only-export-components -- provider and its hooks belong together; only costs fast refresh */
import { createContext, useContext, useEffect, useState, type ReactNode } from "react";
import de from "./locales/de.json";
import en from "./locales/en.json";
+1 -1
View File
@@ -15,7 +15,7 @@ export type ParsedChannelName = {
};
/** Pure line fillers that look better as a CSS rule than raw `---` / `***`. */
const LINE_FILLER_RE = /^[\-\u2013\u2014\u2500\u2501\u2550=\*\.·_\s]+$/;
const LINE_FILLER_RE = /^[-\u2013\u2014\u2500\u2501\u2550=*.·_\s]+$/;
/** Corners / verticals of box-frame spacers (not pure horizontal fills). */
const BOX_FRAME_RE = /[╔╗╚╝╒╓╕╖╘╙╛╜┌┐└┘├┤┬┴┼║│╟╢╤╧╪╫╬╒╓╕╖╘╙╛╜]/;
+11 -1
View File
@@ -648,5 +648,15 @@
"nachrichten.templateName": "Vorlagenname",
"nachrichten.message": "Nachricht",
"nachrichten.add": "Hinzufügen",
"nachrichten.delete": "Löschen"
"nachrichten.delete": "Löschen",
"tree.expand": "Aufklappen",
"tree.collapse": "Zuklappen",
"tabs.disconnect": "Verbindung trennen",
"tabs.closeTab": "Tab schließen: {label}",
"identity.importInvalid": "„{file}“ ist keine gültige Identitätsdatei.",
"log.fileTransferFailed": "Dateiübertragung fehlgeschlagen:",
"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"
}
+11 -1
View File
@@ -648,5 +648,15 @@
"nachrichten.templateName": "Template name",
"nachrichten.message": "Message",
"nachrichten.add": "Add",
"nachrichten.delete": "Delete"
"nachrichten.delete": "Delete",
"tree.expand": "Expand",
"tree.collapse": "Collapse",
"tabs.disconnect": "Disconnect",
"tabs.closeTab": "Close tab: {label}",
"identity.importInvalid": "\"{file}\" is not a valid identity file.",
"log.fileTransferFailed": "File transfer failed:",
"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"
}
+11 -1
View File
@@ -647,5 +647,15 @@
"nachrichten.templateName": "نام الگو",
"nachrichten.message": "پیام",
"nachrichten.add": "افزودن",
"nachrichten.delete": "حذف"
"nachrichten.delete": "حذف",
"tree.expand": "باز کردن",
"tree.collapse": "بستن",
"tabs.disconnect": "قطع اتصال",
"tabs.closeTab": "بستن زبانه: {label}",
"identity.importInvalid": "«{file}» یک فایل هویت معتبر نیست.",
"log.fileTransferFailed": "انتقال فایل ناموفق بود:",
"log.fileTransferInvalidAddress": "انتقال فایل ناموفق بود (نشانی نامعتبر)",
"sounds.importFailed": "این بسته صدا خوانده نشد - آیا یک فایل ‎.ts3soundpack/ZIP معتبر است؟",
"tabs.connections": "اتصال‌های سرور",
"shortcut.ctrl": "Ctrl"
}
+11 -1
View File
@@ -647,5 +647,15 @@
"stream.state.disconnected": "连接中断",
"stream.state.failed": "连接失败",
"stream.state.closed": "已结束",
"clientContext.watchStream": "观看直播"
"clientContext.watchStream": "观看直播",
"tree.expand": "展开",
"tree.collapse": "折叠",
"tabs.disconnect": "断开连接",
"tabs.closeTab": "关闭标签页:{label}",
"identity.importInvalid": "“{file}”不是有效的身份文件。",
"log.fileTransferFailed": "文件传输失败:",
"log.fileTransferInvalidAddress": "文件传输失败(地址无效)",
"sounds.importFailed": "无法读取此音效包——它是有效的 .ts3soundpack/ZIP 文件吗?",
"tabs.connections": "服务器连接",
"shortcut.ctrl": "Ctrl"
}
+1
View File
@@ -1,3 +1,4 @@
import './storageFallback'
import { StrictMode } from 'react'
import { createRoot } from 'react-dom/client'
import './index.css'
+22
View File
@@ -0,0 +1,22 @@
// With storage blocked (privacy settings, some embedded webviews) merely
// touching `localStorage` throws, and dozens of module-level reads would
// leave a blank page. Swap in an in-memory stand-in so the app runs; settings
// just don't survive a reload then. Imported first thing in main.tsx.
try {
const probe = "__webspeak3_probe__";
localStorage.setItem(probe, probe);
localStorage.removeItem(probe);
} catch {
const data = new Map<string, string>();
const memory: Storage = {
get length() {
return data.size;
},
key: (i) => [...data.keys()][i] ?? null,
getItem: (k) => data.get(k) ?? null,
setItem: (k, v) => void data.set(k, String(v)),
removeItem: (k) => void data.delete(k),
clear: () => data.clear(),
};
Object.defineProperty(window, "localStorage", { value: memory, configurable: true });
}
@@ -1,4 +1,5 @@
import type { ReactNode } from "react";
import { useT } from "../../i18n";
export type ConnectionTabItem = {
id: string;
@@ -39,11 +40,12 @@ export function GreenteaSpeakChrome({
: []);
const hasTabs = resolvedTabs.length > 0;
const t = useT();
return (
<>
{hasTabs ? (
<div className="gts-connection-tabs" role="tablist" aria-label="Server-Verbindungen">
<div className="gts-connection-tabs" role="tablist" aria-label={t("tabs.connections")}>
{resolvedTabs.map((tab) => {
const isActive = tab.id === (activeTabId ?? resolvedTabs[0]?.id);
return (
@@ -62,8 +64,8 @@ export function GreenteaSpeakChrome({
<button
type="button"
className="gts-connection-tab-close"
title="Verbindung trennen"
aria-label={`Tab schließen: ${tab.label}`}
title={t("tabs.disconnect")}
aria-label={t("tabs.closeTab", { label: tab.label })}
onClick={(e) => {
e.stopPropagation();
onCloseTab(tab.id);