feat: 🎸 Allow auto connect to SSH targets on windows (#1971)
This commit is contained in:
1 parent
7d6f3df140
commit
4a3d8eee63
4 files changed
+22
-12
No files matched your search
@@ -66,17 +66,17 @@ export default class SessionTerminalTabsComponent extends Component {
|
||||
this.id = uuidv4();
|
||||
this.#setupTerminal(fitAddon, xterm, termContainer);
|
||||
|
||||
const { isWindows } = await this.ipc.invoke('checkOS');
|
||||
const isSSHCommandAvailable = await this.ipc.invoke('checkCommand', 'ssh');
|
||||
const { model } = this.args;
|
||||
|
||||
const { proxy_address, proxy_port, started_desktop_client, target } = model;
|
||||
|
||||
// Only send the command on certain scenarios:
|
||||
// Only send the command in certain scenarios:
|
||||
// 1. Only for SSH targets
|
||||
// 2. Don't connect for windows as most users won't have an openSSH client installed
|
||||
// 3. Don't connect if the session wasn't initiated in the desktop client
|
||||
// 2. Don't connect if the session wasn't initiated in the desktop client
|
||||
// which means we won't have proxy information
|
||||
if (target?.isSSH && started_desktop_client && !isWindows) {
|
||||
// 3. Only connect if the user has an SSH client available in their path
|
||||
if (target?.isSSH && started_desktop_client && isSSHCommandAvailable) {
|
||||
// Send an SSH command immediately
|
||||
window.terminal.send(
|
||||
`ssh ${proxy_address} -p ${proxy_port} -o NoHostAuthenticationForLocalhost=yes\r`,
|
||||
|
||||
@@ -30,7 +30,8 @@
|
||||
"semver": "^7.5.3",
|
||||
"shell-env": "^3.0.1",
|
||||
"shell-quote": "^1.7.3",
|
||||
"tree-kill": "^1.2.2"
|
||||
"tree-kill": "^1.2.2",
|
||||
"which": "^4.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@electron-forge/cli": "^6.1.1",
|
||||
|
||||
@@ -13,6 +13,7 @@ const sanitizer = require('../utils/sanitizer.js');
|
||||
const { isLinux, isMac, isWindows } = require('../helpers/platform.js');
|
||||
const os = require('node:os');
|
||||
const pty = require('node-pty');
|
||||
const which = require('which');
|
||||
|
||||
/**
|
||||
* Returns the current runtime clusterUrl, which is used by the main thread to
|
||||
@@ -112,13 +113,9 @@ handle('toggleFullscreenWindow', () => {
|
||||
handle('closeWindow', () => app.quit());
|
||||
|
||||
/**
|
||||
* Return an object containing helper fields for determining what OS we're running on
|
||||
* Return the location of where a user's binary for a command is. If it isn't found, return null.
|
||||
*/
|
||||
handle('checkOS', () => ({
|
||||
isLinux: isLinux(),
|
||||
isMac: isMac(),
|
||||
isWindows: isWindows(),
|
||||
}));
|
||||
handle('checkCommand', async (command) => which(command, { nothrow: true }));
|
||||
|
||||
/**
|
||||
* Handler to help create terminal windows. We don't use the helper `handle` method
|
||||
|
||||
@@ -1962,6 +1962,11 @@ isexe@^2.0.0:
|
||||
resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10"
|
||||
integrity sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=
|
||||
|
||||
isexe@^3.1.1:
|
||||
version "3.1.1"
|
||||
resolved "https://registry.yarnpkg.com/isexe/-/isexe-3.1.1.tgz#4a407e2bd78ddfb14bea0c27c6f7072dde775f0d"
|
||||
integrity sha512-LpB/54B+/2J5hqQ7imZHfdU31OlgQqx7ZicVlkm9kzg9/w8GKLEcFfJl/t7DCEDueOyBAD6zCCwTO6Fzs0NoEQ==
|
||||
|
||||
jackspeak@^2.0.3:
|
||||
version "2.3.3"
|
||||
resolved "https://registry.yarnpkg.com/jackspeak/-/jackspeak-2.3.3.tgz#95e4cbcc03b3eb357bf6bcce14a903fb3d1151e1"
|
||||
@@ -3513,6 +3518,13 @@ which@^2.0.1, which@^2.0.2:
|
||||
dependencies:
|
||||
isexe "^2.0.0"
|
||||
|
||||
which@^4.0.0:
|
||||
version "4.0.0"
|
||||
resolved "https://registry.yarnpkg.com/which/-/which-4.0.0.tgz#cd60b5e74503a3fbcfbf6cd6b4138a8bae644c1a"
|
||||
integrity sha512-GlaYyEb07DPxYCKhKzplCWBJtvxZcZMrL+4UkrTSJHHPyZU4mYYTv3qaOe77H7EODLSSopAUFAc6W8U4yqvscg==
|
||||
dependencies:
|
||||
isexe "^3.1.1"
|
||||
|
||||
wide-align@^1.1.5:
|
||||
version "1.1.5"
|
||||
resolved "https://registry.yarnpkg.com/wide-align/-/wide-align-1.1.5.tgz#df1d4c206854369ecf3c9a4898f1b23fbd9d15d3"
|
||||
|
||||
Reference in new issue
Block a user