diff options
Diffstat (limited to 'app.js')
-rw-r--r-- | app.js | 14 |
1 files changed, 9 insertions, 5 deletions
@@ -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'); |