diff options
author | 0neGal <mail@0negal.com> | 2021-12-26 19:28:45 +0100 |
---|---|---|
committer | 0neGal <mail@0negal.com> | 2021-12-26 19:28:45 +0100 |
commit | df7b714d27e5d23a6ac3e381e6684856bc818d1c (patch) | |
tree | d4afdcb0005ae1a4879c8594769df7a7524ef4b6 /src/app/main.js | |
parent | e6a3c962330289e02276b0fafe4629598933e54e (diff) | |
download | Viper-df7b714d27e5d23a6ac3e381e6684856bc818d1c.tar.gz Viper-df7b714d27e5d23a6ac3e381e6684856bc818d1c.zip |
the renderer is no longer required for updating
Everything is now in utils.js and simply gets called through IPC calls
which make it quite simple to add CLI arguments...
Diffstat (limited to 'src/app/main.js')
-rw-r--r-- | src/app/main.js | 29 |
1 files changed, 2 insertions, 27 deletions
diff --git a/src/app/main.js b/src/app/main.js index 352e654..8d174c1 100644 --- a/src/app/main.js +++ b/src/app/main.js @@ -1,9 +1,6 @@ const fs = require("fs"); const path = require("path"); -const unzip = require("unzipper"); -const request = require("request"); const { ipcRenderer } = require("electron"); -const { https } = require("follow-redirects"); var settings = { gamepath: "", @@ -19,30 +16,8 @@ if (fs.existsSync(settings.file)) { setpath(); } -function update() { - request({ - json: true, - headers: {"User-Agent": navigator.userAgent}, - url: "https://api.github.com/repos/R2Northstar/Northstar/releases/latest", - }, (error, response, body) => { - https.get(body.assets[0].browser_download_url, (res) => { - let stream = fs.createWriteStream(settings.zip); - res.pipe(stream); - stream.on("finish",() => { - stream.close(); - console.log("download done"); - fs.createReadStream(settings.zip).pipe(unzip.Extract({path: settings.gamepath})) - .on("finish", () => { - alert("Installation finished!") - }); - }) - }) - }) -} - -function setpath() { - ipcRenderer.send("setpath"); -} +function update() {ipcRenderer.send("update")} +function setpath() {ipcRenderer.send("setpath")} ipcRenderer.on("newpath", (event, newpath) => { settings.gamepath = newpath; |