diff --git a/agents/meshcore.js b/agents/meshcore.js index 055023a6..b7ee766a 100644 --- a/agents/meshcore.js +++ b/agents/meshcore.js @@ -171,6 +171,12 @@ var agentFileHttpRequests = {}; // Currently active agent HTTPS GET requests fro var agentFileHttpPendingRequests = []; // Pending HTTPS GET requests from the server. var debugConsole = (global._MSH && (_MSH().debugConsole == 1)); +var color_options = + { + background: (global._MSH != null) ? global._MSH().background : '0,54,105', + foreground: (global._MSH != null) ? global._MSH().foreground : '255,255,255' + }; + if (process.platform == 'win32' && require('user-sessions').isRoot()) { // Check the Agent Uninstall MetaData for correctness, as the installer may have written an incorrect value try { @@ -1091,7 +1097,7 @@ function handleServerCommand(data) { ipr.username = data.username; global._clientmessage = ipr.then(function (img) { - this.messagebox = require('win-dialog').create(this.title, this.message, this.username, { timeout: 120000, b64Image: img.split(',').pop() }); + 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 }); this.__childPromise.addMessage = this.messagebox.addMessage.bind(this.messagebox); return (this.messagebox); }); @@ -2072,7 +2078,7 @@ function onTunnelData(data) { ipr.username = this.httprequest.realname; ipr.translations = { Allow: currentTranslation['allow'], Deny: currentTranslation['deny'], Auto: currentTranslation['autoAllowForFive'], Caption: consentMessage }; this.httprequest.tpromise._consent = ipr.then(function (img) { - this.consent = require('win-userconsent').create(this.consentTitle, this.consentMessage, this.username, { b64Image: img.split(',').pop(), timeout: 30000, translations: this.translations }); + 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 }); this.__childPromise.close = this.consent.close.bind(this.consent); return (this.consent); }); @@ -2372,7 +2378,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.rusers.join(', ')).replace('{1}', this.httprequest.desktop.kvm.users.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, color_options); 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); @@ -2433,7 +2439,7 @@ function onTunnelData(data) { ipr.username = this.httprequest.realname; ipr.translation = { Allow: currentTranslation['allow'], Deny: currentTranslation['deny'], Auto: currentTranslation['autoAllowForFive'], Caption: consentMessage }; pr = ipr.then(function (img) { - this.consent = require('win-userconsent').create(this.consentTitle, this.consentMessage, this.username, { b64Image: img.split(',').pop(), uid: this.tsid, timeout: 30000, translations: this.translation }); + 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 }); this.__childPromise.close = this.consent.close.bind(this.consent); return (this.consent); }); @@ -2478,7 +2484,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.rusers.join(', ')).replace('{1}', this.ws.httprequest.desktop.kvm.users.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, color_options); MeshServerLogEx(31, null, "Remote Desktop Connection Bar Activated/Updated (" + this.ws.httprequest.remoteaddr + ")", this.ws.httprequest); } catch (ex) { if (process.platform != 'darwin') { @@ -2530,7 +2536,7 @@ function onTunnelData(data) { this.httprequest.desktop.kvm.connectionBar.close(); } try { - 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 = 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); MeshServerLogEx(31, null, "Remote Desktop Connection Bar Activated/Updated (" + this.httprequest.remoteaddr + ")", this.httprequest); } catch (ex) { MeshServerLogEx(32, null, "Remote Desktop Connection Bar Failed or not Supported (" + this.httprequest.remoteaddr + ")", this.httprequest); @@ -2616,7 +2622,7 @@ function onTunnelData(data) { ipr.username = this.httprequest.realname; ipr.translations = { Allow: currentTranslation['allow'], Deny: currentTranslation['deny'], Auto: currentTranslation['autoAllowForFive'], Caption: consentMessage }; pr = ipr.then(function (img) { - this.consent = require('win-userconsent').create(this.consentTitle, this.consentMessage, this.username, { b64Image: img.split(',').pop(), timeout: 30000, translations: this.translations }); + 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 }); this.__childPromise.close = this.consent.close.bind(this.consent); return (this.consent); });