diff --git a/agents/meshcore.js b/agents/meshcore.js index 68934889..b1f4d6fe 100644 --- a/agents/meshcore.js +++ b/agents/meshcore.js @@ -1921,7 +1921,7 @@ function onTunnelData(data) { this.httprequest.desktop.kvm.users.splice(i, 1); this.httprequest.desktop.kvm.connectionBar.removeAllListeners('close'); this.httprequest.desktop.kvm.connectionBar.close(); - this.httprequest.desktop.kvm.connectionBar = require('notifybar-desktop')(this.httprequest.privacybartext.replace('{0}', this.httprequest.desktop.kvm.users.join(', ')).replace('{1}', this.httprequest.desktop.kvm.rusers.join(', ')), require('MeshAgent')._tsid); + this.httprequest.desktop.kvm.connectionBar = require('notifybar-desktop')(this.httprequest.privacybartext.replace('{0}', this.httprequest.desktop.kvm.rusers.join(', ')).replace('{1}', this.httprequest.desktop.kvm.users.join(', ')), require('MeshAgent')._tsid); this.httprequest.desktop.kvm.connectionBar.httprequest = this.httprequest; this.httprequest.desktop.kvm.connectionBar.on('close', function () { MeshServerLogEx(29, null, "Remote Desktop Connection forcefully closed by local user (" + this.httprequest.remoteaddr + ")", this.httprequest); @@ -1993,7 +1993,7 @@ function onTunnelData(data) { this.ws.httprequest.desktop.kvm.connectionBar.close(); } try { - this.ws.httprequest.desktop.kvm.connectionBar = require('notifybar-desktop')(this.ws.httprequest.privacybartext.replace('{0}', this.ws.httprequest.desktop.kvm.users.join(', ')).replace('{1}', this.ws.httprequest.desktop.kvm.rusers.join(', ')), require('MeshAgent')._tsid); + this.ws.httprequest.desktop.kvm.connectionBar = require('notifybar-desktop')(this.ws.httprequest.privacybartext.replace('{0}', this.ws.httprequest.desktop.kvm.rusers.join(', ')).replace('{1}', this.ws.httprequest.desktop.kvm.users.join(', ')), require('MeshAgent')._tsid); MeshServerLogEx(31, null, "Remote Desktop Connection Bar Activated/Updated (" + this.ws.httprequest.remoteaddr + ")", this.ws.httprequest); } catch (e) { diff --git a/firebase.js b/firebase.js index 8c22fb3c..f598ccb8 100644 --- a/firebase.js +++ b/firebase.js @@ -100,6 +100,7 @@ module.exports.CreateFirebase = function (parent, senderid, serverkey) { var message = new Message('msg_' + (++obj.messageId)); if (options.priority) { message.priority(options.priority); } if (payload.data) { for (var i in payload.data) { message.addData(i, payload.data[i]); } } + if ((payload.data == null) || (payload.data.shash == null)) { message.addData('shash', parent.webserver.agentCertificateHashBase64); } // Add the server agent hash, new Android agents will reject notifications that don't have this. if (notification) { message.notification(notification) } message.build(); @@ -244,6 +245,10 @@ module.exports.CreateFirebaseRelay = function (parent, url, key) { // Fill in our lookup table if (node._id != null) { obj.tokenToNodeMap[node.pmt] = { nid: node._id, mid: node.meshid, did: node.domain } } + // Fill in the server agent cert hash + if (payload.data == null) { payload.data = {}; } + if (payload.data.shash == null) { payload.data.shash = parent.webserver.agentCertificateHashBase64; } // Add the server agent hash, new Android agents will reject notifications that don't have this. + // If the web socket is open, send now if (obj.wsopen == true) { try { obj.wsclient.send(JSON.stringify({ pmt: node.pmt, payload: payload, options: options })); } catch (ex) { func(0, 'error'); obj.stats.sendError++; return; } @@ -265,6 +270,10 @@ module.exports.CreateFirebaseRelay = function (parent, url, key) { const querydata = querystring.stringify({ 'msg': JSON.stringify({ pmt: node.pmt, payload: payload, options: options }) }); + // Fill in the server agent cert hash + if (payload.data == null) { payload.data = {}; } + if (payload.data.shash == null) { payload.data.shash = parent.webserver.agentCertificateHashBase64; } // Add the server agent hash, new Android agents will reject notifications that don't have this. + // Send the message to the relay const httpOptions = { hostname: relayUrl.hostname, diff --git a/sample-config-advanced.json b/sample-config-advanced.json index 15fb8bd4..941a3ce1 100644 --- a/sample-config-advanced.json +++ b/sample-config-advanced.json @@ -213,7 +213,7 @@ "desktopprivacybar": true }, "_urlSwitching": false, - "_desktopPrivacyBarText": "Your privacy bar message", + "_desktopPrivacyBarText": "Privacy bar: {0}, {1}", "_limits": { "_maxDevices": 100, "_maxUserAccounts": 100,