Added support for new foreground/background MSH fields to set colors for windows user consent, privacy bar, and sendmessage dialog
Bryan Roe committed
Feb 14, 2022 at 19:33 UTC
a590ea6aa11763c3b3b0fd1e835b60c3ac1c2ab0
1 file changed
+13
-7
agents/meshcore.js
+13
-7
@@ -171,6 +171,12 @@ var agentFileHttpRequests = {}; // Currently active agent HTTPS GET requests fro
171
var agentFileHttpPendingRequests = []; // Pending HTTPS GET requests from the server.
172
var debugConsole = (global._MSH && (_MSH().debugConsole == 1));
173
174
+var color_options =
175
+ {
176
+ background: (global._MSH != null) ? global._MSH().background : '0,54,105',
177
+ foreground: (global._MSH != null) ? global._MSH().foreground : '255,255,255'
178
+ };
179
+
180
if (process.platform == 'win32' && require('user-sessions').isRoot()) {
181
// Check the Agent Uninstall MetaData for correctness, as the installer may have written an incorrect value
182
try {
@@ -1091,7 +1097,7 @@ function handleServerCommand(data) {
1097
ipr.username = data.username;
1098
global._clientmessage = ipr.then(function (img)
1099
{
1094
- this.messagebox = require('win-dialog').create(this.title, this.message, this.username, { timeout: 120000, b64Image: img.split(',').pop() });
1100
+ this.messagebox = require('win-dialog').create(this.title, this.message, this.username, { timeout: 120000, b64Image: img.split(',').pop(), background: color_options.background, foreground: color_options.foreground });
1101
this.__childPromise.addMessage = this.messagebox.addMessage.bind(this.messagebox);
1102
return (this.messagebox);
1103
});
@@ -2072,7 +2078,7 @@ function onTunnelData(data) {
2078
ipr.username = this.httprequest.realname;
2079
ipr.translations = { Allow: currentTranslation['allow'], Deny: currentTranslation['deny'], Auto: currentTranslation['autoAllowForFive'], Caption: consentMessage };
2080
this.httprequest.tpromise._consent = ipr.then(function (img) {
2075
- this.consent = require('win-userconsent').create(this.consentTitle, this.consentMessage, this.username, { b64Image: img.split(',').pop(), timeout: 30000, translations: this.translations });
2081
+ this.consent = require('win-userconsent').create(this.consentTitle, this.consentMessage, this.username, { b64Image: img.split(',').pop(), timeout: 30000, translations: this.translations, background: color_options.background, foreground: color_options.foreground });
2082
this.__childPromise.close = this.consent.close.bind(this.consent);
2083
return (this.consent);
2084
});
@@ -2372,7 +2378,7 @@ function onTunnelData(data) {
2378
this.httprequest.desktop.kvm.users.splice(i, 1);
2379
this.httprequest.desktop.kvm.connectionBar.removeAllListeners('close');
2380
this.httprequest.desktop.kvm.connectionBar.close();
2375
- 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);
2381
+ 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, color_options);
2382
this.httprequest.desktop.kvm.connectionBar.httprequest = this.httprequest;
2383
this.httprequest.desktop.kvm.connectionBar.on('close', function () {
2384
MeshServerLogEx(29, null, "Remote Desktop Connection forcefully closed by local user (" + this.httprequest.remoteaddr + ")", this.httprequest);
@@ -2433,7 +2439,7 @@ function onTunnelData(data) {
2439
ipr.username = this.httprequest.realname;
2440
ipr.translation = { Allow: currentTranslation['allow'], Deny: currentTranslation['deny'], Auto: currentTranslation['autoAllowForFive'], Caption: consentMessage };
2441
pr = ipr.then(function (img) {
2436
- this.consent = require('win-userconsent').create(this.consentTitle, this.consentMessage, this.username, { b64Image: img.split(',').pop(), uid: this.tsid, timeout: 30000, translations: this.translation });
2442
+ this.consent = require('win-userconsent').create(this.consentTitle, this.consentMessage, this.username, { b64Image: img.split(',').pop(), uid: this.tsid, timeout: 30000, translations: this.translation, background: color_options.background, foreground: color_options.foreground });
2443
this.__childPromise.close = this.consent.close.bind(this.consent);
2444
return (this.consent);
2445
});
@@ -2478,7 +2484,7 @@ function onTunnelData(data) {
2484
this.ws.httprequest.desktop.kvm.connectionBar.close();
2485
}
2486
try {
2481
- 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);
2487
+ 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, color_options);
2488
MeshServerLogEx(31, null, "Remote Desktop Connection Bar Activated/Updated (" + this.ws.httprequest.remoteaddr + ")", this.ws.httprequest);
2489
} catch (ex) {
2490
if (process.platform != 'darwin') {
@@ -2530,7 +2536,7 @@ function onTunnelData(data) {
2536
this.httprequest.desktop.kvm.connectionBar.close();
2537
}
2538
try {
2533
- 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);
2539
+ 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, color_options);
2540
MeshServerLogEx(31, null, "Remote Desktop Connection Bar Activated/Updated (" + this.httprequest.remoteaddr + ")", this.httprequest);
2541
} catch (ex) {
2542
MeshServerLogEx(32, null, "Remote Desktop Connection Bar Failed or not Supported (" + this.httprequest.remoteaddr + ")", this.httprequest);
@@ -2616,7 +2622,7 @@ function onTunnelData(data) {
2622
ipr.username = this.httprequest.realname;
2623
ipr.translations = { Allow: currentTranslation['allow'], Deny: currentTranslation['deny'], Auto: currentTranslation['autoAllowForFive'], Caption: consentMessage };
2624
pr = ipr.then(function (img) {
2619
- this.consent = require('win-userconsent').create(this.consentTitle, this.consentMessage, this.username, { b64Image: img.split(',').pop(), timeout: 30000, translations: this.translations });
2625
+ this.consent = require('win-userconsent').create(this.consentTitle, this.consentMessage, this.username, { b64Image: img.split(',').pop(), timeout: 30000, translations: this.translations, background: color_options.background, foreground: color_options.foreground });
2626
this.__childPromise.close = this.consent.close.bind(this.consent);
2627
return (this.consent);
2628
});