From 9392398db7e896dc401617b35b52d660231351bd Mon Sep 17 00:00:00 2001 From: xRangerDE Date: Sat, 21 Feb 2026 00:30:24 +0100 Subject: [PATCH] Prevent updater check UI lockups with timeout safeguards (v4.1.10) --- typescript-version/package-lock.json | 4 ++-- typescript-version/package.json | 2 +- typescript-version/src/index.html | 4 ++-- typescript-version/src/main.ts | 21 +++++++++++++++++++-- typescript-version/src/renderer-updates.ts | 14 +++++++++++++- 5 files changed, 37 insertions(+), 8 deletions(-) diff --git a/typescript-version/package-lock.json b/typescript-version/package-lock.json index 2fa9959..371ac46 100644 --- a/typescript-version/package-lock.json +++ b/typescript-version/package-lock.json @@ -1,12 +1,12 @@ { "name": "twitch-vod-manager", - "version": "4.1.9", + "version": "4.1.10", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "twitch-vod-manager", - "version": "4.1.9", + "version": "4.1.10", "license": "MIT", "dependencies": { "axios": "^1.6.0", diff --git a/typescript-version/package.json b/typescript-version/package.json index bb39ab3..62cbdb9 100644 --- a/typescript-version/package.json +++ b/typescript-version/package.json @@ -1,6 +1,6 @@ { "name": "twitch-vod-manager", - "version": "4.1.9", + "version": "4.1.10", "description": "Twitch VOD Manager - Download Twitch VODs easily", "main": "dist/main.js", "author": "xRangerDE", diff --git a/typescript-version/src/index.html b/typescript-version/src/index.html index 1a34d13..90e7ead 100644 --- a/typescript-version/src/index.html +++ b/typescript-version/src/index.html @@ -457,7 +457,7 @@

Updates

-

Version: v4.1.9

+

Version: v4.1.10

@@ -502,7 +502,7 @@
Nicht verbunden - v4.1.9 + v4.1.10 diff --git a/typescript-version/src/main.ts b/typescript-version/src/main.ts index e26810c..13d8e32 100644 --- a/typescript-version/src/main.ts +++ b/typescript-version/src/main.ts @@ -8,7 +8,7 @@ import { autoUpdater } from 'electron-updater'; // ========================================== // CONFIG & CONSTANTS // ========================================== -const APP_VERSION = '4.1.9'; +const APP_VERSION = '4.1.10'; const UPDATE_CHECK_URL = 'http://24-music.de/version.json'; // Paths @@ -34,6 +34,7 @@ const AUTO_UPDATE_CHECK_INTERVAL_MS = 10 * 60 * 1000; const AUTO_UPDATE_STARTUP_CHECK_DELAY_MS = 5000; const AUTO_UPDATE_MIN_CHECK_GAP_MS = 45 * 1000; const AUTO_UPDATE_AUTO_DOWNLOAD = true; +const AUTO_UPDATE_CHECK_TIMEOUT_MS = 30 * 1000; const CACHE_CLEANUP_INTERVAL_MS = 60 * 1000; const MAX_LOGIN_TO_USER_ID_CACHE_ENTRIES = 4096; const MAX_VOD_LIST_CACHE_ENTRIES = 512; @@ -2884,7 +2885,23 @@ async function requestUpdateCheck(source: UpdateCheckSource, force = false): Pro appendDebugLog('update-check-start', { source }); try { - await autoUpdater.checkForUpdates(); + let timeoutHandle: NodeJS.Timeout | null = null; + try { + await Promise.race([ + autoUpdater.checkForUpdates(), + new Promise((_, reject) => { + timeoutHandle = setTimeout(() => { + reject(new Error(`Update check timed out after ${AUTO_UPDATE_CHECK_TIMEOUT_MS}ms`)); + }, AUTO_UPDATE_CHECK_TIMEOUT_MS); + }) + ]); + } finally { + if (timeoutHandle) { + clearTimeout(timeoutHandle); + timeoutHandle = null; + } + } + return { started: true }; } catch (err) { appendDebugLog('update-check-failed', { source, error: String(err) }); diff --git a/typescript-version/src/renderer-updates.ts b/typescript-version/src/renderer-updates.ts index 9016bdb..57a6091 100644 --- a/typescript-version/src/renderer-updates.ts +++ b/typescript-version/src/renderer-updates.ts @@ -88,6 +88,16 @@ async function checkUpdate(): Promise { notifyUpdate(UI_TEXT.updates.checkInProgress, 'info'); return; } + + manualUpdateCheckPending = false; + updateCheckInProgress = false; + setCheckButtonCheckingState(false); + + window.setTimeout(() => { + if (!updateReady && byId('updateBanner').style.display !== 'flex') { + notifyUpdate(UI_TEXT.updates.latest, 'info'); + } + }, 2500); } catch { manualUpdateCheckPending = false; updateCheckInProgress = false; @@ -141,7 +151,9 @@ function downloadUpdate(): void { window.api.onUpdateChecking(() => { updateCheckInProgress = true; - setCheckButtonCheckingState(true); + if (manualUpdateCheckPending) { + setCheckButtonCheckingState(true); + } }); window.api.onUpdateAvailable((info: UpdateInfo) => {