Fixed names on desktop privacy bar.

This commit is contained in:
Ylian Saint-Hilaire 2021-02-21 23:23:15 -08:00
parent ac8736ff2e
commit 66061120ea
3 changed files with 12 additions and 3 deletions

View File

@ -1921,7 +1921,7 @@ function onTunnelData(data) {
this.httprequest.desktop.kvm.users.splice(i, 1); this.httprequest.desktop.kvm.users.splice(i, 1);
this.httprequest.desktop.kvm.connectionBar.removeAllListeners('close'); this.httprequest.desktop.kvm.connectionBar.removeAllListeners('close');
this.httprequest.desktop.kvm.connectionBar.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.httprequest = this.httprequest;
this.httprequest.desktop.kvm.connectionBar.on('close', function () { this.httprequest.desktop.kvm.connectionBar.on('close', function () {
MeshServerLogEx(29, null, "Remote Desktop Connection forcefully closed by local user (" + this.httprequest.remoteaddr + ")", this.httprequest); 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(); this.ws.httprequest.desktop.kvm.connectionBar.close();
} }
try { 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); MeshServerLogEx(31, null, "Remote Desktop Connection Bar Activated/Updated (" + this.ws.httprequest.remoteaddr + ")", this.ws.httprequest);
} }
catch (e) { catch (e) {

View File

@ -100,6 +100,7 @@ module.exports.CreateFirebase = function (parent, senderid, serverkey) {
var message = new Message('msg_' + (++obj.messageId)); var message = new Message('msg_' + (++obj.messageId));
if (options.priority) { message.priority(options.priority); } 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) { 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) } if (notification) { message.notification(notification) }
message.build(); message.build();
@ -244,6 +245,10 @@ module.exports.CreateFirebaseRelay = function (parent, url, key) {
// Fill in our lookup table // Fill in our lookup table
if (node._id != null) { obj.tokenToNodeMap[node.pmt] = { nid: node._id, mid: node.meshid, did: node.domain } } 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 the web socket is open, send now
if (obj.wsopen == true) { 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; } 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 }) }); 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 // Send the message to the relay
const httpOptions = { const httpOptions = {
hostname: relayUrl.hostname, hostname: relayUrl.hostname,

View File

@ -213,7 +213,7 @@
"desktopprivacybar": true "desktopprivacybar": true
}, },
"_urlSwitching": false, "_urlSwitching": false,
"_desktopPrivacyBarText": "Your privacy bar message", "_desktopPrivacyBarText": "Privacy bar: {0}, {1}",
"_limits": { "_limits": {
"_maxDevices": 100, "_maxDevices": 100,
"_maxUserAccounts": 100, "_maxUserAccounts": 100,