Added way to use cookies only once, added desktopPrivacyBarText option in domain.
Ylian Saint-Hilaire committed
Dec 11, 2019 at 15:44 UTC
37d3bea8c6f9850da3e65a5f54405c82d81d29a5
6 files changed
+153
-20
agents/meshcore.js
+4
-4
@@ -627,6 +627,7 @@ function createMeshCore(agent) {
627
tunnel.sessionid = data.sessionid;
628
tunnel.rights = data.rights;
629
tunnel.consent = data.consent;
630
+ tunnel.privacybartext = data.privacybartext ? data.privacybartext : 'Sharing desktop with: {0}';
631
tunnel.username = data.username;
632
tunnel.userid = data.userid;
633
tunnel.remoteaddr = data.remoteaddr;
@@ -1300,8 +1301,7 @@ function createMeshCore(agent) {
1301
this.httprequest.desktop.kvm.users.splice(i, 1);
1302
this.httprequest.desktop.kvm.connectionBar.removeAllListeners('close');
1303
this.httprequest.desktop.kvm.connectionBar.close();
1303
-
1304
- this.httprequest.desktop.kvm.connectionBar = require('notifybar-desktop')('Sharing desktop with: ' + this.httprequest.desktop.kvm.users.sort().join(', '), require('MeshAgent')._tsid);
1304
+ this.httprequest.desktop.kvm.connectionBar = require('notifybar-desktop')(this.httprequest.privacybartext.replace('{0}', this.httprequest.desktop.kvm.users.sort().join(', ')), require('MeshAgent')._tsid);
1305
this.httprequest.desktop.kvm.connectionBar.httprequest = this.httprequest;
1306
this.httprequest.desktop.kvm.connectionBar.on('close', function ()
1307
{
@@ -1366,7 +1366,7 @@ function createMeshCore(agent) {
1366
}
1367
try
1368
{
1369
- this.ws.httprequest.desktop.kvm.connectionBar = require('notifybar-desktop')('Sharing desktop with: ' + this.ws.httprequest.desktop.kvm.users.sort().join(', '), require('MeshAgent')._tsid);
1369
+ this.ws.httprequest.desktop.kvm.connectionBar = require('notifybar-desktop')(this.ws.httprequest.privacybartext.replace('{0}', this.ws.httprequest.desktop.kvm.users.sort().join(', ')), require('MeshAgent')._tsid);
1370
MeshServerLog('Remote Desktop Connection Bar Activated/Updated (' + this.ws.httprequest.remoteaddr + ')', this.ws.httprequest);
1371
}
1372
catch(xx)
@@ -1420,7 +1420,7 @@ function createMeshCore(agent) {
1420
}
1421
try
1422
{
1423
- this.httprequest.desktop.kvm.connectionBar = require('notifybar-desktop')('Sharing desktop with: ' + this.httprequest.desktop.kvm.users.sort().join(', '), require('MeshAgent')._tsid);
1423
+ this.httprequest.desktop.kvm.connectionBar = require('notifybar-desktop')(this.httprequest.privacybartext.replace('{0}', this.httprequest.desktop.kvm.users.sort().join(', ')), require('MeshAgent')._tsid);
1424
MeshServerLog('Remote Desktop Connection Bar Activated/Updated (' + this.httprequest.remoteaddr + ')', this.httprequest);
1425
}
1426
catch(xx)
agents/meshcore.min.js
+118
-14
@@ -627,6 +627,7 @@ function createMeshCore(agent) {
627
tunnel.sessionid = data.sessionid;
628
tunnel.rights = data.rights;
629
tunnel.consent = data.consent;
630
+ tunnel.privacybartext = data.privacybartext ? data.privacybartext : 'Sharing desktop with: {0}';
631
tunnel.username = data.username;
632
tunnel.userid = data.userid;
633
tunnel.remoteaddr = data.remoteaddr;
@@ -696,18 +697,30 @@ function createMeshCore(agent) {
697
} catch (e) { }
698
break;
699
}
699
- case 'deskBackground': {
700
+ case 'deskBackground':
701
+ {
702
// Toggle desktop background
703
try {
702
- if (process.platform == 'win32') {
704
+ if (process.platform == 'win32')
705
+ {
706
+ var stype = require('user-sessions').getProcessOwnerName(process.pid).tsid == 0 ? 1 : 0;
707
+ var sid = undefined;
708
+ if (stype == 1)
709
+ {
710
+ if(require('MeshAgent')._tsid != null)
711
+ {
712
+ stype = 5;
713
+ sid = require('MeshAgent')._tsid;
714
+ }
715
+ }
716
var id = require('user-sessions').getProcessOwnerName(process.pid).tsid == 0 ? 1 : 0;
704
- var child = require('child_process').execFile(process.execPath, [process.execPath.split('\\').pop(), '-b64exec', 'dmFyIFNQSV9HRVRERVNLV0FMTFBBUEVSID0gMHgwMDczOwp2YXIgU1BJX1NFVERFU0tXQUxMUEFQRVIgPSAweDAwMTQ7CnZhciBHTSA9IHJlcXVpcmUoJ19HZW5lcmljTWFyc2hhbCcpOwp2YXIgdXNlcjMyID0gR00uQ3JlYXRlTmF0aXZlUHJveHkoJ3VzZXIzMi5kbGwnKTsKdXNlcjMyLkNyZWF0ZU1ldGhvZCgnU3lzdGVtUGFyYW1ldGVyc0luZm9BJyk7CgppZiAocHJvY2Vzcy5hcmd2Lmxlbmd0aCA9PSAzKQp7CiAgICB2YXIgdiA9IEdNLkNyZWF0ZVZhcmlhYmxlKDEwMjQpOwogICAgdXNlcjMyLlN5c3RlbVBhcmFtZXRlcnNJbmZvQShTUElfR0VUREVTS1dBTExQQVBFUiwgdi5fc2l6ZSwgdiwgMCk7CiAgICBjb25zb2xlLmxvZyh2LlN0cmluZyk7CiAgICBwcm9jZXNzLmV4aXQoKTsKfQplbHNlCnsKICAgIHZhciBuYiA9IEdNLkNyZWF0ZVZhcmlhYmxlKHByb2Nlc3MuYXJndlszXSk7CiAgICB1c2VyMzIuU3lzdGVtUGFyYW1ldGVyc0luZm9BKFNQSV9TRVRERVNLV0FMTFBBUEVSLCBuYi5fc2l6ZSwgbmIsIDApOwogICAgcHJvY2Vzcy5leGl0KCk7Cn0='], { type: id });
717
+ var child = require('child_process').execFile(process.execPath, [process.execPath.split('\\').pop(), '-b64exec', 'dmFyIFNQSV9HRVRERVNLV0FMTFBBUEVSID0gMHgwMDczOwp2YXIgU1BJX1NFVERFU0tXQUxMUEFQRVIgPSAweDAwMTQ7CnZhciBHTSA9IHJlcXVpcmUoJ19HZW5lcmljTWFyc2hhbCcpOwp2YXIgdXNlcjMyID0gR00uQ3JlYXRlTmF0aXZlUHJveHkoJ3VzZXIzMi5kbGwnKTsKdXNlcjMyLkNyZWF0ZU1ldGhvZCgnU3lzdGVtUGFyYW1ldGVyc0luZm9BJyk7CgppZiAocHJvY2Vzcy5hcmd2Lmxlbmd0aCA9PSAzKQp7CiAgICB2YXIgdiA9IEdNLkNyZWF0ZVZhcmlhYmxlKDEwMjQpOwogICAgdXNlcjMyLlN5c3RlbVBhcmFtZXRlcnNJbmZvQShTUElfR0VUREVTS1dBTExQQVBFUiwgdi5fc2l6ZSwgdiwgMCk7CiAgICBjb25zb2xlLmxvZyh2LlN0cmluZyk7CiAgICBwcm9jZXNzLmV4aXQoKTsKfQplbHNlCnsKICAgIHZhciBuYiA9IEdNLkNyZWF0ZVZhcmlhYmxlKHByb2Nlc3MuYXJndlszXSk7CiAgICB1c2VyMzIuU3lzdGVtUGFyYW1ldGVyc0luZm9BKFNQSV9TRVRERVNLV0FMTFBBUEVSLCBuYi5fc2l6ZSwgbmIsIDApOwogICAgcHJvY2Vzcy5leGl0KCk7Cn0='], { type: stype, uid: sid });
718
child.stdout.str = ''; child.stdout.on('data', function (c) { this.str += c.toString(); });
719
child.stderr.on('data', function () { });
720
child.waitExit();
721
var current = child.stdout.str.trim();
722
if (current != '') { require('MeshAgent')._wallpaper = current; }
710
- child = require('child_process').execFile(process.execPath, [process.execPath.split('\\').pop(), '-b64exec', 'dmFyIFNQSV9HRVRERVNLV0FMTFBBUEVSID0gMHgwMDczOwp2YXIgU1BJX1NFVERFU0tXQUxMUEFQRVIgPSAweDAwMTQ7CnZhciBHTSA9IHJlcXVpcmUoJ19HZW5lcmljTWFyc2hhbCcpOwp2YXIgdXNlcjMyID0gR00uQ3JlYXRlTmF0aXZlUHJveHkoJ3VzZXIzMi5kbGwnKTsKdXNlcjMyLkNyZWF0ZU1ldGhvZCgnU3lzdGVtUGFyYW1ldGVyc0luZm9BJyk7CgppZiAocHJvY2Vzcy5hcmd2Lmxlbmd0aCA9PSAzKQp7CiAgICB2YXIgdiA9IEdNLkNyZWF0ZVZhcmlhYmxlKDEwMjQpOwogICAgdXNlcjMyLlN5c3RlbVBhcmFtZXRlcnNJbmZvQShTUElfR0VUREVTS1dBTExQQVBFUiwgdi5fc2l6ZSwgdiwgMCk7CiAgICBjb25zb2xlLmxvZyh2LlN0cmluZyk7CiAgICBwcm9jZXNzLmV4aXQoKTsKfQplbHNlCnsKICAgIHZhciBuYiA9IEdNLkNyZWF0ZVZhcmlhYmxlKHByb2Nlc3MuYXJndlszXSk7CiAgICB1c2VyMzIuU3lzdGVtUGFyYW1ldGVyc0luZm9BKFNQSV9TRVRERVNLV0FMTFBBUEVSLCBuYi5fc2l6ZSwgbmIsIDApOwogICAgcHJvY2Vzcy5leGl0KCk7Cn0=', current != '' ? '""' : require('MeshAgent')._wallpaper], { type: id });
723
+ child = require('child_process').execFile(process.execPath, [process.execPath.split('\\').pop(), '-b64exec', 'dmFyIFNQSV9HRVRERVNLV0FMTFBBUEVSID0gMHgwMDczOwp2YXIgU1BJX1NFVERFU0tXQUxMUEFQRVIgPSAweDAwMTQ7CnZhciBHTSA9IHJlcXVpcmUoJ19HZW5lcmljTWFyc2hhbCcpOwp2YXIgdXNlcjMyID0gR00uQ3JlYXRlTmF0aXZlUHJveHkoJ3VzZXIzMi5kbGwnKTsKdXNlcjMyLkNyZWF0ZU1ldGhvZCgnU3lzdGVtUGFyYW1ldGVyc0luZm9BJyk7CgppZiAocHJvY2Vzcy5hcmd2Lmxlbmd0aCA9PSAzKQp7CiAgICB2YXIgdiA9IEdNLkNyZWF0ZVZhcmlhYmxlKDEwMjQpOwogICAgdXNlcjMyLlN5c3RlbVBhcmFtZXRlcnNJbmZvQShTUElfR0VUREVTS1dBTExQQVBFUiwgdi5fc2l6ZSwgdiwgMCk7CiAgICBjb25zb2xlLmxvZyh2LlN0cmluZyk7CiAgICBwcm9jZXNzLmV4aXQoKTsKfQplbHNlCnsKICAgIHZhciBuYiA9IEdNLkNyZWF0ZVZhcmlhYmxlKHByb2Nlc3MuYXJndlszXSk7CiAgICB1c2VyMzIuU3lzdGVtUGFyYW1ldGVyc0luZm9BKFNQSV9TRVRERVNLV0FMTFBBUEVSLCBuYi5fc2l6ZSwgbmIsIDApOwogICAgcHJvY2Vzcy5leGl0KCk7Cn0=', current != '' ? '""' : require('MeshAgent')._wallpaper], { type: stype, uid: sid });
724
child.stdout.str = ''; child.stdout.on('data', function (c) { this.str += c.toString(); });
725
child.stderr.on('data', function () { });
726
child.waitExit();
@@ -717,7 +730,10 @@ function createMeshCore(agent) {
730
if (current != '/dev/null') { require('MeshAgent')._wallpaper = current; }
731
require('linux-gnome-helpers').setDesktopWallpaper(id, current != '/dev/null' ? undefined : require('MeshAgent')._wallpaper);
732
}
720
- } catch (e) { }
733
+ } catch (e)
734
+ {
735
+ sendConsoleText(e);
736
+ }
737
break;
738
}
739
case 'openUrl': {
@@ -1285,8 +1301,7 @@ function createMeshCore(agent) {
1301
this.httprequest.desktop.kvm.users.splice(i, 1);
1302
this.httprequest.desktop.kvm.connectionBar.removeAllListeners('close');
1303
this.httprequest.desktop.kvm.connectionBar.close();
1288
-
1289
- this.httprequest.desktop.kvm.connectionBar = require('notifybar-desktop')('Sharing desktop with: ' + this.httprequest.desktop.kvm.users.sort().join(', '), require('MeshAgent')._tsid);
1304
+ this.httprequest.desktop.kvm.connectionBar = require('notifybar-desktop')(this.httprequest.privacybartext.replace('{0}', this.httprequest.desktop.kvm.users.sort().join(', ')), require('MeshAgent')._tsid);
1305
this.httprequest.desktop.kvm.connectionBar.httprequest = this.httprequest;
1306
this.httprequest.desktop.kvm.connectionBar.on('close', function ()
1307
{
@@ -1351,7 +1366,7 @@ function createMeshCore(agent) {
1366
}
1367
try
1368
{
1354
- this.ws.httprequest.desktop.kvm.connectionBar = require('notifybar-desktop')('Sharing desktop with: ' + this.ws.httprequest.desktop.kvm.users.sort().join(', '), require('MeshAgent')._tsid);
1369
+ this.ws.httprequest.desktop.kvm.connectionBar = require('notifybar-desktop')(this.ws.httprequest.privacybartext.replace('{0}', this.ws.httprequest.desktop.kvm.users.sort().join(', ')), require('MeshAgent')._tsid);
1370
MeshServerLog('Remote Desktop Connection Bar Activated/Updated (' + this.ws.httprequest.remoteaddr + ')', this.ws.httprequest);
1371
}
1372
catch(xx)
@@ -1405,7 +1420,7 @@ function createMeshCore(agent) {
1420
}
1421
try
1422
{
1408
- this.httprequest.desktop.kvm.connectionBar = require('notifybar-desktop')('Sharing desktop with: ' + this.httprequest.desktop.kvm.users.sort().join(', '), require('MeshAgent')._tsid);
1423
+ this.httprequest.desktop.kvm.connectionBar = require('notifybar-desktop')(this.httprequest.privacybartext.replace('{0}', this.httprequest.desktop.kvm.users.sort().join(', ')), require('MeshAgent')._tsid);
1424
MeshServerLog('Remote Desktop Connection Bar Activated/Updated (' + this.httprequest.remoteaddr + ')', this.httprequest);
1425
}
1426
catch(xx)
@@ -1856,7 +1871,11 @@ function createMeshCore(agent) {
1871
var response = null;
1872
switch (cmd) {
1873
case 'help': { // Displays available commands
1859
- var fin = '', f = '', availcommands = 'help,info,osinfo,args,print,type,dbkeys,dbget,dbset,dbcompact,eval,parseuri,httpget,nwslist,plugin,wsconnect,wssend,wsclose,notify,ls,ps,kill,amt,netinfo,location,power,wakeonlan,setdebug,smbios,rawsmbios,toast,lock,users,sendcaps,openurl,amtreset,amtccm,amtacm,amtdeactivate,amtpolicy,getscript,getclip,setclip,log,av,cpuinfo,sysinfo,apf,scanwifi,scanamt,safemode,wallpaper';
1874
+ var fin = '', f = '', availcommands = 'help,info,osinfo,args,print,type,dbkeys,dbget,dbset,dbcompact,eval,parseuri,httpget,nwslist,plugin,wsconnect,wssend,wsclose,notify,ls,ps,kill,amt,netinfo,location,power,wakeonlan,setdebug,smbios,rawsmbios,toast,lock,users,sendcaps,openurl,amtreset,amtccm,amtacm,amtdeactivate,amtpolicy,getscript,getclip,setclip,log,av,cpuinfo,sysinfo,apf,scanwifi,scanamt,wallpaper';
1875
+ if (process.platform == 'win32')
1876
+ {
1877
+ availcommands += ',safemode,wpfhwacceleration';
1878
+ }
1879
availcommands = availcommands.split(',').sort();
1880
while (availcommands.length > 0) {
1881
if (f.length > 100) { fin += (f + ',\r\n'); f = ''; }
@@ -1866,6 +1885,71 @@ function createMeshCore(agent) {
1885
response = 'Available commands: \r\n' + fin + '.';
1886
break;
1887
}
1888
+ case 'wpfhwacceleration':
1889
+ if (process.platform != 'win32') { throw ('wpfhwacceleration setting is only supported on Windows'); }
1890
+ if (args['_'].length != 1)
1891
+ {
1892
+ response = 'Proper usage: wpfhwacceleration (ON|OFF|STATUS)'; // Display usage
1893
+ }
1894
+ else
1895
+ {
1896
+ var reg = require('win-registry');
1897
+ var uname = require('user-sessions').getUsername(require('user-sessions').consoleUid());
1898
+ var key = reg.usernameToUserKey(uname);
1899
+
1900
+ switch(args['_'][0].toUpperCase())
1901
+ {
1902
+ default:
1903
+ response = 'Proper usage: wpfhwacceleration (ON|OFF|STATUS|DEFAULT)'; // Display usage
1904
+ break;
1905
+ case 'ON':
1906
+ try
1907
+ {
1908
+ reg.WriteKey(reg.HKEY.Users, key + '\\SOFTWARE\\Microsoft\\Avalon.Graphics', 'DisableHWAcceleration', 0);
1909
+ response = 'OK';
1910
+ }
1911
+ catch (ee)
1912
+ {
1913
+ response = 'FAILED';
1914
+ }
1915
+ break;
1916
+ case 'OFF':
1917
+ try
1918
+ {
1919
+ reg.WriteKey(reg.HKEY.Users, key + '\\SOFTWARE\\Microsoft\\Avalon.Graphics', 'DisableHWAcceleration', 1);
1920
+ response = 'OK';
1921
+ }
1922
+ catch (ee)
1923
+ {
1924
+ response = 'FAILED';
1925
+ }
1926
+ break;
1927
+ break;
1928
+ case 'STATUS':
1929
+ var s;
1930
+ try
1931
+ {
1932
+ s = reg.QueryKey(reg.HKEY.Users, key + '\\SOFTWARE\\Microsoft\\Avalon.Graphics', 'DisableHWAcceleration')==1?'DISABLED':'ENABLED';
1933
+ }
1934
+ catch (ee)
1935
+ {
1936
+ s = 'DEFAULT';
1937
+ }
1938
+ response = 'WPF Hardware Acceleration: ' + s;
1939
+ break;
1940
+ case 'DEFAULT':
1941
+ try
1942
+ {
1943
+ reg.DeleteKey(reg.HKEY.Users, key + '\\SOFTWARE\\Microsoft\\Avalon.Graphics', 'DisableHWAcceleration');
1944
+ }
1945
+ catch (ee)
1946
+ {
1947
+ }
1948
+ response = 'OK';
1949
+ break;
1950
+ }
1951
+ }
1952
+ break;
1953
case 'tsid':
1954
if (process.platform == 'win32')
1955
{
@@ -1880,6 +1964,10 @@ function createMeshCore(agent) {
1964
response = 'TSID set to: ' + (require('MeshAgent')._tsid == null ? 'console' : require('MeshAgent')._tsid);
1965
}
1966
}
1967
+ else
1968
+ {
1969
+ response = 'TSID command only supported on Windows';
1970
+ }
1971
break;
1972
case 'activeusers':
1973
if (process.platform == 'win32')
@@ -1899,6 +1987,10 @@ function createMeshCore(agent) {
1987
sendConsoleText(JSON.stringify(v, null, 1), this.sessionid);
1988
});
1989
}
1990
+ else
1991
+ {
1992
+ response = 'activeusers command only supported on Windows';
1993
+ }
1994
break;
1995
case 'wallpaper':
1996
if (process.platform != 'win32' && !(process.platform == 'linux' && require('linux-gnome-helpers').available))
@@ -2106,8 +2198,16 @@ function createMeshCore(agent) {
2198
break;
2199
}
2200
case 'toast': {
2109
- if (args['_'].length < 1) { response = 'Proper usage: toast "message"'; } else {
2110
- require('toaster').Toast('MeshCentral', args['_'][0]).then(sendConsoleText, sendConsoleText);
2201
+ if (args['_'].length < 1) { response = 'Proper usage: toast "message"'; } else
2202
+ {
2203
+ if (require('MeshAgent')._tsid == null)
2204
+ {
2205
+ require('toaster').Toast('MeshCentral', args['_'][0]).then(sendConsoleText, sendConsoleText);
2206
+ }
2207
+ else
2208
+ {
2209
+ require('toaster').Toast('MeshCentral', args['_'][0], require('MeshAgent')._tsid).then(sendConsoleText, sendConsoleText);
2210
+ }
2211
}
2212
break;
2213
}
@@ -2243,10 +2343,14 @@ function createMeshCore(agent) {
2343
case 'osinfo': { // Return the operating system information
2344
var i = 1;
2345
if (args['_'].length > 0) { i = parseInt(args['_'][0]); if (i > 8) { i = 8; } response = 'Calling ' + i + ' times.'; }
2246
- for (var j = 0; j < i; j++) {
2346
+ for (var j = 0; j < i; j++)
2347
+ {
2348
var pr = require('os').name();
2349
pr.sessionid = sessionid;
2249
- pr.then(function (v) { sendConsoleText("OS: " + v, this.sessionid); });
2350
+ pr.then(function (v)
2351
+ {
2352
+ sendConsoleText("OS: " + v + (process.platform=='win32'?(require('win-virtual-terminal').supported?' [ConPTY: YES]':' [ConPTY: NO]'):''), this.sessionid);
2353
+ });
2354
}
2355
break;
2356
}
meshcentral.js
+26
-1
@@ -69,6 +69,8 @@ function CreateMeshCentralServer(config, args) {
69
obj.taskLimiter = obj.common.createTaskLimiterQueue(50, 20, 60); // (maxTasks, maxTaskTime, cleaningInterval) This is a task limiter queue to smooth out server work.
70
obj.agentUpdateBlockSize = 65531; // MeshAgent update block size
71
obj.serverWarnings = []; // List of warnings that should be shown to administrators
72
+ obj.cookieUseOnceTable = {}; // List of cookies that are already expired
73
+ obj.cookieUseOnceTableCleanCounter = 0; // Clean the cookieUseOnceTable each 20 additions
74
try { obj.currentVer = JSON.parse(obj.fs.readFileSync(obj.path.join(__dirname, 'package.json'), 'utf8')).version; } catch (e) { } // Fetch server version
75
76
// Setup the default configuration and files paths
@@ -1857,7 +1859,30 @@ function CreateMeshCentralServer(config, args) {
1859
// Decode a cookie back into an object using a key using AES256-GCM or AES128-CBC/HMAC-SHA386. Return null if it's not a valid cookie. (key must be 32 bytes or more)
1860
obj.decodeCookie = function (cookie, key, timeout) {
1861
const r = obj.decodeCookieAESGCM(cookie, key, timeout);
1860
- if (r == null) { return obj.decodeCookieAESSHA(cookie, key, timeout); }
1862
+ if (r == null) { r = obj.decodeCookieAESSHA(cookie, key, timeout); }
1863
+ if ((r != null) && (typeof r.once == 'string') && (r.once.length > 0)) {
1864
+ // This cookie must only be used once.
1865
+ if (timeout == null) { timeout = 2; }
1866
+ if (obj.cookieUseOnceTable[r.once] == null) {
1867
+ const ctimeout = (((r.expire) == null || (typeof r.expire != 'number')) ? (r.time + ((timeout + 3) * 60000)) : (r.time + ((r.expire + 3) * 60000)));
1868
+
1869
+ // Store the used cookie in RAM
1870
+ obj.cookieUseOnceTable[r.once] = ctimeout;
1871
+
1872
+ // Store the used cookie in the database
1873
+ // TODO
1874
+
1875
+ // Send the used cookie to peer servers
1876
+ // TODO
1877
+
1878
+ // Clean up the used table
1879
+ if (++obj.cookieUseOnceTableCleanCounter > 20) {
1880
+ const now = Date.now();
1881
+ for (var i in obj.cookieUseOnceTable) { if (obj.cookieUseOnceTable[i] < now) { delete obj.cookieUseOnceTable[i]; } }
1882
+ obj.cookieUseOnceTableCleanCounter = 0;
1883
+ }
1884
+ } else { return null; }
1885
+ }
1886
return r;
1887
}
1888
meshrelay.js
+2
@@ -88,6 +88,7 @@ module.exports.CreateMeshRelay = function (parent, ws, req, domain, user, cookie
88
command.consent = mesh.consent; // Add user consent
89
if (typeof domain.userconsentflags == 'number') { command.consent |= domain.userconsentflags; } // Add server required consent flags
90
command.username = user.name; // Add user name
91
+ if (typeof domain.desktopprivacybartext == 'string') { command.privacybartext = domain.desktopprivacybartext; } // Privacy bar text
92
delete command.nodeid; // Remove the nodeid since it's implyed.
93
agent.send(JSON.stringify(command));
94
return true;
@@ -105,6 +106,7 @@ module.exports.CreateMeshRelay = function (parent, ws, req, domain, user, cookie
106
command.consent = mesh.consent; // Add user consent
107
if (typeof domain.userconsentflags == 'number') { command.consent |= domain.userconsentflags; } // Add server required consent flags
108
command.username = user.name; // Add user name
109
+ if (typeof domain.desktopprivacybartext == 'string') { command.privacybartext = domain.desktopprivacybartext; } // Privacy bar text
110
parent.parent.multiServer.DispatchMessageSingleServer(command, routing.serverid);
111
return true;
112
}
meshuser.js
+2
@@ -165,6 +165,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
165
command.username = user.name; // Add user name
166
command.userid = user._id; // Add user id
167
command.remoteaddr = cleanRemoteAddr(req.ip); // User's IP address
168
+ if (typeof domain.desktopprivacybartext == 'string') { command.privacybartext = domain.desktopprivacybartext; } // Privacy bar text
169
delete command.nodeid; // Remove the nodeid since it's implied
170
try { agent.send(JSON.stringify(command)); } catch (ex) { }
171
}
@@ -183,6 +184,7 @@ module.exports.CreateMeshUser = function (parent, db, ws, req, args, domain, use
184
command.username = user.name; // Add user name
185
command.userid = user._id; // Add user id
186
command.remoteaddr = cleanRemoteAddr(req.ip); // User's IP address
187
+ if (typeof domain.desktopprivacybartext == 'string') { command.privacybartext = domain.desktopprivacybartext; } // Privacy bar text
188
parent.parent.multiServer.DispatchMessageSingleServer(command, routing.serverid);
189
}
190
}
package.json
+1
-1
@@ -1,6 +1,6 @@
1
{
2
"name": "meshcentral",
3
- "version": "0.4.5-q",
3
+ "version": "0.4.5-r",
4
"keywords": [
5
"Remote Management",
6
"Intel AMT",