summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaindropsSys <contact@minteck.org>2023-05-22 15:54:20 +0200
committerRaindropsSys <contact@minteck.org>2023-05-22 15:54:20 +0200
commit0931c055e748fb9253c14e0cc21f1ef0459b1353 (patch)
tree2a74a4246dd30e3b76ebbad6e3b81a48f8c20e10
parent6ecb6d7d7d246a4e1db0985422ac011ad8b522b7 (diff)
downloadluna-0931c055e748fb9253c14e0cc21f1ef0459b1353.tar.gz
luna-0931c055e748fb9253c14e0cc21f1ef0459b1353.tar.bz2
luna-0931c055e748fb9253c14e0cc21f1ef0459b1353.zip
Updated app.js (automated)HEADmane
-rw-r--r--app.js48
1 files changed, 25 insertions, 23 deletions
diff --git a/app.js b/app.js
index 83e07ee..8b4d38f 100644
--- a/app.js
+++ b/app.js
@@ -5,7 +5,7 @@ const axios = require('axios');
const si = require('systeminformation');
global.luna_version = "1.4.0";
-global.dsb_version = 6;
+global.dsb_version = 7;
global.lastSentData = {};
global.clientsList = {};
global.lastDataUpdate = 0;
@@ -57,7 +57,7 @@ app.whenReady().then(() => {
function updateTray() {
let template = [
- { label: 'Luna ' + luna_version, type: 'normal', enabled: false, icon: __dirname + "/icons/menu/16x16@2x.png" },
+ { label: 'Luna ' + luna_version + '-' + dsb_version, type: 'normal', enabled: false, icon: __dirname + "/icons/menu/16x16@2x.png" },
{ label: 'Last updated ' + timeAgo(global.lastDataUpdate), type: 'normal', enabled: false },
];
@@ -71,7 +71,7 @@ function updateTray() {
const contextMenu = Menu.buildFromTemplate(template);
- tray.setToolTip('Luna ' + luna_version);
+ tray.setToolTip('Luna ' + luna_version + '-' + dsb_version);
tray.setContextMenu(contextMenu);
}
@@ -196,17 +196,19 @@ global.startApp = async () => {
if (!(await axios("https://ponies.equestria.horse/api/session", {
headers: {'Cookie': 'PEH2_SESSION_TOKEN=' + token}
})).data['created']) {
- throw new Error();
+ clearInterval(global.i1); clearInterval(global.i2); clearInterval(global.i3); clearInterval(global.i4);
+ require('./auth')();
+ return;
}
} catch (e) {
- clearInterval(global.i1); clearInterval(global.i2); clearInterval(global.i3); clearInterval(global.i4);
- require('./auth')();
- return;
+ console.error(e);
}
- await axios("https://ponies.equestria.horse/api/rename?name=" + encodeURIComponent("Luna " + luna_version + " (Desktop DSB " + dsb_version + ", " + hostname() + ", " + ((await si.osInfo()).distro) + ")"), {
- headers: {'Cookie': 'PEH2_SESSION_TOKEN=' + token}
- });
+ try {
+ await axios("https://ponies.equestria.horse/api/rename?name=" + encodeURIComponent("Luna " + luna_version + " (Desktop DSB " + dsb_version + ", " + hostname() + ", " + ((await si.osInfo()).distro) + ")"), {
+ headers: {'Cookie': 'PEH2_SESSION_TOKEN=' + token}
+ });
+ } catch (e) {}
refresh();
systemProfile();
@@ -217,24 +219,24 @@ global.startApp = async () => {
global.i2 = setInterval(async () => {
try {
- let data = (await axios("https://ponies.equestria.horse/api/session", {
+ if (!(await axios("https://ponies.equestria.horse/api/session", {
headers: {'Cookie': 'PEH2_SESSION_TOKEN=' + token}
- })).data;
-
- console.log(data);
-
- if (!data['created']) {
- throw new Error();
+ })).data['created']) {
+ clearInterval(global.i1); clearInterval(global.i2); clearInterval(global.i3); clearInterval(global.i4);
+ require('./auth')();
+ return;
}
} catch (e) {
- clearInterval(global.i1); clearInterval(global.i2); clearInterval(global.i3); clearInterval(global.i4);
- require('./auth')();
- return;
+ console.error(e);
}
- await axios("https://ponies.equestria.horse/api/rename?name=" + encodeURIComponent("Luna " + luna_version + " (Desktop DSB " + dsb_version + ", " + hostname() + ", " + ((await si.osInfo()).distro) + ")"), {
- headers: {'Cookie': 'PEH2_SESSION_TOKEN=' + token}
- });
+ try {
+ await axios("https://ponies.equestria.horse/api/rename?name=" + encodeURIComponent("Luna " + luna_version + " (Desktop DSB " + dsb_version + ", " + hostname() + ", " + ((await si.osInfo()).distro) + ")"), {
+ headers: {'Cookie': 'PEH2_SESSION_TOKEN=' + token}
+ });
+ } catch (e) {
+ console.error(e);
+ }
try {
await axios("https://ponies.equestria.horse/api/computer?type=heartbeat", {