aboutsummaryrefslogtreecommitdiff
path: root/src/index.js
diff options
context:
space:
mode:
author0neGal <mail@0negal.com>2021-12-26 19:28:45 +0100
committer0neGal <mail@0negal.com>2021-12-26 19:28:45 +0100
commitdf7b714d27e5d23a6ac3e381e6684856bc818d1c (patch)
treed4afdcb0005ae1a4879c8594769df7a7524ef4b6 /src/index.js
parente6a3c962330289e02276b0fafe4629598933e54e (diff)
downloadViper-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/index.js')
-rw-r--r--src/index.js11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/index.js b/src/index.js
index 0babcea..5586633 100644
--- a/src/index.js
+++ b/src/index.js
@@ -2,6 +2,8 @@ const fs = require("fs");
const path = require("path");
const { app, dialog, ipcMain, BrowserWindow } = require("electron");
+const utils = require("./utils")
+
function start() {
win = new BrowserWindow({
width: 500,
@@ -18,13 +20,8 @@ function start() {
win.loadFile(__dirname + "/app/index.html");
win.webContents.once("dom-ready", () => {win.show()});
- ipcMain.on("setpath", (event) => {
- dialog.showOpenDialog({properties: ["openDirectory"]}).then(res => {
- fs.writeFileSync(app.getPath("appData") + "/viper.json", JSON.stringify({path: res.filePaths[0]}))
-
- win.webContents.send("newpath", res.filePaths[0]);
- }).catch(err => {console.error(err)})
- })
+ ipcMain.on("update", (event) => {utils.update(win)})
+ ipcMain.on("setpath", (event) => {utils.setpath(win)})
}
app.on("ready", () => {