fix(windows): restore taskbar identity and shared downloads

This commit is contained in:
Sucukdeluxe
2026-08-12 03:10:23 +02:00
parent be5d60a0ca
commit a472f5dac9
12 changed files with 420 additions and 47 deletions
+17 -6
View File
@@ -4,7 +4,8 @@ import { pathToFileURL } from 'node:url';
import { watch } from 'node:fs';
import { dirname, resolve } from 'node:path';
const rootDirectory = resolve(dirname(fileURLToPath(import.meta.url)), '..');
const scriptPath = fileURLToPath(import.meta.url);
const rootDirectory = resolve(dirname(scriptPath), '..');
const typescriptCli = resolve(rootDirectory, 'node_modules', 'typescript', 'bin', 'tsc');
const electronSourceExecutable = process.platform === 'win32'
? resolve(rootDirectory, 'node_modules', 'electron', 'dist', 'electron.exe')
@@ -13,10 +14,14 @@ let electronExecutable = electronSourceExecutable;
const outputDirectory = resolve(rootDirectory, 'dist');
const developmentProgramData = resolve(rootDirectory, '.dev-program-data');
const developmentUserData = resolve(rootDirectory, '.dev-user-data');
const developmentRelaunchCommand = `"${process.execPath}" "${scriptPath}" --once`;
const runOnce = process.argv.includes('--once');
let electronProcess;
let restarting = false;
let restartTimer;
let compiler;
let outputWatcher;
function run(command, args, options = {}) {
return spawn(command, args, { cwd: rootDirectory, stdio: 'inherit', ...options });
@@ -35,11 +40,13 @@ function startElectron() {
...process.env,
PROGRAMDATA: developmentProgramData,
TWITCH_VOD_MANAGER_DEV: '1',
TWITCH_VOD_MANAGER_RELAUNCH_COMMAND: developmentRelaunchCommand,
},
});
electronProcess.once('exit', () => {
electronProcess = undefined;
});
return electronProcess;
}
function restartElectron() {
@@ -90,16 +97,20 @@ if (process.platform === 'win32') {
});
}
const compiler = run(process.execPath, [typescriptCli, '--watch', '--preserveWatchOutput']);
const outputWatcher = watch(outputDirectory, { recursive: true }, (_, fileName) => scheduleRestart(fileName));
startElectron();
for (const signal of ['SIGINT', 'SIGTERM']) {
process.once(signal, () => {
outputWatcher.close();
outputWatcher?.close();
clearTimeout(restartTimer);
stop(compiler);
stop(electronProcess);
process.exit();
});
}
if (runOnce) {
process.exitCode = await waitForExit(startElectron());
} else {
compiler = run(process.execPath, [typescriptCli, '--watch', '--preserveWatchOutput']);
outputWatcher = watch(outputDirectory, { recursive: true }, (_, fileName) => scheduleRestart(fileName));
startElectron();
}
+1
View File
@@ -131,6 +131,7 @@
"src/renderer-archive.ts",
"src/renderer-command-palette.ts",
"src/renderer-cutter.ts",
"src/renderer-cutter.production-path.test.ts",
"src/renderer-globals.d.ts",
"src/renderer-locale-de.ts",
"src/renderer-locale-en.ts",
+6 -1
View File
@@ -38,7 +38,12 @@ check(fs.existsSync(path.join(root, 'build', 'icon.png')), 'application PNG icon
check(fs.existsSync(path.join(root, 'build', 'icon.ico')), 'application ICO icon is missing');
check(mainSource.includes('app.setAppUserModelId(WINDOWS_APP_IDENTITY.appUserModelId)'), 'Windows AppUserModelID is not applied from the centralized identity');
check(mainSource.includes('app.setName(WINDOWS_APP_IDENTITY.name)'), 'Windows application name is not applied before startup');
check(mainSource.includes("icon: path.join(__dirname, process.platform === 'win32' ? '../build/icon.ico' : '../build/icon.png')"), 'BrowserWindow does not use the platform application icon');
const windowCreationIndex = mainSource.indexOf('mainWindow = new BrowserWindow');
const taskbarDetailsIndex = mainSource.indexOf('mainWindow.setAppDetails', windowCreationIndex);
const windowShowIndex = mainSource.indexOf('mainWindow.show()', windowCreationIndex);
check(mainSource.includes('resolveWindowsAppIconPath') && mainSource.includes('createWindowsTaskbarDetails'), 'BrowserWindow does not use centralized Windows taskbar identity');
check(mainSource.slice(windowCreationIndex, taskbarDetailsIndex).includes('show: false'), 'BrowserWindow is visible before Windows taskbar identity is applied');
check(taskbarDetailsIndex > windowCreationIndex && windowShowIndex > taskbarDetailsIndex, 'Windows taskbar identity is not applied before the window is shown');
check(indexSource.includes('class="topbar-brand-mark" src="../build/icon.png"'), 'topbar does not use the application icon');
check(mainSource.includes('GITHUB_RELEASES_API_LATEST_URL'), 'GitHub releases API constant is missing');
check(mainSource.includes('GITHUB_RELEASES_DOWNLOAD_BASE_URL'), 'GitHub releases download constant is missing');