mirror of
https://github.com/Fabio286/antares.git
synced 2025-02-19 21:20:40 +01:00
fix: nsis updater not working
This commit is contained in:
parent
354928e302
commit
198ff0103b
@ -2,8 +2,6 @@ import { ipcMain } from 'electron';
|
|||||||
import * as Store from 'electron-store';
|
import * as Store from 'electron-store';
|
||||||
import { autoUpdater } from 'electron-updater';
|
import { autoUpdater } from 'electron-updater';
|
||||||
|
|
||||||
import { validateSender } from '../libs/misc/validateSender';
|
|
||||||
|
|
||||||
const persistentStore = new Store({
|
const persistentStore = new Store({
|
||||||
name: 'settings',
|
name: 'settings',
|
||||||
clearInvalidConfig: true,
|
clearInvalidConfig: true,
|
||||||
@ -20,8 +18,6 @@ autoUpdater.allowPrerelease = persistentStore.get('allow_prerelease', false) as
|
|||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
ipcMain.on('check-for-updates', event => {
|
ipcMain.on('check-for-updates', event => {
|
||||||
if (!validateSender(event.senderFrame)) return { status: 'error', response: 'Unauthorized process' };
|
|
||||||
|
|
||||||
mainWindow = event;
|
mainWindow = event;
|
||||||
if (process.windowsStore || (process.platform === 'linux' && !process.env.APPIMAGE))
|
if (process.windowsStore || (process.platform === 'linux' && !process.env.APPIMAGE))
|
||||||
mainWindow.reply('no-auto-update');
|
mainWindow.reply('no-auto-update');
|
||||||
@ -35,38 +31,31 @@ export default () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
ipcMain.on('restart-to-update', (event) => {
|
ipcMain.on('restart-to-update', () => {
|
||||||
if (!validateSender(event.senderFrame)) return { status: 'error', response: 'Unauthorized process' };
|
|
||||||
autoUpdater.quitAndInstall();
|
autoUpdater.quitAndInstall();
|
||||||
});
|
});
|
||||||
|
|
||||||
// auto-updater events
|
// auto-updater events
|
||||||
autoUpdater.on('checking-for-update', (event) => {
|
autoUpdater.on('checking-for-update', () => {
|
||||||
if (!validateSender(event.senderFrame)) return { status: 'error', response: 'Unauthorized process' };
|
|
||||||
mainWindow.reply('checking-for-update');
|
mainWindow.reply('checking-for-update');
|
||||||
});
|
});
|
||||||
|
|
||||||
autoUpdater.on('update-available', (event) => {
|
autoUpdater.on('update-available', () => {
|
||||||
if (!validateSender(event.senderFrame)) return { status: 'error', response: 'Unauthorized process' };
|
|
||||||
|
|
||||||
if (isMacOS)
|
if (isMacOS)
|
||||||
mainWindow.reply('link-to-download');
|
mainWindow.reply('link-to-download');
|
||||||
else
|
else
|
||||||
mainWindow.reply('update-available');
|
mainWindow.reply('update-available');
|
||||||
});
|
});
|
||||||
|
|
||||||
autoUpdater.on('update-not-available', (event) => {
|
autoUpdater.on('update-not-available', () => {
|
||||||
if (!validateSender(event.senderFrame)) return { status: 'error', response: 'Unauthorized process' };
|
|
||||||
mainWindow.reply('update-not-available');
|
mainWindow.reply('update-not-available');
|
||||||
});
|
});
|
||||||
|
|
||||||
autoUpdater.on('download-progress', event => {
|
autoUpdater.on('download-progress', event => {
|
||||||
if (!validateSender(event.senderFrame)) return { status: 'error', response: 'Unauthorized process' };
|
|
||||||
mainWindow.reply('download-progress', event);
|
mainWindow.reply('download-progress', event);
|
||||||
});
|
});
|
||||||
|
|
||||||
autoUpdater.on('update-downloaded', (event) => {
|
autoUpdater.on('update-downloaded', () => {
|
||||||
if (!validateSender(event.senderFrame)) return { status: 'error', response: 'Unauthorized process' };
|
|
||||||
mainWindow.reply('update-downloaded');
|
mainWindow.reply('update-downloaded');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user