Windows package smoke (export, hw decode toggle), fail-closed ELF checker, exact built-in icons, own-name highlight, ICO, PRODUCT/DESIGN, docs sync
This commit is contained in:
1 parent
aaa389cc9b
commit
24266469bf
19 files changed
+387
-25
No files matched your search
@@ -24,9 +24,14 @@ function isElf(file) {
|
||||
}
|
||||
}
|
||||
|
||||
const missing = [];
|
||||
|
||||
function walk(p, out) {
|
||||
const st = statSync(p, { throwIfNoEntry: false });
|
||||
if (!st) return;
|
||||
if (!st) {
|
||||
missing.push(p);
|
||||
return;
|
||||
}
|
||||
if (st.isDirectory()) for (const e of readdirSync(p)) walk(path.join(p, e), out);
|
||||
else if (st.isFile() && st.size > 64 && isElf(p)) out.push(p);
|
||||
}
|
||||
@@ -83,24 +88,39 @@ function inspect(file) {
|
||||
}
|
||||
const glibc = [...new Set(b.toString('latin1').match(/GLIBC_[0-9]+(\.[0-9]+)+/g) ?? [])]
|
||||
.sort((x, y) => x.slice(6).split('.').map(Number).reduce((acc, n, i) => acc || n - (y.slice(6).split('.').map(Number)[i] ?? 0), 0));
|
||||
const type = b.readUInt16LE(16);
|
||||
const loadable = type === 2 || type === 3; // ET_EXEC, ET_DYN
|
||||
if (loadable && loads.length === 0) return { file, error: 'executable/shared object without PT_LOAD segments' };
|
||||
return {
|
||||
file,
|
||||
type: type === 2 ? 'exec' : type === 3 ? 'dyn' : type === 1 ? 'rel' : `type-${type}`,
|
||||
machine: machine === 0xb7 ? 'aarch64' : machine === 0x3e ? 'x86-64' : `0x${machine.toString(16)}`,
|
||||
minLoadAlign: loads.length ? Math.min(...loads.map((l) => l.align)) : null,
|
||||
pageOk: loads.every((l) => l.ok),
|
||||
// Relocatable objects are never mapped by the loader; everything loadable must satisfy every PT_LOAD.
|
||||
pageOk: !loadable || loads.every((l) => l.ok),
|
||||
needed,
|
||||
maxGlibc: glibc.at(-1) ?? null,
|
||||
};
|
||||
}
|
||||
|
||||
if (!Number.isInteger(PAGE) || PAGE <= 0 || (PAGE & (PAGE - 1)) !== 0) {
|
||||
console.error(`--page must be a positive power of two, got ${pi >= 0 ? argv[pi + 1] : PAGE}`);
|
||||
process.exit(2);
|
||||
}
|
||||
if (inputs.length === 0) {
|
||||
console.error('no input path given');
|
||||
process.exit(2);
|
||||
}
|
||||
const files = [];
|
||||
for (const input of inputs) walk(path.resolve(input), files);
|
||||
const results = files.map(inspect);
|
||||
let bad = 0;
|
||||
for (const r of results) {
|
||||
if (r.error || !r.pageOk) bad += 1;
|
||||
console.log(`${r.pageOk ? 'ok ' : 'FAIL'} ${r.machine ?? ''} align=${r.minLoadAlign} glibc=${r.maxGlibc ?? '-'} ${path.relative(process.cwd(), r.file)}${r.needed?.length ? ` needs ${r.needed.join(',')}` : ''}${r.error ? ` (${r.error})` : ''}`);
|
||||
console.log(`${r.error || !r.pageOk ? 'FAIL' : 'ok '} ${r.machine ?? ''} ${r.type ?? ''} align=${r.minLoadAlign ?? '-'} glibc=${r.maxGlibc ?? '-'} ${path.relative(process.cwd(), r.file)}${r.needed?.length ? ` needs ${r.needed.join(',')}` : ''}${r.error ? ` (${r.error})` : ''}`);
|
||||
}
|
||||
console.log(`${results.length} ELF files, ${bad} incompatible with ${PAGE}-byte pages`);
|
||||
if (jsonOut) writeFileSync(jsonOut, JSON.stringify({ page: PAGE, results }, null, 2));
|
||||
process.exit(bad ? 1 : 0);
|
||||
for (const m of missing) console.error(`FAIL missing input: ${m}`);
|
||||
if (files.length === 0) console.error('FAIL no ELF files found in the given inputs');
|
||||
console.log(`${results.length} ELF files, ${bad} incompatible with ${PAGE}-byte pages, ${missing.length} missing inputs`);
|
||||
if (jsonOut) writeFileSync(jsonOut, JSON.stringify({ page: PAGE, missing, results }, null, 2));
|
||||
process.exit(bad || missing.length || files.length === 0 ? 1 : 0);
|
||||
@@ -26,6 +26,25 @@ app.whenReady().then(async () => {
|
||||
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();
|
||||
});
|
||||
+33
-2
@@ -30,10 +30,12 @@ const step = (name, data = {}) => {
|
||||
};
|
||||
|
||||
async function launch(label) {
|
||||
const extra = [...(process.env.TEAMSPEACH_SMOKE_EXTRA_ARGS ?? '').split(' ').filter(Boolean), ...(args.fakemic ? ['--use-fake-device-for-media-stream', '--use-fake-ui-for-media-stream'] : [])];
|
||||
// --exe runs a packaged build instead of the development tree.
|
||||
const app = await electron.launch({
|
||||
executablePath: electronPath,
|
||||
executablePath: args.exe ? path.resolve(args.exe) : electronPath,
|
||||
env: { ...process.env, TEAMSPEACH_PROFILE_DIR: profile },
|
||||
args: [root, ...(process.env.TEAMSPEACH_SMOKE_EXTRA_ARGS ?? '').split(' ').filter(Boolean), ...(args.fakemic ? ['--use-fake-device-for-media-stream', '--use-fake-ui-for-media-stream'] : [])],
|
||||
args: args.exe ? extra : [root, ...extra],
|
||||
});
|
||||
const page = await app.firstWindow();
|
||||
page.on('console', (msg) => result.console.push(`${label} ${msg.type()}: ${msg.text()}`));
|
||||
@@ -108,6 +110,35 @@ try {
|
||||
await page.waitForFunction(() => window.teamspeachDiagnostics.snapshot().conn === 'disconnected', null, { timeout: 15000 });
|
||||
step('disconnected');
|
||||
}
|
||||
|
||||
// 6. Identity backup through the real export path; only the native save dialog is answered by the test.
|
||||
const exportFile = path.join(mkdtempSync(path.join(tmpdir(), 'teamspeach-export-')), 'identity.ini');
|
||||
await app.evaluate(({ dialog }, file) => {
|
||||
dialog.showSaveDialog = async () => ({ canceled: false, filePath: file });
|
||||
}, exportFile);
|
||||
await page.click('#btn-settings');
|
||||
await page.click('#identity-export');
|
||||
await page.waitForFunction(() => /UID|не удался/.test(document.querySelector('#identity-status').textContent), null, { timeout: 20000 });
|
||||
const exportStatus = await page.textContent('#identity-status');
|
||||
const { readFileSync, rmSync } = await import('node:fs');
|
||||
const exported = readFileSync(exportFile, 'utf8');
|
||||
step('identity exported', { status: exportStatus, statusHasUid: exportStatus.includes(uid1), iniHeader: exported.split(/\r?\n/)[0], containsIdentityKey: /^identity=/m.test(exported) });
|
||||
rmSync(path.dirname(exportFile), { recursive: true, force: true });
|
||||
if (!exportStatus.includes(uid1)) throw new Error('export did not report the profile UID');
|
||||
|
||||
// 7. Hardware video decoding: off → restart → reported as disabled at launch.
|
||||
await page.uncheck('#opt-hwdec');
|
||||
await page.waitForSelector('#hwdec-restart', { state: 'visible', timeout: 5000 });
|
||||
step('hardware decode disabled, restart required', { status: await page.textContent('#hwdec-status') });
|
||||
await app.close();
|
||||
({ app, page } = await launch('run4'));
|
||||
await visible(page, '#view-app');
|
||||
await page.click('#btn-settings');
|
||||
await page.waitForFunction(() => /запрещено/.test(document.querySelector('#hwdec-status').textContent), null, { timeout: 10000 });
|
||||
step('after restart', { status: await page.textContent('#hwdec-status'), restartHint: await page.isVisible('#hwdec-restart') });
|
||||
await page.locator('#set-video').scrollIntoViewIfNeeded();
|
||||
await shot(page, '05-video-decode-disabled.png');
|
||||
await page.check('#opt-hwdec');
|
||||
await app.close();
|
||||
} catch (err) {
|
||||
failed = err;
|
||||
|
||||
Reference in new issue
Block a user