Publish Untrace Desktop 1.6.1 with offline batch workflows

This commit is contained in:
Dario P. committed 2026-10-25 01:22:14 +02:00
1 parent 99b4b22352
commit 7ce81b0727
47 files changed
+5958 -1208

No files matched your search

+27
View File
@@ -0,0 +1,27 @@
import { _electron as electron } from '@playwright/test';
import { mkdtemp, rm, writeFile } from 'node:fs/promises';
import os from 'node:os';
import path from 'node:path';
const data = await mkdtemp(path.join(os.tmpdir(), 'untrace-icon-'));
const env = { ...process.env, UNTRACE_TEST: '1', UNTRACE_DATA_DIR: data };
delete env.ELECTRON_RUN_AS_NODE;
const app = await electron.launch({ args: ['.'], env });
try {
const page = await app.firstWindow();
const encoded = await page.evaluate(async () => {
const img = new Image(); img.src = '/favicon.svg'; await img.decode();
const canvas = document.createElement('canvas'); canvas.width = 256; canvas.height = 256;
canvas.getContext('2d').drawImage(img, 0, 0, 256, 256);
return canvas.toDataURL('image/png').split(',')[1];
});
const png = Buffer.from(encoded, 'base64');
const header = Buffer.alloc(22);
header.writeUInt16LE(1, 2); header.writeUInt16LE(1, 4);
header.writeUInt16LE(1, 10); header.writeUInt16LE(32, 12);
header.writeUInt32LE(png.length, 14); header.writeUInt32LE(22, 18);
await writeFile('desktop/icon.ico', Buffer.concat([header, png]));
} finally {
await app.close();
await rm(data, { recursive: true, force: true, maxRetries: 5, retryDelay: 200 });
}