Terminal SSH improvements.
Ylian Saint-Hilaire committed
May 8, 2021 at 19:11 UTC
33364c4f4cfb98a475c7986ba628345a0da5b0e9
1 file changed
+10
-3
views/default.handlebars
+10
-3
@@ -5270,7 +5270,7 @@
5270
switch (cmenu) {
5271
case 'termConnectButton': {
5272
// Terminal connect button context menu
5273
- if ((currentNode == null) || (currentNode.agent == null)) return true;
5273
+ if ((currentNode == null) || (currentNode.agent == null) || (currentNode.mtype == 3)) return true;
5274
5275
// If the server has a specific terminal shell mode, don't show connection options
5276
if (serverinfo.linuxshell && (currentNode.agent.id > 4)) return;
@@ -8662,7 +8662,7 @@
8662
var x = '';
8663
x += addHtmlValue("Username", '<input id=dp2user style=width:230px maxlength=64 autocomplete=off onkeyup=sshAuthKeyUp(event) />');
8664
x += addHtmlValue("Password", '<input type=password id=dp2pass style=width:230px maxlength=64 autocomplete=off onkeyup=sshAuthKeyUp(event) />');
8665
- setDialogMode(2, "Authentication", 3, sshConnectEx, x);
8665
+ setDialogMode(2, "Authentication", 11, sshConnectEx, x, 'ssh');
8666
setTimeout(sshAuthKeyUp, 50);
8667
}
8668
}
@@ -8671,7 +8671,13 @@
8671
}
8672
8673
function sshAuthKeyUp(e) { QE('idx_dlgOkButton', (Q('dp2user').value.length > 0) && (Q('dp2pass').value.length > 0)); }
8674
- function sshConnectEx() { terminal.socket.send(JSON.stringify({ action: 'sshauth', username: Q('dp2user').value, password: Q('dp2pass').value, cols: xterm.cols, rows: xterm.rows, width: Q('termarea3xdiv').offsetWidth, height: Q('termarea3xdiv').offsetHeight })); }
8674
+ function sshConnectEx(b) {
8675
+ if (b == 0) {
8676
+ if (terminal != null) { connectTerminal(); } // Disconnect
8677
+ } else {
8678
+ terminal.socket.send(JSON.stringify({ action: 'sshauth', username: Q('dp2user').value, password: Q('dp2pass').value, cols: xterm.cols, rows: xterm.rows, width: Q('termarea3xdiv').offsetWidth, height: Q('termarea3xdiv').offsetHeight }));
8679
+ }
8680
+ }
8681
8682
// Send the new terminal size to the agent
8683
function xTermSendResize() {
@@ -8814,6 +8820,7 @@
8820
}
8821
} else {
8822
//QH('Term', '');
8823
+ if (xxdialogTag == 'ssh') { setDialogMode(0); }
8824
terminal.Stop();
8825
terminal = null;
8826
if (fullscreen) { deskToggleFull(); }