diff options
author | 2022-06-03 19:56:48 -0500 | |
---|---|---|
committer | 2022-06-03 19:56:48 -0500 | |
commit | e14df85e39a27944fdc4d5aecf084a68d7fd00c2 (patch) | |
tree | da474d4dabb98026354dc1ab75c90ff6da1ab3ef /src/electron/ipc-api | |
parent | 6.0.0-nightly.52 [skip ci] (diff) | |
download | ferdium-app-e14df85e39a27944fdc4d5aecf084a68d7fd00c2.tar.gz ferdium-app-e14df85e39a27944fdc4d5aecf084a68d7fd00c2.tar.zst ferdium-app-e14df85e39a27944fdc4d5aecf084a68d7fd00c2.zip |
Enable AutoUpdates from in-app with self-sign certificates on macOS (#213)
Co-authored-by: Alphrag <alphrag@pm.me>
Diffstat (limited to 'src/electron/ipc-api')
-rw-r--r-- | src/electron/ipc-api/autoUpdate.ts | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/electron/ipc-api/autoUpdate.ts b/src/electron/ipc-api/autoUpdate.ts index d20a413b3..fb91d3515 100644 --- a/src/electron/ipc-api/autoUpdate.ts +++ b/src/electron/ipc-api/autoUpdate.ts | |||
@@ -1,6 +1,7 @@ | |||
1 | import { app, ipcMain, BrowserWindow } from 'electron'; | 1 | import { ipcMain, BrowserWindow } from 'electron'; |
2 | import { autoUpdater } from 'electron-updater'; | 2 | import { autoUpdater } from 'electron-updater'; |
3 | import { isMac, isWindows } from '../../environment'; | 3 | import { isMac, isWindows } from '../../environment'; |
4 | import { appEvents } from '../..'; | ||
4 | 5 | ||
5 | const debug = require('../../preload-safe-debug')('Ferdium:ipcApi:autoUpdate'); | 6 | const debug = require('../../preload-safe-debug')('Ferdium:ipcApi:autoUpdate'); |
6 | 7 | ||
@@ -24,11 +25,13 @@ export default (params: { mainWindow: BrowserWindow; settings: any }) => { | |||
24 | autoUpdater.checkForUpdates(); | 25 | autoUpdater.checkForUpdates(); |
25 | } else if (args.action === 'install') { | 26 | } else if (args.action === 'install') { |
26 | debug('installing update'); | 27 | debug('installing update'); |
27 | app.removeAllListeners('window-all-closed'); | 28 | |
28 | params.mainWindow.removeAllListeners('close'); | 29 | appEvents.emit('install-update'); |
30 | |||
31 | const openedWindows = BrowserWindow.getAllWindows(); | ||
32 | for (const window of openedWindows) window.close(); | ||
33 | |||
29 | autoUpdater.quitAndInstall(); | 34 | autoUpdater.quitAndInstall(); |
30 | // TODO: based on https://github.com/electron-userland/electron-builder/issues/6058#issuecomment-1130344017 (not yet tested since we don't have signed builds yet for macos) | ||
31 | app.exit(); | ||
32 | } | 35 | } |
33 | } catch (error) { | 36 | } catch (error) { |
34 | event.sender.send('autoUpdate', { error }); | 37 | event.sender.send('autoUpdate', { error }); |