mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2024-12-23 22:13:14 +03:00
updated tsid selection
This commit is contained in:
parent
da1a8951df
commit
0d6a70250f
@ -1151,19 +1151,26 @@ function createMeshCore(agent) {
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Logged in user
|
// Logged in user
|
||||||
var username = require('user-sessions').getUsername(require('user-sessions').consoleUid());
|
var userPromise = require('user-sessions').enumerateUsers();
|
||||||
|
userPromise.that = this;
|
||||||
|
userPromise.then(function (u)
|
||||||
|
{
|
||||||
|
var that = this.that;
|
||||||
|
if (u.Active.length > 0)
|
||||||
|
{
|
||||||
|
var username = u.Active[0].Username;
|
||||||
if (require('win-virtual-terminal').supported)
|
if (require('win-virtual-terminal').supported)
|
||||||
{
|
{
|
||||||
// ConPTY PseudoTerminal
|
// ConPTY PseudoTerminal
|
||||||
this.httprequest._dispatcher = require('win-dispatcher').dispatch({ user: username, modules: [{ name: 'win-virtual-terminal', script: getJSModule('win-virtual-terminal') }], launch: { module: 'win-virtual-terminal', method: (this.httprequest.protocol == 9 ? 'StartPowerShell' : 'Start'), args: [80, 25] } });
|
that.httprequest._dispatcher = require('win-dispatcher').dispatch({ user: username, modules: [{ name: 'win-virtual-terminal', script: getJSModule('win-virtual-terminal') }], launch: { module: 'win-virtual-terminal', method: (that.httprequest.protocol == 9 ? 'StartPowerShell' : 'Start'), args: [80, 25] } });
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Legacy Terminal
|
// Legacy Terminal
|
||||||
this.httprequest._dispatcher = require('win-dispatcher').dispatch({ user: username, modules: [{ name: 'win-terminal', script: getJSModule('win-terminal') }], launch: { module: 'win-terminal', method: (this.httprequest.protocol == 9 ? 'StartPowerShell' : 'Start'), args: [80, 25] } });
|
that.httprequest._dispatcher = require('win-dispatcher').dispatch({ user: username, modules: [{ name: 'win-terminal', script: getJSModule('win-terminal') }], launch: { module: 'win-terminal', method: (that.httprequest.protocol == 9 ? 'StartPowerShell' : 'Start'), args: [80, 25] } });
|
||||||
}
|
}
|
||||||
this.httprequest._dispatcher.ws = this;
|
that.httprequest._dispatcher.ws = that;
|
||||||
this.httprequest._dispatcher.on('connection', function (c)
|
that.httprequest._dispatcher.on('connection', function (c)
|
||||||
{
|
{
|
||||||
console.log('client connected');
|
console.log('client connected');
|
||||||
this.ws._term = c;
|
this.ws._term = c;
|
||||||
@ -1175,6 +1182,8 @@ function createMeshCore(agent) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
} catch (e)
|
} catch (e)
|
||||||
{
|
{
|
||||||
MeshServerLog('Failed to start remote terminal session, ' + e.toString() + ' (' + this.httprequest.remoteaddr + ')', this.httprequest);
|
MeshServerLog('Failed to start remote terminal session, ' + e.toString() + ' (' + this.httprequest.remoteaddr + ')', this.httprequest);
|
||||||
@ -1271,9 +1280,7 @@ function createMeshCore(agent) {
|
|||||||
// Look for a TSID
|
// Look for a TSID
|
||||||
var tsid = null;
|
var tsid = null;
|
||||||
if ((this.httprequest.xoptions != null) && (typeof this.httprequest.xoptions.tsid == 'number')) { tsid = this.httprequest.xoptions.tsid; }
|
if ((this.httprequest.xoptions != null) && (typeof this.httprequest.xoptions.tsid == 'number')) { tsid = this.httprequest.xoptions.tsid; }
|
||||||
//if (require('MeshAgent')._tsid != null) { tsid = require('MeshAgent')._tsid; }
|
require('MeshAgent')._tsid = tsid;
|
||||||
//sendConsoleText('tsid: ' + tsid);
|
|
||||||
//require('MeshAgent')._tsid = tsid;
|
|
||||||
|
|
||||||
// Remote desktop using native pipes
|
// Remote desktop using native pipes
|
||||||
this.httprequest.desktop = { state: 0, kvm: mesh.getRemoteDesktopStream(tsid), tunnel: this };
|
this.httprequest.desktop = { state: 0, kvm: mesh.getRemoteDesktopStream(tsid), tunnel: this };
|
||||||
|
Loading…
Reference in New Issue
Block a user