feat(autoupdate): autoupdate on statup
This commit is contained in:
1731
package-lock.json
generated
1731
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -29,7 +29,9 @@
|
|||||||
"directories": {
|
"directories": {
|
||||||
"buildResources": "resources"
|
"buildResources": "resources"
|
||||||
},
|
},
|
||||||
"publish": null,
|
"publish": {
|
||||||
|
"provider": "github"
|
||||||
|
},
|
||||||
"win": {
|
"win": {
|
||||||
"extraFiles": [
|
"extraFiles": [
|
||||||
{
|
{
|
||||||
@ -75,6 +77,7 @@
|
|||||||
"debug": "^3.1.0",
|
"debug": "^3.1.0",
|
||||||
"diskusage": "^0.2.4",
|
"diskusage": "^0.2.4",
|
||||||
"electron-context-menu": "^0.9.1",
|
"electron-context-menu": "^0.9.1",
|
||||||
|
"electron-updater": "^2.20.1",
|
||||||
"fs-jetpack": "^1.2.0",
|
"fs-jetpack": "^1.2.0",
|
||||||
"iconv-lite": "^0.4.19",
|
"iconv-lite": "^0.4.19",
|
||||||
"ipaddr.js": "^1.5.4",
|
"ipaddr.js": "^1.5.4",
|
||||||
|
@ -5,8 +5,9 @@
|
|||||||
|
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import url from "url";
|
import url from "url";
|
||||||
import { app, Menu, ipcMain, Tray } from "electron";
|
import { app, Menu, ipcMain, Tray, dialog } from "electron";
|
||||||
import createWindow from "./helpers/window";
|
import createWindow from "./helpers/window";
|
||||||
|
import { autoUpdater } from 'electron-updater'
|
||||||
|
|
||||||
import { devMenuTemplate } from "./menu/dev_menu_template";
|
import { devMenuTemplate } from "./menu/dev_menu_template";
|
||||||
import { editMenuTemplate } from "./menu/edit_menu_template";
|
import { editMenuTemplate } from "./menu/edit_menu_template";
|
||||||
@ -231,6 +232,24 @@ const startSphinx = (callback) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
autoUpdater.on('update-downloaded', () => {
|
||||||
|
console.log('update-downloaded lats quitAndInstall');
|
||||||
|
if (env.name === "production") {
|
||||||
|
dialog.showMessageBox({
|
||||||
|
type: 'info',
|
||||||
|
title: 'Found Updates',
|
||||||
|
message: 'Found updates, do you want update now?',
|
||||||
|
buttons: ['Sure', 'No']
|
||||||
|
}, (buttonIndex) => {
|
||||||
|
if (buttonIndex === 0) {
|
||||||
|
const isSilent = true;
|
||||||
|
const isForceRunAfter = true;
|
||||||
|
autoUpdater.quitAndInstall(isSilent, isForceRunAfter);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
let tray = undefined
|
let tray = undefined
|
||||||
|
|
||||||
app.on("ready", () => {
|
app.on("ready", () => {
|
||||||
@ -296,6 +315,7 @@ app.on("ready", () => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if (env.name === "production") { autoUpdater.checkForUpdates() }
|
||||||
|
|
||||||
spider = spiderCall((...data) => mainWindow.webContents.send(...data), (message, callback) => {
|
spider = spiderCall((...data) => mainWindow.webContents.send(...data), (message, callback) => {
|
||||||
ipcMain.on(message, (event, arg) => {
|
ipcMain.on(message, (event, arg) => {
|
||||||
|
Reference in New Issue
Block a user