More push messaging improvements.

Ylian Saint-Hilaire committed Jan 31, 2021 at 00:37 UTC 5a154b752ec28ab4812dfb1bf4419dcddcbaed1f
2 files changed +8 -7
views/default.handlebars
+6 -6
@@ -6303,7 +6303,7 @@
6303 if (xxdialogMode) return;
6304 var url = '/messenger?id=meshmessenger/' + encodeURIComponentEx(currentNode._id) + '/' + encodeURIComponentEx(userinfo._id) + '&title=' + currentNode.name;
6305 if ((authCookie != null) && (authCookie != '')) { url += '&auth=' + authCookie; }
6306 - if (currentNode.pmt == 1) { url += '&pmt=1'; } // Push messaging is possible for this device
6306 + if ((currentNode.pmt == 1) && ((features2 & 2) != 0)) { url += '&pmt=1'; } // Push messaging is possible for this device
6307 if (e && (e.shiftKey == true)) {
6308 safeNewWindow(url, 'meshmessenger:' + currentNode._id);
6309 } else {
@@ -9336,18 +9336,18 @@
9336 if ((consoleNode.conn & 16) != 0) { onlineText += ", MQTT is online" }
9337 QH('p15statetext', onlineText);
9338 QE('p15uploadCore', ((consoleNode.conn & 1) != 0));
9339 - QV('p15outputselecttd', ((consoleNode.conn & 16) != 0) || (currentNode.pmt == 1));
9339 + QV('p15outputselecttd', ((consoleNode.conn & 16) != 0) || ((currentNode.pmt == 1) && ((features2 & 2) != 0)));
9340 QV('p15outputselect2', ((consoleNode.conn & 16) != 0)); // MQTT channel
9341 - QV('p15outputselect3', (currentNode.pmt == 1)); // Push Notification channel
9341 + QV('p15outputselect3', ((currentNode.pmt == 1) && ((features2 & 2) != 0))); // Push Notification channel
9342
9343 var c = Q('p15outputselect').value;
9344 if (((consoleNode.conn & 16) == 0) && (c == 2)) { c = 1; Q('p15outputselect').value = 1; }
9345 - if ((currentNode.pmt != 1) && (c == 3)) { c = 1; Q('p15outputselect').value = 1; }
9345 + if (((currentNode.pmt != 1) || ((features2 & 2) == 0)) && (c == 3)) { c = 1; Q('p15outputselect').value = 1; }
9346
9347 var active = false;
9348 if (((consoleNode.conn & 1) != 0) && (c == 1)) { active = true; } // Agent
9349 if (((consoleNode.conn & 16) != 0) && (c == 2)) { active = true; } // MQTT
9350 - if ((consoleNode.pmt == 1) && (c == 3)) { active = true; } // Push
9350 + if (((currentNode.pmt == 1) && ((features2 & 2) != 0)) && (c == 3)) { active = true; } // Push
9351 QE('p15consoleText', active);
9352 } else {
9353 QH('p15statetext', "Access Denied");
@@ -9386,7 +9386,7 @@
9386 t = '<div style=color:orange>' + "MQTT" + '&gt; ' + EscapeHtml(v) + '<br/></div>';
9387 consoleNode.consoleText += t;
9388 meshserver.send({ action: 'sendmqttmsg', topic: 'console', nodeids: [ consoleNode._id ], msg: v });
9389 - } else if ((consoleNode.pmt == 1) && (Q('p15outputselect').value == 3)) {
9389 + } else if ((consoleNode.pmt == 1) && (Q('p15outputselect').value == 3) && ((features2 & 2) != 0)) {
9390 // Send the command using push notification
9391 t = '<div style=color:violet>' + "PUSH" + '&gt; ' + EscapeHtml(v) + '<br/></div>';
9392 consoleNode.consoleText += t;
webserver.js
+2 -1
@@ -2413,7 +2413,8 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) {
2413 if (domain.novnc === false) { features += 0x20000000; } // Disables noVNC
2414 if (domain.mstsc !== true) { features += 0x40000000; } // Disables MSTSC.js
2415 if (obj.isTrustedCert(domain) == false) { features += 0x80000000; } // Indicate we are not using a trusted certificate
2416 - if (obj.parent.amtManager != null) { features2 += 1; } // Indicates that the Intel AMT manager is active
2416 + if (obj.parent.amtManager != null) { features2 += 0x00000001; } // Indicates that the Intel AMT manager is active
2417 + if (obj.parent.firebase != null) { features2 += 0x00000002; } // Indicates the server supports Firebase push messaging
2418
2419 // Create a authentication cookie
2420 const authCookie = obj.parent.encodeCookie({ userid: dbGetFunc.user._id, domainid: domain.id, ip: req.clientIp }, obj.parent.loginCookieEncryptionKey);