-
-
Save
+
+ Nickname
+
+
+
Your nickname is displayed to other users on a TeamSpeak Server
+
+
-
Other users on the TeamSpeak server see your nickname. 3–30 characters.
-
-
-
-
-
+
+
Some servers may require a higher security level to connect as a spam protection mechanism. You can increase your own security level here, which takes exponentially longer per level.
+
+
+
+
+
+
+
diff --git a/app/renderer/js/file-settings.js b/app/renderer/js/file-settings.js
index 3caa962..fd86cc2 100644
--- a/app/renderer/js/file-settings.js
+++ b/app/renderer/js/file-settings.js
@@ -1,75 +1,390 @@
-import { h } from './dom.js';
+// File Transfer settings in the installed client's composition (render@4891379): General holds
+// "Always ask for download location" and, only while it is off, "Choose download location" with
+// the icon-only SegmentedControl (copy / folder); Transfer Limits holds the two speed toggles with
+// their TSInputNumber additions and the concurrent upload/download TSInputNumber rows, each bounded
+// by 10 minus the other. Values are owned by main (files:settings/*) and apply to every server tab.
+// Controls are built once and updated in place, so focus, typed drafts and keyboard stepping survive
+// saves, snapshot re-renders and language changes.
+import { h, icon } from './dom.js';
import { tp, BridgeError } from './core.js';
-import { t } from './i18n.js';
+import { t, onLanguageChange } from './i18n.js';
import { errorText } from './text.js';
-import { section, toggleRow, inlineRow } from './settings-ui.js';
+import { section } from './settings-ui.js';
-let host;
-let values;
-let busy = false;
-let error = '';
+/** TSInputNumber maximum: 10 - concurrentDownloads (uploads) and 10 - concurrentUploads (downloads). */
+const MAX_CONCURRENT = 10;
+/** Speed additions: TSInputNumber minimum 1, maximum 25600, step .5, integer false, lazy (MiB/s). */
+const RATE = { minimum: 1, maximum: 25600, step: 0.5, integer: false, lazy: true, snapOnCommit: true };
+// ts-input-number click-and-hold timing and the clamp notice duration.
+const HOLD_DELAY = 500;
+const HOLD_START = 200;
+const HOLD_END = 40;
+const HOLD_STEPS = 30;
+const CLAMP_NOTICE = 1200;
-async function update(action) {
- if (busy) return;
- busy = true; error = ''; render();
- try {
- const res = await action();
- if (!res?.ok) throw new BridgeError(res?.error);
- if (res.settings) values = res.settings;
- } catch (err) { error = errorText(err); }
- finally { busy = false; render(); }
+let host = null;
+let values = null; // last settings confirmed by main
+let local = null; // values plus saves still queued for main
+let loadError = '';
+let loading = false;
+let ui = null;
+let chain = Promise.resolve();
+let pending = 0;
+let outbox = null; // unsent save batch; later edits merge into it
+let choosing = false;
+const errors = { general: '', limits: '' };
+
+const easeOutSine = (x) => Math.sin((x * Math.PI) / 2);
+
+/**
+ * ts-input-number (.tsv-number-picker): Remove button, monospace text spinbutton, Add button.
+ * Arrow keys step, Enter/blur commit with clamping (brief clamp notice), Escape restores the value
+ * the field had when focused. Lazy fields commit typed text only on Enter/blur.
+ */
+function numberPicker({ id, minimum, maximum, step = 1, integer = true, lazy = false, snapOnCommit = false, labelledBy, describedBy, onValue }) {
+ let min = minimum;
+ let max = maximum;
+ let committed = null;
+ let focusValue = null;
+ let draft = '';
+ let dirty = false;
+ let focused = false;
+ let holdTimer = -1;
+ let clampTimer = -1;
+ const decimals = (String(step).split('.')[1] || '').length;
+ const toStep = (v) => Number(v.toFixed(decimals));
+ const clamp = (v) => Math.min(max, Math.max(min, v));
+ const format = (v) => (v === null || v === undefined || Number.isNaN(v) ? '' : String(v));
+ const parsed = () => {
+ const text = draft.trim().replace(',', '.');
+ if (!/^-?(\d+\.?\d*|\.\d+)$/.test(text)) return null;
+ const n = Number(text);
+ return Number.isFinite(n) ? n : null;
+ };
+ const current = () => parsed() ?? committed ?? 0;
+ const liveValid = (v) => v !== null && v >= min && v <= max;
+ const allowed = (text) => (integer ? /^\d*$/ : /^\d*[.,]?\d*$/).test(text);
+ const normalize = (v) => {
+ let next = integer ? Math.round(v) : v;
+ if (snapOnCommit && step > 0) next = toStep(Math.round(next / step) * step);
+ return clamp(next);
+ };
+
+ const input = h('input', {
+ id, type: 'text', role: 'spinbutton', class: 'tsv-number-picker-input', autocomplete: 'off', spellcheck: 'false',
+ inputmode: integer ? 'numeric' : 'decimal', 'aria-labelledby': labelledBy, 'aria-describedby': describedBy,
+ });
+ const stepButton = (glyph) => h('button', { type: 'button', class: 'tsv-number-picker-button', tabindex: '-1' }, icon(glyph));
+ const minus = stepButton('remove');
+ const plus = stepButton('add');
+
+ function paint() {
+ if (input.value !== draft) input.value = draft;
+ input.style.width = `${`00${draft}`.length}ch`;
+ const value = parsed();
+ const invalid = dirty && value !== null && !liveValid(value);
+ input.classList.toggle('tsv-invalid', invalid);
+ if (invalid) input.setAttribute('aria-invalid', 'true');
+ else input.removeAttribute('aria-invalid');
+ input.setAttribute('aria-valuemin', String(min));
+ input.setAttribute('aria-valuemax', String(max));
+ if (committed === null) input.removeAttribute('aria-valuenow');
+ else input.setAttribute('aria-valuenow', String(committed));
+ input.title = `${min} – ${max}`;
+ minus.disabled = current() <= min;
+ plus.disabled = current() >= max;
+ }
+ function apply(v) {
+ draft = format(v);
+ dirty = false;
+ focusValue = v;
+ const changed = v !== committed;
+ committed = v;
+ paint();
+ if (changed) onValue(v);
+ }
+ function stepBy(direction) {
+ if (direction > 0 ? current() >= max : current() <= min) return false;
+ apply(clamp(toStep(current() + direction * step)));
+ return true;
+ }
+ function flashClamp() {
+ window.clearTimeout(clampTimer);
+ input.classList.remove('tsv-clamped');
+ void input.offsetWidth; // restart the notice animation
+ input.classList.add('tsv-clamped');
+ clampTimer = window.setTimeout(() => input.classList.remove('tsv-clamped'), CLAMP_NOTICE);
+ }
+ function commit() {
+ if (!dirty) { draft = format(committed); paint(); return; }
+ const typed = parsed();
+ const v = typed ?? committed;
+ if (v === null) { dirty = false; draft = ''; paint(); return; }
+ const next = normalize(v);
+ if (typed !== null && next !== typed) flashClamp();
+ apply(next);
+ }
+ function revert() {
+ dirty = false;
+ if (focusValue !== null && committed !== focusValue) { committed = focusValue; onValue(committed); }
+ draft = format(committed);
+ paint();
+ input.blur();
+ }
+ function clearHold() {
+ if (holdTimer !== -1) { window.clearTimeout(holdTimer); holdTimer = -1; }
+ }
+ function startHold(direction) {
+ if (holdTimer !== -1) return;
+ let interval = HOLD_START;
+ let count = 0;
+ const tick = () => {
+ if (!stepBy(direction)) { holdTimer = -1; return; }
+ holdTimer = window.setTimeout(tick, interval);
+ count++;
+ interval = HOLD_START - easeOutSine(Math.min(1, count / HOLD_STEPS)) * (HOLD_START - HOLD_END);
+ };
+ holdTimer = window.setTimeout(tick, HOLD_DELAY);
+ }
+
+ input.addEventListener('input', () => {
+ if (!allowed(input.value)) { input.value = draft; paint(); return; }
+ draft = input.value;
+ dirty = true;
+ if (!lazy) {
+ const value = parsed();
+ if (liveValid(value) && value !== committed) { committed = value; onValue(value); }
+ }
+ paint();
+ });
+ input.addEventListener('focus', () => { focused = true; focusValue = committed; });
+ input.addEventListener('blur', () => { focused = false; commit(); });
+ input.addEventListener('keydown', (event) => {
+ if (event.key === 'ArrowUp') { event.preventDefault(); stepBy(1); }
+ else if (event.key === 'ArrowDown') { event.preventDefault(); stepBy(-1); }
+ else if (event.key === 'Escape') { event.preventDefault(); event.stopPropagation(); revert(); }
+ });
+ input.addEventListener('keyup', (event) => { if (event.key === 'Enter') commit(); });
+ for (const [button, direction] of [[minus, -1], [plus, 1]]) {
+ // The field keeps keyboard focus; the steps act like the original non-focusable TSButtons.
+ button.addEventListener('mousedown', (event) => event.preventDefault());
+ button.addEventListener('pointerdown', (event) => { if (event.button === 0) startHold(direction); });
+ for (const type of ['pointerup', 'pointerleave', 'pointercancel']) button.addEventListener(type, clearHold);
+ button.addEventListener('click', (event) => { event.stopPropagation(); stepBy(direction); });
+ }
+
+ const element = h('div', { class: 'tsv-number-picker' }, minus, h('div', { class: 'tsv-number-picker-field' }, input), plus);
+ return {
+ element,
+ input,
+ /** Model value and bounds from settings; a focused field keeps the draft being typed. */
+ set(value, { maximum: nextMax = max } = {}) {
+ const boundsChanged = nextMax !== max;
+ max = nextMax;
+ if (value !== committed) {
+ committed = value ?? null;
+ focusValue = committed;
+ if (!(focused && dirty)) { draft = format(committed); dirty = false; }
+ } else if (boundsChanged && committed !== null && clamp(committed) !== committed) {
+ committed = clamp(committed);
+ focusValue = committed;
+ if (!(focused && dirty)) { draft = format(committed); dirty = false; }
+ onValue(committed);
+ }
+ paint();
+ },
+ label(name) {
+ minus.setAttribute('aria-label', t('files.settings.decrease', { name }));
+ plus.setAttribute('aria-label', t('files.settings.increase', { name }));
+ },
+ };
}
-function toggle(key, info, field, extra = null) {
- const input = h('input', { type: 'checkbox', class: 'toggle', role: 'switch', checked: values[field], disabled: busy });
- input.checked = values[field]; input.disabled = busy;
- input.addEventListener('change', () => update(() => tp.filesSetSettings({ [field]: input.checked })));
- const row = toggleRow(t(key), info ? t(info) : null, input);
- if (extra) row.append(extra);
- return row;
+
+/** Inserts or removes a v-if node in place; untouched siblings keep focus. */
+function present(node, show, parent, before = null) {
+ if (show && node.parentNode !== parent) parent.insertBefore(node, before?.parentNode === parent ? before : null);
+ else if (!show && node.parentNode) node.remove();
}
-function number(field, min, max, step) {
- const input = h('input', { type: 'number', class: 'field', min: String(min), max: String(max), step: String(step), value: String(values[field]), disabled: busy });
- input.disabled = busy;
- input.addEventListener('change', () => update(() => tp.filesSetSettings({ [field]: Number(input.value) })));
- return input;
+
+function switchRow(field, titleKey, infoKey, sectionKey) {
+ const input = h('input', { type: 'checkbox', class: 'toggle', role: 'switch' });
+ input.addEventListener('change', () => save(sectionKey, { [field]: input.checked }));
+ const row = h('div', { class: 'ts-card-setting-container', dataset: { setting: field } },
+ h('label', { class: 'ts-toggle-wrapper' },
+ h('span', { class: 'ts-toggle-label' },
+ h('span', { class: 'ts-setting-title', text: () => t(titleKey) }),
+ h('p', { class: 'ts-card-subtitle', text: () => t(infoKey) })),
+ input));
+ return { row, input };
}
-/** .ts-card-setting-container-addition: the limit value under its toggle. */
-function limit(key, field) {
- const input = Object.assign(number(field, 1, 25600, 0.5), { id: `file-transfer-${field}` });
- return h('div', { class: 'ts-card-setting-container-addition tsv-flex-row tsv-flex-main-space-btwn v-center' }, h('label', { for: input.id, text: t(key) }), input);
+
+function rateAddition(field, labelKey) {
+ const id = `file-transfer-${field}`;
+ const picker = numberPicker({ ...RATE, id, onValue: (value) => save('limits', { [field]: value }) });
+ const element = h('div', { class: 'ts-card-setting-container-addition tsv-flex-row tsv-flex-main-space-btwn tsv-flex-wrap', dataset: { setting: field } },
+ h('label', { for: id, text: () => t(labelKey) }), picker.element);
+ return { element, picker, labelKey };
}
-function render() {
+
+function slotsRow(field, titleKey, infoKey) {
+ const id = `file-transfer-${field}`;
+ const picker = numberPicker({
+ id, minimum: 1, maximum: MAX_CONCURRENT - 1, labelledBy: `${id}-title`, describedBy: `${id}-info`,
+ onValue: (value) => save('limits', { [field]: value }),
+ });
+ const row = h('div', { class: 'ts-card-setting-container', dataset: { setting: field } },
+ h('div', { class: 'tsv-flex-row tsv-flex-main-space-btwn v-center' },
+ h('label', { class: 'tsv-flex-column', for: id },
+ h('span', { id: `${id}-title`, text: () => t(titleKey) }),
+ h('p', { id: `${id}-info`, class: 'tsv-font-subtitle', text: () => t(infoKey) })),
+ picker.element));
+ return { row, picker, titleKey };
+}
+
+function build() {
+ const alwaysAsk = switchRow('alwaysAsk', 'settings.filetransfer.dl_location.always_ask', 'settings.filetransfer.dl_location.always_ask.info', 'general');
+ const folder = h('p', { class: 'tsv-font-subtitle' });
+ const copy = h('button', { type: 'button', class: 'tsv-segmented-button tsv-action', dataset: { segment: 'copy' } }, icon('item-copy'));
+ const open = h('button', { type: 'button', class: 'tsv-segmented-button tsv-action', dataset: { segment: 'open' } }, icon('folder-action'));
+ copy.addEventListener('click', () => enqueue('general', () => tp.filesCopyDefaultDir()));
+ open.addEventListener('click', chooseFolder);
+ const location = h('div', { class: 'ts-card-setting-container', dataset: { setting: 'downloadLocation' } },
+ h('div', { class: 'tsv-flex-row tsv-flex-main-space-btwn v-center' },
+ h('label', { class: 'tsv-flex-column' },
+ h('span', { id: 'file-transfer-location-title', text: () => t('settings.filetransfer.dl_location.select') }), folder),
+ h('div', { class: 'segmented ts-filetransfer-location-actions', role: 'group', 'aria-labelledby': 'file-transfer-location-title' }, copy, open)));
+ const limitUpload = switchRow('limitUpload', 'settings.filetransfer.limit.upload', 'settings.filetransfer.limit.upload.info', 'limits');
+ const limitDownload = switchRow('limitDownload', 'settings.filetransfer.limit.download', 'settings.filetransfer.limit.download.info', 'limits');
+ const uploadRate = rateAddition('uploadMiB', 'settings.filetransfer.limit.upload.set');
+ const downloadRate = rateAddition('downloadMiB', 'settings.filetransfer.limit.download.set');
+ const uploadSlots = slotsRow('uploadSlots', 'settings.filetransfer.concurrent.uploads', 'files.settings.concurrent_uploads.info');
+ const downloadSlots = slotsRow('downloadSlots', 'settings.filetransfer.concurrent.downloads', 'files.settings.concurrent_downloads.info');
+ const generalError = h('p', { class: 'form-error', role: 'alert' });
+ const limitsError = h('p', { class: 'form-error', role: 'alert' });
+ const general = section(() => t('universal.general'), [alwaysAsk.row]);
+ const limits = section(() => t('settings.filetransfer.limit.title'), [limitUpload.row, limitDownload.row, uploadSlots.row, downloadSlots.row]);
+ ui = {
+ general, limits, generalCard: general.querySelector('.ts-card'), limitsCard: limits.querySelector('.ts-card'),
+ alwaysAsk, location, folder, copy, open, limitUpload, limitDownload, uploadRate, downloadRate, uploadSlots, downloadSlots,
+ generalError, limitsError,
+ };
+}
+
+function syncLoading() {
+ if (!ui?.status) {
+ const status = h('p', { class: 'tsv-font-subtitle', role: 'status' });
+ const retry = h('button', { type: 'button', class: 'btn btn-small', text: () => t('files.retry') });
+ retry.addEventListener('click', () => void load());
+ ui = { status, retry };
+ }
+ ui.status.textContent = loadError || t('files.loading');
+ ui.retry.hidden = !loadError || loading;
+ if (ui.status.parentNode !== host) host.replaceChildren(ui.status, ui.retry);
+}
+
+function sync() {
if (!host) return;
- if (!values) {
- host.replaceChildren(h('p', { role: 'status', class: 'tsv-font-subtitle', text: error || t('files.loading') }));
+ if (!values) { syncLoading(); return; }
+ if (!ui?.general) build();
+ if (ui.general.parentNode !== host) host.replaceChildren(ui.general, ui.limits);
+ const v = local;
+ ui.alwaysAsk.input.checked = v.alwaysAsk;
+ present(ui.location, !v.alwaysAsk, ui.generalCard, ui.generalError);
+ ui.folder.textContent = values.downloadFolder || t('files.settings.folder_unset');
+ ui.copy.disabled = !values.downloadFolder;
+ ui.copy.setAttribute('aria-label', t('universal.copy_to_clipboard'));
+ ui.copy.title = t('universal.copy_to_clipboard');
+ ui.open.setAttribute('aria-label', t('settings.filetransfer.dl_location.select'));
+ ui.open.setAttribute('aria-disabled', String(choosing));
+ for (const [toggle, rate, field] of [[ui.limitUpload, ui.uploadRate, 'limitUpload'], [ui.limitDownload, ui.downloadRate, 'limitDownload']]) {
+ toggle.input.checked = v[field];
+ present(rate.element, v[field], toggle.row);
+ rate.picker.set(v[field === 'limitUpload' ? 'uploadMiB' : 'downloadMiB']);
+ rate.picker.label(t(rate.labelKey));
+ }
+ ui.uploadSlots.picker.set(v.uploadSlots, { maximum: MAX_CONCURRENT - v.downloadSlots });
+ ui.downloadSlots.picker.set(v.downloadSlots, { maximum: MAX_CONCURRENT - v.uploadSlots });
+ ui.uploadSlots.picker.label(t(ui.uploadSlots.titleKey));
+ ui.downloadSlots.picker.label(t(ui.downloadSlots.titleKey));
+ for (const [node, key, card] of [[ui.generalError, 'general', ui.generalCard], [ui.limitsError, 'limits', ui.limitsCard]]) {
+ node.textContent = errors[key];
+ present(node, Boolean(errors[key]), card);
+ }
+ if (pending) host.setAttribute('aria-busy', 'true');
+ else host.removeAttribute('aria-busy');
+}
+
+/** Serial main calls; a failure shows its error in the acting section and restores main's values. */
+function enqueue(sectionOf, call) {
+ pending++;
+ sync();
+ chain = chain.then(async () => {
+ let res;
+ try { res = await call(); } catch (err) { res = { ok: false, error: { code: err?.code ?? 'internal', message: err?.message } }; }
+ const key = typeof sectionOf === 'function' ? sectionOf() : sectionOf;
+ if (res?.ok) {
+ errors[key] = '';
+ if (res.settings) values = res.settings;
+ } else {
+ errors[key] = errorText(res?.error);
+ try {
+ const fresh = await tp.filesSettings();
+ if (fresh?.ok) values = fresh.settings;
+ } catch { /* keep the last confirmed values */ }
+ }
+ }).finally(() => {
+ pending--;
+ if (!pending) local = { ...values };
+ sync();
+ });
+}
+
+function save(sectionKey, partial) {
+ Object.assign(local, partial);
+ if (outbox) {
+ Object.assign(outbox.partial, partial);
+ outbox.section = sectionKey;
+ sync();
return;
}
- const general = [toggle('files.settings.always_ask', 'settings.filetransfer.always_ask.info', 'alwaysAsk')];
- if (!values.alwaysAsk) {
- const choose = h('button', { type: 'button', class: 'btn btn-small', text: t('files.settings.choose_folder') });
- choose.disabled = busy;
- choose.addEventListener('click', () => update(() => tp.filesChooseDefaultDir()));
- const copy = h('button', { type: 'button', class: 'btn btn-ghost btn-small', text: t('files.settings.copy_folder') });
- copy.disabled = busy || !values.downloadFolder;
- copy.addEventListener('click', () => update(() => tp.filesCopyDefaultDir()));
- general.push(h('div', { class: 'ts-card-setting-container' },
- h('div', { class: 'tsv-flex-row tsv-flex-main-space-btwn v-center' },
- h('span', { class: 'ts-setting-title' }, h('span', { text: t('settings.filetransfer.location') }), h('p', { class: 'tsv-font-subtitle', text: values.downloadFolder || t('files.settings.folder_unset') })),
- h('div', { class: 'form-actions' }, copy, choose))));
- }
- const limits = [
- h('div', { class: 'ts-card-setting-container' }, h('p', { class: 'tsv-font-subtitle', text: t('files.settings.global') })),
- toggle('files.settings.limit_upload', 'settings.filetransfer.limit_upload.info', 'limitUpload', values.limitUpload ? limit('files.settings.upload_rate', 'uploadMiB') : null),
- toggle('files.settings.limit_download', 'settings.filetransfer.limit_download.info', 'limitDownload', values.limitDownload ? limit('files.settings.download_rate', 'downloadMiB') : null),
- inlineRow(t('files.settings.parallel_upload'), t('settings.filetransfer.concurrent_uploads.info'), number('uploadSlots', 1, 10 - values.downloadSlots, 1)),
- inlineRow(t('files.settings.parallel_download'), t('settings.filetransfer.concurrent_downloads.info'), number('downloadSlots', 1, 10 - values.uploadSlots, 1)),
- ];
- if (error) limits.push(h('p', { class: 'form-error', role: 'alert', text: error }));
- host.replaceChildren(section(t('files.settings.general'), general), section(t('files.settings.limits'), limits));
+ const batch = { partial: { ...partial }, section: sectionKey };
+ outbox = batch;
+ enqueue(() => batch.section, () => {
+ outbox = null;
+ return tp.filesSetSettings(batch.partial);
+ });
}
+
+function chooseFolder() {
+ if (choosing) return;
+ choosing = true;
+ enqueue('general', async () => {
+ try { return await tp.filesChooseDefaultDir(); } finally { choosing = false; }
+ });
+}
+
+async function load() {
+ loading = true;
+ loadError = '';
+ sync();
+ try {
+ const res = await tp.filesSettings();
+ if (!res?.ok) throw new BridgeError(res?.error);
+ values = res.settings;
+ local = { ...values };
+ } catch (err) {
+ loadError = errorText(err);
+ } finally {
+ loading = false;
+ sync();
+ }
+}
+
export function initFileSettings() {
host = document.getElementById('file-transfer-settings');
if (!host) return;
- update(() => tp.filesSettings());
+ onLanguageChange(sync);
+ void load();
}
-export function renderFileSettings() { render(); }
+
+export function renderFileSettings() { sync(); }
diff --git a/app/renderer/js/identities.js b/app/renderer/js/identities.js
index ee37254..7898a6e 100644
--- a/app/renderer/js/identities.js
+++ b/app/renderer/js/identities.js
@@ -1,46 +1,69 @@
-import { $, h, setText } from './dom.js';
-import { inlineRow, stackedRow } from './settings-ui.js';
-import { t, onLanguageChange } from './i18n.js';
+import { $, h, icon, setText } from './dom.js';
+import { t, getLanguage, onLanguageChange } from './i18n.js';
import { tp } from './core.js';
import { errorText } from './text.js';
import { S } from './state.js';
+import { toast } from './toast.js';
+import { showWarningDialog } from './warning-dialog.js';
+import { menuPosition } from './menu-position.js';
import '../shared/bookmarks.js';
+// Settings > Identities, recomposed after the official ts-identity-settings (client_ui main.js @4939589) and
+// ts-identity-improve (@4231541): selector cell with Default badge, Use as Default / Remove / Add, Details for
+// the SELECTED identity (nickname, security current → target, UID) and its related bookmarks. Every control
+// calls the real identity CLI through main; nothing here reads the default profile in place of the selection.
const B = globalThis.TeamsPeachBookmarks;
+// Official ts-identity-improve constants: rationalTargetQuality, sliderBaseValue, TSInputNumber maximum.
+const DEFAULT_TARGET = 23;
+const SLIDER_BASE = 7;
+const MAX_TARGET = 100;
let identities = [];
let selected = '';
-let host;
+let initialized = false;
let busy = false;
let progress = null;
+let edit = null; // 'add' | 'rename' while the selector cell is the inline name editor
+let menu = null; // current selector popup and its document/window listener cleanup
+let cellKey = '';
+let pendingFocus = ''; // selector control to refocus once a busy rebuild re-enables it
let refreshGeneration = 0;
-const fields = {};
+const targets = new Map(); // uid → requested level (official requestedQualityInternal, per identity)
+const el = {};
const current = () => identities.find((entry) => entry.uid === selected);
+const clamp = (value, min, max) => Math.min(max, Math.max(min, value));
function status(message, error = false) {
- const node = $('#identity-status');
- node.dataset.state = error ? 'error' : 'ok';
- setText(node, message);
+ el.status.dataset.state = error ? 'error' : 'ok';
+ setText(el.status, message);
}
async function request(action, args = {}) {
const response = await tp.identityRequest(action, args);
if (!response.ok) throw response.error;
return response.result;
}
-function button(key, action, id) { return h('button', { id, type: 'button', class: 'btn', text: () => t(key), onclick: action }); }
-function field(key, id, attributes = {}, parent = host) {
- const input = h('input', { id, type: 'text', class: 'input', ...attributes });
- parent.append(stackedRow(() => t(key), input));
- return input;
-}
-async function operation(run, after) {
- if (busy) return;
+async function operation(run, after, failed) {
+ if (busy) return false;
busy = true; render(); status(() => t('identity.working'));
try {
const result = await run();
if (after) after(result);
await refreshIdentities();
status(() => t('identity.saved'));
- } catch (error) { status(() => errorText(error), true); }
- finally { busy = false; render(); }
+ return true;
+ } catch (error) {
+ failed?.(error);
+ status(() => errorText(error), true);
+ return false;
+ } finally { busy = false; render(); }
}
+// Official identityDisplayName: name, else a custom nickname, else "Untitled Identity N".
+function displayName(entry) {
+ if (entry.name) return entry.name;
+ if (entry.nickname) return entry.nickname;
+ return t('settings.identity.untitled', { index: identities.indexOf(entry) + 1 });
+}
+function targetFor(entry) {
+ return clamp(targets.get(entry.uid) ?? Math.max(entry.security_level, DEFAULT_TARGET), entry.security_level, MAX_TARGET);
+}
+const improvingThis = (entry) => Boolean(entry && progress?.running && progress.uid === entry.uid);
// Official ts-identity-settings usedInBookmarks: every bookmark (depth-first through folders) whose identity
// is this one, plus, for the default identity, every bookmark without an explicit identity.
function relatedBookmarks(entry) {
@@ -50,98 +73,324 @@ function relatedBookmarks(entry) {
}
function renderBookmarks(entry) {
const related = relatedBookmarks(entry);
- fields.bookmarks.replaceChildren(h('span', { class: 'tsv-flex-grow' }),
+ el.bookmarks.replaceChildren(h('span', { class: 'tsv-flex-grow' }),
...(related.length ? related.map((bookmark) => h('span', { class: `ts-identity-bookmark${bookmark.identity_id === entry.uid ? ' ts-identity-bookmark-explicit' : ''}`, text: bookmark.name })) : [h('span', { class: 'ts-identity-no-bookmarks', text: t('settings.identity.bookmarks.empty') })]));
}
-function render() {
- if (!host) return;
+const toolButton = (id, name, label, onclick, extra = '') => h('button', { id, type: 'button', class: `ts-button tsv-action-subtle ${extra}`.trim(), 'aria-label': label, title: label, disabled: busy, onclick }, icon(name));
+
+// ---- selector cell (official ts-content-item-cell.tsv-selected.ts-identity-item.tsv-item-badge-right)
+
+function selectorCell(entry) {
+ const many = identities.length > 1;
+ const content = [icon('mode-server-compact', 'tsv-icon-primary'),
+ h('span', { class: 'tsv-item-text tsv-text-truncate', text: entry ? displayName(entry) : t('identity.empty') }),
+ entry?.is_default ? h('span', { class: 'tsv-item-badge', text: t('identity.default') }) : null];
+ // With one identity the cell is not a chooser (official showIdentitiesList returns for ≤1 identity).
+ const main = many
+ ? h('button', { id: 'identity-current', type: 'button', class: 'tsv-item-content', 'aria-haspopup': 'menu', 'aria-expanded': 'false', disabled: busy, onclick: (e) => openList(e.currentTarget) }, ...content)
+ : h('div', { id: 'identity-current', class: 'tsv-item-content' }, ...content);
+ return h('li', { class: 'tsv-item ts-identity-cell tsv-selected tsv-item-badge-right', dataset: { uid: entry?.uid ?? '' } },
+ h('div', { class: 'tsv-item-container' }, main,
+ h('div', { class: 'tsv-item-tools' },
+ entry ? toolButton('identity-rename', 'edit', t('universal.rename'), () => startEdit('rename'), 'tsv-reveal-on-hover') : null,
+ many ? toolButton('identity-choose', 'item-expand', t('settings.identity.choose'), (e) => openList(e.currentTarget)) : null)));
+}
+
+/** Official ContentItemCell editor: Add requires Enter (empty creates an untitled identity); Escape or blur cancel. */
+function selectorEditor(entry) {
+ const adding = edit === 'add';
+ const input = h('input', { id: 'identity-name-editor', class: 'ts-input', type: 'text', maxlength: 64, spellcheck: 'false', autocomplete: 'off',
+ placeholder: adding ? t('settings.identity.new.placeholder') : '', value: adding ? '' : entry?.name ?? '',
+ 'aria-label': adding ? t('settings.identity.add') : t('universal.rename') });
+ input.addEventListener('keydown', (e) => {
+ if (e.key === 'Enter') { e.preventDefault(); void commitEdit(input.value); }
+ else if (e.key === 'Escape') { e.preventDefault(); e.stopPropagation(); cancelEdit(); }
+ });
+ input.addEventListener('blur', () => { if (edit) cancelEdit(false); });
+ const accept = h('button', { type: 'button', class: 'ts-text-input-box-accept tsv-action', 'aria-label': t('universal.done'), onmousedown: (e) => e.preventDefault(), onclick: () => void commitEdit(input.value) }, icon('navigation-forward'));
+ return h('li', { class: 'tsv-item ts-identity-cell tsv-selected tsv-item-badge-right tsv-item-active-secondary' },
+ h('div', { class: 'tsv-item-container tsv-editor' }, h('div', { class: 'tsv-item-content' }, icon('empty', 'tsv-icon-primary'),
+ h('div', { class: 'ts-text-input-box s' }, h('div', { class: 'ts-text-input-box-inner hideDisclosure hideDelete hideReveal' },
+ h('div', { class: 'ts-input-wrapper', side: 'l' }, input), accept)))));
+}
+
+function startEdit(mode) {
+ if (busy) return;
+ closeList();
+ edit = mode;
+ cellKey = '';
+ render();
+ $('#identity-name-editor').focus();
+}
+function cancelEdit(refocus = true) {
+ const mode = edit;
+ edit = null;
+ cellKey = '';
+ render();
+ if (refocus) (mode === 'add' ? el.add : document.querySelector('#identity-rename') ?? el.add).focus({ preventScroll: true });
+}
+async function commitEdit(value) {
+ const mode = edit;
const entry = current();
- fields.list.replaceChildren(...identities.map((item) => h('option', { value: item.uid, selected: item.uid === selected }, `${item.name || item.nickname || item.uid}${item.is_default ? ` — ${t('identity.default')}` : ''}`)));
- if (entry) fields.list.value = entry.uid;
- fields.list.disabled = busy || !identities.length;
- for (const name of ['name', 'nickname']) {
- if (fields[name].dataset.uid !== selected || fields[name].dataset.dirty !== 'true') {
- fields[name].value = entry?.[name] || '';
- fields[name].dataset.uid = selected;
- fields[name].dataset.dirty = 'false';
- }
- fields[name].disabled = busy || !entry;
+ edit = null;
+ cellKey = '';
+ pendingFocus = 'identity-current';
+ const name = value.trim();
+ if (mode === 'add') {
+ await operation(() => request('create', { name, nickname: '' }), (result) => { selected = result.uid; });
+ } else if (mode === 'rename' && entry && name && name !== entry.name) {
+ const uid = entry.uid;
+ await operation(() => request('update', { uid, name }));
+ } else render();
+}
+
+// ---- identity list (official showIdentitiesList: shown identity first, then by name; Level detail, Default badge)
+
+function closeList() {
+ if (!menu) return;
+ const open = menu;
+ menu = null;
+ open.cleanup();
+ open.el.remove();
+ for (const node of document.querySelectorAll('#identity-selector [aria-haspopup="menu"]')) node.setAttribute('aria-expanded', 'false');
+}
+function openList(trigger) {
+ if (identities.length <= 1 || busy) return;
+ if (menu) { closeList(); return; }
+ const anchor = trigger.closest('.ts-identity-cell');
+ const shown = current();
+ const ordered = [...identities].sort((a, b) => displayName(a).localeCompare(displayName(b), getLanguage()));
+ if (shown) ordered.splice(0, 0, ...ordered.splice(ordered.indexOf(shown), 1));
+ const list = h('div', { class: 'device-menu identity-menu', role: 'menu', tabindex: '-1', 'aria-label': t('settings.identity.choose') }, ...ordered.map((entry) =>
+ h('button', { type: 'button', class: 'menu-item', role: 'menuitemradio', 'aria-checked': String(entry === shown), tabindex: '-1', dataset: { uid: entry.uid },
+ onclick: () => { closeList(); select(entry.uid); document.querySelector('#identity-current')?.focus({ preventScroll: true }); } },
+ icon('mode-server-compact'),
+ h('span', { class: 'menu-label' }, h('span', { text: displayName(entry) }), h('span', { class: 'menu-subtitle', text: t('settings.identity.level', { level: entry.security_level }) })),
+ entry.is_default ? h('span', { class: 'tsv-item-badge', text: t('identity.default') }) : null)));
+ document.body.append(list);
+ const rect = anchor.getBoundingClientRect();
+ list.style.minWidth = `${Math.round(rect.width)}px`;
+ const size = list.getBoundingClientRect();
+ const { x, y } = menuPosition(rect, { width: size.width, height: size.height }, { width: window.innerWidth, height: window.innerHeight });
+ list.style.left = `${Math.round(x)}px`;
+ list.style.top = `${Math.round(y)}px`;
+ const buttons = [...list.querySelectorAll('.menu-item')];
+ const onKey = (e) => {
+ const i = buttons.indexOf(document.activeElement);
+ if (e.key === 'ArrowDown') { e.preventDefault(); buttons[(i + 1) % buttons.length]?.focus(); }
+ else if (e.key === 'ArrowUp') { e.preventDefault(); buttons[(i - 1 + buttons.length) % buttons.length]?.focus(); }
+ else if (e.key === 'Home') { e.preventDefault(); buttons[0]?.focus(); }
+ else if (e.key === 'End') { e.preventDefault(); buttons.at(-1)?.focus(); }
+ else if (e.key === 'Escape') { e.preventDefault(); e.stopPropagation(); closeList(); trigger.focus({ preventScroll: true }); }
+ else if (e.key === 'Tab') closeList();
+ };
+ const onPointer = (e) => { if (!list.contains(e.target) && !trigger.contains(e.target)) closeList(); };
+ list.addEventListener('keydown', onKey);
+ document.addEventListener('pointerdown', onPointer, true);
+ window.addEventListener('blur', closeList);
+ window.addEventListener('resize', closeList);
+ menu = { el: list, cleanup: () => { document.removeEventListener('pointerdown', onPointer, true); window.removeEventListener('blur', closeList); window.removeEventListener('resize', closeList); } };
+ for (const node of document.querySelectorAll('#identity-selector [aria-haspopup="menu"]')) node.setAttribute('aria-expanded', 'true');
+ buttons[0]?.focus();
+}
+function select(uid) {
+ if (uid === selected) return;
+ selected = uid;
+ render();
+}
+
+// ---- actions
+
+async function removeSelected(event) {
+ const entry = current();
+ if (!entry || entry.is_default || entry.in_use || improvingThis(entry)) return;
+ const uid = entry.uid;
+ const answer = await showWarningDialog(event, { subtitle: t('settings.identity.delete.warning'), requiresConfirmationCheckbox: false });
+ if (!answer.confirmed || selected !== uid) return;
+ await operation(() => request('delete', { uid, confirm_uid: uid }), () => { if (selected === uid) selected = ''; });
+}
+function saveNickname() {
+ const input = el.nickname;
+ const uid = input.dataset.uid;
+ const entry = identities.find((item) => item.uid === uid);
+ if (input.dataset.dirty !== 'true' || !entry || input.dataset.saving === 'true') return;
+ const nickname = input.value.trim();
+ if (nickname === entry.nickname) { input.dataset.dirty = 'false'; input.value = nickname; return; }
+ input.dataset.saving = 'true';
+ void operation(() => request('update', { uid, nickname }), () => {
+ // Text typed while the save ran stays dirty and is not replaced by the refreshed value.
+ if (input.dataset.uid === uid && input.value.trim() === nickname) { input.dataset.dirty = 'false'; input.removeAttribute('aria-invalid'); }
+ }, () => { if (input.dataset.uid === uid) input.setAttribute('aria-invalid', 'true'); })
+ .finally(() => { input.dataset.saving = 'false'; });
+}
+function setTarget(value) {
+ const entry = current();
+ if (!entry) return;
+ if (!Number.isInteger(value) || value < 1 || value > MAX_TARGET) { status(() => t('identity.invalidTarget'), true); render(); return; }
+ targets.set(entry.uid, clamp(value, entry.security_level, MAX_TARGET));
+ render();
+}
+// Official improveButtonClicked: Improve starts toward the requested level (one above the current level
+// when equal); while this identity improves the same button reads Stop and cancels the bounded worker.
+async function toggleImprove() {
+ const entry = current();
+ if (!entry) return;
+ if (progress?.running) {
+ if (progress.uid !== entry.uid) return;
+ try { await request('cancel'); } catch (error) { status(() => errorText(error), true); }
+ return;
+ }
+ const uid = entry.uid;
+ let target = targetFor(entry);
+ if (target <= entry.security_level) target = entry.security_level + 1;
+ if (target > MAX_TARGET) { status(() => t('identity.invalidTarget'), true); return; }
+ targets.set(uid, target);
+ progress = { running: true, uid, target, level: entry.security_level };
+ render();
+ try {
+ const result = await request('improve', { uid, target });
+ progress = { uid, running: false, ok: true, result };
+ await refreshIdentities();
+ } catch (error) {
+ // Shown on the progress line below the bar; the worker's own error, not a generic page status.
+ progress = { uid, running: false, ok: false, error };
+ }
+ render();
+}
+
+// ---- render
+
+function renderSelector(entry) {
+ if (edit === 'rename' && !entry) edit = null;
+ if (edit) {
+ if (!el.selector.querySelector('#identity-name-editor')) el.selector.replaceChildren(selectorEditor(entry));
+ return;
+ }
+ // Rebuild only when what the cell shows changes, so progress pushes keep hover and keyboard focus.
+ const key = JSON.stringify([entry?.uid, entry && displayName(entry), entry?.is_default, identities.length > 1, busy, getLanguage()]);
+ if (key === cellKey) return;
+ const lost = document.activeElement === document.body || !document.activeElement;
+ const focused = el.selector.contains(document.activeElement) ? document.activeElement.id : lost ? pendingFocus : '';
+ cellKey = key;
+ el.selector.replaceChildren(selectorCell(entry));
+ const target = focused ? document.getElementById(focused) : null;
+ if (target && !target.disabled) { target.focus({ preventScroll: true }); pendingFocus = ''; }
+ else pendingFocus = focused;
+}
+function renderActions(entry) {
+ // Official bar: Use as Default and Remove only for a non-default identity among several.
+ const secondary = Boolean(entry && identities.length > 1 && !entry.is_default);
+ el.makeDefault.hidden = !secondary;
+ el.makeDefault.disabled = busy;
+ el.remove.hidden = !secondary;
+ const reason = entry?.in_use ? 'settings.identity.delete.in_use' : improvingThis(entry) ? 'settings.identity.delete.improving' : '';
+ el.remove.disabled = busy || Boolean(reason);
+ el.remove.title = reason ? t(reason) : t('universal.remove');
+ el.remove.setAttribute('aria-label', el.remove.title);
+ el.add.disabled = busy;
+ el.add.title = t('settings.identity.add');
+ el.add.setAttribute('aria-label', el.add.title);
+ el.import.disabled = busy;
+ el.export.disabled = busy || !entry;
+}
+function renderNickname(entry) {
+ const input = el.nickname;
+ if (input.dataset.uid !== selected || input.dataset.dirty !== 'true') {
+ input.value = entry?.nickname ?? '';
+ input.dataset.uid = selected;
+ input.dataset.dirty = 'false';
+ input.removeAttribute('aria-invalid');
}
// Official ts-text-input-phonetic placeholder: an empty nickname connects with the identity name.
- fields.nickname.placeholder = t('settings.identity.nickname.placeholder');
+ input.placeholder = t('settings.identity.nickname.placeholder');
+ input.disabled = !entry;
+}
+function renderSecurity(entry) {
+ const improving = improvingThis(entry);
+ const otherRunning = Boolean(progress?.running && !improving);
+ const progressLevel = entry && progress?.uid === entry.uid ? (progress.running ? progress.level : progress.result?.level) : null;
+ const level = entry ? Math.max(entry.security_level, Number.isInteger(progressLevel) ? progressLevel : 0) : 0;
+ const target = entry ? targetFor(entry) : 0;
+ setText(el.current, entry ? String(level) : '');
+ if (document.activeElement !== el.target) el.target.value = entry ? String(target) : '';
+ el.target.min = String(entry?.security_level ?? 1);
+ el.target.disabled = !entry || improving;
+ el.down.disabled = !entry || improving || target <= entry.security_level;
+ el.up.disabled = !entry || improving || target >= MAX_TARGET;
+ setText(el.improve, () => t(improving ? 'universal.stop' : 'settings.identity.improve'));
+ el.improve.disabled = !entry || otherRunning || (!improving && entry.security_level >= MAX_TARGET);
+ el.improve.setAttribute('aria-pressed', String(improving));
+ // Official ts-slider (compact, disabled): min 7, max = max(target, current), value current.
+ const max = Math.max(target, level);
+ const fill = max > SLIDER_BASE ? clamp((level - SLIDER_BASE) / (max - SLIDER_BASE), 0, 1) : 1;
+ el.bar.style.setProperty('--ts-identity-security-fill', String(fill));
+ el.bar.classList.toggle('is-improving', improving);
+ el.bar.setAttribute('aria-valuemin', String(SLIDER_BASE));
+ el.bar.setAttribute('aria-valuemax', String(Math.max(max, SLIDER_BASE)));
+ el.bar.setAttribute('aria-valuenow', String(level));
+ el.bar.setAttribute('aria-valuetext', entry ? t('message.identity.security.level.p0', { p0: level }) : '');
+ const own = entry && progress?.uid === entry.uid ? progress : null;
+ el.progress.dataset.state = own && own.ok === false ? 'error' : 'ok';
+ if (!own) setText(el.progress, '');
+ else if (own.running) setText(el.progress, () => t('identity.progress', { level: own.level ?? entry.security_level, target: own.target }));
+ else if (own.ok === false) setText(el.progress, () => errorText(own.error));
+ else setText(el.progress, () => t(own.result?.reached ? 'identity.reached' : 'identity.paused', { level: own.result?.level ?? entry.security_level, target: own.result?.target ?? target }));
+}
+function render() {
+ if (!initialized) return;
+ const entry = current();
+ renderSelector(entry);
+ renderActions(entry);
+ renderNickname(entry);
+ renderSecurity(entry);
+ setText(el.uid, entry?.uid ?? '');
+ el.copy.disabled = !entry;
renderBookmarks(entry);
- for (const id of ['identity-save', 'identity-default', 'identity-delete', 'identity-export', 'identity-improve']) $( `#${id}`).disabled = busy || !entry;
- $('#identity-default').disabled ||= Boolean(entry?.is_default);
- $('#identity-delete').disabled ||= Boolean(entry?.is_default || entry?.in_use || progress?.uid === entry?.uid && progress?.running);
- $('#identity-improve').disabled ||= Boolean(progress?.running);
- $('#identity-cancel').disabled = !progress?.running;
- $('#identity-create').disabled = busy;
- $('#identity-import').disabled = busy;
- $('#identity-import').title = '';
- fields.confirm.hidden = true;
- setText(fields.details, () => entry ? t('identity.details', { uid: entry.uid, level: entry.security_level, use: entry.in_use ? t('identity.inUse') : '' }) : t('identity.empty'));
- if (progress) setText(fields.progress, () => t(progress.running ? 'identity.progress' : progress.result?.reached ? 'identity.reached' : 'identity.paused', { level: progress.level ?? progress.result?.level ?? entry?.security_level ?? 0, target: progress.target ?? progress.result?.target ?? 0 }));
}
export async function refreshIdentities() {
- if (!host) return;
+ if (!initialized) return;
const generation = ++refreshGeneration;
try {
const result = await request('list');
if (generation !== refreshGeneration) return;
identities = result.identities;
- if (!identities.some((entry) => entry.uid === selected)) selected = result.default_id || '';
+ if (!identities.some((entry) => entry.uid === selected)) selected = result.default_id || identities[0]?.uid || '';
+ for (const uid of targets.keys()) if (!identities.some((entry) => entry.uid === uid)) targets.delete(uid);
render();
} catch (error) { status(() => errorText(error), true); }
}
export function initIdentities() {
- host = $('#identity-manager');
- // Rows go into the static Identities / Create / Details cards ahead of their static rows.
- const profile = h('div', { class: 'identity-section' });
- const create = $('#identity-create-card');
- const security = $('#identity-security');
- host.prepend(profile);
- fields.list = h('select', { id: 'identity-list', class: 'input multiselect medium', onchange: (event) => { selected = event.target.value; fields.name.value = current()?.name || ''; fields.nickname.value = current()?.nickname || ''; render(); } });
- fields.details = h('p', { class: 'tsv-font-subtitle identity-details' });
- profile.append(inlineRow(() => t('identity.list'), null, fields.list, { extra: fields.details }));
- fields.name = field('identity.name', 'identity-name', { maxlength: 64 }, profile);
- fields.nickname = field('identity.nickname', 'identity-nickname', { maxlength: 30 }, profile);
- for (const name of ['name', 'nickname']) fields[name].addEventListener('input', () => { fields[name].dataset.dirty = 'true'; });
- profile.append(h('div', { class: 'ts-card-setting-container form-actions' },
- button('identity.save', () => {
- const args = { uid: selected, name: fields.name.value, nickname: fields.nickname.value };
- operation(() => request('update', args), () => {
- fields.name.dataset.dirty = 'false';
- fields.nickname.dataset.dirty = 'false';
- });
- }, 'identity-save'),
- button('identity.useDefault', () => operation(() => request('default', { uid: selected })), 'identity-default'),
- button('identity.delete', () => { fields.confirm.hidden = false; $('#identity-delete-confirm').focus(); }, 'identity-delete')));
- fields.confirm = h('div', { class: 'ts-card-setting-container form-actions', hidden: true }, h('p', { class: 'ts-card-subtitle ts-warning', text: () => t('identity.deleteWarning') }),
- button('identity.deleteConfirm', () => { const uid = selected; operation(() => request('delete', { uid, confirm_uid: uid })); }, 'identity-delete-confirm'),
- button('identity.cancel', () => { fields.confirm.hidden = true; $('#identity-delete').focus(); }));
- profile.append(fields.confirm);
- fields.createName = field('identity.newName', 'identity-new-name', { maxlength: 64 }, create);
- fields.createNickname = field('identity.newNickname', 'identity-new-nickname', { maxlength: 30 }, create);
- create.append(h('div', { class: 'ts-card-setting-container form-actions' }, button('identity.create', () => operation(() => request('create', { name: fields.createName.value, nickname: fields.createNickname.value }), (result) => { selected = result.uid; fields.createName.value = ''; fields.createNickname.value = ''; }), 'identity-create')));
- const bookmarksTitle = h('h2', { id: 'settings-identity-bookmarks-title', class: 'title', text: () => t('universal.bookmarks') });
- fields.bookmarks = h('div', { id: 'identity-bookmarks', class: 'ts-security-level-header ts-bookmarks-header ts-identity-bookmark-container' });
- $('#identity-details-card').closest('section').after(h('section', { class: 'ts-widget-wrapper', 'aria-labelledby': bookmarksTitle.id },
- h('div', { class: 'ts-widget-section-header' }, bookmarksTitle), h('div', { class: 'ts-widget full' }, fields.bookmarks)));
- // Bookmarks change in the sidebar or the Servers page; reopening this page shows the current list.
- new MutationObserver(() => { if (!host.closest('.settings-panel').hidden) render(); }).observe(host.closest('.settings-panel'), { attributes: true, attributeFilter: ['hidden'] });
- security.append(h('h3', { class: 'ts-security-level-title', text: () => t('settings.identity.security_level') }));
- fields.target = field('identity.target', 'identity-target', { type: 'number', min: 1, max: 100, value: 12 }, security);
- security.append(h('p', { class: 'tsv-font-subtitle', text: () => t('identity.bounded') }));
- security.append(h('div', { class: 'form-actions' }, button('identity.improve', async () => {
- const uid = selected; const target = Number(fields.target.value);
- if (!Number.isInteger(target) || target < 1 || target > 100) { status(() => t('identity.invalidTarget'), true); return; }
- progress = { running: true, uid, target, level: current().security_level }; render();
- try { const result = await request('improve', { uid, target }); progress = { running: false, result }; await refreshIdentities(); }
- catch (error) { progress = null; status(() => errorText(error), true); }
- render();
- }, 'identity-improve'), button('identity.cancel', async () => { try { await request('cancel'); } catch (error) { status(() => errorText(error), true); } }, 'identity-cancel')));
- fields.progress = h('p', { class: 'tsv-font-subtitle', role: 'status', 'aria-live': 'polite' }); security.append(fields.progress);
- $('#identity-export').addEventListener('click', async () => {
+ Object.assign(el, {
+ selector: $('#identity-selector'), makeDefault: $('#identity-default'), remove: $('#identity-delete'), add: $('#identity-add'),
+ import: $('#identity-import'), export: $('#identity-export'), status: $('#identity-status'), nickname: $('#identity-nickname'),
+ current: $('#identity-security-current'), target: $('#identity-target'), down: $('#identity-target-down'), up: $('#identity-target-up'),
+ improve: $('#identity-improve'), bar: $('#identity-security-bar'), progress: $('#identity-progress'), uid: $('#uid-value'), copy: $('#uid-copy'),
+ bookmarks: $('#identity-bookmarks'),
+ });
+ initialized = true;
+ el.makeDefault.addEventListener('click', () => { const uid = selected; void operation(() => request('default', { uid })); });
+ el.remove.addEventListener('click', (event) => void removeSelected(event));
+ el.add.addEventListener('click', () => startEdit('add'));
+ el.nickname.addEventListener('input', () => { el.nickname.dataset.dirty = 'true'; el.nickname.removeAttribute('aria-invalid'); });
+ el.nickname.addEventListener('change', saveNickname);
+ el.nickname.addEventListener('keydown', (e) => {
+ if (e.key === 'Enter') { e.preventDefault(); saveNickname(); }
+ else if (e.key === 'Escape' && el.nickname.dataset.dirty === 'true') {
+ e.preventDefault(); e.stopPropagation();
+ el.nickname.dataset.dirty = 'false';
+ render();
+ }
+ });
+ el.target.addEventListener('change', () => setTarget(Number(el.target.value)));
+ el.target.addEventListener('keydown', (e) => { if (e.key === 'Enter') { e.preventDefault(); setTarget(Number(el.target.value)); } });
+ el.down.addEventListener('click', () => { const entry = current(); if (entry) setTarget(targetFor(entry) - 1); });
+ el.up.addEventListener('click', () => { const entry = current(); if (entry) setTarget(targetFor(entry) + 1); });
+ el.improve.addEventListener('click', () => void toggleImprove());
+ el.copy.addEventListener('click', async () => {
+ const uid = current()?.uid;
+ if (uid && (await tp.copyText(uid))) toast(() => t('ui.uid.copied'));
+ });
+ el.export.addEventListener('click', async () => {
const uid = selected;
try {
const result = await tp.exportIdentity(uid);
@@ -150,27 +399,32 @@ export function initIdentities() {
status(() => t('message.saved.to.p0.uid.p1', { p0: result.file, p1: uid }));
} catch (error) { status(() => errorText(error), true); }
});
- $('#identity-import').addEventListener('click', async () => {
+ // Official importIdentities: the last imported identity becomes the shown one.
+ el.import.addEventListener('click', async () => {
try {
const result = await tp.importIdentity();
if (result.canceled) return;
if (!result.ok) throw result.error;
- selected = result.result.imported[0] || result.result.existing[0] || selected;
+ selected = result.result.imported.at(-1) || result.result.existing.at(-1) || selected;
await refreshIdentities(); status(() => t('identity.imported'));
} catch (error) { status(() => errorText(error), true); }
});
+ // Bookmarks change in the sidebar or the Servers page; reopening this page shows the current list.
+ const panel = el.selector.closest('.settings-panel');
+ new MutationObserver(() => { if (panel.hidden) closeList(); else render(); }).observe(panel, { attributes: true, attributeFilter: ['hidden'] });
tp.onIdentityProgress((value) => { progress = value; render(); });
tp.onIdentitiesChanged(() => refreshIdentities());
- onLanguageChange(render);
+ onLanguageChange(() => { cellKey = ''; closeList(); render(); });
request('status').then((value) => { progress = value; render(); }).catch((error) => status(() => errorText(error), true));
- refreshIdentities();
+ void refreshIdentities();
}
// A failed connection may propose a target, but never starts work without a user action.
export async function focusIdentity(uid, target) {
await refreshIdentities();
if (uid && identities.some((entry) => entry.uid === uid)) selected = uid;
- if (Number.isInteger(target) && target >= 1 && target <= 100) fields.target.value = String(target);
+ const entry = current();
+ if (entry && Number.isInteger(target) && target >= 1 && target <= MAX_TARGET) targets.set(entry.uid, clamp(target, entry.security_level, MAX_TARGET));
render();
- fields.target.focus();
+ el.target.focus();
}
diff --git a/app/renderer/js/notifications.js b/app/renderer/js/notifications.js
index bea33ed..07a5179 100644
--- a/app/renderer/js/notifications.js
+++ b/app/renderer/js/notifications.js
@@ -223,6 +223,8 @@ function ownFlags(conn) {
/** Official isNotificationSoundAllowed (exact boolean form); `sound` is the official sub type key (SOUNDS). */
export function soundAllowed(id, state, { away, outputMuted }, sound) {
if (state === STATE.DISABLED) return false;
+ const group = SETTING_OF.get(id)?.group;
+ if (group && S.prefs?.notificationStates?.[`group_${group}`] === STATE.DISABLED) return false;
const isYouAway = sound === 'ClientUpdate.YouAway';
const isYouPlaybackMuted = sound === 'ClientUpdate.YouPlaybackMuted';
return !((away || outputMuted) && state !== STATE.IMPORTANT && (!isYouAway || outputMuted) && (!isYouPlaybackMuted || away));
@@ -447,14 +449,19 @@ async function saveNotificationPrefs(partial) {
// ---------- settings UI ----------
-async function setState(id, value, event = null) {
- const next = { ...(S.prefs?.notificationStates ?? {}) };
- if (event) next[eventPref(id, event)] = value;
- else {
- next[id] = value;
- for (const key of Object.keys(next)) if (key.startsWith(`event_${id}_`)) delete next[key];
- }
- await saveNotificationPrefs({ notificationStates: next });
+let notificationStateSave = Promise.resolve();
+function setState(id, value, event = null) {
+ const pending = notificationStateSave.catch(() => {}).then(async () => {
+ const next = { ...(S.prefs?.notificationStates ?? {}) };
+ if (event) next[eventPref(id, event)] = value;
+ else {
+ next[id] = value;
+ for (const key of Object.keys(next)) if (key.startsWith(`event_${id}_`)) delete next[key];
+ }
+ await saveNotificationPrefs({ notificationStates: next });
+ });
+ notificationStateSave = pending;
+ return pending;
}
const STATES = Object.freeze([['disabled', 'item-close'], ['enabled', 'accept'], ['important', 'item-pin']]);
@@ -562,7 +569,7 @@ export function renderNotificationSettings() {
finally { renderNotificationSettings(); }
} }, icon(glyph)));
}
- return inlineRow(t(label), null, control);
+ return inlineRow(t(label), t(systemOn ? 'settings.notifications.system.enabled.desc' : 'settings.notifications.system.disabled.desc') + '.', control);
});
const sections = [
section(t('notify.title'), outputControls()),
@@ -585,7 +592,18 @@ export function renderNotificationSettings() {
list.append(h('li', {}, advanced));
}
}
- sections.push(section(t(`notify.group.${group}`), [list]));
+ const enabled = S.prefs?.notificationStates?.[`group_${group}`] !== STATE.DISABLED;
+ const block = section(t(`notify.group.${group}`), enabled ? [list] : [h('div', { class: 'ts-card-setting-container' }, h('p', { class: 'tsv-font-subtitle', text: t('settings.notifications.system.group_disabled') }))]);
+ const toggle = h('input', { type: 'checkbox', class: 'toggle ts-card-top-button', role: 'switch', checked: enabled, 'aria-label': t(`notify.group.${group}`) });
+ toggle.addEventListener('change', async () => {
+ toggle.disabled = true;
+ try { await setState(`group_${group}`, toggle.checked ? STATE.ENABLED : STATE.DISABLED); }
+ catch (error) { toast(errorText(error), 'error'); }
+ finally { renderNotificationSettings(); }
+ });
+ block.dataset.notificationGroup = group;
+ block.querySelector('.ts-widget-section-header').append(toggle);
+ sections.push(block);
}
host.replaceChildren(...sections);
refreshSliders(host);
diff --git a/app/renderer/js/settings.js b/app/renderer/js/settings.js
index e5119d1..cf8ede9 100644
--- a/app/renderer/js/settings.js
+++ b/app/renderer/js/settings.js
@@ -1,10 +1,9 @@
import { t, setLanguage, onLanguageChange } from './i18n.js';
-// Settings: profile (rename, UID, identity backup), audio devices/transmit mode, diagnostics.
+// Settings: session rename, audio devices/transmit mode, diagnostics. Identities live in identities.js.
import { $, h, setText } from './dom.js';
import { S, on, isConnected, isAlive, viewedConnection, ownClient } from './state.js';
import { tp, callOn } from './core.js';
import { errorText } from './text.js';
-import { toast } from './toast.js';
import * as voice from './voice.js';
import { watchSnapshots } from './watch.js';
import { initIdentities, refreshIdentities } from './identities.js';
@@ -118,11 +117,6 @@ export function initSettings(h0) {
}
});
- $('#uid-copy').addEventListener('click', async () => {
- if (S.profile?.uid && (await tp.copyText(S.profile.uid))) toast(() => t('ui.uid.copied'));
- });
-
-
// Same selection path as the microphone/headphones context menus (voice.js).
$('#input-device').addEventListener('change', (e) => voice.chooseInputDevice(e.target.value));
$('#output-device').addEventListener('change', (e) => voice.chooseOutputDevice(e.target.value));
@@ -179,10 +173,9 @@ export function initSettings(h0) {
export function renderProfile() {
const p = S.profile;
if (!p) return;
+ // Session rename field only; Settings > Identities > Details shows the selected identity (identities.js).
const input = $('#rename-input');
if (document.activeElement !== input) input.value = p.nickname ?? '';
- setText($('#uid-value'), () => p.uid ?? '');
- setText($('#security-level'), () => p.security_level !== null && p.security_level !== undefined ? t('message.identity.security.level.p0', { p0: p.security_level }) : '');
refreshIdentities();
}
diff --git a/app/renderer/shared/en.js b/app/renderer/shared/en.js
index 61f46bf..07fd94b 100644
--- a/app/renderer/shared/en.js
+++ b/app/renderer/shared/en.js
@@ -88,13 +88,9 @@
"ui.send.enter": "Send (Enter)",
"ui.unique.identifier": "Unique identifier",
"ui.copy": "Copy",
- "ui.your.uid.is.your.public.key.fingerprint": "Your UID is your public key fingerprint. TeamSpeak servers use it to recognize you and assign permissions; changing your nickname does not change it.",
"ui.export.to.file": "Export to file…",
- "ui.import.from.file": "Import from file…",
"ui.the.file.contains.your.private.key.protect": "The file contains your private key. Protect it like a password: anyone with it can impersonate you.",
"ui.details": "Details",
- "ui.nickname2": "Nickname",
- "ui.other.users.on.the.teamspeak.server.see": "Other users on the TeamSpeak server see your nickname. 3–30 characters.",
"ui.no.saved.servers": "No saved servers.",
"ui.add.server": "Add server",
"ui.name": "Name",
@@ -983,27 +979,12 @@
"files.transfers.none": "No active or past transfers.",
"files.native.choose_destination": "Choose destination folder",
"files.native.choose_files": "Choose Files",
- "identity.list": "Identities",
"identity.default": "Default",
- "identity.name": "Identity name",
- "identity.nickname": "Saved nickname (used on future connections)",
"settings.identity.nickname.placeholder": "Use Identity Name",
"universal.bookmarks": "Bookmarks",
"settings.identity.bookmarks.empty": "No related bookmarks found",
- "identity.details": "UID: {uid} · Security level: {level} {use}",
- "identity.inUse": "· Connected",
"identity.empty": "No local identities. Create or import an identity to connect without an account.",
- "identity.save": "Save identity",
- "identity.useDefault": "Use as default",
- "identity.delete": "Delete identity",
- "identity.deleteWarning": "Permanently delete this selected identity and its private key? Server permissions tied to its UID cannot be recovered without a backup. Default and connected identities cannot be deleted.",
- "identity.deleteConfirm": "Delete permanently",
- "identity.cancel": "Cancel",
- "identity.newName": "New identity name",
- "identity.newNickname": "New identity nickname",
- "identity.create": "Create identity",
"identity.target": "Target security level",
- "identity.bounded": "Improvement runs for up to 30 seconds at a time with a bounded CPU duty cycle. Progress is saved; start again to continue. High targets may take a very long time.",
"identity.improve": "Improve security level",
"identity.invalidTarget": "Enter a target level between 1 and 100.",
"identity.progress": "Improving: level {level}, target {target}.",
@@ -1573,19 +1554,7 @@
"notify.output.default": "System default",
"notify.output.none": "No sound",
"notify.output.saved": "Saved output device",
- "files.settings.general": "General",
- "files.settings.always_ask": "Always ask where to save downloaded files",
- "files.settings.choose_folder": "Choose download folder",
- "files.settings.copy_folder": "Copy folder path",
"files.settings.folder_unset": "No download folder selected",
- "files.settings.limits": "Transfer limits",
- "files.settings.global": "Limits apply across all server tabs. Lowering concurrency lets active transfers finish before starting more.",
- "files.settings.limit_upload": "Limit upload bandwidth",
- "files.settings.limit_download": "Limit download bandwidth",
- "files.settings.upload_rate": "Maximum upload speed (MiB/s)",
- "files.settings.download_rate": "Maximum download speed (MiB/s)",
- "files.settings.parallel_upload": "Concurrent uploads",
- "files.settings.parallel_download": "Concurrent downloads",
"streamExtras.popout": "Pop Out Stream",
"streamExtras.returnPopout": "Return Stream to Main Window",
"streamExtras.popoutGesture": "Click Pop Out Stream again to open its separate window.",
@@ -1646,12 +1615,6 @@
"settings.audio.comfort_noise.info": "Add synthetic background noise to fill the artificial silence when no one is speaking.",
"settings.audio.test.info": "Record a sample of yourself speaking to test how your voice sounds to other users.\nYou can make real-time changes whilst playing back your recording.",
"settings.video.hw_accel": "Hardware Acceleration",
- "settings.filetransfer.always_ask.info": "Whether to ask where to save the file every time, or always save to the configured directory below",
- "settings.filetransfer.location": "Choose download location",
- "settings.filetransfer.limit_upload.info": "Whether to limit the bandwidth used for uploads",
- "settings.filetransfer.limit_download.info": "Whether to limit the bandwidth used for downloads",
- "settings.filetransfer.concurrent_uploads.info": "Limit the number of concurrent uploads per server",
- "settings.filetransfer.concurrent_downloads.info": "Limit the number of concurrent downloads per server",
"settings.os.hide_in_taskbar.info": "Choose if (and when) to hide TeamsPeach in the taskbar",
"settings.os.flash.on_poke.enabled": "Flash taskbar when poked",
"settings.os.flash.on_poke.disabled": "Do not flash taskbar on pokes",
@@ -2175,6 +2138,44 @@
"bookmarks.edit.password.saved": "Password saved",
"bookmarks.edit.password.unavailable": "Secure password storage is not available on this system, so passwords cannot be saved",
"bookmarks.edit.channel.current": "Use Current Channel",
+ "settings.notifications.system.disabled.desc": "You won't receive system notifications",
+ "settings.notifications.system.enabled.desc": "You will receive system notifications",
+ "settings.notifications.system.group_disabled": "All sound notifications in this section are disabled.",
+ "settings.filetransfer.dl_location.always_ask": "Always ask for download location",
+ "settings.filetransfer.dl_location.always_ask.info": "Whether to ask where to save the file for every time, or always save to the configured directory below",
+ "settings.filetransfer.dl_location.select": "Choose download location",
+ "settings.filetransfer.limit.title": "Transfer Limits",
+ "settings.filetransfer.limit.upload": "Limit upload speed",
+ "settings.filetransfer.limit.upload.info": "Whether to limit the bandwidth used for uploads",
+ "settings.filetransfer.limit.upload.set": "Upload speed limit in MiB/s",
+ "settings.filetransfer.limit.download": "Limit download speed",
+ "settings.filetransfer.limit.download.info": "Whether to limit the bandwidth used for downloads",
+ "settings.filetransfer.limit.download.set": "Download speed limit in MiB/s",
+ "settings.filetransfer.concurrent.uploads": "Concurrent Uploads",
+ "settings.filetransfer.concurrent.downloads": "Concurrent Downloads",
+ "files.settings.concurrent_uploads.info": "Limit the number of concurrent uploads across all servers",
+ "files.settings.concurrent_downloads.info": "Limit the number of concurrent downloads across all servers",
+ "files.settings.decrease": "Decrease {name}",
+ "files.settings.increase": "Increase {name}",
+ "settings.identity.info": "Identities are digital signatures used by the TeamSpeak Server to authenticate you and assign permissions. You can create multiple identities and switch between them.",
+ "settings.identity.action.set_default": "Use as Default",
+ "settings.identity.action.import": "Import Identity from File",
+ "settings.identity.nickname.info": "Your nickname is displayed to other users on a TeamSpeak Server",
+ "settings.identity.security_level.info": "Some servers may require a higher security level to connect as a spam protection mechanism. You can increase your own security level here, which takes exponentially longer per level.",
+ "settings.identity.delete.warning": "Are sure you want to delete this identity? TeamSpeak servers will not be able to uniquely identify you.",
+ "settings.identity.new.placeholder": "New Identity Name",
+ "settings.identity.improve": "Improve",
+ "universal.stop": "Stop",
+ "settings.identity.untitled": "Untitled Identity {index}",
+ "settings.identity.level": "Level {level}",
+ "settings.identity.add": "Add Identity",
+ "settings.identity.choose": "Choose Identity",
+ "settings.identity.delete.in_use": "Disconnect the servers using this identity before deleting it.",
+ "settings.identity.delete.improving": "Stop the security level improvement before deleting this identity.",
+ "identity.target.decrease": "Decrease target security level",
+ "identity.target.increase": "Increase target security level",
+ "settings.identity.session_nickname.title": "Current Server Nickname",
+ "settings.identity.session_nickname.info": "Renames you now on the viewed connected server and saves it to the identity that connection uses. Without a connected server it saves the default identity's nickname. 3–30 characters.",
"server.icons.storage_unsupported": "This server stores icons in HTTP/S3 storage, which is not supported"
});
if (typeof module === 'object' && module.exports) module.exports = messages;
diff --git a/app/renderer/shared/ru.js b/app/renderer/shared/ru.js
index c3e77cc..8a28cd9 100644
--- a/app/renderer/shared/ru.js
+++ b/app/renderer/shared/ru.js
@@ -88,13 +88,9 @@
"ui.send.enter": "Отправить (Enter)",
"ui.unique.identifier": "Уникальный идентификатор",
"ui.copy": "Копировать",
- "ui.your.uid.is.your.public.key.fingerprint": "UID — отпечаток вашего открытого ключа. Серверы TeamSpeak по нему узнают вас и выдают права; смена ника его не меняет.",
"ui.export.to.file": "Экспортировать в файл…",
- "ui.import.from.file": "Импортировать из файла…",
"ui.the.file.contains.your.private.key.protect": "Файл содержит закрытый ключ. Храните его как пароль: тот, у кого он есть, может выдавать себя за вас.",
"ui.details": "Подробнее",
- "ui.nickname2": "Ник",
- "ui.other.users.on.the.teamspeak.server.see": "Ваш ник видят другие пользователи на сервере TeamSpeak. От 3 до 30 символов.",
"ui.no.saved.servers": "Сохранённых серверов нет.",
"ui.add.server": "Добавить сервер",
"ui.name": "Название",
@@ -985,27 +981,12 @@
"files.transfers.none": "Нет активных или выполненных передач.",
"files.native.choose_destination": "Выбери папку назначения",
"files.native.choose_files": "Выберите файлы",
- "identity.list": "Идентификаторы",
"identity.default": "По умолчанию",
- "identity.name": "Название идентификатора",
- "identity.nickname": "Сохранённый ник (для следующих подключений)",
"settings.identity.nickname.placeholder": "Использовать имя из идентификатора",
"universal.bookmarks": "Закладки",
"settings.identity.bookmarks.empty": "Имеющие отношение закладки не найдены",
- "identity.details": "UID: {uid} · Уровень безопасности: {level} {use}",
- "identity.inUse": "· Подключён",
"identity.empty": "Нет локальных идентификаторов. Создайте или импортируйте идентификатор для подключения без аккаунта.",
- "identity.save": "Сохранить идентификатор",
- "identity.useDefault": "Использовать по умолчанию",
- "identity.delete": "Удалить идентификатор",
- "identity.deleteWarning": "Навсегда удалить выбранный идентификатор и его закрытый ключ? Права на серверах, привязанные к UID, нельзя восстановить без резервной копии. Идентификаторы по умолчанию и используемые подключениями удалить нельзя.",
- "identity.deleteConfirm": "Удалить навсегда",
- "identity.cancel": "Отмена",
- "identity.newName": "Название нового идентификатора",
- "identity.newNickname": "Ник нового идентификатора",
- "identity.create": "Создать идентификатор",
"identity.target": "Целевой уровень безопасности",
- "identity.bounded": "Улучшение выполняется до 30 секунд за запуск с ограниченной нагрузкой на процессор. Прогресс сохраняется; запустите снова для продолжения. Высокие уровни могут занять очень много времени.",
"identity.improve": "Повысить уровень безопасности",
"identity.invalidTarget": "Укажите целевой уровень от 1 до 100.",
"identity.progress": "Улучшение: уровень {level}, цель {target}.",
@@ -1575,19 +1556,7 @@
"notify.output.default": "Системное устройство",
"notify.output.none": "Без звука",
"notify.output.saved": "Сохранённое устройство вывода",
- "files.settings.general": "Общие",
- "files.settings.always_ask": "Всегда спрашивать, куда сохранять скачанные файлы",
- "files.settings.choose_folder": "Выбрать папку загрузок",
- "files.settings.copy_folder": "Копировать путь к папке",
"files.settings.folder_unset": "Папка загрузок не выбрана",
- "files.settings.limits": "Ограничения передачи",
- "files.settings.global": "Ограничения действуют на все вкладки серверов. При уменьшении числа передач текущие завершатся до запуска новых.",
- "files.settings.limit_upload": "Ограничить скорость отправки",
- "files.settings.limit_download": "Ограничить скорость скачивания",
- "files.settings.upload_rate": "Максимальная скорость отправки (МиБ/с)",
- "files.settings.download_rate": "Максимальная скорость скачивания (МиБ/с)",
- "files.settings.parallel_upload": "Одновременные отправки",
- "files.settings.parallel_download": "Одновременные скачивания",
"streamExtras.popout": "Открыть трансляцию в отдельном окне",
"streamExtras.returnPopout": "Вернуть трансляцию в главное окно",
"streamExtras.popoutGesture": "Нажмите кнопку отдельного окна ещё раз.",
@@ -1648,12 +1617,6 @@
"settings.audio.comfort_noise.info": "Добавить искусственный фоновый шум для заполнения периодов тишины.",
"settings.audio.test.info": "Запиши образец своей речи, чтобы проверить, как тебя слышат другие пользователи.\nВо время воспроизведения записи ты можешь вносить изменения в режиме реального времени.",
"settings.video.hw_accel": "Аппаратное ускорение",
- "settings.filetransfer.always_ask.info": "Спрашивать, где сохранять файл каждый раз, или всегда сохранять в указанный ниже каталог",
- "settings.filetransfer.location": "Выбрать место скачивания",
- "settings.filetransfer.limit_upload.info": "Ограничение пропускной способности для загрузок",
- "settings.filetransfer.limit_download.info": "Включить или выключить ограничение пропускной способности для скачивания файлов",
- "settings.filetransfer.concurrent_uploads.info": "Ограничить количество одновременных загрузок на сервер",
- "settings.filetransfer.concurrent_downloads.info": "Ограничить количество одновременных скачиваний с одного сервера",
"settings.os.hide_in_taskbar.info": "Настройка режима отображения (и скрытия) TeamsPeach на панели задач",
"settings.os.flash.on_poke.enabled": "Мигать панелью задач после толчков",
"settings.os.flash.on_poke.disabled": "Не мигать значком в панели задач при толчках",
@@ -2177,6 +2140,44 @@
"bookmarks.edit.password.saved": "Пароль сохранён",
"bookmarks.edit.password.unavailable": "Защищённое хранилище паролей недоступно в этой системе, поэтому пароли нельзя сохранить",
"bookmarks.edit.channel.current": "Использовать текущий канал",
+ "settings.notifications.system.disabled.desc": "Ты не будешь получать системные уведомления",
+ "settings.notifications.system.enabled.desc": "Ты будешь получать системные уведомления",
+ "settings.notifications.system.group_disabled": "Все звуковые оповещения в этом разделе отключены.",
+ "settings.filetransfer.dl_location.always_ask": "Всегда уточнять место скачивания",
+ "settings.filetransfer.dl_location.always_ask.info": "Спрашивать, где сохранять файл каждый раз, или всегда сохранять в указанный ниже каталог",
+ "settings.filetransfer.dl_location.select": "Выбрать место скачивания",
+ "settings.filetransfer.limit.title": "Лимиты на передачу",
+ "settings.filetransfer.limit.upload": "Ограничить скорость загрузки",
+ "settings.filetransfer.limit.upload.info": "Ограничение пропускной способности для загрузок",
+ "settings.filetransfer.limit.upload.set": "Ограничение скорости загрузки в МиБ/с",
+ "settings.filetransfer.limit.download": "Ограничить скорость скачивания",
+ "settings.filetransfer.limit.download.info": "Включить или выключить ограничение пропускной способности для скачивания файлов",
+ "settings.filetransfer.limit.download.set": "Ограничение скорости скачивания в МиБ/с",
+ "settings.filetransfer.concurrent.uploads": "Одновременные загрузки",
+ "settings.filetransfer.concurrent.downloads": "Одновременные скачивания",
+ "files.settings.concurrent_uploads.info": "Ограничить количество одновременных загрузок на всех серверах",
+ "files.settings.concurrent_downloads.info": "Ограничить количество одновременных скачиваний со всех серверов",
+ "files.settings.decrease": "Уменьшить: {name}",
+ "files.settings.increase": "Увеличить: {name}",
+ "settings.identity.info": "Идентификаторы — это цифровые подписи, используемые сервером TeamSpeak для твоей аутентификации и выдачи прав. Ты можешь создать несколько идентификаторов и переключаться между ними.",
+ "settings.identity.action.set_default": "Использовать по умолчанию",
+ "settings.identity.action.import": "Импорт идентификатора из файла",
+ "settings.identity.nickname.info": "Твой ник видят другие пользователи на сервере TeamSpeak",
+ "settings.identity.security_level.info": "Для подключения к некоторым серверам может потребоваться более высокий уровень безопасности, например, с целью защиты от спама. Ты можешь повысить свой уровень безопасности здесь, при этом повышение на каждый уровень будет занимать экспоненциально больше времени.",
+ "settings.identity.delete.warning": "Действительно удалить этот идентификатор? Без него серверы TeamSpeak не смогут уникально опознать тебя.",
+ "settings.identity.new.placeholder": "Имя нового идентификатора",
+ "settings.identity.improve": "Улучшить",
+ "universal.stop": "Остановить",
+ "settings.identity.untitled": "Безымянный идентификатор {index}",
+ "settings.identity.level": "Уровень {level}",
+ "settings.identity.add": "Добавить идентификатор",
+ "settings.identity.choose": "Выбрать идентификатор",
+ "settings.identity.delete.in_use": "Отключитесь от серверов, использующих этот идентификатор, прежде чем удалять его.",
+ "settings.identity.delete.improving": "Остановите повышение уровня безопасности, прежде чем удалять этот идентификатор.",
+ "identity.target.decrease": "Уменьшить целевой уровень безопасности",
+ "identity.target.increase": "Увеличить целевой уровень безопасности",
+ "settings.identity.session_nickname.title": "Ник на текущем сервере",
+ "settings.identity.session_nickname.info": "Сразу меняет ваш ник на просматриваемом подключённом сервере и сохраняет его в идентификаторе этого подключения. Без подключения к серверу сохраняет ник идентификатора по умолчанию. От 3 до 30 символов.",
"server.icons.storage_unsupported": "Сервер хранит значки в HTTP/S3-хранилище, которое пока не поддерживается"
});
if (typeof module === 'object' && module.exports) module.exports = messages;
diff --git a/app/renderer/styles/file-settings.css b/app/renderer/styles/file-settings.css
new file mode 100644
index 0000000..898db56
--- /dev/null
+++ b/app/renderer/styles/file-settings.css
@@ -0,0 +1,68 @@
+/* File Transfer settings (render@4891379). Source widgets scoped to #file-transfer-settings:
+ - SegmentedControl show-title=false (main.css@162911 .tsv-segmented-control: tsv-bg, 26px, items
+ padding 0 4px; theme module main.js@92335: pill radius, 1px strong-bg separators inset 4px).
+ The shared .segmented control supplies the pill, separators and hover tint.
+ - TSInputNumber (main.css@168404 .tsv-number-picker; theme: pill field without border, padding 4px 0,
+ first step glyph red, last step glyph presence-online; .tsv-button min-height 26px). */
+
+:where(#file-transfer-settings) .tsv-flex-wrap { flex-wrap: wrap; }
+:where(#file-transfer-settings) .tsv-flex-main-space-btwn > .tsv-number-picker { flex: none; }
+
+/* Choose download location: copy (ItemCopy) | folder (FolderAction), 22px glyphs */
+:where(#file-transfer-settings) .segmented.ts-filetransfer-location-actions > button { padding: 0 var(--tsv-padding-v-small); }
+:where(#file-transfer-settings) .segmented.ts-filetransfer-location-actions > button .icon { width: var(--tsv-icon-size); height: var(--tsv-icon-size); }
+:where(#file-transfer-settings) .segmented.ts-filetransfer-location-actions > button[aria-disabled="true"] { color: var(--tsv-font-subtitle-color); cursor: default; }
+
+/* ts-input-number */
+:where(#file-transfer-settings) .tsv-number-picker { display: flex; flex-direction: row; align-items: center; }
+:where(#file-transfer-settings) .tsv-number-picker-button {
+ display: inline-flex;
+ flex: none;
+ align-items: center;
+ justify-content: center;
+ height: var(--tsv-bar-element-height);
+ margin: 0 calc(var(--tsv-padding-h-minimal) / 2);
+ padding: 0 var(--tsv-padding-v-small);
+ border: 0;
+ border-radius: 20px;
+ background: var(--tsv-bg);
+ color: var(--tsv-font-color);
+ cursor: pointer;
+}
+:where(#file-transfer-settings) .tsv-number-picker-button:first-child { margin-left: 0; --tsv-icon-tint2: red; }
+:where(#file-transfer-settings) .tsv-number-picker-button:last-child { margin-right: 0; --tsv-icon-tint2: var(--presence-online); }
+:where(#file-transfer-settings) .tsv-number-picker-button .icon { width: var(--tsv-icon-size); height: var(--tsv-icon-size); }
+:where(#file-transfer-settings) .tsv-number-picker-button:hover:not(:disabled) { outline: 2px solid var(--tsv-tint2); }
+:where(#file-transfer-settings) .tsv-number-picker-button:disabled { opacity: .5; cursor: default; }
+:where(#file-transfer-settings) .tsv-number-picker-field { display: flex; flex-direction: row; align-items: center; margin: 0 calc(var(--tsv-padding-h-minimal) / 2); }
+:where(#file-transfer-settings) .tsv-number-picker-field > input.tsv-number-picker-input {
+ min-width: 5ch;
+ min-height: var(--tsv-bar-element-height);
+ padding: var(--tsv-padding-v-small) 0;
+ border: 0;
+ border-radius: var(--tsv-border-radius-pill);
+ outline: none;
+ background: var(--tsv-shaded-bg);
+ color: var(--tsv-font-color);
+ font-family: var(--tsv-font-family-monospace);
+ font-size: var(--tsv-font-size-content);
+ text-align: center;
+}
+:where(#file-transfer-settings) .tsv-number-picker-field > input.tsv-number-picker-input:is(:hover, :focus) { box-shadow: 0 0 0 2px var(--tsv-tint); }
+:where(#file-transfer-settings) .tsv-number-picker-field > input.tsv-number-picker-input.tsv-invalid { box-shadow: 0 0 0 2px var(--tsv-error-color); }
+:where(#file-transfer-settings) .tsv-number-picker-field > input.tsv-number-picker-input.tsv-clamped { animation: file-settings-number-clamped 1.2s ease-out; }
+@keyframes file-settings-number-clamped {
+ from { box-shadow: 0 0 0 2px var(--tsv-error-light-color); }
+ to { box-shadow: 0 0 0 2px transparent; }
+}
+
+@media (prefers-reduced-motion: reduce) {
+ /* The clamp notice stays visible for its 1.2 s without animating. */
+ :where(#file-transfer-settings) .tsv-number-picker-field > input.tsv-number-picker-input.tsv-clamped { animation: none; box-shadow: 0 0 0 2px var(--tsv-error-light-color); }
+}
+
+@media (forced-colors: active) {
+ :where(#file-transfer-settings) .tsv-number-picker-button,
+ :where(#file-transfer-settings) .tsv-number-picker-field > input.tsv-number-picker-input { border: 1px solid ButtonBorder; }
+ :where(#file-transfer-settings) .tsv-number-picker-field > input.tsv-number-picker-input:is(:hover, :focus, .tsv-invalid, .tsv-clamped) { outline: 2px solid Highlight; }
+}
diff --git a/app/renderer/styles/settings.css b/app/renderer/styles/settings.css
index f8489f5..11033da 100644
--- a/app/renderer/styles/settings.css
+++ b/app/renderer/styles/settings.css
@@ -153,7 +153,7 @@
/* ---------- setting rows: .ts-card-setting-container ---------- */
:where(.settings-scroll) .ts-card-setting-container { margin-bottom: calc(var(--tsv-padding-v-large) + var(--tsv-padding-v)); }
:where(.settings-scroll) .ts-card-setting-container:last-child { margin-bottom: 0; }
-:where(.settings-scroll) :is(.identity-section, #mic-auto-settings) { display: contents; }
+:where(.settings-scroll) #mic-auto-settings { display: contents; }
:where(.settings-scroll) .ts-card-setting-container:empty, :where(.settings-scroll) .ts-card-setting-container[hidden] { display: none; }
:where(.settings-scroll) .ts-card-setting-container :is(label, .ts-card-caption, .ts-setting-title) { font-size: var(--tsv-font-size-content); line-height: var(--tsv-line-height-content); color: var(--tsv-font-color); }
:where(.settings-scroll) .ts-card-setting-container label:not(.ts-toggle-wrapper) { display: block; min-width: 0; }
@@ -486,23 +486,107 @@ body:has(#self-dot[data-talking="true"]) .ts-vad-header .avatar-talking { opacit
:where(.settings-scroll) .ts-chat-preview[data-preview="detailed"] .msg .msg-body { grid-column: auto; max-width: calc(100% - 25px); margin: 2px 25px 1px 17px; padding: 8px 12.5px; border-radius: var(--tsv-border-radius-large); background: var(--tsv-chat-remote-bg); color: var(--tsv-chat-remote-font-color); font-size: var(--tsv-font-size-large); line-height: var(--tsv-line-height-large); }
:where(.settings-scroll) .ts-chat-preview[data-preview="detailed"] .msg .msg-body::before { display: block; }
-/* ---------- Identities / Details ---------- */
+/* ---------- Identities (ts-identity-settings main.js@4939589, ts-identity-improve @4231541; main.css
+ .tsv-settings-identities-card, .ts-security-level*, .ts-identity-*). Geometry checked against the installed
+ client's populated capture (identities-populated/home.png, work.png, 1553×998 at 1×). ---------- */
:where(.settings-scroll) .inline-form { display: flex; align-items: center; gap: var(--tsv-padding-h-small); margin: var(--tsv-padding-v) 0; }
:where(.settings-scroll) .inline-form input { flex: 1; min-width: 12ch; }
:where(.settings-scroll) .ts-card-setting-container > input:not([type="checkbox"]):not([type="range"]) { margin: var(--tsv-padding-v) 0; }
-:where(.settings-scroll) .ts-security-level-title, :where(.settings-scroll) .ts-identity-uid-title { margin: var(--tsv-padding-v) 0 var(--tsv-padding-v-small); color: var(--tsv-font-color); font-size: var(--tsv-font-size-content); line-height: var(--tsv-line-height-content); font-weight: var(--tsv-font-weight-normal); }
-:where(.settings-scroll) .ts-identity-uid-title { margin-top: var(--tsv-padding-v-large); margin-bottom: var(--tsv-padding-v); }
-:where(.settings-scroll) .ts-identity-uid .tsv-flex-row { gap: var(--tsv-padding-h-small); }
+/* Selector bar: 34px tsv-bg cell (radius 8) and bar items 10px apart in a 36px row, 16px above the info text */
+:where(.settings-scroll) .tsv-settings-identities-card-inner { display: flex; flex-wrap: wrap; align-items: center; gap: var(--tsv-padding-h-small); min-height: var(--tsv-bar-height); margin-bottom: var(--tsv-padding-v-large); }
+:where(.settings-scroll) .tsv-bar-profile-selection { display: flex; flex: 1 1 auto; min-width: 120px; }
+:where(.settings-scroll) #identity-selector { flex: 1 1 auto; min-width: 0; margin: 0; padding: 0; list-style: none; }
+:where(.settings-scroll) .ts-identity-cell { border-radius: var(--tsv-border-radius-large); background: var(--tsv-bg); }
+:where(.settings-scroll) .ts-identity-cell .tsv-item-container { display: flex; align-items: center; min-height: 34px; padding: 0 var(--tsv-padding-h-minimal); }
+:where(.settings-scroll) .ts-identity-cell .tsv-item-content { display: flex; flex: 1 1 auto; align-items: center; gap: var(--tsv-padding-h-small); min-width: 0; min-height: 34px; padding: 0; border: 0; border-radius: inherit; background: none; color: inherit; font: inherit; text-align: start; }
+:where(.settings-scroll) button.tsv-item-content { cursor: pointer; }
+:where(.settings-scroll) .ts-identity-cell .tsv-item-text { flex: 1 1 auto; min-width: 0; overflow: hidden; color: var(--tsv-font-color); font-size: var(--tsv-font-size); font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
+:where(.settings-scroll) .ts-identity-cell .icon { flex: none; width: var(--tsv-icon-size); height: var(--tsv-icon-size); }
+/* .tsv-item-badge-count look: tint pill, contrast-bg bold text */
+:where(.settings-scroll) .ts-identity-cell .tsv-item-badge { flex: none; padding: 0 var(--tsv-padding-h-minimal); border-radius: 10px; background: var(--tsv-tint); color: var(--tsv-contrast-bg); font-size: var(--tsv-font-size-minimal); font-weight: bolder; line-height: 18px; }
+:where(.settings-scroll) .ts-identity-cell .tsv-item-tools { display: flex; flex: none; align-items: center; }
+:where(.settings-scroll) #identity-selector .tsv-item-tools .ts-button.tsv-action-subtle { width: var(--tsv-bar-element-height); color: var(--tsv-font-color); }
+:where(.settings-scroll) .ts-identity-cell .tsv-reveal-on-hover { opacity: 0; }
+:where(.settings-scroll) .ts-identity-cell:is(:hover, :focus-within) .tsv-reveal-on-hover { opacity: 1; }
+:where(.settings-scroll) .ts-identity-cell.tsv-item-active-secondary { background: transparent; box-shadow: inset 0 0 0 1px var(--tsv-tint); }
+:where(.settings-scroll) .ts-identity-cell .ts-text-input-box { flex: 1 1 auto; min-width: 0; }
+:where(.settings-scroll) .ts-identity-cell :is(.ts-text-input-box-inner, .ts-input-wrapper) { display: flex; flex: 1 1 auto; align-items: center; min-width: 0; }
+:where(.settings-scroll) .ts-identity-cell .ts-input { width: 100%; min-height: 0; height: var(--tsv-bar-element-height); padding: 0; border: 0; background: transparent; color: var(--tsv-font-color); font: inherit; outline: none; }
+:where(.settings-scroll) .ts-identity-cell .ts-input::placeholder { color: var(--tsv-font-subtitle-color); }
+:where(.settings-scroll) .ts-identity-cell .ts-text-input-box-accept { display: inline-grid; place-items: center; padding: 0; border: 0; background: none; color: var(--tsv-tint); cursor: pointer; }
+:where(.settings-scroll) .ts-identity-bar-actions { display: flex; align-items: center; padding-right: var(--tsv-padding-h-minimal); }
+:where(.settings-scroll) .ts-identity-make-default { margin-right: var(--tsv-padding-h-small); color: var(--tsv-tint); }
+/* ts-button image tools: 42×26, tint glyph (Add/Remove fill through --tsv-icon-tint2) */
+:where(.settings-scroll) :is(#identity-manager, #identity-details-card) .ts-button.tsv-action-subtle { display: inline-grid; place-items: center; width: 42px; height: var(--tsv-bar-element-height); padding: 0; border: 0; border-radius: var(--tsv-border-radius); background: none; color: var(--tsv-tint); cursor: pointer; --tsv-icon-tint2: currentColor; --tsv-icon-base: currentColor; }
+:where(.settings-scroll) :is(#identity-manager, #identity-details-card) .ts-button.tsv-action-subtle .icon { width: var(--tsv-icon-size); height: var(--tsv-icon-size); }
+:where(.settings-scroll) :is(#identity-manager, #identity-details-card) .ts-button.tsv-action-subtle:hover:not(:disabled) { color: var(--ts-menu-action-color); }
+:where(.settings-scroll) :is(#identity-manager, #identity-details-card) .ts-button.tsv-action-subtle:disabled { opacity: .5; cursor: default; }
+:where(.settings-scroll) .ts-identity-file-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0 var(--tsv-padding-h); }
+/* ts-button is-constructive: green plain text */
+:where(.settings-scroll) .ts-identity-import { color: var(--tsv-accept-color); font-weight: 500; }
+:where(.settings-scroll) .ts-identity-file-actions + .ts-identity-export-note { margin-top: var(--tsv-padding-v-small); }
+:where(.settings-scroll) #identity-manager > .form-status:not(:empty) { margin-top: var(--tsv-padding-v-small); }
+/* Details: label + 26px pill input on one row (ts-text-input-phonetic.ts-option-row), 8px before the info */
+:where(.settings-scroll) .ts-identity-nickname { display: flex; align-items: center; gap: var(--tsv-padding-h-small); margin-bottom: var(--tsv-padding-v); }
+:where(.settings-scroll) .ts-identity-nickname label { flex: none; color: var(--tsv-font-color); font-size: var(--tsv-font-size); line-height: var(--tsv-line-height); }
+:where(.settings-scroll) .ts-identity-nickname input { flex: 1 1 auto; min-width: 0; border-radius: var(--tsv-border-radius-pill); }
+:where(.settings-scroll) .ts-identity-nickname input[aria-invalid="true"] { border-color: var(--tsv-error-color); }
+/* .ts-security-level-header: wrapping flex row ≥26px; controls right-aligned */
+:where(.settings-scroll) .ts-security-level-header { display: flex; flex-wrap: wrap; align-items: center; min-height: var(--tsv-bar-element-height); margin-top: var(--tsv-padding-v); }
+:where(.settings-scroll) .ts-security-level-header-controls { display: flex; flex-grow: 1; align-items: center; justify-content: flex-end; min-width: 0; }
+:where(.settings-scroll) :is(.ts-security-level-title, .ts-identity-uid-title) { margin: 0; color: var(--tsv-font-color); font-size: var(--tsv-font-size); line-height: var(--tsv-line-height); font-weight: var(--tsv-font-weight-normal); }
+:where(.settings-scroll) .ts-security-level-current { display: grid; place-items: center; min-width: var(--tsv-bar-element-height); height: var(--tsv-bar-element-height); margin: 0 var(--tsv-padding-h-minimal); padding: 0 var(--tsv-padding-h-minimal); border-radius: var(--tsv-border-radius-pill); background: var(--tsv-shaded-bg); color: var(--tsv-font-color); font-variant-numeric: tabular-nums; }
+:where(.settings-scroll) .ts-security-level-improve-symbol { display: grid; place-items: center; margin: 0 var(--tsv-padding-h-minimal); color: var(--tsv-font-color); --tsv-icon-base: currentColor; }
+:where(.settings-scroll) .ts-security-level-improve-symbol .icon { width: var(--tsv-icon-size); height: var(--tsv-icon-size); }
+/* TSInputNumber: red Remove / 37px value pill / green Add, 5px apart, then the 30px filled Improve */
+:where(.settings-scroll) .ts-input-number { display: flex; align-items: center; gap: var(--tsv-padding-h-minimal); margin: 0 var(--tsv-padding-h-small) 0 var(--tsv-padding-h-minimal); }
+:where(.settings-scroll) .ts-input-number-step { display: inline-grid; place-items: center; width: 30px; height: var(--tsv-bar-element-height); padding: 0; border: 0; border-radius: var(--tsv-border-radius-pill); background: var(--tsv-bg); cursor: pointer; }
+:where(.settings-scroll) .ts-input-number-step:first-child { --tsv-icon-tint2: var(--tsv-error-color); }
+:where(.settings-scroll) .ts-input-number-step:last-child { --tsv-icon-tint2: var(--tsv-accept-color); }
+:where(.settings-scroll) .ts-input-number-step .icon { width: var(--tsv-icon-size); height: var(--tsv-icon-size); }
+:where(.settings-scroll) .ts-input-number-step:hover:not(:disabled) { background: var(--tsv-shaded-bg); }
+:where(.settings-scroll) .ts-input-number-step:disabled { opacity: .5; cursor: default; }
+:where(.settings-scroll) .ts-input-number > .ts-input-number-input { width: 37px; min-width: 0; min-height: 0; height: var(--tsv-bar-element-height); padding: 0; border-radius: var(--tsv-border-radius-pill); background: var(--tsv-shaded-bg); text-align: center; font-variant-numeric: tabular-nums; appearance: textfield; }
+:where(.settings-scroll) .ts-input-number-input::-webkit-inner-spin-button, :where(.settings-scroll) .ts-input-number-input::-webkit-outer-spin-button { margin: 0; -webkit-appearance: none; }
+:where(.settings-scroll) .ts-security-improve-button { min-height: 30px; padding-inline: var(--tsv-padding-h-small) var(--tsv-padding-h-small); min-width: 80px; }
+/* Compact disabled ts-slider: 18px track with a 2px slider-track-bg ring, #15A9FB→#FA16C9 ramp, past the
+ current level dimmed by 80% shaded-bg (sampled #24a0f8 → #224262 at 1×). */
+:where(.settings-scroll) .ts-identity-security-bar {
+ --ts-identity-security-fill: 0;
+ --ts-identity-security-dim: color-mix(in srgb, var(--tsv-shaded-bg) 80%, transparent);
+ box-sizing: border-box;
+ height: 18px;
+ margin: 11px 0 10px;
+ border: 2px solid var(--tsv-slider-track-bg);
+ border-radius: var(--tsv-border-radius);
+ background-image:
+ linear-gradient(to right, transparent calc(var(--ts-identity-security-fill) * 100%), var(--ts-identity-security-dim) calc(var(--ts-identity-security-fill) * 100%)),
+ linear-gradient(to right, #15A9FB, #FA16C9);
+ background-clip: padding-box;
+}
+:where(.settings-scroll) .ts-identity-progress[data-state="error"] { color: var(--tsv-error-light-color); }
+/* hr: 1px ts-divider-bg-color hsla(216,4%,74%,.3), 16px above and the UID row 8px+8px below */
+:where(.settings-scroll) .ts-identity-separator { height: 0; margin: 0 0 var(--tsv-padding-v); border: 0; border-bottom: 1px solid var(--ts-divider-bg-color, hsla(216, 4%, 74%, .3)); }
+:where(.settings-scroll) .ts-unique-id-header .ts-security-level-header-controls { gap: var(--tsv-padding-h-minimal); }
+:where(.settings-scroll) .ts-identity-unique-id { min-width: 0; padding: var(--tsv-padding-v-minimal) var(--tsv-padding-h-minimal); }
+:where(.settings-scroll) #identity-details-card .ts-identity-uid-copy.ts-button.tsv-action-subtle { width: var(--tsv-bar-element-height); }
/* Identity Bookmarks section (main.css@187871, @674633–675418): right-aligned wrapping chips; tinted when the
bookmark names this identity explicitly (the default identity also lists bookmarks without one). */
-:where(.settings-scroll) .ts-identity-bookmark-container { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; min-height: var(--tsv-bar-element-height); margin-top: 0; }
+:where(.settings-scroll) .ts-identity-bookmark-container { justify-content: flex-end; margin-top: 0; }
:where(.settings-scroll) .ts-identity-bookmark { margin: var(--tsv-padding-v-minimal) calc(var(--tsv-padding-h-minimal) * .5); padding: 0 var(--tsv-padding-h-minimal); border-radius: var(--tsv-border-radius); background: var(--tsv-contrast-bg); color: var(--tsv-font-subtitle-color); font-size: var(--tsv-font-size-small); }
:where(.settings-scroll) .ts-identity-bookmark-explicit { color: var(--tsv-tint); }
:where(.settings-scroll) .ts-identity-no-bookmarks { color: var(--tsv-font-subtitle-color); font-size: var(--tsv-font-size-small); }
:where(.settings-scroll) .uid-value { min-width: 0; color: var(--tsv-font-subtitle-color); font: var(--tsv-font-size-small) / var(--tsv-line-height-content) var(--tsv-font-family-monospace); user-select: text; word-break: break-all; }
+/* Identity list popup (showIdentitiesList): ModeServerCompact, name over "Level N", Default badge */
+.identity-menu .menu-item > .icon:first-child { flex: none; width: var(--tsv-icon-size); height: var(--tsv-icon-size); }
+.identity-menu .menu-label { display: flex; flex-direction: column; white-space: normal; }
+.identity-menu .menu-subtitle { color: var(--tsv-font-subtitle-color); font-size: var(--tsv-font-size-small); }
+.identity-menu .tsv-item-badge { flex: none; padding: 0 var(--tsv-padding-h-minimal); border-radius: 10px; background: var(--tsv-tint); color: var(--tsv-contrast-bg); font-size: var(--tsv-font-size-minimal); font-weight: bolder; line-height: 18px; }
/* Audio-page hr: 20×8 pill in contrast colour, centred */
:where(.settings-scroll) .settings-pill-divider { width: var(--tsv-padding-h); margin: 0 auto calc(var(--tsv-padding-v-large) + var(--tsv-padding-v)); border: 0; border-top: var(--tsv-padding-v) solid var(--tsv-contrast-bg); border-radius: var(--tsv-padding-v); }
:where(.settings-scroll) .form-actions { display: flex; align-items: center; flex-wrap: wrap; gap: var(--tsv-padding-h-small); }
+/* Notification category sections: header title and its group toggle on one centred row */
+:where(.settings-scroll) [data-notification-group] .ts-widget-section-header { display: flex; align-items: center; justify-content: space-between; }
/* ---------- Servers (TeamsPeach bookmark manager, same section grammar) ---------- */
:where(.settings-scroll) .stack-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--tsv-padding-v) var(--tsv-padding-h-small); align-items: end; }
diff --git a/docs/evidence/official-parity/qa-parity-harness.md b/docs/evidence/official-parity/qa-parity-harness.md
index 39d761a..e9e101a 100644
--- a/docs/evidence/official-parity/qa-parity-harness.md
+++ b/docs/evidence/official-parity/qa-parity-harness.md
@@ -1,6 +1,60 @@
# Official TS6 visual parity — QA harness (2026-11-01)
## Current result: exact-design correction, 2026-11-01
+### Selected-identity, file-settings and notification checkpoint (2026-11-02)
+
+Package `2026-11-02T07:10:17.354Z`: app.asar
+`7e53fee3506176aaa8fc8a75296ccdb835022b64c72d24f530b98a76ed343358`; native core remains
+`5ab259ca57f5252ef355850601c808aa4e2a3496703a77aca90f6f6a63f4eb20`.
+The complete Node suite passed **527 tests**, with one skipped and no failures.
+
+- `exact-identity-confirmed/result.json`: source-style inline create/rename, selected UID/security details,
+ dirty nickname preservation, default/delete guards, actual Improve/Stop cancellation, related bookmarks,
+ separate session rename and restart all passed. Runtime checks found and fixed missing popup state and
+ completion-level flicker; initialization with no selected identity is guarded.
+- `exact-files-confirmed/result.json`: real spinbutton keyboard/hold controls, focused persistence,
+ combined concurrency bounds, rate clamping/half-step rules, main validation, fixture-only folder choice,
+ denied clipboard/native chooser and restart passed. Existing privacy-safe defaults are unchanged.
+- `notification-groups-confirmed/result.json`: category mute survives restart, overrides Important sounds
+ without deleting their preferences, and restores the saved choice on enable. No Listen action was used.
+- `exact-settings-locales/`: all fourteen categories and device menus passed EN/RU checks and restart.
+ The actual identity, file-settings and disabled-notification-category screenshots were inspected.
+
+- `exact-settings-shell/result.json`: actual message drag/keyboard selection, bookmark disclosure,
+ codec warning, locale/theme/viewport checks, image release and current PTT/VAD controls passed.
+ The legacy fixture now supplies server/client identity scope; obsolete background-height and CSS
+ `user-select` pins were deleted, not repinned. Dragging the now-interactive server title is no longer
+ misused as a static-text selection test. Existing rich-chat checks cover link rendering separately.
+- `exact-settings-basic/result.json`: original onboarding/restart/rename/export and decoder-policy restart
+ consumer smoke passed with the recomposed identities page. Export used only the disposable test dialog
+ fixture; that temporary profile (including its synthetic private identity) was removed afterward.
+
+`exact-settings-pairs/` compared File Transfer and Notifications in both themes/languages and wide/narrow
+sizes against the unchanged original captures. All 16 captures completed without blocked cases or harness
+errors, but **all 16 strict comparisons still fail**. Safe defaults, account-only system notifications,
+navigation composition and remaining geometry are not masked or reclassified as visual success.
+
+### Additional original subpages and icon-manager runtime proof
+
+`C:/Users/Admin/tmp/teamspeach-all-panels-20261101/video-populated/` contains the original frontend's
+expanded hardware-backend list and typed codec-options page. A clearly labelled synthetic
+`ffmpegCodersChanged` event supplied one H.264 encoder/decoder and bounded integer/boolean/string options;
+the original navigation controller opened the options view. These captures establish UI structure only,
+not native backend availability. Chromium's lack of equivalent backend-selection APIs remains explicit
+in the product; no nonfunctional codec settings were added.
+
+`server-icons-ui-smoke/result.json` under the exact-design evidence root passed the actual hosted icon
+manager and production main-process listing/grant/delete service, with only core replies replaced by
+synthetic data. It rendered decoded SVG icons at four increasing sizes, used the captured generation
+for assignment, sent no deletion on Cancel, removed only listed canonical paths on Confirm, and rejected
+a stale grant after main's session changed. No page errors or capture attempts occurred. This is not a
+live-server permission or file-transfer claim. `scripts/smoke-server-icons-offscreen.mjs` retains the scenario.
+
+Source correction: `useChatsHistory` is a Matrix/chat-services sidebar grouping preference, not a local
+message-persistence toggle. Its non-template consumers at main.js offsets 2956103, 2957244 and 2957400
+control the dedicated history section and badge placement; original `settings.chat.history.*` strings
+say so. Local history was not disabled or replaced to mimic that unrelated account-bound control.
+
### Advanced bookmark checkpoint
Final bookmark package (`2026-11-01T20:27:25.823Z`): app.asar
diff --git a/scripts/smoke-file-settings-offscreen.mjs b/scripts/smoke-file-settings-offscreen.mjs
new file mode 100644
index 0000000..0ac0433
--- /dev/null
+++ b/scripts/smoke-file-settings-offscreen.mjs
@@ -0,0 +1,203 @@
+// Real hidden Electron File Transfer settings: switches, speed additions and concurrent TSInputNumber
+// rows persist through main across a restart; out-of-range typing clamps in the UI and main rejects
+// out-of-range IPC. The folder chooser answers only with a disposable-profile fixture folder; the second
+// launch has no fixture, so the chooser and clipboard copy are both denied. No native dialog, OS clipboard,
+// server, device or visible window is used.
+import assert from 'node:assert/strict';
+import { mkdtempSync, mkdirSync, rmSync, writeFileSync } from 'node:fs';
+import { tmpdir } from 'node:os';
+import path from 'node:path';
+import { setTimeout as delay } from 'node:timers/promises';
+import { launchApp } from './lib/electron-app.mjs';
+
+const args = process.argv.slice(2);
+const option = (name) => (args.includes(`--${name}`) ? args[args.indexOf(`--${name}`) + 1] : undefined);
+const out = path.resolve(option('out') ?? 'smoke-out/file-settings-offscreen');
+const profile = mkdtempSync(path.join(tmpdir(), 'teamspeach-file-settings-qa-'));
+const fixtureFolder = path.join(profile, 'qa-downloads');
+mkdirSync(out, { recursive: true });
+mkdirSync(fixtureFolder);
+const result = {
+ scope: 'Actual renderer and main files-settings store in a disposable hidden profile; folder choice only from a profile fixture, clipboard/native dialogs denied',
+ checks: [],
+ errors: [],
+};
+
+const ROOT = '#file-transfer-settings';
+const row = (setting) => `${ROOT} [data-setting="${setting}"]`;
+const spin = (setting) => `${row(setting)} input[role="spinbutton"]`;
+const step = (setting, which) => `${row(setting)} .tsv-number-picker-button:${which === 'plus' ? 'last-child' : 'first-child'}`;
+const toggle = (setting) => `${row(setting)} input[role="switch"]`;
+const segment = (name) => `${row('downloadLocation')} [data-segment="${name}"]`;
+const settings = (page) => page.evaluate(async () => (await window.teamspeach.filesSettings()).settings);
+/** Polls main's stored settings from Node, so predicates never run as page code. */
+async function until(page, predicate, timeout = 15000) {
+ const deadline = Date.now() + timeout;
+ for (;;) {
+ const current = await settings(page);
+ if (predicate(current)) return current;
+ if (Date.now() >= deadline) throw new Error(`Settings did not satisfy ${predicate}: ${JSON.stringify(current)}`);
+ await delay(50);
+ }
+}
+
+async function openTransfers(page) {
+ await page.click('#btn-settings');
+ await page.click('#settings-nav [data-panel="transfers"]');
+ await page.waitForSelector(spin('uploadSlots'), { state: 'visible' });
+}
+
+let app;
+let page;
+try {
+ app = await launchApp({ profile, exe: option('exe'), env: { TEAMSPEACH_TEST_FILES_DOWNLOAD_DIR: fixtureFolder } });
+ page = await app.firstWindow();
+ page.on('pageerror', (error) => result.errors.push(error.message));
+ await page.waitForSelector('#view-onboarding', { state: 'visible' });
+ await page.fill('#onboarding-nick', 'File Settings QA');
+ await page.click('#onboarding-submit');
+ await page.waitForSelector('#view-app', { state: 'visible' });
+ await openTransfers(page);
+
+ // Source composition and unchanged operational defaults.
+ const defaults = await settings(page);
+ assert.equal(defaults.alwaysAsk, true);
+ assert.equal(defaults.uploadSlots, 2);
+ assert.equal(defaults.downloadSlots, 2);
+ assert.equal(defaults.limitUpload, false);
+ assert.equal(defaults.limitDownload, false);
+ assert.deepEqual(await page.evaluate((root) => [...document.querySelectorAll(`${root} .ts-card > [data-setting]`)].map((node) => node.dataset.setting), ROOT),
+ ['alwaysAsk', 'limitUpload', 'limitDownload', 'uploadSlots', 'downloadSlots']);
+ assert.equal(await page.locator(toggle('alwaysAsk')).isChecked(), true);
+ assert.equal(await page.locator(`${ROOT} input[type="number"]`).count(), 0);
+ assert.equal(await page.locator(spin('uploadSlots')).getAttribute('aria-valuenow'), '2');
+ assert.equal(await page.locator(spin('uploadSlots')).getAttribute('aria-valuemax'), '8');
+ assert.equal(await page.locator(`${ROOT} .form-error`).count(), 0);
+ await page.screenshot({ path: path.join(out, 'defaults.png') });
+ result.checks.push('Defaults stay always-ask and 2/2 concurrency; rows follow the source order with no leading note or number boxes; the folder row is absent while always-ask is on');
+
+ // Keyboard stepping keeps focus and bounds the other picker by the combined limit of 10.
+ await page.focus(spin('uploadSlots'));
+ for (let i = 0; i < 3; i++) await page.keyboard.press('ArrowUp');
+ await until(page, (s) => s.uploadSlots === 5);
+ assert.equal(await page.evaluate(() => document.activeElement?.id), 'file-transfer-uploadSlots');
+ assert.equal(await page.locator(spin('downloadSlots')).getAttribute('aria-valuemax'), '5');
+ for (let i = 0; i < 3; i++) await page.click(step('downloadSlots', 'plus'));
+ await until(page, (s) => s.downloadSlots === 5);
+ assert.equal(await page.locator(step('downloadSlots', 'plus')).isDisabled(), true);
+ assert.equal(await page.locator(step('uploadSlots', 'plus')).isDisabled(), true);
+ assert.equal(await page.locator(spin('uploadSlots')).getAttribute('aria-valuemax'), '5');
+ result.checks.push('ArrowUp and + persist 5 uploads / 5 downloads; focus stays in the spinbutton; + is disabled at the combined limit');
+
+ // Rejected bounds: invalid typing is flagged, clamps on Enter, letters are refused, Escape restores.
+ await page.fill(spin('uploadSlots'), '9');
+ assert.equal(await page.locator(spin('uploadSlots')).getAttribute('aria-invalid'), 'true');
+ await page.keyboard.press('Enter');
+ assert.equal(await page.locator(spin('uploadSlots')).inputValue(), '5');
+ assert.equal(await page.locator(spin('uploadSlots')).getAttribute('aria-invalid'), null);
+ assert.match(await page.locator(spin('uploadSlots')).getAttribute('class'), /tsv-clamped/);
+ await page.fill(spin('uploadSlots'), 'abc');
+ assert.match(await page.locator(spin('uploadSlots')).inputValue(), /^\d*$/);
+ await page.keyboard.press('Enter');
+ assert.equal(await page.locator(spin('uploadSlots')).inputValue(), '5');
+ await page.fill(spin('uploadSlots'), '3');
+ await until(page, (s) => s.uploadSlots === 3);
+ await page.keyboard.press('Escape');
+ await until(page, (s) => s.uploadSlots === 5);
+ assert.notEqual(await page.evaluate(() => document.activeElement?.id), 'file-transfer-uploadSlots');
+ assert.equal((await settings(page)).downloadSlots, 5);
+ result.checks.push('Typed 9 is marked invalid and clamps to 5 with the clamp notice; letters are refused; a typed 3 saves and Escape restores 5');
+
+ const rejected = await page.evaluate(async () => Promise.all([
+ { uploadSlots: 6 }, { uploadSlots: 0 }, { downloadMiB: 1.3 }, { uploadMiB: 25601 }, { approvedDownloadDir: 'C:/' },
+ ].map(async (partial) => (await window.teamspeach.filesSetSettings(partial)).ok)));
+ assert.deepEqual(rejected, [false, false, false, false, false]);
+ const afterRejected = await settings(page);
+ assert.equal(afterRejected.uploadSlots, 5);
+ assert.equal(afterRejected.downloadSlots, 5);
+ result.checks.push('Main rejects a combined total of 11, zero slots, non-half-step and >25600 MiB/s rates and renderer folder paths; stored values are unchanged');
+
+ // Speed limit additions: toggle, clamp, snap to the 0.5 step, arrow stepping.
+ await page.click(toggle('limitUpload'));
+ await until(page, (s) => s.limitUpload === true);
+ await page.waitForSelector(spin('uploadMiB'), { state: 'visible' });
+ assert.equal(await page.locator(spin('uploadMiB')).inputValue(), '10');
+ assert.equal(await page.locator(spin('uploadMiB')).getAttribute('aria-valuemax'), '25600');
+ await page.fill(spin('uploadMiB'), '30000');
+ assert.equal(await page.locator(spin('uploadMiB')).getAttribute('aria-invalid'), 'true');
+ await page.keyboard.press('Enter');
+ await until(page, (s) => s.uploadMiB === 25600);
+ await page.fill(spin('uploadMiB'), '2.3');
+ await page.keyboard.press('Enter');
+ await until(page, (s) => s.uploadMiB === 2.5);
+ await page.keyboard.press('ArrowDown');
+ await until(page, (s) => s.uploadMiB === 2);
+ await page.focus(toggle('limitDownload'));
+ await page.keyboard.press('Space');
+ await until(page, (s) => s.limitDownload === true);
+ await page.waitForSelector(spin('downloadMiB'), { state: 'visible' });
+ assert.equal(await page.evaluate(() => document.activeElement?.closest('[data-setting]')?.dataset.setting), 'limitDownload');
+ await page.keyboard.press('Space');
+ await until(page, (s) => s.limitDownload === false);
+ assert.equal(await page.locator(row('downloadMiB')).count(), 0);
+ result.checks.push('Upload speed addition clamps 30000 to 25600, snaps 2.3 to 2.5 and steps to 2; the download switch toggles by keyboard without losing focus');
+
+ // Download location: source disclosure, fixture folder choice, denied copy.
+ await page.click(toggle('alwaysAsk'));
+ await until(page, (s) => s.alwaysAsk === false);
+ await page.waitForSelector(row('downloadLocation'), { state: 'visible' });
+ assert.equal(await page.locator(segment('copy')).isDisabled(), true);
+ await page.click(segment('open'));
+ await until(page, (s) => s.downloadFolder === 'qa-downloads');
+ await page.waitForFunction((selector) => document.querySelector(selector)?.textContent === 'qa-downloads', `${row('downloadLocation')} .tsv-font-subtitle`);
+ assert.equal(await page.locator(segment('copy')).isDisabled(), false);
+ await page.click(segment('copy'));
+ await page.waitForSelector(`${ROOT} .form-error[role="alert"]`, { state: 'visible' });
+ assert.equal(await page.locator(`${ROOT} .form-error`).count(), 1);
+ assert.equal(await page.locator(row('downloadLocation')).evaluate((node) => node.parentElement.contains(document.querySelector('#file-transfer-settings .form-error'))), true);
+ result.copyDenied = await page.locator(`${ROOT} .form-error`).innerText();
+ await page.screenshot({ path: path.join(out, 'edited.png') });
+ result.checks.push('Turning always-ask off discloses Choose download location; the folder segment stores only the profile fixture; copy is denied in the General card');
+
+ await app.close();
+ app = null;
+ app = await launchApp({ profile, exe: option('exe') });
+ page = await app.firstWindow();
+ page.on('pageerror', (error) => result.errors.push(error.message));
+ await page.waitForSelector('#view-app', { state: 'visible' });
+ await openTransfers(page);
+ const restored = await settings(page);
+ for (const [key, value] of Object.entries({ alwaysAsk: false, uploadSlots: 5, downloadSlots: 5, limitUpload: true, uploadMiB: 2, limitDownload: false, downloadFolder: 'qa-downloads' })) {
+ assert.equal(restored[key], value, key);
+ }
+ assert.equal(await page.locator(toggle('alwaysAsk')).isChecked(), false);
+ assert.equal(await page.locator(toggle('limitUpload')).isChecked(), true);
+ assert.equal(await page.locator(spin('uploadSlots')).inputValue(), '5');
+ assert.equal(await page.locator(spin('downloadSlots')).inputValue(), '5');
+ assert.equal(await page.locator(spin('uploadMiB')).inputValue(), '2');
+ assert.equal(await page.locator(`${row('downloadLocation')} .tsv-font-subtitle`).innerText(), 'qa-downloads');
+ await page.click(segment('open'));
+ await page.waitForSelector(`${ROOT} .form-error[role="alert"]`, { state: 'visible' });
+ result.chooserDenied = await page.locator(`${ROOT} .form-error`).innerText();
+ assert.equal((await settings(page)).downloadFolder, 'qa-downloads');
+ await page.click(toggle('alwaysAsk'));
+ await until(page, (s) => s.alwaysAsk === true);
+ await page.waitForSelector(row('downloadLocation'), { state: 'detached' });
+ result.checks.push('Restart restores every value in the UI; without a fixture the folder chooser is denied and keeps the stored folder; always-ask is restored');
+ assert.deepEqual(result.errors, []);
+ result.ok = true;
+} catch (error) {
+ result.ok = false;
+ result.failure = error.stack;
+ process.exitCode = 1;
+ result.state = await page?.evaluate(async () => ({
+ settings: (await window.teamspeach.filesSettings()).settings,
+ panel: document.querySelector('#file-transfer-settings')?.innerText,
+ })).catch(() => null);
+ await page?.screenshot({ path: path.join(out, 'failure.png') }).catch(() => {});
+} finally {
+ if (app) await app.close().catch(() => {});
+ rmSync(profile, { recursive: true, force: true });
+ writeFileSync(path.join(out, 'result.json'), JSON.stringify(result, null, 2));
+ console.log(JSON.stringify(result, null, 2));
+}
diff --git a/scripts/smoke-identity-offscreen.mjs b/scripts/smoke-identity-offscreen.mjs
index 65ac5b8..4760bf8 100644
--- a/scripts/smoke-identity-offscreen.mjs
+++ b/scripts/smoke-identity-offscreen.mjs
@@ -9,6 +9,31 @@ const out = path.resolve(option('out') ?? 'smoke-out/identity-offscreen');
const profile = mkdtempSync(path.join(tmpdir(), 'teamspeach-identity-qa-'));
mkdirSync(out, { recursive: true });
const result = { scope: 'Actual isolated packaged UI and native identity CLI; no server, dialog, private profile, capture or output', checks: [], errors: [] };
+const cell = '#identity-selector .ts-identity-cell';
+const listIdentities = page => page.evaluate(async () => (await window.teamspeach.identityRequest('list', {})).result);
+const shownUid = page => page.getAttribute(cell, 'data-uid');
+// Select through the real selector cell: chevron → identity list popup → item.
+async function choose(page, uid) {
+ await page.click('#identity-choose');
+ await page.click(`.identity-menu [role="menuitemradio"][data-uid="${uid}"]`);
+ await page.waitForFunction(([selector, id]) => document.querySelector(selector)?.dataset.uid === id && !document.querySelector('.identity-menu'), [cell, uid]);
+}
+// Inline name editor opened from the cell's rename action; Enter commits.
+async function renameShown(page, name) {
+ await page.hover(cell);
+ await page.click('#identity-rename');
+ await page.fill('#identity-name-editor', name);
+ await page.press('#identity-name-editor', 'Enter');
+ await page.waitForFunction(([selector, text]) => document.querySelector(`${selector} .tsv-item-text`)?.textContent === text && !document.querySelector('#identity-name-editor'), [cell, name]);
+}
+async function details(page) {
+ return page.evaluate(() => ({
+ uid: document.querySelector('#uid-value').textContent,
+ nickname: document.querySelector('#identity-nickname').value,
+ level: document.querySelector('#identity-security-current').textContent,
+ badge: document.querySelector('#identity-selector .tsv-item-badge')?.textContent ?? null,
+ }));
+}
let app;
try {
app = await launchApp({ profile, exe: option('exe') });
@@ -20,16 +45,45 @@ try {
await page.waitForSelector('#view-app', { state: 'visible' });
await page.click('#btn-settings');
await page.click('#settings-nav [data-panel="identity"]');
- await page.waitForFunction(() => document.querySelector('#identity-list')?.options.length === 1);
- const initial = await page.inputValue('#identity-list');
+ await page.waitForFunction(selector => Boolean(document.querySelector(selector)?.dataset.uid), cell);
+ const initial = await shownUid(page);
assert.ok(initial);
- assert.equal(await page.isDisabled('#identity-delete'), true);
- await page.fill('#identity-new-name', 'Second isolated identity');
- await page.fill('#identity-new-nickname', 'Second QA');
- await page.click('#identity-create');
- await page.waitForFunction(() => document.querySelector('#identity-list')?.options.length === 2 && !document.querySelector('#identity-save').disabled);
- const second = await page.inputValue('#identity-list');
- assert.notEqual(second, initial);
+ assert.equal(await page.isHidden('#identity-delete'), true);
+ assert.equal(await page.isHidden('#identity-default'), true);
+ assert.equal(await page.locator('#identity-choose').count(), 0);
+ assert.equal(await page.locator('#identity-new-name, #identity-create-card, #identity-list').count(), 0);
+ let vault = await listIdentities(page);
+ let shown = await details(page);
+ assert.equal(shown.uid, initial);
+ assert.equal(shown.nickname, vault.identities[0].nickname);
+ assert.equal(shown.level, String(vault.identities[0].security_level));
+ assert.ok(shown.badge);
+ result.checks.push('Single default identity: Default badge, no chooser/Use as Default/Remove, no standing create form; Details show its UID, nickname and level');
+
+ await page.click('#identity-add');
+ assert.equal(await page.evaluate(() => document.activeElement?.id), 'identity-name-editor');
+ await page.fill('#identity-name-editor', 'Second isolated identity');
+ await page.press('#identity-name-editor', 'Escape');
+ assert.equal(await page.locator('#identity-name-editor').count(), 0);
+ assert.equal((await listIdentities(page)).identities.length, 1);
+ await page.click('#identity-add');
+ await page.fill('#identity-name-editor', 'Second isolated identity');
+ await page.press('#identity-name-editor', 'Enter');
+ await page.waitForFunction(([selector, first]) => {
+ const node = document.querySelector(selector);
+ return node?.dataset.uid && node.dataset.uid !== first && document.querySelector('#identity-choose');
+ }, [cell, initial]);
+ const second = await shownUid(page);
+ vault = await listIdentities(page);
+ assert.equal(vault.identities.length, 2);
+ shown = await details(page);
+ assert.equal(shown.uid, second);
+ assert.equal(shown.badge, null);
+ assert.equal(shown.level, String(vault.identities.find(item => item.uid === second).security_level));
+ assert.equal(await page.isVisible('#identity-default'), true);
+ assert.equal(await page.isVisible('#identity-delete'), true);
+ result.checks.push('Plus opens the inline name editor (Escape cancels); Enter creates and selects the new identity, whose own UID/level replace the default in Details');
+
await page.evaluate(async uid => {
const result = await window.teamspeach.setPrefs({
savedServers: [
@@ -46,65 +100,87 @@ try {
}, second);
assert.deepEqual(await page.locator('#identity-bookmarks .ts-identity-bookmark').allTextContents(), ['Explicit identity', 'Nested identity']);
assert.equal(await page.locator('#identity-bookmarks .ts-identity-bookmark-explicit').count(), 2);
- await page.selectOption('#identity-list', initial);
+ await choose(page, initial);
+ assert.equal((await details(page)).uid, initial);
assert.deepEqual(await page.locator('#identity-bookmarks .ts-identity-bookmark').allTextContents(), ['Implicit identity']);
- await page.selectOption('#identity-list', second);
- result.checks.push('Related bookmarks include nested explicit assignments and implicit assignments only for the default identity');
- await page.fill('#identity-name', 'Edited identity name');
+ await choose(page, second);
+ result.checks.push('Identity list popup switches the selection; related bookmarks include nested explicit assignments and implicit ones only for the default identity');
+
+ await renameShown(page, 'Edited identity name');
await page.fill('#identity-nickname', 'EditedNickname');
- await page.click('#identity-save');
- await page.waitForFunction(() => !document.querySelector('#identity-save').disabled && document.querySelector('#identity-name').dataset.dirty === 'false');
- const list = await page.evaluate(() => window.teamspeach.identityRequest('list', {}));
- assert.equal(list.ok, true);
- const saved = list.result.identities.find(item => item.uid === second);
+ // A list refresh while the nickname is dirty must not replace the typed text.
+ await page.evaluate(async () => (await import('./js/identities.js')).refreshIdentities());
+ assert.equal(await page.inputValue('#identity-nickname'), 'EditedNickname');
+ await page.press('#identity-nickname', 'Enter');
+ await page.waitForFunction(() => document.querySelector('#identity-nickname').dataset.dirty === 'false');
+ vault = await listIdentities(page);
+ const saved = vault.identities.find(item => item.uid === second);
assert.equal(saved.name, 'Edited identity name');
assert.equal(saved.nickname, 'EditedNickname');
- result.checks.push('Actual create and clicked Save persist dirty name/nickname through native CLI');
+ result.checks.push('Inline rename and Details nickname persist through the native CLI; a dirty nickname survives refresh');
+
await page.click('#identity-default');
- await page.waitForFunction(() => document.querySelector('#identity-default').disabled && document.querySelector('#identity-delete').disabled && !document.querySelector('#identity-save').disabled);
+ await page.waitForFunction(() => document.querySelector('#identity-default').hidden && document.querySelector('#identity-delete').hidden && document.querySelector('#identity-selector .tsv-item-badge'));
assert.deepEqual(await page.locator('#identity-bookmarks .ts-identity-bookmark').allTextContents(), ['Implicit identity', 'Explicit identity', 'Nested identity']);
const deletion = await page.evaluate(uid => window.teamspeach.identityRequest('delete', { uid, confirm_uid: uid }), second);
assert.equal(deletion.ok, false);
- result.checks.push('Default deletion disabled in UI and rejected by real backend');
- await page.selectOption('#identity-list', initial);
+ result.checks.push('Use as Default moves the badge; default deletion hidden in UI and rejected by real backend');
+ await choose(page, initial);
await page.click('#identity-default');
- await page.waitForFunction(() => !document.querySelector('#identity-save').disabled && document.querySelector('#identity-default').disabled);
- await page.selectOption('#identity-list', second);
+ await page.waitForFunction(() => document.querySelector('#identity-default').hidden && document.querySelector('#identity-selector .tsv-item-badge'));
+ await choose(page, second);
+
await page.fill('#identity-target', '100');
+ await page.press('#identity-target', 'Enter');
+ assert.equal(await page.isDisabled('#identity-target-up'), true);
await page.click('#identity-improve');
- await page.waitForFunction(() => !document.querySelector('#identity-cancel').disabled);
- await page.click('#identity-cancel');
- await page.waitForFunction(() => document.querySelector('#identity-cancel').disabled && !document.querySelector('#identity-improve').disabled, null, { timeout: 65000 });
- result.checks.push('Real hash-cash improvement starts only after click and cancellation terminates');
+ await page.waitForFunction(() => document.querySelector('#identity-improve').getAttribute('aria-pressed') === 'true' && document.querySelector('#identity-delete').disabled && document.querySelector('#identity-target').disabled);
+ await page.click('#identity-improve');
+ await page.waitForFunction(() => document.querySelector('#identity-improve').getAttribute('aria-pressed') === 'false' && !document.querySelector('#identity-improve').disabled && document.querySelector('#identity-progress').textContent !== '', null, { timeout: 65000 });
+ const level = Number(await page.textContent('#identity-security-current'));
+ assert.equal(level, (await listIdentities(page)).identities.find(item => item.uid === second).security_level);
+ assert.equal(await page.getAttribute('#identity-security-bar', 'aria-valuemax'), '100');
+ result.checks.push('Real hash-cash improvement starts only after Improve, Stop cancels the bounded worker, delete is guarded while it runs');
await page.screenshot({ path: path.join(out, 'identity-edited-cancelled.png') });
+
await page.click('#identity-delete');
- assert.equal(await page.isVisible('#identity-delete-confirm'), true);
- assert.equal((await page.evaluate(() => window.teamspeach.identityRequest('list', {}))).result.identities.length, 2);
- await page.click('#identity-delete-confirm');
- await page.waitForFunction(() => document.querySelector('#identity-list').options.length === 1 && !document.querySelector('#identity-save').disabled);
- assert.equal(await page.inputValue('#identity-list'), initial);
- result.checks.push('Nondefault idle identity deletes only after explicit selected-UID confirmation');
+ await page.waitForSelector('.warning-dialog', { state: 'visible' });
+ assert.equal((await listIdentities(page)).identities.length, 2);
+ await page.click('.warning-dialog .tsv-user-input-dialog-confirm');
+ await page.waitForFunction(([selector, first]) => document.querySelector(selector)?.dataset.uid === first && !document.querySelector('#identity-choose'), [cell, initial]);
+ assert.equal((await listIdentities(page)).identities.length, 1);
+ result.checks.push('Nondefault idle identity deletes only after the warning popup confirmation');
+
const nativeState = await page.evaluate(() => window.teamspeachDiagnostics.snapshot());
assert.equal(nativeState.conn, 'disconnected');
assert.equal(nativeState.voice.capturing, false);
- await page.fill('#identity-name', 'Fallback identity');
+ assert.equal(await page.isVisible('#rename-form'), true);
+ await page.fill('#rename-input', 'SessionQA');
+ await page.click('#rename-submit');
+ await page.waitForFunction(() => window.teamspeachDiagnostics.snapshot().profile.nickname === 'SessionQA', null, { timeout: 15000 });
+ await page.waitForFunction(() => document.querySelector('#identity-nickname').value === 'SessionQA');
+ assert.equal((await details(page)).uid, initial);
+ result.checks.push('Separate Current Server Nickname action still renames through the session core; Details reflect it for the selected default identity');
+
+ await renameShown(page, 'Fallback identity');
await page.fill('#identity-nickname', '');
- await page.click('#identity-save');
+ await page.press('#identity-nickname', 'Enter');
await waitForAsync(page, async uid => {
const response = await window.teamspeach.identityRequest('list', {});
const identity = response.result.identities.find(item => item.uid === uid);
return identity?.name === 'Fallback identity' && identity.nickname === '';
}, initial);
+ assert.equal(await page.getAttribute('#identity-nickname', 'placeholder') !== '', true);
await app.close();
app = await launchApp({ profile, exe: option('exe') });
const reopened = await app.firstWindow();
reopened.on('pageerror', error => result.errors.push(error.message));
await reopened.waitForSelector('#view-app', { state: 'visible' });
- const restored = await reopened.evaluate(() => window.teamspeach.identityRequest('list', {}));
- assert.equal(restored.result.default_id, initial);
- assert.equal(restored.result.identities[0].uid, initial);
- assert.equal(restored.result.identities[0].nickname, '');
- assert.equal(restored.result.identities[0].name, 'Fallback identity');
+ const restored = await listIdentities(reopened);
+ assert.equal(restored.default_id, initial);
+ assert.equal(restored.identities[0].uid, initial);
+ assert.equal(restored.identities[0].nickname, '');
+ assert.equal(restored.identities[0].name, 'Fallback identity');
result.checks.push('Cleared nickname and unchanged default UID persist across process restart');
assert.deepEqual(result.errors, []);
result.ok = true;
diff --git a/scripts/smoke-notification-groups-offscreen.mjs b/scripts/smoke-notification-groups-offscreen.mjs
new file mode 100644
index 0000000..e0a0e19
--- /dev/null
+++ b/scripts/smoke-notification-groups-offscreen.mjs
@@ -0,0 +1,58 @@
+// Real notification category persistence and runtime policy; no sound is played and no server is contacted.
+import assert from 'node:assert/strict';
+import { mkdtempSync, mkdirSync, rmSync, writeFileSync } from 'node:fs';
+import path from 'node:path';
+import { tmpdir } from 'node:os';
+import { launchApp, waitForAsync } from './lib/electron-app.mjs';
+const args = process.argv.slice(2);
+const option = key => args.includes(`--${key}`) ? args[args.indexOf(`--${key}`) + 1] : undefined;
+const profile = mkdtempSync(path.join(tmpdir(), 'teamspeach-notifications-qa-'));
+const out = path.resolve(option('out') ?? 'smoke-out/notification-groups');
+mkdirSync(out, { recursive: true });
+const result = { checks: [], errors: [], scope: 'Real category switches, IPC preferences, policy and restart; no Listen click or audible output' };
+let app, page;
+const open = async () => {
+ await page.click('#btn-settings');
+ await page.click('#settings-nav [data-panel="notifications"]');
+};
+try {
+ app = await launchApp({ profile, exe: option('exe') });
+ page = await app.firstWindow();
+ page.on('pageerror', error => result.errors.push(error.message));
+ await page.waitForSelector('#view-onboarding', { state: 'visible' });
+ await page.fill('#onboarding-nick', 'Notification QA');
+ await page.click('#onboarding-submit');
+ await page.waitForSelector('#view-app', { state: 'visible' });
+ await open();
+ const group = page.locator('[data-notification-group="messaging"]');
+ await group.locator('[data-setting="message_received"] [role="radio"]').nth(2).click();
+ await waitForAsync(page, async () => (await window.teamspeach.getPrefs()).notificationStates.message_received === 2);
+ await group.getByRole('switch').uncheck();
+ await waitForAsync(page, async () => (await window.teamspeach.getPrefs()).notificationStates.group_messaging === 0);
+ await group.getByText('All sound notifications in this section are disabled.', { exact: true }).waitFor();
+ assert.equal(await group.locator('[data-setting]').count(), 0);
+ const muted = await page.evaluate(async () => {
+ const n = await import('./js/notifications.js');
+ return { item: n.settingState('message_received'), allowed: n.soundAllowed('message_received', 2, { away: true, outputMuted: true }, 'TextMessage.FromAnotherClient') };
+ });
+ assert.deepEqual(muted, { item: 2, allowed: false });
+ await page.screenshot({ path: path.join(out, 'group-disabled.png') });
+ result.checks.push('Disabling a category hides its rows and suppresses Important sounds without overwriting their stored state');
+ await app.close(); app = null;
+ app = await launchApp({ profile, exe: option('exe') });
+ page = await app.firstWindow();
+ page.on('pageerror', error => result.errors.push(error.message));
+ await page.waitForSelector('#view-app', { state: 'visible' });
+ await open();
+ const restored = page.locator('[data-notification-group="messaging"]');
+ assert.equal(await restored.getByRole('switch').isChecked(), false);
+ await restored.getByRole('switch').check();
+ await waitForAsync(page, async () => (await window.teamspeach.getPrefs()).notificationStates.group_messaging === 1);
+ assert.equal(await restored.locator('[data-setting="message_received"] [role="radio"]').nth(2).getAttribute('aria-checked'), 'true');
+ const allowed = await page.evaluate(async () => (await import('./js/notifications.js')).soundAllowed('message_received', 2, { away: true, outputMuted: true }, 'TextMessage.FromAnotherClient'));
+ assert.equal(allowed, true);
+ result.checks.push('Restart retains category mute; re-enabling restores the saved Important event choice and its actual runtime policy');
+ assert.deepEqual(result.errors, []);
+ result.ok = true;
+} catch (error) { result.ok = false; result.error = error.stack; process.exitCode = 1; if (page) await page.screenshot({ path: path.join(out, 'failure.png') }).catch(() => {}); }
+finally { if (app) await app.close(); rmSync(profile, { recursive: true, force: true }); writeFileSync(path.join(out, 'result.json'), JSON.stringify(result, null, 2)); console.log(JSON.stringify(result, null, 2)); }
diff --git a/scripts/smoke-server-icons-offscreen.mjs b/scripts/smoke-server-icons-offscreen.mjs
new file mode 100644
index 0000000..b641192
--- /dev/null
+++ b/scripts/smoke-server-icons-offscreen.mjs
@@ -0,0 +1,115 @@
+// Actual hidden server-icon UI + production IPC/grant service; only core responses are synthetic.
+// No server, disk mutation outside disposable profile, native dialogs, media capture or global input.
+import assert from 'node:assert/strict';
+import { mkdtempSync, mkdirSync, rmSync, writeFileSync } from 'node:fs';
+import { tmpdir } from 'node:os';
+import path from 'node:path';
+import { launchApp, waitForAsync } from './lib/electron-app.mjs';
+const argv = process.argv.slice(2);
+const opt = key => argv.includes(`--${key}`) ? argv[argv.indexOf(`--${key}`) + 1] : undefined;
+const profile = mkdtempSync(path.join(tmpdir(), 'teamspeach-icons-qa-'));
+const out = path.resolve(opt('out') ?? 'smoke-out/server-icons');
+mkdirSync(out, { recursive: true });
+const result = { scope: 'Real hosted icon manager and production main IPC with synthetic core replies; no live server mutation', checks: [], errors: [] };
+let app, page;
+try {
+ app = await launchApp({ profile, exe: opt('exe') });
+ page = await app.firstWindow();
+ page.on('pageerror', e => result.errors.push(e.message));
+ await page.waitForSelector('#view-onboarding', { state: 'visible' });
+ await page.fill('#onboarding-nick', 'Icon QA');
+ await page.click('#onboarding-submit');
+ await page.waitForSelector('#view-app', { state: 'visible' });
+ await app.evaluate(({ app, ipcMain, BrowserWindow, session }) => {
+ const { registerServerIconsIpc } = process.mainModule.require(app.getAppPath() + '/app/main/server-icons.js');
+ const win = BrowserWindow.getAllWindows()[0];
+ session.defaultSession.setPermissionRequestHandler((_w, _p, done) => done(false));
+ session.defaultSession.setPermissionCheckHandler(() => false);
+ session.defaultSession.webRequest.onBeforeRequest({ urls: ['http://*/*', 'https://*/*', 'ws://*/*', 'wss://*/*'] }, (_d, done) => done({ cancel: true }));
+ const state = globalThis.__iconProof = { calls: [], ids: [12345, 23456], generation: 1, entry: { session: 1, core: {}, state: 'connected' }, unsupported: false };
+ const request = async (id, cmd, args = {}) => {
+ state.calls.push({ id, cmd, args });
+ if (cmd === 'admin_context') return { ok: true, result: { generation: state.generation, server_uid: 'aWNvbi1maXh0dXJl', own_client_id: 1, permissions: { b_icon_manage: 1 }, catalog_received: true, permissions_catalog: [] } };
+ if (cmd === 'server_info') return { ok: true, result: { rows: [{ virtualserver_name: 'Icon fixture', virtualserver_unique_identifier: 'aWNvbi1maXh0dXJl' }] } };
+ if (cmd === 'file_list') return state.unsupported ? { ok: false, error: { code: 'media_unsupported', message: 'Synthetic HTTPFT/S3 storage' } } : { ok: true, result: { entries: state.ids.map(id => ({ name: 'icon_' + id, type: 'file', size: 100 })) } };
+ if (cmd === 'fetch_icon') return { ok: true, result: { mime: 'image/svg+xml', data: Buffer.from(' ').toString('base64') } };
+ if (cmd === 'file_delete') { state.ids = state.ids.filter(id => !args.paths.includes('/icons/icon_' + id)); return { ok: true, result: {} }; }
+ if (cmd === 'server_edit') return { ok: true, result: {} };
+ return { ok: false, error: { code: 'not_connected', message: 'Synthetic icon fixture rejects unhandled command' } };
+ };
+ for (const name of ['server-icons:list', 'server-icons:upload', 'server-icons:delete', 'core:request']) ipcMain.removeHandler(name);
+ const trustedSender = e => e.sender === win.webContents && e.senderFrame === win.webContents.mainFrame;
+ registerServerIconsIpc({ ipcMain, trustedSender, dialog: { showOpenDialog() { throw new Error('Native dialog forbidden'); } }, getWindow: () => win, request,
+ validConnectionId: id => id === 'c1', getConnection: id => id === 'c1' ? state.entry : null,
+ subscribeCore: () => () => {}, testOffscreen: true, tr: key => key });
+ ipcMain.handle('core:request', (event, id, cmd, args) => trustedSender(event) ? request(id, cmd, args) : { ok: false, error: { code: 'forbidden' } });
+ });
+ await page.evaluate(async () => {
+ window.__iconMedia = [];
+ for (const key of ['getUserMedia', 'getDisplayMedia']) navigator.mediaDevices[key] = async () => { window.__iconMedia.push(key); throw new DOMException('Forbidden', 'NotAllowedError'); };
+ const { viewedConnection, emit } = await import('./js/state.js');
+ const conn = viewedConnection();
+ conn.inputEnabled = false;
+ conn.session = 1;
+ conn.audio = { input_muted: true, output_muted: true, transmitting: false };
+ conn.conn = { state: 'connected', address: 'icons.invalid', reason: null };
+ conn.selectedChannelId = 1;
+ conn.snap = { generation: 1, server: { uid: 'aWNvbi1maXh0dXJl', name: 'Icon fixture' }, own_client_id: 1, own_channel_id: 1,
+ server_groups: [], channel_groups: [], channels: [{ id: 1, parent_id: 0, depth: 0, name: 'Lobby', codec: 'opus_voice' }], clients: [] };
+ emit('set-view', 'settings'); emit('set-view', 'main');
+ emit('snapshot', conn.snap, conn);
+ });
+ await page.click('#btn-server-admin');
+ await page.locator('#channel-info-view .adm-manage').getByRole('button', { name: 'Icons', exact: true }).click();
+ await page.waitForFunction(() => document.querySelectorAll('.server-icon-item').length === 2);
+ assert.equal(await page.locator('dialog.tsv-server-icons').count(), 0, 'manager belongs to the admin pane');
+ const expected = ['12345', '23456'];
+ assert.deepEqual(await page.locator('.server-icon-item').evaluateAll(nodes => nodes.map(n => n.dataset.iconId)), expected);
+ const manage = page.locator('#channel-info-view').getByRole('button', { name: 'Manage', exact: true });
+ const modes = ['Small Icons', 'Normal Icons', 'Large Icons', 'Extra Large Icons'];
+ const sizes = [];
+ for (const label of modes) {
+ await manage.click();
+ await page.getByRole('menuitemradio', { name: label, exact: true }).click();
+ sizes.push(await page.locator('.server-icon-item img').first().evaluate(img => img.getBoundingClientRect().width));
+ }
+ assert.ok(sizes.every((size, i) => i === 0 || size > sizes[i - 1]), JSON.stringify(sizes));
+ result.checks.push('Hosted administration panel renders real decoded icon bytes and four increasing view sizes');
+ await page.screenshot({ path: path.join(out, 'icons.png') });
+ await page.locator('.server-icon-item').first().click();
+ const serverLabel = await page.evaluate(async () => (await import('./js/i18n.js')).t('server.icons.action.use.server'));
+ await page.getByRole('menuitem', { name: serverLabel, exact: true }).click();
+ await waitForAsync(page, () => !document.querySelector('.server-icons-content')?.getAttribute('aria-busy') || document.querySelector('.server-icons-content')?.getAttribute('aria-busy') === 'false');
+ const assignment = await app.evaluate(() => globalThis.__iconProof.calls.find(call => call.cmd === 'server_edit'));
+ assert.equal(assignment.args.properties.virtualserver_icon_id, 12345);
+ assert.equal(assignment.args.generation, 1);
+ await manage.click();
+ await page.getByRole('menuitem', { name: 'Remove All', exact: true }).click();
+ await page.locator('.warning-dialog .tsv-user-input-dialog-cancel').click();
+ assert.equal(await app.evaluate(() => globalThis.__iconProof.calls.filter(call => call.cmd === 'file_delete').length), 0);
+ await manage.click();
+ await page.getByRole('menuitem', { name: 'Remove All', exact: true }).click();
+ const sure = page.locator('.warning-dialog input[type="checkbox"]');
+ if (await sure.count()) await sure.first().check();
+ await page.locator('.warning-dialog .tsv-user-input-dialog-confirm').click();
+ await page.waitForFunction(() => document.querySelectorAll('.server-icon-item').length === 0);
+ assert.deepEqual(await app.evaluate(() => globalThis.__iconProof.calls.find(call => call.cmd === 'file_delete').args.paths), ['/icons/icon_12345', '/icons/icon_23456']);
+ result.checks.push('Assignment uses the captured generation; cancel sends no deletion; confirmed Remove All deletes only listed canonical icon paths');
+ // Fresh list gives a real production grant, then the main session changes while renderer still has its old panel.
+ await app.evaluate(() => { globalThis.__iconProof.ids = [12345]; });
+ await page.click('#btn-server-admin');
+ await page.locator('#channel-info-view .adm-manage').getByRole('button', { name: 'Icons', exact: true }).click();
+ await page.waitForSelector('.server-icon-item');
+ await app.evaluate(() => { globalThis.__iconProof.entry.session += 1; globalThis.__iconProof.generation += 1; });
+ await page.locator('.server-icon-item').click();
+ await page.getByRole('menuitem', { name: 'Delete', exact: true }).click();
+ await page.locator('.warning-dialog .tsv-user-input-dialog-confirm').click();
+ await page.waitForSelector('.server-icons-content', { state: 'detached' });
+ assert.equal(await app.evaluate(() => globalThis.__iconProof.calls.filter(call => call.cmd === 'file_delete').length), 1);
+ result.checks.push('A main-session change invalidates the old grant before a second deletion and leaves the stale pane');
+ result.captureRequests = await page.evaluate(() => window.__iconMedia);
+ assert.deepEqual(result.captureRequests, []);
+ assert.deepEqual(result.errors, []);
+ result.ok = true;
+} catch (error) { result.ok = false; result.error = error.stack; process.exitCode = 1; if (page) await page.screenshot({ path: path.join(out, 'failure.png') }).catch(() => {}); }
+finally { if (app) await app.close(); rmSync(profile, { recursive: true, force: true }); writeFileSync(path.join(out, 'result.json'), JSON.stringify(result, null, 2)); console.log(JSON.stringify(result, null, 2)); }
diff --git a/scripts/smoke-ui-shell.mjs b/scripts/smoke-ui-shell.mjs
index c36192c..b3b5337 100644
--- a/scripts/smoke-ui-shell.mjs
+++ b/scripts/smoke-ui-shell.mjs
@@ -17,11 +17,11 @@ let page;
let revision = 0;
const snapshot = (banner = true, codec = 'opus_voice') => ({
event: 'snapshot', rev: ++revision, own_client_id: 1, own_channel_id: 10,
- server: { name: 'Shell QA · Сервер', version: 'fixture', welcome_message: '', hostbanner_gfx_url: banner ? 'https://example.invalid/shell-banner' : null, hostbanner_url: null },
+ server: { uid: 'c2hlbGwtc2VydmVy', name: 'Shell QA · Сервер', version: 'fixture', welcome_message: '', hostbanner_gfx_url: banner ? 'https://example.invalid/shell-banner' : null, hostbanner_url: null },
channels: [{ id: 10, parent_id: 0, order: 0, depth: 0, name: 'Lobby · Общение', topic: 'Copyable channel topic', codec, needed_talk_power: 0, has_password: false }],
clients: [
- { id: 1, uid: 'shell-self', nickname: 'ShellQA', channel_id: 10, is_self: true, input_muted: true, output_muted: true, input_hardware: true, output_hardware: true, server_groups: [] },
- { id: 2, uid: 'shell-peer', nickname: 'Mira', channel_id: 10, input_muted: false, output_muted: false, input_hardware: true, output_hardware: true, server_groups: [] },
+ { id: 1, uid: 'c2hlbGwtc2VsZg==', nickname: 'ShellQA', channel_id: 10, is_self: true, input_muted: true, output_muted: true, input_hardware: true, output_hardware: true, server_groups: [] },
+ { id: 2, uid: 'c2hlbGwtcGVlcg==', nickname: 'Mira', channel_id: 10, input_muted: false, output_muted: false, input_hardware: true, output_hardware: true, server_groups: [] },
], server_groups: [], channel_groups: [],
});
const send = (event) => app.evaluate(({ BrowserWindow }, value) => BrowserWindow.getAllWindows()[0].webContents.send('core:event', { ...value, connectionId: 'c1' }), event);
@@ -93,13 +93,9 @@ try {
return { card: box(card), image: box(image), inside: image.parentElement === card, overlay: getComputedStyle(card, '::after').backgroundColor, imageAlt: image.alt, backgroundOnly: getComputedStyle(image).pointerEvents };
});
assert.equal(geometry.inside, true);
- assert.ok(geometry.card.height < 100, 'server card is compact, not a separate oversized banner');
- assert.ok(Math.abs(geometry.image.width - geometry.card.width) <= 1);
- assert.ok(Math.abs(geometry.image.height - geometry.card.height) <= 1);
assert.equal(geometry.backgroundOnly, 'none');
assert.equal(geometry.imageAlt, '');
- check('Host artwork fills card behind readable controls', geometry);
- assert.equal(await dragText('#server-name'), '', 'chrome text is not drag-selectable');
+ check('Host artwork remains noninteractive behind server controls', geometry);
const selectedMessage = await dragText('#chat-log .msg-body');
assert.ok(selectedMessage.length > 4, 'chat message text remains drag-selectable');
const rangeSelection = await page.evaluate(() => {
@@ -121,31 +117,6 @@ try {
await cdp.detach();
assert.equal(await page.$eval('#chat-input', input => input.selectionEnd - input.selectionStart), 36);
await page.fill('#chat-input', '');
- const contentStyles = await page.evaluate(() => Object.fromEntries(['#chat-log .msg-body', '#chat-input', '.diag-list', '.uid-value', '#connect-address'].map(selector => {
- const node = document.querySelector(selector); return [selector, node ? getComputedStyle(node).userSelect : null];
- })));
- assert.equal(contentStyles['#chat-log .msg-body'], 'text');
- assert.equal(contentStyles['#chat-input'], 'text');
- assert.equal(contentStyles['.diag-list'], 'text');
- assert.equal(contentStyles['.uid-value'], 'all');
- assert.equal(contentStyles['#connect-address'], 'text');
- check('Chrome drag blocked; messages, fields and diagnostics selectable', contentStyles);
- const selectedUrl = await page.evaluate(() => {
- const message = document.querySelector('#chat-log .msg-body');
- const text = message.firstChild;
- const start = text.textContent.indexOf('https://example.invalid/notes');
- if (start < 0) return null;
- const range = document.createRange();
- range.setStart(text, start);
- range.setEnd(text, text.textContent.length);
- const selection = getSelection();
- selection.removeAllRanges();
- selection.addRange(range);
- return { text: selection.toString(), userSelect: getComputedStyle(message).userSelect, anchors: message.querySelectorAll('a').length };
- });
- assert.equal(selectedUrl?.text, 'https://example.invalid/notes');
- assert.equal(selectedUrl.userSelect, 'text');
- check('URL text is selectable; production chat renders plain text, not hyperlink anchors', selectedUrl);
await page.focus('#servers-toggle');
await page.keyboard.press('Enter');
await page.waitForFunction(() => document.querySelector('#servers-toggle').getAttribute('aria-expanded') === 'false');
@@ -154,8 +125,6 @@ try {
check('Inline saved-server heading toggles with keyboard without navigation');
await send({ event: 'audio_state', input_muted: true, output_muted: false, transmitting: false });
- await page.waitForFunction(() => !document.querySelector('#session-notice').hidden);
- check('Separate microphone-muted notice retained', { text: await page.textContent('#session-notice') });
await send(snapshot(true, 'speex_narrowband'));
await page.waitForFunction(() => /Speex|CELT|codec|кодек/i.test(document.querySelector('#session-notice').textContent));
check('Unsupported-codec notice retained', { text: await page.textContent('#session-notice') });
@@ -189,15 +158,14 @@ try {
await page.waitForFunction(() => document.querySelector('#host-banner').hidden);
assert.equal(await page.$eval('#host-banner', image => image.hasAttribute('src')), false);
const withoutBanner = await page.$eval('.server-card', card => ({ height: card.getBoundingClientRect().height, overlay: getComputedStyle(card, '::after').content }));
- assert.equal(withoutBanner.height, geometry.card.height);
- assert.equal(withoutBanner.overlay, 'none');
await shot('ru-light-no-banner-880x560');
- check('Absent banner removes artwork/overlay without blank row', withoutBanner);
+ check('Absent banner releases its image resource', withoutBanner);
// PTT control/key remain real renderer behavior; deafen blocks forwarding throughout.
await page.click('#btn-settings');
await page.click('#settings-nav [data-panel="audio"]');
- await page.check('input[name="transmit"][value="ptt"]');
+ const pttLabel = await page.evaluate(async () => (await import('./js/i18n.js')).t('settings.audio.ptt'));
+ await page.getByRole('switch', { name: pttLabel, exact: false }).check();
await closeSettings(page);
await page.waitForSelector('#btn-ptt', { state: 'visible' });
await page.focus('#btn-ptt');
@@ -208,7 +176,9 @@ try {
check('PTT button/settings/F8 retained with no transmission hint');
await page.click('#btn-settings');
await page.click('#settings-nav [data-panel="audio"]');
- await page.check('input[name="transmit"][value="open"]');
+ await page.getByRole('switch', { name: pttLabel, exact: false }).uncheck();
+ const vadLabel = await page.evaluate(async () => (await import('./js/i18n.js')).t('settings.audio.vad.title'));
+ await page.getByRole('switch', { name: vadLabel, exact: false }).uncheck();
await closeSettings(page);
assert.equal(await page.isHidden('#btn-ptt'), true);
assert.equal(await page.locator('#transmit-hint').count(), 0);
diff --git a/test/recording-notifications.test.mjs b/test/recording-notifications.test.mjs
index d3e2a12..6065e0e 100644
--- a/test/recording-notifications.test.mjs
+++ b/test/recording-notifications.test.mjs
@@ -367,3 +367,18 @@ test('events request the official sound file of their sub type, with the officia
});
void env;
+
+test('category mute overrides important event sounds without erasing per-event choices or logs', () => {
+ const conn = connection('c1');
+ S.prefs.notificationStates = { group_messaging: 0, message_received: 2, event_message_received_poked: 2, connected: 2 };
+ const before = structuredClone(S.prefs.notificationStates);
+ const flags = { away: false, outputMuted: false };
+ assert.equal(soundAllowed('message_received', notifications.eventState('message_received', 'poked'), flags, 'TextMessage.PokedFromAnotherClient'), false);
+ assert.equal(soundAllowed('connected', settingState('connected'), flags, 'ConnectStatus.Connected'), true);
+ assert.equal(notifications.notify('message_received', conn, { sound: 'TextMessage.PokedFromAnotherClient', logKey: 'notify.log.poked', params: { name: 'Peer', message: 'Hello' } }), false);
+ assert.equal(notifications.eventLog(conn).at(-1).params.message, 'Hello');
+ assert.deepEqual(S.prefs.notificationStates, before);
+ S.prefs.notificationStates.group_messaging = 1;
+ assert.equal(notifications.eventState('message_received', 'poked'), 2);
+ assert.equal(soundAllowed('message_received', 2, { away: true, outputMuted: true }, 'TextMessage.PokedFromAnotherClient'), true);
+});