Do not verify code signature on windows and only check and prompt for updates on windows

Closes #15
This commit is contained in:
Alice Gaudon 2020-06-15 14:48:52 +02:00
parent b8afb7a77d
commit a5394f3acd
3 changed files with 17 additions and 9 deletions

View File

@ -78,7 +78,7 @@
"target": "nsis",
"icon": "resources/logo.png",
"publisherName": "Alice Gaudon",
"verifyUpdateCodeSignature": "true",
"verifyUpdateCodeSignature": "false",
"publish": [
{
"provider": "github",

View File

@ -3,6 +3,7 @@ import Meta from "./Meta";
import Config from "./Config";
import Updater from "./Updater";
import MainWindow from "./windows/MainWindow";
import * as os from "os";
export default class Application {
private readonly devMode: boolean;
@ -14,7 +15,7 @@ export default class Application {
constructor(devMode: boolean) {
this.devMode = devMode;
this.config = new Config();
this.updater = new Updater(this.config);
this.updater = new Updater(this.config, this);
this.mainWindow = new MainWindow(this);
}
@ -26,9 +27,11 @@ export default class Application {
this.setupElectronTweaks();
// Check for updates
this.updater.checkAndPromptForUpdates(this.mainWindow.getWindow()).then(() => {
console.log('Update check successful.');
}).catch(console.error);
if (os.platform() === 'win32') {
this.updater.checkAndPromptForUpdates(this.mainWindow.getWindow()).then(() => {
console.log('Update check successful.');
}).catch(console.error);
}
console.log('App started');
}

View File

@ -2,13 +2,16 @@ import {autoUpdater, UpdateInfo} from "electron-updater";
import {dialog, shell} from "electron";
import Config from "./Config";
import BrowserWindow = Electron.BrowserWindow;
import Application from "./Application";
export default class Updater {
private readonly config: Config;
private readonly application: Application;
private updateInfo?: UpdateInfo;
public constructor(config: Config) {
public constructor(config: Config, application: Application) {
this.config = config;
this.application = application;
// Configure auto updater
autoUpdater.autoDownload = false;
@ -42,10 +45,10 @@ export default class Updater {
if (updateInfo && updateInfo.version !== this.config.updateCheckSkip) {
const input = await dialog.showMessageBox(mainWindow, {
message: `Version ${updateInfo.version} of tabs is available. Do you wish to download this update?`,
message: `Version ${updateInfo.version} of tabs is available. Do you wish to install this update?`,
buttons: [
'Cancel',
'Download',
'Install',
],
checkboxChecked: false,
checkboxLabel: `Don't remind me for this version`,
@ -61,7 +64,9 @@ export default class Updater {
}
if (input.response === 1) {
await shell.openExternal(`https://github.com/ArisuOngaku/tabs/releases/download/v${updateInfo.version}/${updateInfo.path}`);
await this.application.stop();
await autoUpdater.downloadUpdate();
autoUpdater.quitAndInstall();
}
}
}