diff options
author | Minteck <nekostarfan@gmail.com> | 2021-06-05 21:03:47 +0200 |
---|---|---|
committer | Minteck <nekostarfan@gmail.com> | 2021-06-05 21:03:47 +0200 |
commit | 4ec6f33be6130705b81f19fdc9e2fe01b4a3e7e2 (patch) | |
tree | 5b302015939c129ea7fdffc9560fdd89e2547039 /app.js | |
parent | 97ebd65491420363f74ae9e5e6bf77495a37172f (diff) | |
download | kartik-client-4ec6f33be6130705b81f19fdc9e2fe01b4a3e7e2.tar.gz kartik-client-4ec6f33be6130705b81f19fdc9e2fe01b4a3e7e2.tar.bz2 kartik-client-4ec6f33be6130705b81f19fdc9e2fe01b4a3e7e2.zip |
Stats presque fini
Diffstat (limited to 'app.js')
-rw-r--r-- | app.js | 15 |
1 files changed, 13 insertions, 2 deletions
@@ -51,9 +51,9 @@ const { app, BrowserWindow } = require('electron'); process.on('uncaughtException', (error) => { console.log(" * Starting recovery procedure: E_ERROR"); - id = new Date().toISOString(); + id = new Date().toISOString().replaceAll(":", "-"); - require('fs').writeFileSync(homedir + "/.kartik/crashes/" + id + ".txt", "Kartik Bootstraper Crash\n\n" + error.stack); + require('fs').writeFileSync(require('os').userInfo().homedir + "/.kartik/crashes/" + id + ".txt", "Kartik Bootstraper Crash\n\n" + error.stack); if (require('os').platform() === "win32") { require('child_process').exec("runtime\\kartik-crash.bat " + id); } else if (require('os').platform() === "darwin") { @@ -278,6 +278,17 @@ const { app, BrowserWindow } = require('electron'); musicIpc.on('preunfademusic', (event, value) => { win.webContents.send('unfademusic', value); }) + + stats = require(homedir + "/.kartik/stats.json"); + musicIpc.on('addstats', (event, value) => { + stats[value.catalog][value.key] = stats[value.catalog][value.key] + value.add; + fs.writeFile(homedir + "/.kartik/stats.json", JSON.stringify(stats), () => {}); + }) + musicIpc.on('addstatsandclose', (event, value) => { + stats[value.catalog][value.key] = stats[value.catalog][value.key] + value.add; + fs.writeFile(homedir + "/.kartik/stats.json", JSON.stringify(stats), () => {}); + win.destroy(); + }) }) } |