aboutsummaryrefslogtreecommitdiff
path: root/src/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/index.js')
-rw-r--r--src/index.js18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/index.js b/src/index.js
index 198bc74..b43611d 100644
--- a/src/index.js
+++ b/src/index.js
@@ -1,5 +1,6 @@
const fs = require("fs");
const path = require("path");
+const { autoUpdater } = require("electron-updater");
const { app, dialog, ipcMain, BrowserWindow, ipcRenderer } = require("electron");
const Emitter = require("events");
@@ -41,6 +42,17 @@ function start() {
ipcMain.on("ns-updated", () => {win.webContents.send("ns-updated")})
ipcMain.on("ns-updating", () => {win.webContents.send("ns-updating")})
ipcMain.on("winLog", (event, ...args) => {win.webContents.send("log", ...args)})
+
+ if (utils.settings.autoupdate) {utils.updatevp(false)}
+
+ autoUpdater.on("update-downloaded", () => {
+ win.webContents.send("updateavailable")
+ });
+
+ ipcMain.on("updatenow", () => {
+ autoUpdater.quitAndInstall();
+ })
+
}
ipcMain.on("launch", (event) => {utils.launch()})
@@ -68,7 +80,11 @@ ipcMain.on("versioncli", () => {
process.chdir(app.getPath("appData"));
if (cli.hasArgs()) {
- cli.init();
+ if (cli.hasParam("updatevp")) {
+ utils.updatevp(true);
+ } else {
+ cli.init();
+ }
} else {
app.on("ready", () => {
app.setPath("userData", path.join(app.getPath("cache"), app.name));