Fixed connection options, not sent unless needed.

This commit is contained in:
Ylian Saint-Hilaire 2019-12-16 10:39:51 -08:00
parent afce306026
commit 4fb6a77d94
2 changed files with 7 additions and 3 deletions

View File

@ -1271,7 +1271,9 @@ 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; } //if (require('MeshAgent')._tsid != null) { tsid = require('MeshAgent')._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 };

View File

@ -1710,7 +1710,7 @@
} else if ((message.type == 'userSessions') && (currentNode != null) && (currentNode._id == message.nodeid) && (desktop == null)) { } else if ((message.type == 'userSessions') && (currentNode != null) && (currentNode._id == message.nodeid) && (desktop == null)) {
// Got list of user sessions // Got list of user sessions
var userSessions = []; var userSessions = [];
if (message.data != null) { for (var i in message.data) { if ((message.data[i].State == 'Active') || (debugmode == 3)) { userSessions.push(message.data[i]); } } } if (message.data != null) { for (var i in message.data) { if ((message.data[i].State == 'Active') || (message.data[i].StationName == 'Console') || (debugmode == 3)) { userSessions.push(message.data[i]); } } }
if (userSessions.length == 0) { connectDesktop(null, 1); } // No active sessions, do a normal connection. if (userSessions.length == 0) { connectDesktop(null, 1); } // No active sessions, do a normal connection.
else if (userSessions.length == 1) { connectDesktop(null, 1, userSessions[0].SessionId); } // One active session, connect to it else if (userSessions.length == 1) { connectDesktop(null, 1, userSessions[0].SessionId); } // One active session, connect to it
else { else {
@ -5165,6 +5165,8 @@
function autoConnectDesktop(e) { if (autoConnectDesktopTimer == null) { autoConnectDesktopTimer = setInterval(function() { connectDesktop(null, 1) }, 1000); } else { clearInterval(autoConnectDesktopTimer); autoConnectDesktopTimer = null; } } function autoConnectDesktop(e) { if (autoConnectDesktopTimer == null) { autoConnectDesktopTimer = setInterval(function() { connectDesktop(null, 1) }, 1000); } else { clearInterval(autoConnectDesktopTimer); autoConnectDesktopTimer = null; } }
function connectDesktop(e, contype, tsid) { function connectDesktop(e, contype, tsid) {
if (xxdialogMode) return;
if ((e != null) && (e.shiftKey == false) && (contype == 3)) { contype = 1; } // If the shift key is not pressed, don't try to ask for session list.
QV('p11DeskSessionSelector', false); QV('p11DeskSessionSelector', false);
p11clearConsoleMsg(); p11clearConsoleMsg();
if (desktop == null) { if (desktop == null) {
@ -5259,7 +5261,7 @@
desktop.debugmode = debugmode; desktop.debugmode = debugmode;
desktop.m.debugmode = debugmode; desktop.m.debugmode = debugmode;
desktop.attemptWebRTC = attemptWebRTC; desktop.attemptWebRTC = attemptWebRTC;
desktop.options = { tsid: tsid }; if (tsid != null) { desktop.options = { tsid: tsid }; }
desktop.onStateChanged = onDesktopStateChange; desktop.onStateChanged = onDesktopStateChange;
desktop.onConsoleMessageChange = function () { desktop.onConsoleMessageChange = function () {
p11clearConsoleMsg(); p11clearConsoleMsg();