diff --git a/views/default.handlebars b/views/default.handlebars index 734bab46..4b8f2a17 100644 --- a/views/default.handlebars +++ b/views/default.handlebars @@ -743,7 +743,7 @@
- + Disconnected
@@ -801,7 +801,9 @@
- + + + Disconnected
@@ -2722,7 +2724,6 @@ if (message.localport) { url += '&localport=' + message.localport; } if (message.ip != null) { url += ('&remoteip=' + message.ip); } url += ('&appid=' + message.protocol + '&autoexit=1'); // Protocol: 0 = Custom, 1 = HTTP, 2 = HTTPS, 3 = RDP, 4 = PuTTY, 5 = WinSCP, 6 = MCRDesktop, 7 = MCRFiles - console.log(url); downloadFile(url, ''); } else if (message.tag == 'novnc') { var vncurl = window.location.origin + domainUrl + 'novnc/vnc.html?ws=wss%3A%2F%2F' + window.location.host + encodeURIComponentEx(domainUrl) + (message.localRelay?'local':'mesh') + 'relay.ashx%3Fauth%3D' + message.cookie + '&show_dot=1' + (urlargs.key?('&key=' + urlargs.key):'') + '&l={{{lang}}}'; @@ -9557,7 +9558,8 @@ // Show the right buttons QV('disconnectbutton2span', (termState == true)); - QV('connectbutton2span', (termState == false) && (terminalNode.agent != null) && (terminalNode.agent.caps & 2)); + QV('connectbutton2span', (termState == false) && (terminalNode.agent != null) && (terminalNode.agent.caps & 2) && (terminalNode.mtype != 3)); + QV('connectbutton2sspan', (termState == false) && (terminalNode.agent != null) && (terminalNode.agent.caps & 2) && (terminalNode.agent.id != 3) && (terminalNode.agent.id != 4)); if (terminalNode.mtype == 1) { QV('connectbutton2hspan', (termState == false) && (terminalNode.intelamt != null) && (terminalNode.intelamt.state == 2)); QV('terminalSizeDropDown', (termState == false) && (terminalNode.intelamt != null) && (terminalNode.intelamt.state == 2)); @@ -9568,7 +9570,7 @@ // Enable action button if mesh type is not "local devices" QV('termActionsBtn', terminalNode.mtype != 3); - if (terminalNode.mtype != 3) { + if (((termState == true) && (terminal.contype != 3)) || (terminalNode.agent.id == 3) || (terminalNode.agent.id == 4)) { QH('terminalCustomUpperRight', ''); } else { QH('terminalCustomUpperRight', '' + format("SSH Port {0}", (terminalNode.sshport?terminalNode.sshport:22)) + ''); @@ -9577,6 +9579,7 @@ // Enable buttons var online = ((terminalNode.conn & 1) != 0) || (terminalNode.mtype == 3); // If Agent (1) connected, enable Terminal QE('connectbutton2', online); + QE('connectbutton2s', online); var hwonline = ((terminalNode.conn & 6) != 0); // If CIRA (2) or AMT (4) connected, enable hardware terminal QE('connectbutton2h', hwonline); @@ -9612,7 +9615,10 @@ var xstate = state; if ((xstate == 3) && (xterminal.contype == 2)) { xstate++; } var str = StatusStrs[xstate]; - if (terminal.webRtcActive == true) { str += ", WebRTC"; } + if (xstate == 3) { + if (terminal.contype == 3) { str += ", SSH"; } + if (terminal.webRtcActive == true) { str += ", WebRTC"; } + } QH('termstatus', str); switch (state) { case 0: @@ -9777,6 +9783,7 @@ } } + // contype: 1 = Agent, 2 = AMT, 3 = SSH function connectTerminal(e, contype, options) { p12clearConsoleMsg(); if (!terminal) { @@ -9853,8 +9860,8 @@ }); // Setup a terminal tunnel to the agent - terminal = CreateAgentRedirect(meshserver, CreateRemoteTunnel((currentNode.mtype == 3)? sshTunnelUpdate : tunnelUpdate, termoptions), serverPublicNamePort, authCookie, authRelayCookie, domainUrl); - if (currentNode.mtype == 3) { terminal.urlname = 'sshterminalrelay.ashx'; } // If this is a SSH session, change the URL to the SSH application relay. + terminal = CreateAgentRedirect(meshserver, CreateRemoteTunnel((contype == 3)? sshTunnelUpdate : tunnelUpdate, termoptions), serverPublicNamePort, authCookie, authRelayCookie, domainUrl); + if (contype == 3) { terminal.urlname = 'sshterminalrelay.ashx'; } // If this is a SSH session, change the URL to the SSH application relay. terminal.debugmode = debugmode; terminal.m.debugmode = debugmode; terminal.options = termoptions; @@ -9862,7 +9869,7 @@ if (termoptions.requireLogin) { terminal.options.requireLogin = true; } terminal.Start(terminalNode._id); terminal.onStateChanged = onTerminalStateChange; - terminal.contype = 1; + terminal.contype = contype; terminal.attemptWebRTC = false; // Never do WebRTC on terminal, because of a race condition we can't do it. terminal.onConsoleMessageChange = function () { p12setConsoleMsg(terminal.consoleMessage ? formatAgentConsoleMessage(terminal.consoleMessage, terminal.consoleMessageId, terminal.consoleMessageArgs) : null, terminal.consoleMessageTimeout); } } else { @@ -9880,7 +9887,7 @@ terminal.onStateChanged = onTerminalStateChange; terminal.onConsoleMessageChange = function () { p12setConsoleMsg(terminal.consoleMessage ? formatAgentConsoleMessage(terminal.consoleMessage, terminal.consoleMessageId, terminal.consoleMessageArgs) : null, terminal.consoleMessageTimeout); } terminal.Start(terminalNode._id); - terminal.contype = 1; + terminal.contype = contype; terminal.m.terminalEmulation = 0; terminal.m.fxEmulation = 0; Q('id_ttypebutton').value = terminalEmulations[0]; @@ -9980,14 +9987,24 @@ filesNode = currentNode; var online = ((filesNode.conn & 1) != 0) || (filesNode.mtype == 3); // If Agent (1) connected, enable Terminal QE('p13Connect', online); + QE('p13Connects', online); + QV('p13Connect', files == null); + QV('p13Connects', (files == null) && (filesNode.agent != null) && (filesNode.agent.id != 3) && (filesNode.agent.id != 4)); + QV('p13Disconnect', files != null); if (((samenode == false) || (online == false)) && files) { files.Stop(); files = null; } p13setActions(); } function onFilesStateChange(xfiles, state) { - p13Connect.value = (state == 0) ? "Connect" : "Disconnect"; + QV('p13Connect', state == 0); + QV('p13Connects', state == 0); + QV('p13Disconnect', state != 0); + //p13Connect.value = (state == 0) ? "Connect" : "Disconnect"; var str = StatusStrs[state]; - if (files.webRtcActive == true) { str += ", WebRTC"; } + if (state == 3) { + if (files.contype == 2) { str += ", SFTP"; } + if (files.webRtcActive == true) { str += ", WebRTC"; } + } Q('p13Status').textContent = str; switch (state) { case 0: @@ -10033,12 +10050,14 @@ var autoConnectFilesTimer = null; function autoConnectFiles(e) { if (autoConnectFilesTimer == null) { autoConnectFilesTimer = setInterval(connectFiles, 100); } else { clearInterval(autoConnectFilesTimer); autoConnectFilesTimer = null; } } - function connectFiles(e) { + // 1 = Agent, 2 = SFTP + function connectFiles(e, contype) { p13clearConsoleMsg(); if (!files) { // Setup a mesh agent files files = CreateAgentRedirect(meshserver, CreateRemoteFiles(p13gotFiles), serverPublicNamePort, authCookie, authRelayCookie, domainUrl); - if (filesNode.mtype == 3) { files.urlname = 'sshfilesrelay.ashx'; } // If this is a SSH session, change the URL to the SSH application relay. + if (contype == 2) { files.urlname = 'sshfilesrelay.ashx'; } // If this is a SSH session, change the URL to the SSH application relay. + files.contype = contype; files.attemptWebRTC = attemptWebRTC; files.onStateChanged = onFilesStateChange; files.onConsoleMessageChange = function () { @@ -10340,7 +10359,8 @@ QE('p13ZipButton', advancedFeatures && (cc > 0) && ((p13filetreelocation.length > 0) || (winAgent == false))); QE('p13PasteButton', advancedFeatures && ((p13filetreelocation.length > 0) || (winAgent == false)) && ((p13clipboard != null) && (p13clipboard.length > 0))); } - if (filesNode.mtype != 3) { + var filesState = ((files != null) && (files.state != 0)); + if (((filesState == true) && (files.contype != 2)) || (filesNode.agent.id == 3) || (filesNode.agent.id == 4)) { QH('filesCustomUpperRight', ''); } else { QH('filesCustomUpperRight', '' + format("SSH Port {0}", (filesNode.sshport?filesNode.sshport:22)) + '');