summaryrefslogtreecommitdiff
path: root/app.js
diff options
context:
space:
mode:
Diffstat (limited to 'app.js')
-rw-r--r--app.js14
1 files changed, 9 insertions, 5 deletions
diff --git a/app.js b/app.js
index 20064ff..bb9c73e 100644
--- a/app.js
+++ b/app.js
@@ -1,4 +1,4 @@
-const { app, desktopCapturer } = require('electron');
+const { app, desktopCapturer, dialog } = require('electron');
const { platform, hostname } = require('node:os');
const { writeFileSync, existsSync, readFileSync } = require('node:fs');
const axios = require('axios');
@@ -15,7 +15,7 @@ process.on('uncaughtException', (e) => {
}
})
-let token;
+global.token = "";
async function refresh() {
let osInfo = await si.osInfo();
@@ -115,11 +115,15 @@ async function refresh() {
}
app.whenReady().then(async () => {
- if (!existsSync("./token.txt")) {
- console.log("Please create a token.txt file containing a valid Cold Haze administrator token.");
+ let data = app.getPath('userData');
+
+ if (!existsSync(data + "/token.txt")) {
+ dialog.showMessageBoxSync({
+ message: "Please create a token.txt file containing a valid Cold Haze administrator token in " + data + "."
+ });
process.exit();
} else {
- token = readFileSync("./token.txt").toString().trim();
+ global.token = readFileSync(data + "/token.txt").toString().trim();
require('./ercp');
global._proxy = require('./proxy');