mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2024-11-22 12:52:50 +03:00
Updated connection bar logic, to log an event if it fails
This commit is contained in:
parent
b30f3d6073
commit
a31e3040a2
@ -1201,7 +1201,7 @@ function createMeshCore(agent) {
|
||||
{
|
||||
for(var i in this.httprequest.desktop.kvm.users)
|
||||
{
|
||||
if(this.httprequest.desktop.kvm.users[i] == this.httprequest.username)
|
||||
if (this.httprequest.desktop.kvm.users[i] == this.httprequest.username && this.httprequest.desktop.kvm.connectionBar)
|
||||
{
|
||||
this.httprequest.desktop.kvm.users.splice(i, 1);
|
||||
this.httprequest.desktop.kvm.connectionBar.removeAllListeners('close');
|
||||
@ -1265,23 +1265,36 @@ function createMeshCore(agent) {
|
||||
if (this.ws.httprequest.consent && (this.ws.httprequest.consent & 0x40))
|
||||
{
|
||||
// Connection Bar is required
|
||||
MeshServerLog('Remote Desktop Connection Bar Activated/Updated (' + this.ws.httprequest.remoteaddr + ')', this.ws.httprequest);
|
||||
if (this.ws.httprequest.desktop.kvm.connectionBar)
|
||||
{
|
||||
this.ws.httprequest.desktop.kvm.connectionBar.removeAllListeners('close');
|
||||
this.ws.httprequest.desktop.kvm.connectionBar.close();
|
||||
}
|
||||
this.ws.httprequest.desktop.kvm.connectionBar = require('notifybar-desktop')('Sharing desktop with: ' + this.ws.httprequest.desktop.kvm.users.sort().join(', '));
|
||||
this.ws.httprequest.desktop.kvm.connectionBar.httprequest = this.ws.httprequest;
|
||||
this.ws.httprequest.desktop.kvm.connectionBar.on('close', function ()
|
||||
try
|
||||
{
|
||||
MeshServerLog('Remote Desktop Connection forcefully closed by local user (' + this.httprequest.remoteaddr + ')', this.httprequest);
|
||||
for (var i in this.httprequest.desktop.kvm._pipedStreams)
|
||||
this.ws.httprequest.desktop.kvm.connectionBar = require('notifybar-desktop')('Sharing desktop with: ' + this.ws.httprequest.desktop.kvm.users.sort().join(', '));
|
||||
MeshServerLog('Remote Desktop Connection Bar Activated/Updated (' + this.ws.httprequest.remoteaddr + ')', this.ws.httprequest);
|
||||
}
|
||||
catch(xx)
|
||||
{
|
||||
if(process.platform != 'darwin')
|
||||
{
|
||||
this.httprequest.desktop.kvm._pipedStreams[i].end();
|
||||
MeshServerLog('Remote Desktop Connection Bar Failed or Not Supported (' + this.ws.httprequest.remoteaddr + ')', this.ws.httprequest);
|
||||
}
|
||||
this.httprequest.desktop.kvm.end();
|
||||
});
|
||||
}
|
||||
if (this.ws.httprequest.desktop.kvm.connectionBar)
|
||||
{
|
||||
this.ws.httprequest.desktop.kvm.connectionBar.httprequest = this.ws.httprequest;
|
||||
this.ws.httprequest.desktop.kvm.connectionBar.on('close', function ()
|
||||
{
|
||||
MeshServerLog('Remote Desktop Connection forcefully closed by local user (' + this.httprequest.remoteaddr + ')', this.httprequest);
|
||||
for (var i in this.httprequest.desktop.kvm._pipedStreams)
|
||||
{
|
||||
this.httprequest.desktop.kvm._pipedStreams[i].end();
|
||||
}
|
||||
this.httprequest.desktop.kvm.end();
|
||||
});
|
||||
}
|
||||
}
|
||||
this.ws.httprequest.desktop.kvm.pipe(this.ws, { dataTypeSkip: 1 });
|
||||
this.ws.resume();
|
||||
@ -1306,23 +1319,33 @@ function createMeshCore(agent) {
|
||||
if (this.httprequest.consent && (this.httprequest.consent & 0x40))
|
||||
{
|
||||
// Connection Bar is required
|
||||
MeshServerLog('Remote Desktop Connection Bar Activated/Updated (' + this.httprequest.remoteaddr + ')', this.httprequest);
|
||||
if(this.httprequest.desktop.kvm.connectionBar)
|
||||
{
|
||||
this.httprequest.desktop.kvm.connectionBar.removeAllListeners('close');
|
||||
this.httprequest.desktop.kvm.connectionBar.close();
|
||||
}
|
||||
this.httprequest.desktop.kvm.connectionBar = require('notifybar-desktop')('Sharing desktop with: ' + this.httprequest.desktop.kvm.users.sort().join(', '));
|
||||
this.httprequest.desktop.kvm.connectionBar.httprequest = this.httprequest;
|
||||
this.httprequest.desktop.kvm.connectionBar.on('close', function ()
|
||||
try
|
||||
{
|
||||
MeshServerLog('Remote Desktop Connection forcefully closed by local user (' + this.httprequest.remoteaddr + ')', this.httprequest);
|
||||
for (var i in this.httprequest.desktop.kvm._pipedStreams)
|
||||
this.httprequest.desktop.kvm.connectionBar = require('notifybar-desktop')('Sharing desktop with: ' + this.httprequest.desktop.kvm.users.sort().join(', '));
|
||||
MeshServerLog('Remote Desktop Connection Bar Activated/Updated (' + this.httprequest.remoteaddr + ')', this.httprequest);
|
||||
}
|
||||
catch(xx)
|
||||
{
|
||||
MeshServerLog('Remote Desktop Connection Bar Failed or not Supported (' + this.httprequest.remoteaddr + ')', this.httprequest);
|
||||
}
|
||||
if (this.httprequest.desktop.kvm.connectionBar)
|
||||
{
|
||||
this.httprequest.desktop.kvm.connectionBar.httprequest = this.httprequest;
|
||||
this.httprequest.desktop.kvm.connectionBar.on('close', function ()
|
||||
{
|
||||
this.httprequest.desktop.kvm._pipedStreams[i].end();
|
||||
}
|
||||
this.httprequest.desktop.kvm.end();
|
||||
});
|
||||
MeshServerLog('Remote Desktop Connection forcefully closed by local user (' + this.httprequest.remoteaddr + ')', this.httprequest);
|
||||
for (var i in this.httprequest.desktop.kvm._pipedStreams)
|
||||
{
|
||||
this.httprequest.desktop.kvm._pipedStreams[i].end();
|
||||
}
|
||||
this.httprequest.desktop.kvm.end();
|
||||
});
|
||||
}
|
||||
}
|
||||
this.httprequest.desktop.kvm.pipe(this, { dataTypeSkip: 1 });
|
||||
}
|
||||
@ -1764,6 +1787,39 @@ function createMeshCore(agent) {
|
||||
response = 'Available commands: \r\n' + fin + '.';
|
||||
break;
|
||||
}
|
||||
case 'safemode':
|
||||
if (process.platform != 'win32')
|
||||
{
|
||||
response = 'safemode only supported on Windows Platforms'
|
||||
}
|
||||
else
|
||||
{
|
||||
if (args['_'].length != 1)
|
||||
{
|
||||
response = 'Proper usage: safemode (ON|OFF|STATUS)'; // Display usage
|
||||
}
|
||||
else
|
||||
{
|
||||
switch(args['_'][0].toUpperCase())
|
||||
{
|
||||
default:
|
||||
response = 'Proper usage: safemode (ON|OFF|STATUS)'; // Display usage
|
||||
break;
|
||||
case 'ON':
|
||||
require('win-bcd').setKey('safeboot', 'Network');
|
||||
require('win-bcd').enableSafeModeService('Mesh Agent');
|
||||
break;
|
||||
case 'OFF':
|
||||
require('win-bcd').deleteKey('safeboot');
|
||||
break;
|
||||
case 'STATUS':
|
||||
var nextboot = require('win-bcd').getKey('safeboot');
|
||||
response = 'Current: ' + require('win-bcd').bootMode + ' , NextBoot: ' + (nextboot ? nextboot : 'NORMAL');
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
/*
|
||||
case 'border':
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user