Fixed names on desktop privacy bar.

Ylian Saint-Hilaire committed Feb 21, 2021 at 23:23 UTC 66061120ea5f28368196cd3a1263a2e5c4d4dc55
3 files changed +12 -3
agents/meshcore.js
+2 -2
@@ -1921,7 +1921,7 @@ function onTunnelData(data) {
1921 this.httprequest.desktop.kvm.users.splice(i, 1);
1922 this.httprequest.desktop.kvm.connectionBar.removeAllListeners('close');
1923 this.httprequest.desktop.kvm.connectionBar.close();
1924 - 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);
1924 + 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);
1925 this.httprequest.desktop.kvm.connectionBar.httprequest = this.httprequest;
1926 this.httprequest.desktop.kvm.connectionBar.on('close', function () {
1927 MeshServerLogEx(29, null, "Remote Desktop Connection forcefully closed by local user (" + this.httprequest.remoteaddr + ")", this.httprequest);
@@ -1993,7 +1993,7 @@ function onTunnelData(data) {
1993 this.ws.httprequest.desktop.kvm.connectionBar.close();
1994 }
1995 try {
1996 - 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);
1996 + 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);
1997 MeshServerLogEx(31, null, "Remote Desktop Connection Bar Activated/Updated (" + this.ws.httprequest.remoteaddr + ")", this.ws.httprequest);
1998 }
1999 catch (e) {
firebase.js
+9
@@ -100,6 +100,7 @@ module.exports.CreateFirebase = function (parent, senderid, serverkey) {
100 var message = new Message('msg_' + (++obj.messageId));
101 if (options.priority) { message.priority(options.priority); }
102 if (payload.data) { for (var i in payload.data) { message.addData(i, payload.data[i]); } }
103 + 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.
104 if (notification) { message.notification(notification) }
105 message.build();
106
@@ -244,6 +245,10 @@ module.exports.CreateFirebaseRelay = function (parent, url, key) {
245 // Fill in our lookup table
246 if (node._id != null) { obj.tokenToNodeMap[node.pmt] = { nid: node._id, mid: node.meshid, did: node.domain } }
247
248 + // Fill in the server agent cert hash
249 + if (payload.data == null) { payload.data = {}; }
250 + 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.
251 +
252 // If the web socket is open, send now
253 if (obj.wsopen == true) {
254 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) {
270
271 const querydata = querystring.stringify({ 'msg': JSON.stringify({ pmt: node.pmt, payload: payload, options: options }) });
272
273 + // Fill in the server agent cert hash
274 + if (payload.data == null) { payload.data = {}; }
275 + 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.
276 +
277 // Send the message to the relay
278 const httpOptions = {
279 hostname: relayUrl.hostname,
sample-config-advanced.json
+1 -1
@@ -213,7 +213,7 @@
213 "desktopprivacybar": true
214 },
215 "_urlSwitching": false,
216 - "_desktopPrivacyBarText": "Your privacy bar message",
216 + "_desktopPrivacyBarText": "Privacy bar: {0}, {1}",
217 "_limits": {
218 "_maxDevices": 100,
219 "_maxUserAccounts": 100,