From 5a154b752ec28ab4812dfb1bf4419dcddcbaed1f Mon Sep 17 00:00:00 2001 From: Ylian Saint-Hilaire Date: Sun, 31 Jan 2021 00:37:25 -0800 Subject: [PATCH] More push messaging improvements. --- views/default.handlebars | 12 ++++++------ webserver.js | 3 ++- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/views/default.handlebars b/views/default.handlebars index 5678851c..4e12f4eb 100644 --- a/views/default.handlebars +++ b/views/default.handlebars @@ -6303,7 +6303,7 @@ if (xxdialogMode) return; var url = '/messenger?id=meshmessenger/' + encodeURIComponentEx(currentNode._id) + '/' + encodeURIComponentEx(userinfo._id) + '&title=' + currentNode.name; if ((authCookie != null) && (authCookie != '')) { url += '&auth=' + authCookie; } - if (currentNode.pmt == 1) { url += '&pmt=1'; } // Push messaging is possible for this device + if ((currentNode.pmt == 1) && ((features2 & 2) != 0)) { url += '&pmt=1'; } // Push messaging is possible for this device if (e && (e.shiftKey == true)) { safeNewWindow(url, 'meshmessenger:' + currentNode._id); } else { @@ -9336,18 +9336,18 @@ if ((consoleNode.conn & 16) != 0) { onlineText += ", MQTT is online" } QH('p15statetext', onlineText); QE('p15uploadCore', ((consoleNode.conn & 1) != 0)); - QV('p15outputselecttd', ((consoleNode.conn & 16) != 0) || (currentNode.pmt == 1)); + QV('p15outputselecttd', ((consoleNode.conn & 16) != 0) || ((currentNode.pmt == 1) && ((features2 & 2) != 0))); QV('p15outputselect2', ((consoleNode.conn & 16) != 0)); // MQTT channel - QV('p15outputselect3', (currentNode.pmt == 1)); // Push Notification channel + QV('p15outputselect3', ((currentNode.pmt == 1) && ((features2 & 2) != 0))); // Push Notification channel var c = Q('p15outputselect').value; if (((consoleNode.conn & 16) == 0) && (c == 2)) { c = 1; Q('p15outputselect').value = 1; } - if ((currentNode.pmt != 1) && (c == 3)) { c = 1; Q('p15outputselect').value = 1; } + if (((currentNode.pmt != 1) || ((features2 & 2) == 0)) && (c == 3)) { c = 1; Q('p15outputselect').value = 1; } var active = false; if (((consoleNode.conn & 1) != 0) && (c == 1)) { active = true; } // Agent if (((consoleNode.conn & 16) != 0) && (c == 2)) { active = true; } // MQTT - if ((consoleNode.pmt == 1) && (c == 3)) { active = true; } // Push + if (((currentNode.pmt == 1) && ((features2 & 2) != 0)) && (c == 3)) { active = true; } // Push QE('p15consoleText', active); } else { QH('p15statetext', "Access Denied"); @@ -9386,7 +9386,7 @@ t = '
' + "MQTT" + '> ' + EscapeHtml(v) + '
'; consoleNode.consoleText += t; meshserver.send({ action: 'sendmqttmsg', topic: 'console', nodeids: [ consoleNode._id ], msg: v }); - } else if ((consoleNode.pmt == 1) && (Q('p15outputselect').value == 3)) { + } else if ((consoleNode.pmt == 1) && (Q('p15outputselect').value == 3) && ((features2 & 2) != 0)) { // Send the command using push notification t = '
' + "PUSH" + '> ' + EscapeHtml(v) + '
'; consoleNode.consoleText += t; diff --git a/webserver.js b/webserver.js index b3fc28b2..53e5d476 100644 --- a/webserver.js +++ b/webserver.js @@ -2413,7 +2413,8 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) { if (domain.novnc === false) { features += 0x20000000; } // Disables noVNC if (domain.mstsc !== true) { features += 0x40000000; } // Disables MSTSC.js if (obj.isTrustedCert(domain) == false) { features += 0x80000000; } // Indicate we are not using a trusted certificate - if (obj.parent.amtManager != null) { features2 += 1; } // Indicates that the Intel AMT manager is active + if (obj.parent.amtManager != null) { features2 += 0x00000001; } // Indicates that the Intel AMT manager is active + if (obj.parent.firebase != null) { features2 += 0x00000002; } // Indicates the server supports Firebase push messaging // Create a authentication cookie const authCookie = obj.parent.encodeCookie({ userid: dbGetFunc.user._id, domainid: domain.id, ip: req.clientIp }, obj.parent.loginCookieEncryptionKey);