diff options
author | 0neGal <mail@0negal.com> | 2022-01-02 00:22:28 +0100 |
---|---|---|
committer | 0neGal <mail@0negal.com> | 2022-01-02 00:22:28 +0100 |
commit | 80eeab10e81a32c00c24608be83e7ea75ff9accf (patch) | |
tree | c12fe0163c16dead879e51f564f870fe8a7b980e /src/index.js | |
parent | 67b32b527aec8d36a4b6cca14677febc46f0e26d (diff) | |
parent | 1598d8b3510580cd886c884b80a69c7b2bcfa422 (diff) | |
download | Viper-80eeab10e81a32c00c24608be83e7ea75ff9accf.tar.gz Viper-80eeab10e81a32c00c24608be83e7ea75ff9accf.zip |
Merge branch 'main' of 0neGal/viper into mod-support
Diffstat (limited to 'src/index.js')
-rw-r--r-- | src/index.js | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/index.js b/src/index.js index 2a5ed2b..511aadb 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"); @@ -46,6 +47,16 @@ function start() { win.webContents.once("dom-ready", () => { win.webContents.send("mods", utils.mods.list()); }); + + 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()}) @@ -87,7 +98,11 @@ ipcMain.on("getmods", (event) => { 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)); |