import { autoUpdater } from 'electron-updater'; import { dialog } from 'electron'; autoUpdater.autoDownload = true; autoUpdater.autoInstallOnAppQuit = true; autoUpdater.allowDowngrade = false; autoUpdater.setFeedURL({ provider: 'github', owner: 'ultilize', repo: 'ultima-desktop-releases' }); export const initializeAutoUpdater = () => { autoUpdater.checkForUpdates(); autoUpdater.on('update-available', () => { dialog.showMessageBox({ type: 'info', title: 'Update Available', message: 'A new update is available. Downloading now...' }); }); autoUpdater.on('update-downloaded', (info) => { dialog.showMessageBox({ type: 'info', title: 'Update Ready', message: 'A new update is ready. It will be installed on restart.' }).then(() => { autoUpdater.quitAndInstall(); }); }); autoUpdater.on('error', (err) => { dialog.showErrorBox('Error:', err == null ? "unknown" : (err.stack || err).toString()); }); };