Options: Meldungen tab (TS3 notification tree, sound packs, text position)

All 93 TS3 notification keys in the native tree layout (Aktion / Sound Skript /
Text Position), per-row and per-group checkboxes, editable scripts (play/say),
customized rows in bold. Sound packs: WebSpeak3 default, no sounds, or an
imported .ts3_soundpack (settings.ini parsed 1:1). "Wenn Ausgabe stumm", and a
per-favorite sound pack override in the favorites dialog. Existing sound
triggers now go through the keys; server log lines follow Text Position.

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-10-23 20:26:40 +00:00
1 parent 7f8fada880
commit b4bd62c1b5
9 files changed
+1195 -33

No files matched your search

+83
View File
@@ -4768,3 +4768,86 @@
gap: 8px;
flex-wrap: wrap;
}
/* Options -> Meldungen */
.ts-notify-row {
display: flex;
align-items: center;
gap: 6px;
}
.ts-notify-row > label {
min-width: 140px;
}
.ts-notify-row > select {
flex: 1;
min-width: 0;
}
.ts-notify-hint {
margin: 0;
font-size: 0.9em;
}
.ts-notify-tree {
max-height: 360px;
overflow: auto;
border: 1px solid var(--border);
background: var(--input-bg);
}
.ts-notify-tree table {
width: 100%;
border-collapse: collapse;
font-size: 0.9em;
}
.ts-notify-tree th {
position: sticky;
top: 0;
z-index: 1;
text-align: left;
font-weight: normal;
padding: 2px 6px;
background: var(--bg-toolbar-1);
border-bottom: 1px solid var(--border);
}
.ts-notify-tree td {
padding: 1px 4px;
white-space: nowrap;
}
.ts-notify-custom > td:first-child {
font-weight: bold;
}
.ts-notify-action {
display: inline-flex;
align-items: center;
gap: 4px;
}
.ts-notify-twisty {
border: none;
background: none;
padding: 0 2px;
min-width: 0;
color: inherit;
cursor: pointer;
}
.ts-notify-script {
display: flex;
align-items: center;
gap: 2px;
}
.ts-notify-script input {
flex: 1;
min-width: 140px;
border: 1px solid transparent;
background: transparent;
color: inherit;
font-family: monospace;
}
.ts-notify-script input:focus {
border-color: var(--border);
background: var(--input-bg);
}
.ts-notify-script button {
padding: 0 4px;
min-width: 0;
}
.ts-notify-tree select {
font-size: 1em;
}
+325 -28
View File
@@ -1,4 +1,4 @@
import { createContext, useContext, useEffect, useMemo, useRef, useState, type ReactNode } from "react";
import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState, type ReactNode } from "react";
import { useRegisterSW } from "virtual:pwa-register/react";
import "./App.css";
// After App.css: its :where() base variables have the same (zero) specificity.
@@ -141,6 +141,27 @@ import {
type SoundEventId,
} from "./sounds";
import { parseSoundpack } from "./soundpack";
import {
BUILTIN_PACK,
NO_SOUNDS_PACK,
NOTIFICATION_TREE,
deleteSoundPack,
getNotificationSettings,
importSoundPack,
isSpecialKey,
loadSoundPacks,
notificationTextPosition,
notify,
packScript,
runSoundScript,
saveNotificationSettings,
setNotificationPlaybackMuted,
setSessionSoundPack,
type NotificationNode,
type NotificationSettings,
type SoundPack,
type TextPosition,
} from "./notifications";
import {
iconPackCss,
loadIconPacks,
@@ -592,6 +613,8 @@ interface Favorite {
defaultChannelPassword: string;
/** When true, ServerQuery clients appear in the channel tree. Default: false. */
showServerQueryClients: boolean;
/** Overrides Options -> Meldungen's sound pack for this server; unset = that one. */
soundPack?: string;
}
function normalizeFavorite(raw: Partial<Favorite> & Pick<Favorite, "id">): Favorite {
@@ -605,6 +628,7 @@ function normalizeFavorite(raw: Partial<Favorite> & Pick<Favorite, "id">): Favor
defaultChannelPassword:
typeof raw.defaultChannelPassword === "string" ? raw.defaultChannelPassword : "",
showServerQueryClients: raw.showServerQueryClients === true,
...(typeof raw.soundPack === "string" && raw.soundPack ? { soundPack: raw.soundPack } : {}),
};
}
@@ -1931,6 +1955,19 @@ function InfoPanel({
);
}
/** Gateway serverLog kind -> Options -> Meldungen key. The server doesn't say who did it, so "by other". */
const SERVER_LOG_NOTIFICATIONS = {
clientJoin: "CLIENT_CONNECTION_CONNECTED_SERVER",
clientLeave: "CLIENT_CONNECTION_DISCONNECTED_SERVER",
clientChannelSwitch: "CLIENT_SWITCHED_TO_OTHER_CHANNEL_STAYS",
clientChannelGroupAssigned: "CLIENT_CHANNELGROUP_CHANGED_BY_USER",
channelCreated: "CHANNEL_CREATED_BY_OTHER",
channelDeleted: "CHANNEL_DELETED_BY_OTHER",
channelEdited: "CHANNEL_EDITED_OTHER_BY_OTHER",
serverEdited: "SERVER_EDITED_BY_OTHER",
permissionError: "SERVER_INSUFFICIENT_PERMISSIONS",
} as const;
interface ChatEntry {
from: string;
message: string;
@@ -3432,8 +3469,13 @@ function FavoritesDialog({
</label>
<label className="ts-dialog-field">
{t("connect.soundPack")}
<select disabled defaultValue="Standard">
<option>Standard</option>
<select
disabled={!selected}
value={selected?.soundPack ?? ""}
onChange={(e) => updateSelected({ soundPack: e.target.value || undefined })}
>
<option value="">Standard</option>
<SoundPackOptions />
</select>
</label>
<label className="ts-dialog-checkbox">
@@ -6648,6 +6690,226 @@ function SecurityPanel({ onOpenIdentities, onClearCache }: { onOpenIdentities: (
);
}
function useSoundPacks(): [SoundPack[], () => void] {
const [packs, setPacks] = useState<SoundPack[]>([]);
const reload = useCallback(() => void loadSoundPacks().then(setPacks), []);
useEffect(reload, [reload]);
return [packs, reload];
}
/** WebSpeak3 Standard, Keine Sounds and the imported packs. */
function SoundPackOptions() {
const t = useT();
const [packs] = useSoundPacks();
return (
<>
<option value={BUILTIN_PACK}>{t("notify.pack.builtin")}</option>
<option value={NO_SOUNDS_PACK}>{t("notify.pack.none")}</option>
{packs.map((p) => (
<option key={p.id} value={p.id}>
{p.name}
</option>
))}
</>
);
}
const notificationLeaves = (node: NotificationNode): string[] =>
node.key ? [node.key] : (node.children ?? []).flatMap(notificationLeaves);
function MeldungenPanel({ onOpenFavorites }: { onOpenFavorites: () => void }) {
const t = useT();
const [settings, setSettings] = useState<NotificationSettings>(getNotificationSettings);
const [packs, reloadPacks] = useSoundPacks();
const [open, setOpen] = useState<Set<string>>(() => new Set(["connection"]));
const fileRef = useRef<HTMLInputElement>(null);
const pack = packs.find((p) => p.id === settings.pack);
const save = (next: NotificationSettings) => {
saveNotificationSettings(next);
setSettings(next);
};
const defaultScript = (key: string) => packScript(pack, settings.pack, key);
const override = (keys: string[], patch: { off?: boolean; script?: string; text?: TextPosition }) => {
const overrides = { ...settings.overrides };
for (const key of keys) {
const merged = { ...overrides[key], ...patch };
// Values equal to the default aren't overrides (that's what makes a row bold).
if (!merged.off) delete merged.off;
if (merged.script === defaultScript(key)) delete merged.script;
if (merged.text === "server") delete merged.text;
if (Object.keys(merged).length) overrides[key] = merged;
else delete overrides[key];
}
save({ ...settings, overrides });
};
const handleImport = async (file: File) => {
try {
const imported = await importSoundPack(file);
reloadPacks();
save({ ...settings, pack: imported.id });
} catch {
window.alert(t("notify.importFailed"));
}
};
const renderNode = (node: NotificationNode, path: string, depth: number): React.ReactNode => {
const id = `${path}/${node.label}`;
const special = node.key ? isSpecialKey(node.key) : id === "/special";
const indent = { paddingLeft: 4 + depth * 16 };
if (node.key) {
const key = node.key;
const o = settings.overrides[key];
const script = o?.script ?? defaultScript(key);
return (
<tr key={id} className={o ? "ts-notify-custom" : undefined}>
<td style={indent}>
<label className="ts-notify-action">
{!special && (
<input type="checkbox" checked={!o?.off} onChange={(e) => override([key], { off: !e.target.checked })} />
)}
{t(`notify.${node.label}`)}
</label>
</td>
<td>
<span className="ts-notify-script">
<input
value={script}
spellCheck={false}
onChange={(e) => override([key], { script: e.target.value })}
/>
{script && (
<button title={t("sounds.test")} onClick={() => void runSoundScript(script, settings.pack)}>
▶
</button>
)}
</span>
</td>
<td>
{!special && (
<select
value={o?.text ?? "server"}
onChange={(e) => override([key], { text: e.target.value as TextPosition })}
>
<option value="none">{t("notify.text.none")}</option>
<option value="server">{t("notify.text.server")}</option>
<option value="channel">{t("notify.text.channel")}</option>
</select>
)}
</td>
</tr>
);
}
const leaves = notificationLeaves(node);
const on = leaves.filter((k) => !settings.overrides[k]?.off).length;
const expanded = open.has(id);
const toggle = () =>
setOpen((prev) => {
const next = new Set(prev);
if (!next.delete(id)) next.add(id);
return next;
});
return [
<tr key={id} className={leaves.some((k) => settings.overrides[k]) ? "ts-notify-custom" : undefined}>
<td style={indent} colSpan={3}>
<span className="ts-notify-action">
<button className="ts-notify-twisty" onClick={toggle}>
{expanded ? "▾" : "▸"}
</button>
{!special && (
<input
type="checkbox"
checked={on === leaves.length}
ref={(el) => {
if (el) el.indeterminate = on > 0 && on < leaves.length;
}}
onChange={(e) => override(leaves, { off: !e.target.checked })}
/>
)}
<span onClick={toggle}>{t(`notify.${node.label}`)}</span>
</span>
</td>
</tr>,
...(expanded ? (node.children ?? []).map((c) => renderNode(c, id, depth + 1)) : []),
];
};
return (
<>
<h3>{t("options.section.meldungen")}</h3>
<p className="ts-options-subtitle">{t("notify.subtitle")}</p>
<div className="ts-options-fields">
<div className="ts-notify-row">
<label htmlFor="ts-notify-pack">{t("notify.soundPack")}</label>
<select id="ts-notify-pack" value={settings.pack} onChange={(e) => save({ ...settings, pack: e.target.value })}>
<SoundPackOptions key={packs.length} />
</select>
<button title={t("notify.importPack")} onClick={() => fileRef.current?.click()}>
📂
</button>
{pack && (
<button
title={t("notify.deletePack")}
onClick={() => {
if (!window.confirm(t("notify.deletePackConfirm", { name: pack.name }))) return;
void deleteSoundPack(pack.id).then(reloadPacks);
save({ ...settings, pack: BUILTIN_PACK });
}}
>
🗑
</button>
)}
<input
ref={fileRef}
type="file"
accept=".ts3_soundpack,.zip"
hidden
onChange={(e) => {
const file = e.target.files?.[0];
e.target.value = "";
if (file) void handleImport(file);
}}
/>
</div>
<div className="ts-notify-row">
<label htmlFor="ts-notify-muted">{t("notify.whenMuted")}</label>
<select
id="ts-notify-muted"
value={settings.whenMuted}
onChange={(e) => save({ ...settings, whenMuted: e.target.value as NotificationSettings["whenMuted"] })}
>
<option value="all">{t("notify.whenMuted.all")}</option>
<option value="none">{t("notify.whenMuted.none")}</option>
</select>
</div>
<p className="ts-notify-hint">
{t("notify.hintBefore")}
<a href="#" onClick={(e) => (e.preventDefault(), onOpenFavorites())}>
{t("notify.hintLink")}
</a>
{t("notify.hintAfter")}
</p>
<div className="ts-notify-tree">
<table>
<thead>
<tr>
<th>{t("notify.col.action")}</th>
<th>{t("notify.col.script")}</th>
<th>{t("notify.col.text")}</th>
</tr>
</thead>
<tbody>{NOTIFICATION_TREE.map((n) => renderNode(n, "", 0))}</tbody>
</table>
</div>
{Object.keys(settings.overrides).length > 0 && (
<div>
<button onClick={() => save({ ...settings, overrides: {} })}>{t("notify.resetAll")}</button>
</div>
)}
</div>
</>
);
}
function DesignPanel({
designSelection,
onSelectionChange,
@@ -7606,6 +7868,7 @@ function OptionsDialog({
onOpenWhisperLists,
onOpenIdentities,
onClearCache,
onOpenFavorites,
}: {
section: string;
onSectionChange: (id: string) => void;
@@ -7625,6 +7888,7 @@ function OptionsDialog({
onOpenWhisperLists: () => void;
onOpenIdentities: () => void;
onClearCache: () => void;
onOpenFavorites: () => void;
}) {
const t = useT();
const active = OPTIONS_SECTIONS.find((s) => s.id === section) ?? OPTIONS_SECTIONS[0];
@@ -7687,6 +7951,8 @@ function OptionsDialog({
<ChatPanel />
) : active.id === "sicherheit" ? (
<SecurityPanel onOpenIdentities={onOpenIdentities} onClearCache={onClearCache} />
) : active.id === "meldungen" ? (
<MeldungenPanel onOpenFavorites={onOpenFavorites} />
) : (
<>
<h3>{t(`options.section.${active.id}`)}</h3>
@@ -9083,7 +9349,7 @@ function AppInner() {
sessionsRef.current.delete(sessionId);
sessionParamsRef.current.delete(sessionId);
setSessionTabs((prev) => prev.filter((t) => t.id !== sessionId));
void playSound("disconnect");
void notify("CONNECTION_DISCONNECTED");
return;
}
// Background tabs get logged too (Options -> Chat).
@@ -9110,9 +9376,9 @@ function AppInner() {
});
if (data.type === "connected") {
connectedAtRef.current.set(sessionId, Date.now());
void playSound("connect");
void notify("CONNECTION_CONNECTED");
}
else if (data.type === "poke") void playSound("poke");
else if (data.type === "poke") void notify("OTHER_RECEIVED_POKE");
return;
}
@@ -9162,23 +9428,38 @@ function AppInner() {
setSelected({ type: "server" });
setServerChat((prev) => capLines([...prev, { from: "Server", message: data.welcomeMessage }], chatSettingsRef.current.maxLines));
previousClientsRef.current = null;
void playSound("connect");
void notify("CONNECTION_CONNECTED");
break;
case "channels": {
const newClients: ClientInfo[] = data.clients;
const prevClients = previousClientsRef.current;
if (prevClients) {
const prevIds = new Set(prevClients.map((c) => c.id));
const ownId = typeof data.ownClientId === "number" && data.ownClientId > 0 ? data.ownClientId : null;
const isOwn = (c: ClientInfo) => (ownId != null ? c.id === ownId : c.name === connectNickname);
const prevById = new Map(prevClients.map((c) => [c.id, c]));
const newIds = new Set(newClients.map((c) => c.id));
// ServerQuery churn is noisy; never play join/leave for those clients.
const joined = newClients.some(
(c) => !prevIds.has(c.id) && c.name !== connectNickname && !c.isQuery
);
const left = prevClients.some(
(c) => !newIds.has(c.id) && c.name !== connectNickname && !c.isQuery
);
if (joined) void playSound("clientJoin");
if (left) void playSound("clientLeave");
const oldOwn = prevClients.find(isOwn)?.channel;
const newOwn = newClients.find(isOwn)?.channel;
// One sound per kind per update; ServerQuery churn is noisy, never notify for those.
const keys = new Set<string>();
if (oldOwn != null && newOwn != null && oldOwn !== newOwn) keys.add("YOU_SWITCHED_CHANNEL");
for (const c of newClients) {
if (isOwn(c) || c.isQuery) continue;
const before = prevById.get(c.id);
if (!before) keys.add(`CLIENT_CONNECTION_CONNECTED_${c.channel === newOwn ? "CURRENT_CHANNEL" : "SERVER"}`);
else if (before.channel !== c.channel)
keys.add(
c.channel === newOwn
? "CLIENT_SWITCHED_TO_CURRENT_CHANNEL_STAYS"
: before.channel === oldOwn
? "CLIENT_SWITCHED_FROM_CURRENT_CHANNEL_STAYS"
: "CLIENT_SWITCHED_TO_OTHER_CHANNEL_STAYS"
);
}
for (const c of prevClients)
if (!newIds.has(c.id) && !isOwn(c) && !c.isQuery)
keys.add(`CLIENT_CONNECTION_DISCONNECTED_${c.channel === oldOwn ? "CURRENT_CHANNEL" : "SERVER"}`);
for (const key of keys) void notify(key);
}
previousClientsRef.current = newClients;
setChannels(data.channels);
@@ -9211,7 +9492,7 @@ function AppInner() {
if (!fromSelf && activeTabRef.current !== tab && (tab === "channel" ? settings.notifyChannel : settings.notifyServer))
setChatUnread((prev) => ({ ...prev, [tab]: true }));
recordUrlsFromMessage(data.message, data.from);
if (!fromSelf) void playSound("message");
void notify(fromSelf ? "CHAT_SENT_MESSAGE" : "CHAT_RECEIVED_MESSAGE");
break;
}
case "privateMessage": {
@@ -9249,7 +9530,7 @@ function AppInner() {
if (settings.logPrivate)
appendChatLog(connectHost, logKind, { from: data.partnerName, message: data.message, self: data.fromSelf });
recordUrlsFromMessage(data.message, data.fromSelf ? connectNickname : data.partnerName);
if (!data.fromSelf) void playSound("message");
void notify(data.fromSelf ? "CHAT_SENT_MESSAGE" : "CHAT_RECEIVED_MESSAGE");
break;
}
case "audioOut":
@@ -9261,8 +9542,8 @@ function AppInner() {
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");
if ([...next].some((id) => !prev.has(id))) void notify("SPECIAL_MIC_CLICK_OTHER_ON");
else if ([...prev].some((id) => !next.has(id))) void notify("SPECIAL_MIC_CLICK_OTHER_OFF");
}
talkersRef.current = next;
setTalkers(next);
@@ -9279,13 +9560,14 @@ function AppInner() {
incoming: true,
},
]);
if (whisperSettingsRef.current.sound && !outputMutedRef.current) void playSound("whisper");
if (whisperSettingsRef.current.sound && !outputMutedRef.current) void notify("SPECIAL_WHISPER_NOTIFY");
if (whisperSettingsRef.current.openHistory) setWhisperHistoryOpen(true);
break;
}
case "reconnecting":
// The gateway lost the TS server and is reconnecting by itself.
appendLog({ text: t("log.serverReconnecting"), kind: "error" });
void notify("CONNECTION_LOST_CONNECTION");
logClient("warning", "Connection", `Lost the server, reconnecting: ${data.reason}`);
updateTabMeta(sessionId, { connecting: true });
break;
@@ -9319,7 +9601,7 @@ function AppInner() {
const id = ++pokeIdRef.current;
setPokes((prev) => [...prev, { id, from: data.from, message: data.message }]);
setTimeout(() => setPokes((prev) => prev.filter((p) => p.id !== id)), 10000);
void playSound("poke");
void notify("OTHER_RECEIVED_POKE", { clientName: data.from });
break;
}
case "serverLog": {
@@ -9357,7 +9639,14 @@ function AppInner() {
message = t("serverLog.permissionError", { action: data.action });
break;
}
setServerChat((prev) => capLines([...prev, { from: "", message, isLog: true }], chatSettingsRef.current.maxLines));
const key = SERVER_LOG_NOTIFICATIONS[data.kind as keyof typeof SERVER_LOG_NOTIFICATIONS];
// Join/leave/switch sounds come from the channel diff above; these only place the text.
if (!["clientJoin", "clientLeave", "clientChannelSwitch"].includes(data.kind)) void notify(key);
const position = notificationTextPosition(key);
if (position !== "none")
(position === "channel" ? setChat : setServerChat)((prev) =>
capLines([...prev, { from: "", message, isLog: true }], chatSettingsRef.current.maxLines)
);
break;
}
case "disconnected": {
@@ -9367,7 +9656,7 @@ function AppInner() {
channelPasswordCacheRef.current.clear();
appendLog({ text: `Disconnected: ${data.reason}`, kind: "info" });
logClient("info", "Connection", `Disconnected: ${data.reason}`);
if (wasConnected) void playSound("disconnect");
if (wasConnected) void notify("CONNECTION_DISCONNECTED");
streamViewerRef.current?.close();
streamViewerRef.current = null;
setWatchedStream(null);
@@ -9965,6 +10254,7 @@ function AppInner() {
const sendAway = (away: boolean, message: string) => {
socketRef.current?.send(JSON.stringify({ type: "setAway", away, message }));
void notify(away ? "STATUS_SET_AWAY" : "STATUS_SET_PRESENT");
};
const handleSaveAwayTemplate = () => {
@@ -10482,7 +10772,7 @@ function AppInner() {
return;
}
socketRef.current?.send(JSON.stringify({ type: "setInputMuted", muted: !inputMutedRef.current }));
void playSound("mute");
void notify(inputMutedRef.current ? "SOUND_CAPTURE_UNMUTED" : "SOUND_CAPTURE_MUTED");
};
// Enable the mic automatically on page load (voice activation still gates
@@ -10613,7 +10903,7 @@ function AppInner() {
const handleToggleOutputMuted = () => {
socketRef.current?.send(JSON.stringify({ type: "setOutputMuted", muted: !outputMutedRef.current }));
void playSound("mute");
void notify(outputMutedRef.current ? "SOUND_PLAYBACK_UNMUTED" : "SOUND_PLAYBACK_MUTED");
};
// Connects the current mic (if any) into the active recording, so a device
@@ -11443,6 +11733,7 @@ function AppInner() {
if (ok) x.done = x.size;
const settings = downloadSettingsRef.current;
if (ok && settings.popupWhenDone) setTransferToast({ name: x.name });
void notify(ok ? "OTHER_FILETRANSFER_COMPLETE" : "OTHER_FILETRANSFER_FAILED");
if (settings.closeWindowWhenDone && transfersRef.current.every((y) => y.status === "done")) setTransfersOpen(false);
commitTransfers();
};
@@ -11631,6 +11922,11 @@ function AppInner() {
const outputMuted = ownClient?.outputMuted ?? false;
const selfTalking = Boolean(selfActive && !inputMuted && ownClient?.hasTalkPower);
const displayTalkers = selfTalking && ownClient ? new Set(talkers).add(ownClient.id) : talkers;
useEffect(() => setNotificationPlaybackMuted(outputMuted), [outputMuted]);
useEffect(
() => setSessionSoundPack(favorites.find((f) => f.id === activeFavoriteId)?.soundPack),
[favorites, activeFavoriteId]
);
const selfTalkingSeenRef = useRef(false);
useEffect(() => {
// Skip the initial render so opening the client doesn't click.
@@ -11638,7 +11934,7 @@ function AppInner() {
selfTalkingSeenRef.current = true;
return;
}
if (ownMicClicks && !outputMuted) void playSound(selfTalking ? "micClickOn" : "micClickOff");
if (ownMicClicks && !outputMuted) void notify(selfTalking ? "SPECIAL_MIC_CLICK_SELF_ON" : "SPECIAL_MIC_CLICK_SELF_OFF");
}, [selfTalking]); // eslint-disable-line react-hooks/exhaustive-deps
const showServerQueryClients =
activeFavoriteId != null &&
@@ -12864,6 +13160,7 @@ function AppInner() {
<OptionsDialog
onOpenWhisperLists={() => setWhisperListsOpen(true)}
onOpenIdentities={() => setIdentitiesOpen(true)}
onOpenFavorites={openManageFavorites}
onClearCache={handleClearCache}
section={optionsSection}
onSectionChange={setOptionsSection}
+95 -1
View File
@@ -808,5 +808,99 @@
"securitySettings.clearCache": "Vyprázdnit mezipaměť",
"securitySettings.cacheCleared": "Mezipaměť vyprázdněna.",
"securitySettings.identities": "Identity",
"securitySettings.manageIdentities": "Spravovat identity"
"securitySettings.manageIdentities": "Spravovat identity",
"notify.connection": "Připojení",
"notify.connected": "Připojeno k serveru",
"notify.disconnected": "Odpojeno od serveru",
"notify.lostConnection": "Ztraceno spojení se serverem",
"notify.channel": "Kanál",
"notify.created": "Vytvořen",
"notify.deleted": "Smazán",
"notify.edited": "Upraven",
"notify.moved": "Přesunut",
"notify.currentChannel": "Aktuální kanál",
"notify.otherChannel": "Jiný kanál",
"notify.byYou": "Vámi",
"notify.byOther": "Jiným klientem",
"notify.server": "Server",
"notify.insufficientPermissions": "Nedostatečná oprávnění",
"notify.error": "Chyba",
"notify.client": "Klient",
"notify.switched": "Změnil kanál",
"notify.movedClient": "Přesunut",
"notify.kickedChannel": "Vyhozen z kanálu",
"notify.kickedServer": "Vyhozen ze serveru",
"notify.banned": "Zabanován",
"notify.toCurrent": "Do aktuálního kanálu",
"notify.fromCurrent": "Z aktuálního kanálu",
"notify.toOther": "Do jiného kanálu",
"notify.appears": "Objeví se",
"notify.stays": "Zůstane viditelný",
"notify.disappears": "Zmizí",
"notify.serverGroup": "Serverová skupina",
"notify.channelGroup": "Změněna skupina kanálu",
"notify.added": "Přidána",
"notify.removed": "Odebrána",
"notify.byServer": "Serverem",
"notify.byUser": "Uživatelem",
"notify.recording": "Nahrávání",
"notify.recordingStart": "Nahrávání zahájeno",
"notify.recordingStop": "Nahrávání ukončeno",
"notify.recordingInChannel": "Nahrávání v kanálu aktivní",
"notify.talkPowerRequested": "Požádal o právo mluvit",
"notify.self": "Já",
"notify.youSwitched": "Změna kanálu",
"notify.youMoved": "Přesunut do jiného kanálu",
"notify.youKickedServer": "Vyhozen ze serveru",
"notify.youKickedChannel": "Vyhozen z kanálu",
"notify.youBanned": "Zabanován",
"notify.talkPowerGranted": "Uděleno právo mluvit",
"notify.talkPowerRevoked": "Odebráno právo mluvit",
"notify.chat": "Chat",
"notify.messageSent": "Zpráva odeslána",
"notify.messageReceived": "Zpráva přijata",
"notify.capture": "Záznam zvuku",
"notify.playback": "Přehrávání zvuku",
"notify.muted": "Ztlumeno",
"notify.unmuted": "Zapnuto",
"notify.status": "Stav",
"notify.away": "Nepřítomen",
"notify.present": "Zpět",
"notify.other": "Ostatní",
"notify.poked": "Šťouchnutí",
"notify.transferComplete": "Přenos souboru dokončen",
"notify.transferFailed": "Přenos souboru selhal",
"notify.whisperListEmpty": "Seznam šeptání je prázdný",
"notify.whisperTargetNotFound": "Cíl šeptání nenalezen",
"notify.whisperTooMany": "Příliš mnoho cílů šeptání",
"notify.special": "Speciální",
"notify.micClickOtherOn": "Klik mikrofonu ostatní zap.",
"notify.micClickOtherOff": "Klik mikrofonu ostatní vyp.",
"notify.micClickSelfOn": "Klik mikrofonu vlastní zap.",
"notify.micClickSelfOff": "Klik mikrofonu vlastní vyp.",
"notify.whisperNotify": "Upozornění na šeptání",
"notify.soundTest": "Test zvuku",
"notify.test3d": "3D test",
"notify.talkingWhileMuted": "Mluvení při ztlumení",
"notify.subtitle": "Nastavení upozornění",
"notify.soundPack": "Zvukový balíček:",
"notify.pack.builtin": "WebSpeak3 výchozí",
"notify.pack.none": "Bez zvuků",
"notify.importPack": "Importovat zvukový balíček TS3 (.ts3_soundpack / .zip)",
"notify.deletePack": "Smazat zvukový balíček",
"notify.deletePackConfirm": "Smazat zvukový balíček \"{name}\"?",
"notify.importFailed": "Toto není platný zvukový balíček TS3 (chybí settings.ini).",
"notify.whenMuted": "Při ztlumeném výstupu:",
"notify.whenMuted.all": "Přehrávat všechny zvuky",
"notify.whenMuted.none": "Nepřehrávat žádné zvuky",
"notify.hintBefore": "Poznámka: zvukový balíček lze přepsat pro každého ",
"notify.hintLink": "oblíbeného",
"notify.hintAfter": ".",
"notify.col.action": "Akce",
"notify.col.script": "Zvukový skript",
"notify.col.text": "Pozice textu",
"notify.text.none": "Žádná",
"notify.text.server": "Server",
"notify.text.channel": "Kanál",
"notify.resetAll": "Obnovit všechny změny"
}
+95 -1
View File
@@ -808,5 +808,99 @@
"securitySettings.clearCache": "Cache löschen",
"securitySettings.cacheCleared": "Cache gelöscht.",
"securitySettings.identities": "Identitäten",
"securitySettings.manageIdentities": "Identitäten verwalten"
"securitySettings.manageIdentities": "Identitäten verwalten",
"notify.connection": "Verbindung",
"notify.connected": "Zu Server verbunden",
"notify.disconnected": "Von Server getrennt",
"notify.lostConnection": "Verbindung zum Server verloren",
"notify.channel": "Channel",
"notify.created": "Erstellt",
"notify.deleted": "Gelöscht",
"notify.edited": "Editiert",
"notify.moved": "Bewegt",
"notify.currentChannel": "Aktueller Channel",
"notify.otherChannel": "Anderer Channel",
"notify.byYou": "Von Ihnen",
"notify.byOther": "Von anderem Client",
"notify.server": "Server",
"notify.insufficientPermissions": "Unzureichende Rechte",
"notify.error": "Fehler",
"notify.client": "Client",
"notify.switched": "Channel gewechselt",
"notify.movedClient": "Verschoben",
"notify.kickedChannel": "Aus Channel gekickt",
"notify.kickedServer": "Vom Server gekickt",
"notify.banned": "Gebannt",
"notify.toCurrent": "In aktuellen Channel",
"notify.fromCurrent": "Aus aktuellem Channel",
"notify.toOther": "In anderen Channel",
"notify.appears": "Erscheint",
"notify.stays": "Bleibt sichtbar",
"notify.disappears": "Verschwindet",
"notify.serverGroup": "Servergruppe",
"notify.channelGroup": "Channelgruppe geändert",
"notify.added": "Hinzugefügt",
"notify.removed": "Entfernt",
"notify.byServer": "Durch Server",
"notify.byUser": "Durch Benutzer",
"notify.recording": "Aufnahme",
"notify.recordingStart": "Aufnahme gestartet",
"notify.recordingStop": "Aufnahme beendet",
"notify.recordingInChannel": "Aufnahme im Channel aktiv",
"notify.talkPowerRequested": "Sprechrecht angefragt",
"notify.self": "Selbst",
"notify.youSwitched": "Channel gewechselt",
"notify.youMoved": "In anderen Channel verschoben",
"notify.youKickedServer": "Vom Server gekickt",
"notify.youKickedChannel": "Aus Channel gekickt",
"notify.youBanned": "Gebannt",
"notify.talkPowerGranted": "Sprechrecht erhalten",
"notify.talkPowerRevoked": "Sprechrecht entzogen",
"notify.chat": "Chat",
"notify.messageSent": "Nachricht gesendet",
"notify.messageReceived": "Nachricht empfangen",
"notify.capture": "Sound Aufnahme",
"notify.playback": "Sound Wiedergabe",
"notify.muted": "Stumm geschaltet",
"notify.unmuted": "Aktiviert",
"notify.status": "Status",
"notify.away": "Abwesend",
"notify.present": "Wieder da",
"notify.other": "Andere",
"notify.poked": "Angestupst",
"notify.transferComplete": "Dateiübertragung abgeschlossen",
"notify.transferFailed": "Dateiübertragung fehlgeschlagen",
"notify.whisperListEmpty": "Flüsterliste leer",
"notify.whisperTargetNotFound": "Kein Flüsterziel gefunden",
"notify.whisperTooMany": "Zu viele Flüsterziele",
"notify.special": "Speziell",
"notify.micClickOtherOn": "Mikrofonklick andere an",
"notify.micClickOtherOff": "Mikrofonklick andere aus",
"notify.micClickSelfOn": "Mikrofonklick selbst an",
"notify.micClickSelfOff": "Mikrofonklick selbst aus",
"notify.whisperNotify": "Flüster-Hinweis",
"notify.soundTest": "Soundtest",
"notify.test3d": "3D-Test",
"notify.talkingWhileMuted": "Sprechen trotz Stummschaltung",
"notify.subtitle": "Meldungen einstellen",
"notify.soundPack": "Sound Pack:",
"notify.pack.builtin": "WebSpeak3 Standard",
"notify.pack.none": "Keine Sounds",
"notify.importPack": "TS3 Sound Pack importieren (.ts3_soundpack / .zip)",
"notify.deletePack": "Sound Pack löschen",
"notify.deletePackConfirm": "Sound Pack \"{name}\" löschen?",
"notify.importFailed": "Das ist kein gültiges TS3 Sound Pack (settings.ini fehlt).",
"notify.whenMuted": "Wenn Ausgabe stumm:",
"notify.whenMuted.all": "Alle Sounds spielen",
"notify.whenMuted.none": "Keine Sounds spielen",
"notify.hintBefore": "Hinweis: Das Sound Pack kann für jeden ",
"notify.hintLink": "Favoriten",
"notify.hintAfter": " überschrieben werden.",
"notify.col.action": "Aktion",
"notify.col.script": "Sound Skript",
"notify.col.text": "Text Position",
"notify.text.none": "Keine",
"notify.text.server": "Server",
"notify.text.channel": "Channel",
"notify.resetAll": "Alle Anpassungen zurücksetzen"
}
+95 -1
View File
@@ -808,5 +808,99 @@
"securitySettings.clearCache": "Clear cache",
"securitySettings.cacheCleared": "Cache cleared.",
"securitySettings.identities": "Identities",
"securitySettings.manageIdentities": "Manage identities"
"securitySettings.manageIdentities": "Manage identities",
"notify.connection": "Connection",
"notify.connected": "Connected to server",
"notify.disconnected": "Disconnected from server",
"notify.lostConnection": "Lost connection to server",
"notify.channel": "Channel",
"notify.created": "Created",
"notify.deleted": "Deleted",
"notify.edited": "Edited",
"notify.moved": "Moved",
"notify.currentChannel": "Current channel",
"notify.otherChannel": "Other channel",
"notify.byYou": "By you",
"notify.byOther": "By another client",
"notify.server": "Server",
"notify.insufficientPermissions": "Insufficient permissions",
"notify.error": "Error",
"notify.client": "Client",
"notify.switched": "Switched channel",
"notify.movedClient": "Moved",
"notify.kickedChannel": "Kicked from channel",
"notify.kickedServer": "Kicked from server",
"notify.banned": "Banned",
"notify.toCurrent": "To current channel",
"notify.fromCurrent": "From current channel",
"notify.toOther": "To other channel",
"notify.appears": "Appears",
"notify.stays": "Stays visible",
"notify.disappears": "Disappears",
"notify.serverGroup": "Server group",
"notify.channelGroup": "Channel group changed",
"notify.added": "Added",
"notify.removed": "Removed",
"notify.byServer": "By server",
"notify.byUser": "By user",
"notify.recording": "Recording",
"notify.recordingStart": "Recording started",
"notify.recordingStop": "Recording stopped",
"notify.recordingInChannel": "Recording active in channel",
"notify.talkPowerRequested": "Requested talk power",
"notify.self": "Self",
"notify.youSwitched": "Switched channel",
"notify.youMoved": "Moved to another channel",
"notify.youKickedServer": "Kicked from server",
"notify.youKickedChannel": "Kicked from channel",
"notify.youBanned": "Banned",
"notify.talkPowerGranted": "Granted talk power",
"notify.talkPowerRevoked": "Revoked talk power",
"notify.chat": "Chat",
"notify.messageSent": "Message sent",
"notify.messageReceived": "Message received",
"notify.capture": "Sound capture",
"notify.playback": "Sound playback",
"notify.muted": "Muted",
"notify.unmuted": "Unmuted",
"notify.status": "Status",
"notify.away": "Away",
"notify.present": "Back",
"notify.other": "Other",
"notify.poked": "Poked",
"notify.transferComplete": "File transfer complete",
"notify.transferFailed": "File transfer failed",
"notify.whisperListEmpty": "Whisper list empty",
"notify.whisperTargetNotFound": "No whisper target found",
"notify.whisperTooMany": "Too many whisper targets",
"notify.special": "Special",
"notify.micClickOtherOn": "Mic click others on",
"notify.micClickOtherOff": "Mic click others off",
"notify.micClickSelfOn": "Mic click self on",
"notify.micClickSelfOff": "Mic click self off",
"notify.whisperNotify": "Whisper notify",
"notify.soundTest": "Sound test",
"notify.test3d": "3D test",
"notify.talkingWhileMuted": "Talking while muted",
"notify.subtitle": "Configure notifications",
"notify.soundPack": "Sound pack:",
"notify.pack.builtin": "WebSpeak3 default",
"notify.pack.none": "No sounds",
"notify.importPack": "Import TS3 sound pack (.ts3_soundpack / .zip)",
"notify.deletePack": "Delete sound pack",
"notify.deletePackConfirm": "Delete sound pack \"{name}\"?",
"notify.importFailed": "That's not a valid TS3 sound pack (settings.ini missing).",
"notify.whenMuted": "When output muted:",
"notify.whenMuted.all": "Play all sounds",
"notify.whenMuted.none": "Play no sounds",
"notify.hintBefore": "Note: the sound pack can be overridden for each ",
"notify.hintLink": "favorite",
"notify.hintAfter": " separately.",
"notify.col.action": "Action",
"notify.col.script": "Sound script",
"notify.col.text": "Text position",
"notify.text.none": "None",
"notify.text.server": "Server",
"notify.text.channel": "Channel",
"notify.resetAll": "Reset all changes"
}
+95 -1
View File
@@ -807,5 +807,99 @@
"securitySettings.clearCache": "خالی کردن حافظه نهان",
"securitySettings.cacheCleared": "حافظه نهان خالی شد.",
"securitySettings.identities": "هویت‌ها",
"securitySettings.manageIdentities": "مدیریت هویت‌ها"
"securitySettings.manageIdentities": "مدیریت هویت‌ها",
"notify.connection": "اتصال",
"notify.connected": "به سرور متصل شد",
"notify.disconnected": "از سرور قطع شد",
"notify.lostConnection": "اتصال به سرور از دست رفت",
"notify.channel": "کانال",
"notify.created": "ایجاد شد",
"notify.deleted": "حذف شد",
"notify.edited": "ویرایش شد",
"notify.moved": "جابجا شد",
"notify.currentChannel": "کانال فعلی",
"notify.otherChannel": "کانال دیگر",
"notify.byYou": "توسط شما",
"notify.byOther": "توسط کلاینت دیگر",
"notify.server": "سرور",
"notify.insufficientPermissions": "دسترسی ناکافی",
"notify.error": "خطا",
"notify.client": "کلاینت",
"notify.switched": "کانال را عوض کرد",
"notify.movedClient": "منتقل شد",
"notify.kickedChannel": "از کانال اخراج شد",
"notify.kickedServer": "از سرور اخراج شد",
"notify.banned": "مسدود شد",
"notify.toCurrent": "به کانال فعلی",
"notify.fromCurrent": "از کانال فعلی",
"notify.toOther": "به کانال دیگر",
"notify.appears": "ظاهر می‌شود",
"notify.stays": "قابل مشاهده می‌ماند",
"notify.disappears": "ناپدید می‌شود",
"notify.serverGroup": "گروه سرور",
"notify.channelGroup": "گروه کانال تغییر کرد",
"notify.added": "اضافه شد",
"notify.removed": "حذف شد",
"notify.byServer": "توسط سرور",
"notify.byUser": "توسط کاربر",
"notify.recording": "ضبط",
"notify.recordingStart": "ضبط شروع شد",
"notify.recordingStop": "ضبط متوقف شد",
"notify.recordingInChannel": "ضبط در کانال فعال است",
"notify.talkPowerRequested": "درخواست اجازه صحبت",
"notify.self": "خود",
"notify.youSwitched": "کانال را عوض کردید",
"notify.youMoved": "به کانال دیگری منتقل شدید",
"notify.youKickedServer": "از سرور اخراج شدید",
"notify.youKickedChannel": "از کانال اخراج شدید",
"notify.youBanned": "مسدود شدید",
"notify.talkPowerGranted": "اجازه صحبت داده شد",
"notify.talkPowerRevoked": "اجازه صحبت گرفته شد",
"notify.chat": "گفتگو",
"notify.messageSent": "پیام ارسال شد",
"notify.messageReceived": "پیام دریافت شد",
"notify.capture": "ضبط صدا",
"notify.playback": "پخش صدا",
"notify.muted": "بی‌صدا شد",
"notify.unmuted": "فعال شد",
"notify.status": "وضعیت",
"notify.away": "غایب",
"notify.present": "برگشت",
"notify.other": "سایر",
"notify.poked": "سقلمه خوردید",
"notify.transferComplete": "انتقال فایل کامل شد",
"notify.transferFailed": "انتقال فایل ناموفق بود",
"notify.whisperListEmpty": "فهرست نجوا خالی است",
"notify.whisperTargetNotFound": "هدف نجوا پیدا نشد",
"notify.whisperTooMany": "اهداف نجوا بیش از حد",
"notify.special": "ویژه",
"notify.micClickOtherOn": "کلیک میکروفون دیگران روشن",
"notify.micClickOtherOff": "کلیک میکروفون دیگران خاموش",
"notify.micClickSelfOn": "کلیک میکروفون خود روشن",
"notify.micClickSelfOff": "کلیک میکروفون خود خاموش",
"notify.whisperNotify": "اعلان نجوا",
"notify.soundTest": "آزمایش صدا",
"notify.test3d": "آزمایش سه‌بعدی",
"notify.talkingWhileMuted": "صحبت در حالت بی‌صدا",
"notify.subtitle": "تنظیم اعلان‌ها",
"notify.soundPack": "بسته صدا:",
"notify.pack.builtin": "پیش‌فرض WebSpeak3",
"notify.pack.none": "بدون صدا",
"notify.importPack": "وارد کردن بسته صدای TS3 (.ts3_soundpack / .zip)",
"notify.deletePack": "حذف بسته صدا",
"notify.deletePackConfirm": "بسته صدای \"{name}\" حذف شود؟",
"notify.importFailed": "این یک بسته صدای معتبر TS3 نیست (settings.ini وجود ندارد).",
"notify.whenMuted": "وقتی خروجی بی‌صداست:",
"notify.whenMuted.all": "پخش همه صداها",
"notify.whenMuted.none": "هیچ صدایی پخش نشود",
"notify.hintBefore": "توجه: بسته صدا را می‌توان برای هر ",
"notify.hintLink": "مورد علاقه",
"notify.hintAfter": "جداگانه تنظیم کرد.",
"notify.col.action": "رویداد",
"notify.col.script": "اسکریپت صدا",
"notify.col.text": "محل متن",
"notify.text.none": "هیچ",
"notify.text.server": "سرور",
"notify.text.channel": "کانال",
"notify.resetAll": "بازنشانی همه تغییرات"
}
+95 -1
View File
@@ -807,5 +807,99 @@
"securitySettings.clearCache": "清空缓存",
"securitySettings.cacheCleared": "缓存已清空。",
"securitySettings.identities": "身份",
"securitySettings.manageIdentities": "管理身份"
"securitySettings.manageIdentities": "管理身份",
"notify.connection": "连接",
"notify.connected": "已连接到服务器",
"notify.disconnected": "已从服务器断开",
"notify.lostConnection": "与服务器的连接丢失",
"notify.channel": "频道",
"notify.created": "已创建",
"notify.deleted": "已删除",
"notify.edited": "已编辑",
"notify.moved": "已移动",
"notify.currentChannel": "当前频道",
"notify.otherChannel": "其他频道",
"notify.byYou": "由你",
"notify.byOther": "由其他客户端",
"notify.server": "服务器",
"notify.insufficientPermissions": "权限不足",
"notify.error": "错误",
"notify.client": "客户端",
"notify.switched": "切换频道",
"notify.movedClient": "被移动",
"notify.kickedChannel": "被踢出频道",
"notify.kickedServer": "被踢出服务器",
"notify.banned": "被封禁",
"notify.toCurrent": "进入当前频道",
"notify.fromCurrent": "离开当前频道",
"notify.toOther": "进入其他频道",
"notify.appears": "出现",
"notify.stays": "仍可见",
"notify.disappears": "消失",
"notify.serverGroup": "服务器组",
"notify.channelGroup": "频道组已更改",
"notify.added": "已添加",
"notify.removed": "已移除",
"notify.byServer": "由服务器",
"notify.byUser": "由用户",
"notify.recording": "录音",
"notify.recordingStart": "开始录音",
"notify.recordingStop": "停止录音",
"notify.recordingInChannel": "频道内正在录音",
"notify.talkPowerRequested": "请求发言权",
"notify.self": "自己",
"notify.youSwitched": "切换了频道",
"notify.youMoved": "被移动到其他频道",
"notify.youKickedServer": "被踢出服务器",
"notify.youKickedChannel": "被踢出频道",
"notify.youBanned": "被封禁",
"notify.talkPowerGranted": "获得发言权",
"notify.talkPowerRevoked": "发言权被撤销",
"notify.chat": "聊天",
"notify.messageSent": "消息已发送",
"notify.messageReceived": "收到消息",
"notify.capture": "声音采集",
"notify.playback": "声音播放",
"notify.muted": "已静音",
"notify.unmuted": "已取消静音",
"notify.status": "状态",
"notify.away": "离开",
"notify.present": "回来",
"notify.other": "其他",
"notify.poked": "被戳",
"notify.transferComplete": "文件传输完成",
"notify.transferFailed": "文件传输失败",
"notify.whisperListEmpty": "悄悄话列表为空",
"notify.whisperTargetNotFound": "未找到悄悄话目标",
"notify.whisperTooMany": "悄悄话目标过多",
"notify.special": "特殊",
"notify.micClickOtherOn": "他人麦克风开",
"notify.micClickOtherOff": "他人麦克风关",
"notify.micClickSelfOn": "自己麦克风开",
"notify.micClickSelfOff": "自己麦克风关",
"notify.whisperNotify": "悄悄话提示",
"notify.soundTest": "声音测试",
"notify.test3d": "3D 测试",
"notify.talkingWhileMuted": "静音时说话",
"notify.subtitle": "配置通知",
"notify.soundPack": "声音包:",
"notify.pack.builtin": "WebSpeak3 默认",
"notify.pack.none": "无声音",
"notify.importPack": "导入 TS3 声音包 (.ts3_soundpack / .zip)",
"notify.deletePack": "删除声音包",
"notify.deletePackConfirm": "删除声音包 \"{name}\"?",
"notify.importFailed": "这不是有效的 TS3 声音包(缺少 settings.ini)。",
"notify.whenMuted": "输出静音时:",
"notify.whenMuted.all": "播放所有声音",
"notify.whenMuted.none": "不播放声音",
"notify.hintBefore": "提示:可以为每个",
"notify.hintLink": "收藏",
"notify.hintAfter": "单独设置声音包。",
"notify.col.action": "动作",
"notify.col.script": "声音脚本",
"notify.col.text": "文本位置",
"notify.text.none": "无",
"notify.text.server": "服务器",
"notify.text.channel": "频道",
"notify.resetAll": "重置所有更改"
}
+306
View File
@@ -0,0 +1,306 @@
import { unzipSync } from "fflate";
import { SOUND_EVENTS, playSound, playSoundBlob, type SoundEventId } from "./sounds";
/** Options -> Meldungen: TS3's notification tree. Keys are TeamSpeak's own
* sound pack keys, so a real .ts3_soundpack's settings.ini maps 1:1. */
export interface NotificationNode {
/** Locale key under "notify.". */
label: string;
key?: string;
children?: NotificationNode[];
}
const leaf = (label: string, key: string): NotificationNode => ({ label, key });
const group = (label: string, children: NotificationNode[]): NotificationNode => ({ label, children });
const byWho = (p: string) => [leaf("byYou", `${p}_BY_YOU`), leaf("byOther", `${p}_BY_OTHER`)];
const where = (p: string) => [leaf("server", `${p}_SERVER`), leaf("currentChannel", `${p}_CURRENT_CHANNEL`)];
const byServerUser = (p: string) => [leaf("byServer", `${p}_BY_SERVER`), leaf("byUser", `${p}_BY_USER`)];
const moves = (p: string) => [
group("toCurrent", [leaf("appears", `${p}_TO_CURRENT_CHANNEL_APPEARS`), leaf("stays", `${p}_TO_CURRENT_CHANNEL_STAYS`)]),
group("fromCurrent", [
leaf("disappears", `${p}_FROM_CURRENT_CHANNEL_DISAPPEARS`),
leaf("stays", `${p}_FROM_CURRENT_CHANNEL_STAYS`),
]),
group("toOther", [
leaf("appears", `${p}_TO_OTHER_CHANNEL_APPEARS`),
leaf("disappears", `${p}_TO_OTHER_CHANNEL_DISAPPEARS`),
leaf("stays", `${p}_TO_OTHER_CHANNEL_STAYS`),
]),
];
export const NOTIFICATION_TREE: NotificationNode[] = [
group("connection", [
leaf("connected", "CONNECTION_CONNECTED"),
leaf("disconnected", "CONNECTION_DISCONNECTED"),
leaf("lostConnection", "CONNECTION_LOST_CONNECTION"),
]),
group("channel", [
group("created", byWho("CHANNEL_CREATED")),
group("deleted", byWho("CHANNEL_DELETED")),
group("edited", [
group("currentChannel", byWho("CHANNEL_EDITED_CURRENT")),
group("otherChannel", byWho("CHANNEL_EDITED_OTHER")),
]),
group("moved", byWho("CHANNEL_MOVED")),
]),
group("server", [
group("edited", byWho("SERVER_EDITED")),
leaf("insufficientPermissions", "SERVER_INSUFFICIENT_PERMISSIONS"),
leaf("error", "SERVER_ERROR"),
]),
group("client", [
group("connection", [
group("connected", where("CLIENT_CONNECTION_CONNECTED")),
group("disconnected", where("CLIENT_CONNECTION_DISCONNECTED")),
group("lostConnection", where("CLIENT_CONNECTION_LOST_CONNECTION")),
]),
group("switched", moves("CLIENT_SWITCHED")),
group("movedClient", moves("CLIENT_MOVED")),
group("kickedChannel", moves("CLIENT_WAS_KICKED_FROM_CHANNEL")),
group("kickedServer", where("CLIENT_WAS_KICKED_FROM_SERVER")),
group("banned", where("CLIENT_WAS_BANNED")),
group("serverGroup", [
group("added", byServerUser("CLIENT_SERVERGROUP_ADDED")),
group("removed", byServerUser("CLIENT_SERVERGROUP_REMOVED")),
]),
group("channelGroup", byServerUser("CLIENT_CHANNELGROUP_CHANGED")),
group("recording", [
leaf("recordingStart", "CLIENT_RECORDING_START"),
leaf("recordingStop", "CLIENT_RECORDING_STOP"),
leaf("recordingInChannel", "CLIENT_RECORDING_IN_CHANNEL"),
]),
leaf("talkPowerRequested", "CLIENT_REQUESTED_TALK_POWER"),
]),
group("self", [
leaf("youSwitched", "YOU_SWITCHED_CHANNEL"),
leaf("youMoved", "YOU_WERE_MOVED_TO_DIFFERENT_CHANNEL"),
leaf("youKickedServer", "YOU_WERE_KICKED_FROM_SERVER"),
leaf("youKickedChannel", "YOU_WERE_KICKED_FROM_CHANNEL"),
leaf("youBanned", "YOU_WERE_BANNED"),
leaf("talkPowerGranted", "YOU_WERE_GRANTED_TALK_POWER"),
leaf("talkPowerRevoked", "YOU_WERE_REVOKED_TALK_POWER"),
group("serverGroup", [
group("added", byServerUser("YOU_SERVERGROUP_ADDED")),
group("removed", byServerUser("YOU_SERVERGROUP_REMOVED")),
]),
group("channelGroup", byServerUser("YOU_CHANNELGROUP_CHANGED")),
]),
group("chat", [leaf("messageSent", "CHAT_SENT_MESSAGE"), leaf("messageReceived", "CHAT_RECEIVED_MESSAGE")]),
group("capture", [leaf("muted", "SOUND_CAPTURE_MUTED"), leaf("unmuted", "SOUND_CAPTURE_UNMUTED")]),
group("playback", [leaf("muted", "SOUND_PLAYBACK_MUTED"), leaf("unmuted", "SOUND_PLAYBACK_UNMUTED")]),
group("status", [leaf("away", "STATUS_SET_AWAY"), leaf("present", "STATUS_SET_PRESENT")]),
group("other", [
leaf("poked", "OTHER_RECEIVED_POKE"),
leaf("transferComplete", "OTHER_FILETRANSFER_COMPLETE"),
leaf("transferFailed", "OTHER_FILETRANSFER_FAILED"),
leaf("whisperListEmpty", "OTHER_WHISPERLIST_EMPTY"),
leaf("whisperTargetNotFound", "OTHER_WHISPERTARGET_NOT_FOUND"),
leaf("whisperTooMany", "OTHER_WHISPERTARGET_TOO_MANY"),
]),
// Like native: no checkboxes here, these are switched on/off on their own options pages.
group("special", [
leaf("micClickOtherOn", "SPECIAL_MIC_CLICK_OTHER_ON"),
leaf("micClickOtherOff", "SPECIAL_MIC_CLICK_OTHER_OFF"),
leaf("micClickSelfOn", "SPECIAL_MIC_CLICK_SELF_ON"),
leaf("micClickSelfOff", "SPECIAL_MIC_CLICK_SELF_OFF"),
leaf("whisperNotify", "SPECIAL_WHISPER_NOTIFY"),
leaf("soundTest", "SPECIAL_SOUND_TEST"),
leaf("test3d", "SPECIAL_3D_TEST"),
leaf("talkingWhileMuted", "SPECIAL_TALKING_WHILE_MUTED"),
]),
];
export const isSpecialKey = (key: string) => key.startsWith("SPECIAL_");
/** WebSpeak3's own pack: plays the chimes from Options -> Sounds (or the file you put there). */
const BUILTIN_SCRIPTS: Record<string, SoundEventId> = {
CONNECTION_CONNECTED: "connect",
CONNECTION_DISCONNECTED: "disconnect",
CONNECTION_LOST_CONNECTION: "disconnect",
CLIENT_CONNECTION_CONNECTED_SERVER: "clientJoin",
CLIENT_CONNECTION_CONNECTED_CURRENT_CHANNEL: "clientJoin",
CLIENT_CONNECTION_DISCONNECTED_SERVER: "clientLeave",
CLIENT_CONNECTION_DISCONNECTED_CURRENT_CHANNEL: "clientLeave",
CLIENT_CONNECTION_LOST_CONNECTION_SERVER: "clientLeave",
CLIENT_CONNECTION_LOST_CONNECTION_CURRENT_CHANNEL: "clientLeave",
CLIENT_SWITCHED_TO_CURRENT_CHANNEL_APPEARS: "clientJoin",
CLIENT_SWITCHED_TO_CURRENT_CHANNEL_STAYS: "clientJoin",
CLIENT_SWITCHED_FROM_CURRENT_CHANNEL_DISAPPEARS: "clientLeave",
CLIENT_SWITCHED_FROM_CURRENT_CHANNEL_STAYS: "clientLeave",
CHAT_RECEIVED_MESSAGE: "message",
OTHER_RECEIVED_POKE: "poke",
SOUND_CAPTURE_MUTED: "mute",
SOUND_CAPTURE_UNMUTED: "mute",
SOUND_PLAYBACK_MUTED: "mute",
SOUND_PLAYBACK_UNMUTED: "mute",
SPECIAL_MIC_CLICK_OTHER_ON: "micClickOn",
SPECIAL_MIC_CLICK_OTHER_OFF: "micClickOff",
SPECIAL_MIC_CLICK_SELF_ON: "micClickOn",
SPECIAL_MIC_CLICK_SELF_OFF: "micClickOff",
SPECIAL_WHISPER_NOTIFY: "whisper",
};
export const BUILTIN_PACK = "builtin";
export const NO_SOUNDS_PACK = "none";
export interface SoundPack {
id: string;
name: string;
scripts: Record<string, string>;
/** Lowercased path relative to settings.ini -> audio. */
files: Record<string, Blob>;
}
export type TextPosition = "none" | "server" | "channel";
export interface NotificationOverride {
off?: boolean;
script?: string;
text?: TextPosition;
}
export interface NotificationSettings {
pack: string;
whenMuted: "all" | "none";
overrides: Record<string, NotificationOverride>;
}
const SETTINGS_KEY = "webspeak3:notification-settings";
const DEFAULT_SETTINGS: NotificationSettings = { pack: BUILTIN_PACK, whenMuted: "all", overrides: {} };
let settings: NotificationSettings = (() => {
try {
return { ...DEFAULT_SETTINGS, ...JSON.parse(localStorage.getItem(SETTINGS_KEY) ?? "{}") };
} catch {
return DEFAULT_SETTINGS;
}
})();
export const getNotificationSettings = () => settings;
export function saveNotificationSettings(next: NotificationSettings): void {
settings = next;
localStorage.setItem(SETTINGS_KEY, JSON.stringify(next));
}
/** Set by the app: output muted state, and the active favorite's pack override. */
let playbackMuted = false;
let sessionPack: string | undefined;
export const setNotificationPlaybackMuted = (muted: boolean) => void (playbackMuted = muted);
export const setSessionSoundPack = (pack: string | undefined) => void (sessionPack = pack || undefined);
// --- imported packs (IndexedDB, blobs don't fit localStorage) ---
function withPacks<T>(mode: IDBTransactionMode, run: (store: IDBObjectStore) => IDBRequest<T>): Promise<T> {
return new Promise((resolve, reject) => {
const open = indexedDB.open("webspeak3-soundpacks", 1);
open.onupgradeneeded = () => open.result.createObjectStore("packs", { keyPath: "id" });
open.onerror = () => reject(open.error);
open.onsuccess = () => {
const req = run(open.result.transaction("packs", mode).objectStore("packs"));
req.onsuccess = () => resolve(req.result);
req.onerror = () => reject(req.error);
};
});
}
let packsCache: Promise<SoundPack[]> | null = null;
export function loadSoundPacks(): Promise<SoundPack[]> {
packsCache ??= withPacks<SoundPack[]>("readonly", (s) => s.getAll()).catch(() => []);
return packsCache;
}
export async function deleteSoundPack(id: string): Promise<void> {
await withPacks("readwrite", (s) => s.delete(id)).catch(() => {});
packsCache = null;
}
const AUDIO = /\.(wav|mp3|ogg|m4a)$/i;
/** Parses a TS3 sound pack (.ts3_soundpack / .zip with a settings.ini). */
export function parseSoundPackZip(data: Uint8Array, fallbackName: string): SoundPack {
const entries = unzipSync(data);
const iniPath = Object.keys(entries)
.filter((p) => p.toLowerCase().endsWith("settings.ini"))
.sort((a, b) => a.length - b.length)[0];
if (!iniPath) throw new Error("settings.ini missing");
const base = iniPath.slice(0, iniPath.length - "settings.ini".length).toLowerCase();
const ini = new TextDecoder().decode(entries[iniPath]);
let section = "";
let name = fallbackName;
const scripts: Record<string, string> = {};
for (const raw of ini.split(/\r?\n/)) {
const line = raw.trim();
if (!line || line.startsWith("#") || line.startsWith(";")) continue;
const head = /^\[(.+)\]$/.exec(line);
if (head) {
section = head[1].toLowerCase();
continue;
}
const eq = line.indexOf("=");
if (eq < 0) continue;
const k = line.slice(0, eq).trim();
const v = line.slice(eq + 1).trim();
if (section === "info" && k === "name" && v) name = v;
else if (section === "soundfiles") scripts[k] = v;
}
const files: Record<string, Blob> = {};
for (const [path, bytes] of Object.entries(entries)) {
const lower = path.toLowerCase();
if (lower.startsWith(base) && AUDIO.test(lower)) files[lower.slice(base.length)] = new Blob([bytes.slice()]);
}
return { id: `pack:${Date.now()}`, name, scripts, files };
}
export async function importSoundPack(file: File): Promise<SoundPack> {
const pack = parseSoundPackZip(new Uint8Array(await file.arrayBuffer()), file.name.replace(/\.[^.]+$/, ""));
await withPacks("readwrite", (s) => s.put(pack));
packsCache = null;
return pack;
}
// --- resolving + playing ---
/** The pack's own script for a key ("" = silent). */
export function packScript(pack: SoundPack | undefined, packId: string, key: string): string {
if (packId === NO_SOUNDS_PACK) return "";
if (packId === BUILTIN_PACK) return BUILTIN_SCRIPTS[key] ? `play("${BUILTIN_SCRIPTS[key]}")` : "";
return pack?.scripts[key] ?? "";
}
export const isNotificationEnabled = (key: string) => isSpecialKey(key) || !settings.overrides[key]?.off;
/** Where the event's text goes; "none" also when the row is unticked. */
export function notificationTextPosition(key: string): TextPosition {
if (!isNotificationEnabled(key)) return "none";
return settings.overrides[key]?.text ?? "server";
}
export type NotificationVars = Record<string, string>;
export async function runSoundScript(script: string, packId: string, vars: NotificationVars = {}): Promise<void> {
const pack = packId.startsWith("pack:") ? (await loadSoundPacks()).find((p) => p.id === packId) : undefined;
const fill = (s: string) => s.replace(/\$\{(\w+)\}/g, (_, v: string) => vars[v] ?? (v === "clientType" ? "neutral" : ""));
for (const [, fn, arg] of script.matchAll(/(play|say)\(\s*"([^"]*)"\s*\)/g)) {
const value = fill(arg);
if (fn === "say") {
if ("speechSynthesis" in window) speechSynthesis.speak(new SpeechSynthesisUtterance(value));
} else if (packId === BUILTIN_PACK || !pack) {
if ((SOUND_EVENTS as string[]).includes(value)) await playSound(value as SoundEventId);
} else {
const blob = pack.files[value.toLowerCase().replace(/\\/g, "/")];
if (blob) await playSoundBlob(blob);
}
}
}
/** Plays the sound for a TS3 notification key, honouring the Meldungen settings. */
export async function notify(key: string, vars?: NotificationVars): Promise<void> {
if (!isNotificationEnabled(key)) return;
if (playbackMuted && settings.whenMuted === "none") return;
const packId = sessionPack ?? settings.pack;
const override = settings.overrides[key]?.script;
const pack = packId.startsWith("pack:") ? (await loadSoundPacks()).find((p) => p.id === packId) : undefined;
await runSoundScript(override ?? packScript(pack, packId, key), packId, vars);
}
+6
View File
@@ -292,6 +292,12 @@ export function setSoundsOutputDevice(deviceId: string): void {
void player.setOutputDevice(deviceId);
}
/** A file from an imported sound pack (Options -> Meldungen). */
export async function playSoundBlob(blob: Blob): Promise<void> {
if (!loadSoundsEnabled()) return;
await player.playBlob(blob, loadSoundsVolume()).catch(() => {});
}
export async function playSound(event: SoundEventId): Promise<void> {
if (!loadSoundsEnabled()) return;
if (!loadEventSoundEnabled(event)) return;