mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2024-12-27 07:35:53 -05:00
updated tsid selection
This commit is contained in:
parent
42ecc12fe5
commit
e82f9dd912
@ -1151,19 +1151,26 @@ function createMeshCore(agent) {
|
||||
else
|
||||
{
|
||||
// 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)
|
||||
{
|
||||
// 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
|
||||
{
|
||||
// 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;
|
||||
this.httprequest._dispatcher.on('connection', function (c)
|
||||
that.httprequest._dispatcher.ws = that;
|
||||
that.httprequest._dispatcher.on('connection', function (c)
|
||||
{
|
||||
console.log('client connected');
|
||||
this.ws._term = c;
|
||||
@ -1175,6 +1182,8 @@ function createMeshCore(agent) {
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
} catch (e)
|
||||
{
|
||||
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
|
||||
var tsid = null;
|
||||
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; }
|
||||
//sendConsoleText('tsid: ' + tsid);
|
||||
//require('MeshAgent')._tsid = tsid;
|
||||
require('MeshAgent')._tsid = tsid;
|
||||
|
||||
// Remote desktop using native pipes
|
||||
this.httprequest.desktop = { state: 0, kvm: mesh.getRemoteDesktopStream(tsid), tunnel: this };
|
||||
|
Loading…
Reference in New Issue
Block a user