diff --git a/main.js b/main.js index a443643..9411a5c 100644 --- a/main.js +++ b/main.js @@ -17,6 +17,7 @@ if (process.platform === 'win32') { let notificationsEnabled = true; let checkForUpdates = true; +let ignoredVersion = ''; let mainWindow; let currentLang = 'zh-TW'; // Default language @@ -34,6 +35,9 @@ function loadConfig() { if (config.checkForUpdates !== undefined) { checkForUpdates = config.checkForUpdates; } + if (config.ignoredVersion) { + ignoredVersion = config.ignoredVersion; + } } } catch (e) { console.error('Failed to load config:', e); @@ -42,7 +46,7 @@ function loadConfig() { function saveConfig() { try { - const config = { language: currentLang, checkForUpdates }; + const config = { language: currentLang, checkForUpdates, ignoredVersion }; fs.writeFileSync(configPath, JSON.stringify(config, null, 2)); } catch (e) { console.error('Failed to save config:', e); @@ -96,6 +100,9 @@ if (!gotTheLock) { if (!response.ok) return; const data = await response.json(); const latestVersion = data.tag_name.replace(/^v/, ''); + + if (!manual && latestVersion === ignoredVersion) return; + const currentVersion = app.getVersion(); // Split by dot or hyphen to handle 1.0.7-20251223 vs 1.0.7 @@ -121,13 +128,16 @@ if (!gotTheLock) { type: 'info', title: t('updateAvailable'), message: t('updateMessage').replace('{version}', latestVersion), - buttons: [t('download'), t('later')], + buttons: [t('download'), t('later'), t('ignoreUpdate')], defaultId: 0, cancelId: 1 }); if (btnIndex === 0) { shell.openExternal(data.html_url); + } else if (btnIndex === 2) { + ignoredVersion = latestVersion; + saveConfig(); } } else if (manual) { const focusedWin = BrowserWindow.getFocusedWindow(); diff --git a/package-lock.json b/package-lock.json index 6eb7908..223428f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "fbm", - "version": "1.2.2", + "version": "1.3.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "fbm", - "version": "1.2.2", + "version": "1.3.0", "license": "ISC", "dependencies": { "electron-window-state": "^5.0.3" diff --git a/package.json b/package.json index 0e96af3..d45c236 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fbm", - "version": "1.2.2", + "version": "1.3.0", "description": "Facebook Messenger desktop app", "main": "main.js", "scripts": { diff --git a/translations.js b/translations.js index 96dbae0..e6696a0 100644 --- a/translations.js +++ b/translations.js @@ -39,6 +39,7 @@ module.exports = { updateMessage: 'A new version {version} is available. Do you want to download it now?', download: 'Download', later: 'Later', + ignoreUpdate: 'Ignore this version', loadFailedTitle: 'Messenger Load Failed', loadFailedMessage: 'Please check your internet connection or click the button below to retry.' }, @@ -82,6 +83,7 @@ module.exports = { updateMessage: '發現新版本 {version}。您想要現在下載嗎?', download: '下載', later: '稍後', + ignoreUpdate: '忽略此次更新', loadFailedTitle: 'Messenger 載入失敗', loadFailedMessage: '請檢查您的網路連線,或點擊下方按鈕重新嘗試。' }