Dark theme by default (stored choices kept); updateChannel pref; new peach icon (transparent); packaged device evidence
No files matched your search
@@ -7,6 +7,8 @@
|
||||
device ids and names. The audio-only permission policy now normalises origins (camera stays denied);
|
||||
real inputs and outputs are listed without starting the microphone, and the default entry names the
|
||||
device it points to.
|
||||
- The default theme is now dark, independent of the OS; light (or «Как в системе») is chosen in
|
||||
Settings → Внешний вид and persists. A theme already saved by an earlier version is kept as is.
|
||||
- Right-click (or Shift+F10 / Menu key) on the microphone and headphones buttons opens an input / output
|
||||
device menu sharing the Settings selection; left click still mutes/deafens.
|
||||
- Voice diagnostics: the local log records the capture device and track state; with
|
||||
|
||||
@@ -39,8 +39,9 @@ Restrained strategy: warm neutrals plus one accent; state colours only where the
|
||||
| `--talk` | `#1f8a5a` | `#4fcf8e` | talking indicator, PTT held |
|
||||
| `--danger` | `#b3261e` | `#f08b82` | mute/deafen active, errors |
|
||||
|
||||
Theme follows the choice in Settings → Внешний вид (system by default, implemented through Electron
|
||||
`nativeTheme.themeSource`, so `prefers-color-scheme` stays the single switch). The dark palette uses the
|
||||
Theme follows the choice in Settings → Внешний вид (dark by default for new profiles, independent of the OS;
|
||||
light and «Как в системе» are selectable; implemented through Electron
|
||||
`nativeTheme.themeSource`, applied before the window is created, so `prefers-color-scheme` stays the single switch). The dark palette uses the
|
||||
blue-gray surfaces of the owner's reference (`--bg #1b2029`, `--surface #242b37`, `--sidebar #1e242e`).
|
||||
Selection, caret, scrollbars and focus rings use the palette.
|
||||
|
||||
|
||||
@@ -98,7 +98,9 @@ CI: `.gitea/workflows/ci.yml` (Gitea Actions, контейнеры на Linux x6
|
||||
|
||||
Рабочий инструмент: привычная раскладка голосового чата (сервер и дерево слева, канал/чат справа),
|
||||
настройки — разделы слева (Идентичность, Серверы, Внешний вид, Звук, Видео, Клавиши, Информация) и
|
||||
карточки справа, как на образце владельца; тема — «как в системе», тёмная или светлая.
|
||||
карточки справа, как на образце владельца. Тема по умолчанию — тёмная (независимо от системы); светлую или
|
||||
«Как в системе» можно выбрать в «Настройки → Внешний вид», выбор сохраняется. Уже сохранённый выбор при
|
||||
обновлении не меняется.
|
||||
Системные шрифты, единственный акцент — персиковый; зелёный —
|
||||
только «говорит». Всё содержимое сервера выводится как текст (`textContent`), изображения — только
|
||||
байты, проверенные по сигнатуре. Renderer изолирован (contextIsolation, sandbox, строгая CSP,
|
||||
|
||||
@@ -19,7 +19,11 @@ const SCHEMA = {
|
||||
voiceVolume: { default: 100, check: (v) => Number.isInteger(v) && v >= 0 && v <= 200 },
|
||||
hardwareVideoDecode: { default: true, check: (v) => typeof v === 'boolean' },
|
||||
streamVolume: { default: 100, check: (v) => Number.isInteger(v) && v >= 0 && v <= 100 },
|
||||
theme: { default: 'system', check: (v) => v === 'system' || v === 'dark' || v === 'light' },
|
||||
// Dark by default for new profiles regardless of the OS (owner's request); a stored valid choice —
|
||||
// including 'system' or 'light' — is always kept.
|
||||
theme: { default: 'dark', check: (v) => v === 'system' || v === 'dark' || v === 'light' },
|
||||
// Updater: 'preview' accepts prereleases (all TeamsPeach releases so far), 'stable' only full releases.
|
||||
updateChannel: { default: 'preview', check: (v) => v === 'preview' || v === 'stable' },
|
||||
// Quick-access servers: name + address only. Passwords are never stored.
|
||||
savedServers: { default: [], check: validServers },
|
||||
};
|
||||
|
||||
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 37 KiB |
|
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 57 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 138 KiB |
@@ -1,6 +1,17 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
|
||||
<rect x="24" y="24" width="464" height="464" rx="104" fill="#2a2320"/>
|
||||
<path d="M256 168c-86-30-150 30-150 112 0 86 67 156 150 156s150-70 150-156c0-82-64-142-150-112z" fill="#f3a37c"/>
|
||||
<path d="M256 176c-30 47-37 160 0 254" fill="none" stroke="#b9653d" stroke-width="12" stroke-linecap="round"/>
|
||||
<path d="M261 160c4-50 39-80 96-82-6 52-40 81-96 82z" fill="#6aa864"/>
|
||||
<defs>
|
||||
<linearGradient id="peach" x1="108" y1="142" x2="390" y2="432" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#ffc18c"/>
|
||||
<stop offset=".48" stop-color="#f3a37c"/>
|
||||
<stop offset="1" stop-color="#ed776b"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="leaf" x1="274" y1="109" x2="368" y2="44" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#3e8053"/>
|
||||
<stop offset="1" stop-color="#83b56b"/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<path d="M252 151c-7-35-3-68 11-94" fill="none" stroke="#80503b" stroke-width="21" stroke-linecap="round"/>
|
||||
<path d="M264 119c3-53 43-84 116-78-10 58-47 92-116 78Z" fill="url(#leaf)"/>
|
||||
<path d="M255 150c-35-26-72-35-106-24C79 148 47 201 53 267c7 85 73 150 167 195 23 11 37 21 44 21s20-12 40-23c96-54 152-120 156-196 4-65-31-119-92-137-43-13-82-4-113 23Z" fill="url(#peach)"/>
|
||||
<path d="M255 150c-22 36-34 75-35 117-2 66 17 133 44 185" fill="none" stroke="#d97158" stroke-width="13" stroke-linecap="round"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 445 B After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 56 KiB |
|
After Width: | Height: | Size: 61 KiB |
@@ -0,0 +1,94 @@
|
||||
{
|
||||
"steps": [
|
||||
{
|
||||
"name": "mic right-click",
|
||||
"menu": true,
|
||||
"inputMuted": false,
|
||||
"capturing": false,
|
||||
"framesSent": 0,
|
||||
"items": [
|
||||
{
|
||||
"label": "Системное по умолчанию (Mic/Line/Inst 1-2 (MiniFuse 4))",
|
||||
"checked": "true"
|
||||
},
|
||||
{
|
||||
"label": "Loopback Mix Left/Right (MiniFuse 4)",
|
||||
"checked": "false"
|
||||
},
|
||||
{
|
||||
"label": "Headset Microphone (Oculus Virtual Audio Device)",
|
||||
"checked": "false"
|
||||
},
|
||||
{
|
||||
"label": "Line 3-4 (MiniFuse 4)",
|
||||
"checked": "false"
|
||||
},
|
||||
{
|
||||
"label": "Микрофон (DroidCam Audio)",
|
||||
"checked": "false"
|
||||
},
|
||||
{
|
||||
"label": "Микрофон (Virtual Desktop Audio)",
|
||||
"checked": "false"
|
||||
},
|
||||
{
|
||||
"label": "Mic/Line/Inst 1-2 (MiniFuse 4)",
|
||||
"checked": "false"
|
||||
}
|
||||
],
|
||||
"insideViewport": true,
|
||||
"focused": "menu-item"
|
||||
},
|
||||
{
|
||||
"name": "menu choice reflected in settings",
|
||||
"pick": "Headset Microphone (Oculus Virtual Audio Device)",
|
||||
"settingsInput": "Headset Microphone (Oculus Virtual Audio Device)",
|
||||
"same": true
|
||||
},
|
||||
{
|
||||
"name": "headphones Shift+F10",
|
||||
"menu": true,
|
||||
"outputMuted": false,
|
||||
"items": [
|
||||
"Системное по умолчанию (Main Left/Right (MiniFuse 4))",
|
||||
"Main Left/Right (MiniFuse 4)",
|
||||
"Realtek Digital Output (Realtek(R) Audio)",
|
||||
"Virtual Left/Right (MiniFuse 4)",
|
||||
"LG ULTRAGEAR (NVIDIA High Definition Audio)",
|
||||
"Наушники (Oculus Virtual Audio Device)",
|
||||
"Aux Left/Right (MiniFuse 4)"
|
||||
],
|
||||
"insideViewport": true
|
||||
},
|
||||
{
|
||||
"name": "escape",
|
||||
"menuClosed": true,
|
||||
"focusRestored": true,
|
||||
"outputMuted": false
|
||||
},
|
||||
{
|
||||
"name": "left click still toggles mute",
|
||||
"inputMuted": true
|
||||
},
|
||||
{
|
||||
"name": "rapid mic → headphones while enumeration pending",
|
||||
"menus": 1,
|
||||
"label": "Устройство вывода",
|
||||
"items": 7
|
||||
},
|
||||
{
|
||||
"name": "dismissed before enumeration finished",
|
||||
"menus": 0,
|
||||
"focused": "connect-address",
|
||||
"expanded": "false"
|
||||
},
|
||||
{
|
||||
"name": "after restart",
|
||||
"checkedIn": "Headset Microphone (Oculus Virtual Audio Device)",
|
||||
"checkedOut": "Realtek Digital Output (Realtek(R) Audio)",
|
||||
"persisted": true
|
||||
}
|
||||
],
|
||||
"console": [],
|
||||
"ok": true
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
{
|
||||
"steps": [
|
||||
{
|
||||
"name": "listed without capture",
|
||||
"inputs": 6,
|
||||
"outputs": 6,
|
||||
"inputLabels": [
|
||||
"Системное по умолчанию (Mic/Line/Inst 1-2 (MiniFuse 4))",
|
||||
"Loopback Mix Left/Right (MiniFuse 4)",
|
||||
"Headset Microphone (Oculus Virtual Audio Device)",
|
||||
"Line 3-4 (MiniFuse 4)",
|
||||
"Микрофон (DroidCam Audio)",
|
||||
"Микрофон (Virtual Desktop Audio)",
|
||||
"Mic/Line/Inst 1-2 (MiniFuse 4)"
|
||||
],
|
||||
"outputLabels": [
|
||||
"Системное по умолчанию (Main Left/Right (MiniFuse 4))",
|
||||
"Main Left/Right (MiniFuse 4)",
|
||||
"Realtek Digital Output (Realtek(R) Audio)",
|
||||
"Virtual Left/Right (MiniFuse 4)",
|
||||
"LG ULTRAGEAR (NVIDIA High Definition Audio)",
|
||||
"Наушники (Oculus Virtual Audio Device)",
|
||||
"Aux Left/Right (MiniFuse 4)"
|
||||
],
|
||||
"status": "Найдено микрофонов: 6, устройств вывода: 6.",
|
||||
"conn": "disconnected",
|
||||
"framesSent": 0,
|
||||
"capturing": false
|
||||
},
|
||||
{
|
||||
"name": "selected",
|
||||
"inputChoice": "Headset Microphone (Oculus Virtual Audio Device)",
|
||||
"outputChoice": "Realtek Digital Output (Realtek(R) Audio)",
|
||||
"toasts": [],
|
||||
"framesSent": 0,
|
||||
"capturing": false
|
||||
},
|
||||
{
|
||||
"name": "after restart",
|
||||
"inputNow": "Headset Microphone (Oculus Virtual Audio Device)",
|
||||
"outputNow": "Realtek Digital Output (Realtek(R) Audio)",
|
||||
"persisted": true,
|
||||
"toasts": [],
|
||||
"conn": "disconnected"
|
||||
}
|
||||
],
|
||||
"console": [],
|
||||
"ok": true
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
// Rasterizes build/icon.svg to build/icon.png (512×512, transparent) and app/renderer/assets/icon.png
|
||||
// with Electron's own renderer, so no extra image tooling is needed.
|
||||
// Exports the transparent SVG master to build/icon.png (512), the runtime PNG (256),
|
||||
// and a seven-size Windows ICO. Draw each size directly to a transparent canvas:
|
||||
// window capture can include scrollbars and depends on the host display scaling.
|
||||
// npx electron scripts/render-icon.cjs
|
||||
const { app, BrowserWindow } = require('electron');
|
||||
const fs = require('node:fs');
|
||||
@@ -10,41 +11,50 @@ const svg = fs.readFileSync(path.join(root, 'build', 'icon.svg'), 'utf8');
|
||||
|
||||
app.whenReady().then(async () => {
|
||||
const win = new BrowserWindow({
|
||||
width: 512,
|
||||
height: 512,
|
||||
show: false,
|
||||
transparent: true,
|
||||
frame: false,
|
||||
webPreferences: { offscreen: true },
|
||||
webPreferences: { offscreen: true, contextIsolation: true, nodeIntegration: false },
|
||||
});
|
||||
win.webContents.setFrameRate(1);
|
||||
const html = `<!doctype html><html><body style="margin:0;background:transparent">${svg.replace('<svg ', '<svg width="512" height="512" ')}</body></html>`;
|
||||
await win.loadURL(`data:text/html;charset=utf-8,${encodeURIComponent(html)}`);
|
||||
await new Promise((r) => setTimeout(r, 300));
|
||||
const image = await win.webContents.capturePage({ x: 0, y: 0, width: 512, height: 512 });
|
||||
const png = image.resize({ width: 512, height: 512 }).toPNG();
|
||||
fs.writeFileSync(path.join(root, 'build', 'icon.png'), png);
|
||||
fs.mkdirSync(path.join(root, 'app', 'renderer', 'assets'), { recursive: true });
|
||||
fs.writeFileSync(path.join(root, 'app', 'renderer', 'assets', 'icon.png'), image.resize({ width: 256, height: 256 }).toPNG());
|
||||
// Windows icon with PNG-compressed entries, so packaging needs no image conversion tool.
|
||||
const sizes = [16, 24, 32, 48, 64, 128, 256];
|
||||
const pngs = sizes.map((s) => image.resize({ width: s, height: s, quality: 'best' }).toPNG());
|
||||
const header = Buffer.alloc(6 + 16 * sizes.length);
|
||||
header.writeUInt16LE(0, 0);
|
||||
header.writeUInt16LE(1, 2);
|
||||
header.writeUInt16LE(sizes.length, 4);
|
||||
let offset = header.length;
|
||||
sizes.forEach((s, i) => {
|
||||
const e = 6 + 16 * i;
|
||||
header.writeUInt8(s === 256 ? 0 : s, e);
|
||||
header.writeUInt8(s === 256 ? 0 : s, e + 1);
|
||||
header.writeUInt16LE(1, e + 4);
|
||||
header.writeUInt16LE(32, e + 6);
|
||||
header.writeUInt32LE(pngs[i].length, e + 8);
|
||||
header.writeUInt32LE(offset, e + 12);
|
||||
offset += pngs[i].length;
|
||||
});
|
||||
fs.writeFileSync(path.join(root, 'build', 'icon.ico'), Buffer.concat([header, ...pngs]));
|
||||
console.log('icon written');
|
||||
app.quit();
|
||||
try {
|
||||
await win.loadURL('data:text/html;charset=utf-8,<!doctype html><html></html>');
|
||||
const sizes = [16, 24, 32, 48, 64, 128, 256];
|
||||
const source = `data:image/svg+xml;charset=utf-8,${encodeURIComponent(svg)}`;
|
||||
const encoded = await win.webContents.executeJavaScript(`(async () => {
|
||||
const image = new Image();
|
||||
image.src = ${JSON.stringify(source)};
|
||||
await image.decode();
|
||||
return ${JSON.stringify([...sizes, 512])}.map((size) => {
|
||||
const canvas = document.createElement('canvas');
|
||||
canvas.width = canvas.height = size;
|
||||
canvas.getContext('2d').drawImage(image, 0, 0, size, size);
|
||||
return canvas.toDataURL('image/png').split(',')[1];
|
||||
});
|
||||
})()`);
|
||||
const pngs = encoded.map((data) => Buffer.from(data, 'base64'));
|
||||
fs.writeFileSync(path.join(root, 'build', 'icon.png'), pngs.pop());
|
||||
fs.mkdirSync(path.join(root, 'app', 'renderer', 'assets'), { recursive: true });
|
||||
fs.writeFileSync(path.join(root, 'app', 'renderer', 'assets', 'icon.png'), pngs.at(-1));
|
||||
// PNG-compressed RGBA entries preserve alpha at every Windows icon size.
|
||||
const header = Buffer.alloc(6 + 16 * sizes.length);
|
||||
header.writeUInt16LE(0, 0);
|
||||
header.writeUInt16LE(1, 2);
|
||||
header.writeUInt16LE(sizes.length, 4);
|
||||
let offset = header.length;
|
||||
sizes.forEach((s, i) => {
|
||||
const e = 6 + 16 * i;
|
||||
header.writeUInt8(s === 256 ? 0 : s, e);
|
||||
header.writeUInt8(s === 256 ? 0 : s, e + 1);
|
||||
header.writeUInt16LE(1, e + 4);
|
||||
header.writeUInt16LE(32, e + 6);
|
||||
header.writeUInt32LE(pngs[i].length, e + 8);
|
||||
header.writeUInt32LE(offset, e + 12);
|
||||
offset += pngs[i].length;
|
||||
});
|
||||
fs.writeFileSync(path.join(root, 'build', 'icon.ico'), Buffer.concat([header, ...pngs]));
|
||||
console.log('Icons exported: build/icon.png (512), app/renderer/assets/icon.png (256), build/icon.ico (16/24/32/48/64/128/256).');
|
||||
} finally {
|
||||
win.destroy();
|
||||
}
|
||||
}).then(() => app.quit()).catch((error) => {
|
||||
console.error(error);
|
||||
app.exit(1);
|
||||
});
|
||||
@@ -0,0 +1,114 @@
|
||||
// Theme contract (no Playwright colour emulation: colorScheme null, the app's own nativeTheme decides):
|
||||
// a new profile is dark from the first frame (window background + onboarding), light chosen in Settings
|
||||
// persists across restart, and a stored legacy choice ('system') is kept untouched.
|
||||
// node scripts/smoke-theme.mjs --out docs/evidence/runtime/<name> [--exe packaged.exe]
|
||||
import { _electron as electron } from 'playwright-core';
|
||||
import { mkdirSync, writeFileSync, mkdtempSync, rmSync, readFileSync } from 'node:fs';
|
||||
import { tmpdir } from 'node:os';
|
||||
import path from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { createRequire } from 'node:module';
|
||||
import { execFileSync } from 'node:child_process';
|
||||
|
||||
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
|
||||
const electronPath = createRequire(import.meta.url)('electron');
|
||||
const argv = process.argv.slice(2);
|
||||
const opt = (n, d) => (argv.indexOf(`--${n}`) >= 0 ? argv[argv.indexOf(`--${n}`) + 1] : d);
|
||||
const out = path.resolve(root, opt('out', 'smoke-out'));
|
||||
const exe = opt('exe');
|
||||
mkdirSync(out, { recursive: true });
|
||||
const result = { steps: [] };
|
||||
const step = (name, data = {}) => {
|
||||
result.steps.push({ name, ...data });
|
||||
console.log(`[theme] ${name}`, JSON.stringify(data));
|
||||
};
|
||||
|
||||
function osTheme() {
|
||||
if (process.platform !== 'win32') return 'unknown';
|
||||
try {
|
||||
const q = execFileSync('reg', ['query', 'HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize', '/v', 'AppsUseLightTheme'], { encoding: 'utf8' });
|
||||
return /0x1\b/.test(q) ? 'light' : 'dark';
|
||||
} catch {
|
||||
return 'unknown';
|
||||
}
|
||||
}
|
||||
|
||||
async function launch(profile) {
|
||||
const app = await electron.launch({ executablePath: exe ? path.resolve(exe) : electronPath, args: exe ? [] : [root], env: { ...process.env, TEAMSPEACH_PROFILE_DIR: profile }, colorScheme: null });
|
||||
const page = await app.firstWindow();
|
||||
await page.setViewportSize({ width: 1280, height: 800 }).catch(() => {});
|
||||
return { app, page };
|
||||
}
|
||||
async function look(app, page) {
|
||||
const [windowBackground, themeSource] = await app.evaluate(({ BrowserWindow, nativeTheme }) => [BrowserWindow.getAllWindows()[0].getBackgroundColor(), nativeTheme.themeSource]);
|
||||
return page.evaluate(([bg, source]) => ({
|
||||
themeSource: source,
|
||||
windowBackground: bg,
|
||||
prefersDark: matchMedia('(prefers-color-scheme: dark)').matches,
|
||||
bodyBackground: getComputedStyle(document.body).backgroundColor,
|
||||
bg: getComputedStyle(document.documentElement).getPropertyValue('--bg').trim(),
|
||||
}), [windowBackground, themeSource]);
|
||||
}
|
||||
|
||||
const profiles = [];
|
||||
const temp = () => {
|
||||
const p = mkdtempSync(path.join(tmpdir(), 'teamspeach-theme-'));
|
||||
profiles.push(p);
|
||||
return p;
|
||||
};
|
||||
let app;
|
||||
let failed = null;
|
||||
try {
|
||||
step('os app theme', { appsUseTheme: osTheme() });
|
||||
|
||||
const fresh = temp();
|
||||
let page;
|
||||
({ app, page } = await launch(fresh));
|
||||
await page.waitForSelector('#view-onboarding', { state: 'visible', timeout: 20000 });
|
||||
let l = await look(app, page);
|
||||
step('new profile: onboarding', l);
|
||||
await page.screenshot({ path: path.join(out, '70-new-profile-onboarding-dark.png') });
|
||||
if (!l.prefersDark) throw new Error('new profile is not dark');
|
||||
await page.fill('#onboarding-nick', 'ThemeSmoke');
|
||||
await page.click('#onboarding-submit');
|
||||
await page.waitForSelector('#view-app', { state: 'visible', timeout: 20000 });
|
||||
await page.click('#btn-settings');
|
||||
await page.click('#settings-nav .nav-item[data-panel="appearance"]');
|
||||
const checked = await page.$eval('input[name="theme"]:checked', (el) => el.value);
|
||||
step('settings shows dark selected', { checked });
|
||||
if (checked !== 'dark') throw new Error('settings radio not dark');
|
||||
await page.check('input[name="theme"][value="light"]');
|
||||
await page.waitForTimeout(300);
|
||||
l = await look(app, page);
|
||||
step('switched to light', l);
|
||||
if (l.prefersDark) throw new Error('light not applied');
|
||||
await app.close();
|
||||
|
||||
({ app, page } = await launch(fresh));
|
||||
await page.waitForSelector('#view-app', { state: 'visible', timeout: 20000 });
|
||||
l = await look(app, page);
|
||||
const stored = JSON.parse(readFileSync(path.join(fresh, 'prefs.json'), 'utf8')).theme;
|
||||
step('restart keeps light', { ...l, stored });
|
||||
await page.screenshot({ path: path.join(out, '71-light-after-restart.png') });
|
||||
if (l.prefersDark || stored !== 'light') throw new Error('light not persisted');
|
||||
await app.close();
|
||||
|
||||
// A profile from an earlier version with an explicit stored theme keeps it.
|
||||
const legacy = temp();
|
||||
writeFileSync(path.join(legacy, 'prefs.json'), JSON.stringify({ theme: 'system', voiceVolume: 100 }));
|
||||
({ app, page } = await launch(legacy));
|
||||
await page.waitForSelector('#view-onboarding', { state: 'visible', timeout: 20000 });
|
||||
const legacyStored = JSON.parse(readFileSync(path.join(legacy, 'prefs.json'), 'utf8')).theme;
|
||||
step('stored "system" kept', { legacyStored, prefersDark: (await look(app, page)).prefersDark });
|
||||
if (legacyStored !== 'system') throw new Error('stored theme rewritten');
|
||||
} catch (err) {
|
||||
failed = err;
|
||||
step('FAILED', { error: String(err.stack || err) });
|
||||
} finally {
|
||||
if (app) await app.close().catch(() => {});
|
||||
for (const p of profiles) rmSync(p, { recursive: true, force: true });
|
||||
}
|
||||
result.ok = !failed;
|
||||
writeFileSync(path.join(out, 'result.json'), JSON.stringify(result, null, 2));
|
||||
console.log(`[theme] ${result.ok ? 'OK' : 'FAILED'} → ${out}`);
|
||||
process.exit(result.ok ? 0 : 1);
|
||||
@@ -59,3 +59,34 @@ test('a corrupted saved list on disk falls back to the default', () => {
|
||||
cleanup();
|
||||
}
|
||||
});
|
||||
|
||||
test('theme: a new profile or a prefs file without the key starts dark', () => {
|
||||
const { file, cleanup } = tempFile();
|
||||
try {
|
||||
assert.equal(new Prefs(file).get().theme, 'dark');
|
||||
fs.writeFileSync(file, JSON.stringify({ voiceVolume: 80 }));
|
||||
assert.equal(new Prefs(file).get().theme, 'dark');
|
||||
fs.writeFileSync(file, JSON.stringify({ theme: 'sepia' }));
|
||||
assert.equal(new Prefs(file).get().theme, 'dark', 'invalid stored value falls back to the default');
|
||||
} finally {
|
||||
cleanup();
|
||||
}
|
||||
});
|
||||
|
||||
test('theme: stored choices survive an update and are never rewritten', () => {
|
||||
const { file, cleanup } = tempFile();
|
||||
try {
|
||||
for (const theme of ['light', 'system', 'dark']) {
|
||||
fs.writeFileSync(file, JSON.stringify({ theme }));
|
||||
const p = new Prefs(file);
|
||||
assert.equal(p.get().theme, theme);
|
||||
p.set({ voiceVolume: 90 }); // unrelated write keeps the choice
|
||||
assert.equal(JSON.parse(fs.readFileSync(file, 'utf8')).theme, theme);
|
||||
}
|
||||
const p = new Prefs(file);
|
||||
p.set({ theme: 'light' });
|
||||
assert.equal(new Prefs(file).get().theme, 'light', 'light persists across restart');
|
||||
} finally {
|
||||
cleanup();
|
||||
}
|
||||
});
|
||||