fix(update): electron update function (#32)
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
/**
|
||||
* Auto-Updater Module
|
||||
* Handles automatic application updates using electron-updater
|
||||
*
|
||||
* Update providers are configured in electron-builder.yml (OSS primary, GitHub fallback).
|
||||
* electron-updater handles provider resolution automatically.
|
||||
*/
|
||||
import { autoUpdater, UpdateInfo, ProgressInfo, UpdateDownloadedEvent } from 'electron-updater';
|
||||
import { BrowserWindow, app, ipcMain } from 'electron';
|
||||
@@ -113,6 +116,7 @@ export class AppUpdater extends EventEmitter {
|
||||
|
||||
/**
|
||||
* Check for updates
|
||||
* electron-updater automatically tries providers defined in electron-builder.yml in order
|
||||
*/
|
||||
async checkForUpdates(): Promise<UpdateInfo | null> {
|
||||
try {
|
||||
@@ -120,7 +124,8 @@ export class AppUpdater extends EventEmitter {
|
||||
return result?.updateInfo || null;
|
||||
} catch (error) {
|
||||
console.error('[Updater] Check for updates failed:', error);
|
||||
return null;
|
||||
this.updateStatus({ status: 'error', error: (error as Error).message || String(error) });
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user