More push messaging improvements.

This commit is contained in:
Ylian Saint-Hilaire 2021-01-31 00:37:25 -08:00
parent 0658d6e5a5
commit 5a154b752e
2 changed files with 8 additions and 7 deletions

View File

@ -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 = '<div style=color:orange>' + "MQTT" + '&gt; ' + EscapeHtml(v) + '<br/></div>';
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 = '<div style=color:violet>' + "PUSH" + '&gt; ' + EscapeHtml(v) + '<br/></div>';
consoleNode.consoleText += t;

View File

@ -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);