aboutsummaryrefslogtreecommitdiff
path: root/src/index.js
diff options
context:
space:
mode:
author0neGal <mail@0negal.com>2023-01-12 19:13:38 +0100
committer0neGal <mail@0negal.com>2023-01-12 19:13:38 +0100
commita67040498d238c3d7b1b947f7be02034f3b71d52 (patch)
treeefcc16b14240fc56748bf558549c192c1594df1a /src/index.js
parentf81558d552e5e3f98438a3fe94290a96041a443a (diff)
downloadViper-a67040498d238c3d7b1b947f7be02034f3b71d52.tar.gz
Viper-a67040498d238c3d7b1b947f7be02034f3b71d52.zip
modularize settings Object
The reasoning behind this is obvious, I overall would like to make utils.js far smaller, and if not get entirely rid of it.
Diffstat (limited to 'src/index.js')
-rw-r--r--src/index.js13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/index.js b/src/index.js
index 4ff774a..c3d3556 100644
--- a/src/index.js
+++ b/src/index.js
@@ -3,8 +3,12 @@ const path = require("path");
const { autoUpdater } = require("electron-updater");
const { app, ipcMain, BrowserWindow, dialog } = require("electron");
+// ensures PWD/CWD is the config folder where viper.json is located
+process.chdir(app.getPath("appData"));
+
const utils = require("./utils");
const cli = require("./cli");
+const settings = require("./modules/settings");
const requests = require("./modules/requests");
var log = console.log;
@@ -47,7 +51,7 @@ function start() {
}; send = win.send;
ipcMain.on("exit", () => {
- if (utils.settings.originkill) {
+ if (settings.originkill) {
utils.isOriginRunning().then((running) => {
if (running) {
utils.killOrigin().then(process.exit(0))
@@ -96,7 +100,7 @@ function start() {
}
});
- ipcMain.on("save-settings", (event, obj) => {utils.saveSettings(obj)});
+ ipcMain.on("save-settings", (event, obj) => {settings.save(obj)});
// allows renderer to check for updates
ipcMain.on("ns-update-event", (event) => {send("ns-update-event", event)});
@@ -107,7 +111,7 @@ function start() {
})
// start auto-update process
- if (utils.settings.autoupdate) {
+ if (settings.autoupdate) {
if (cli.hasParam("no-vp-updates")) {
utils.handleNorthstarUpdating();
} else {
@@ -225,9 +229,6 @@ ipcMain.on("newpath", (event, newpath) => {
win.send("wrong-path");
});
-// ensures PWD/CWD is the config folder where viper.json is located
-process.chdir(app.getPath("appData"));
-
// starts the GUI or CLI
if (cli.hasArgs()) {
if (cli.hasParam("update-viper")) {