diff --git a/terminus-ssh/src/api.ts b/terminus-ssh/src/api.ts index 339a4460..0a75d2e0 100644 --- a/terminus-ssh/src/api.ts +++ b/terminus-ssh/src/api.ts @@ -10,7 +10,7 @@ import stripAnsi from 'strip-ansi' import socksv5 from 'socksv5' import { Injector, NgZone } from '@angular/core' import { NgbModal } from '@ng-bootstrap/ng-bootstrap' -import { FileProvidersService, HostAppService, Logger, NotificationsService, Platform, PlatformService, wrapPromise } from 'terminus-core' +import { ConfigService, FileProvidersService, HostAppService, Logger, NotificationsService, Platform, PlatformService, wrapPromise } from 'terminus-core' import { BaseSession } from 'terminus-terminal' import { Server, Socket, createServer, createConnection } from 'net' import { Client, ClientChannel, SFTPWrapper } from 'ssh2' @@ -281,6 +281,7 @@ export class SSHSession extends BaseSession { private notifications: NotificationsService private zone: NgZone private fileProviders: FileProvidersService + private config: ConfigService constructor ( injector: Injector, @@ -294,6 +295,7 @@ export class SSHSession extends BaseSession { this.notifications = injector.get(NotificationsService) this.zone = injector.get(NgZone) this.fileProviders = injector.get(FileProvidersService) + this.config = injector.get(ConfigService) this.scripts = connection.scripts ?? [] this.destroyed$.subscribe(() => { @@ -307,12 +309,18 @@ export class SSHSession extends BaseSession { async init (): Promise { if (this.hostApp.platform === Platform.Windows) { - if (await fs.exists(WINDOWS_OPENSSH_AGENT_PIPE)) { - this.agentPath = WINDOWS_OPENSSH_AGENT_PIPE - } else { - if (await this.platform.isProcessRunning('pageant.exe')) { - this.agentPath = 'pageant' + if (this.config.store.ssh.agentType === 'auto') { + if (await fs.exists(WINDOWS_OPENSSH_AGENT_PIPE)) { + this.agentPath = WINDOWS_OPENSSH_AGENT_PIPE + } else { + if (await this.platform.isProcessRunning('pageant.exe')) { + this.agentPath = 'pageant' + } } + } else if (this.config.store.ssh.agentType === 'pageant') { + this.agentPath = 'pageant' + } else { + this.agentPath = this.config.store.ssh.agentPath || WINDOWS_OPENSSH_AGENT_PIPE } } else { this.agentPath = process.env.SSH_AUTH_SOCK! diff --git a/terminus-ssh/src/components/sshSettingsTab.component.pug b/terminus-ssh/src/components/sshSettingsTab.component.pug index d68b1100..cac683cc 100644 --- a/terminus-ssh/src/components/sshSettingsTab.component.pug +++ b/terminus-ssh/src/components/sshSettingsTab.component.pug @@ -64,10 +64,33 @@ h3.mt-5 Options .form-line(*ngIf='hostApp.platform === Platform.Windows') .header .title WinSCP path - .descriptions When WinSCP is detected, you can launch an SCP session from the context menu. + .description When WinSCP is detected, you can launch an SCP session from the context menu. input.form-control( type='text', placeholder='Auto-detect', [(ngModel)]='config.store.ssh.winSCPPath', (ngModelChange)='config.save()', ) + +.form-line(*ngIf='hostApp.platform === Platform.Windows') + .header + .title Agent type + .description Forces a specific SSH agent connection type. + select.form-control( + [(ngModel)]='config.store.ssh.agentType', + (ngModelChange)='config.save()', + ) + option(value='auto') Automatic + option(value='pageant') Pageant + option(value='pipe') Named pipe + +.form-line(*ngIf='config.store.ssh.agentType === "pipe"') + .header + .title Agent pipe path + .description Sets the SSH agent's named pipe path. + input.form-control( + type='text', + placeholder='Default: \\\\.\\pipe\\openssh-ssh-agent', + [(ngModel)]='config.store.ssh.agentPath', + (ngModelChange)='config.save()', + ) diff --git a/terminus-ssh/src/config.ts b/terminus-ssh/src/config.ts index 7f1b1724..dc459bed 100644 --- a/terminus-ssh/src/config.ts +++ b/terminus-ssh/src/config.ts @@ -8,6 +8,8 @@ export class SSHConfigProvider extends ConfigProvider { recentConnections: [], warnOnClose: false, winSCPPath: null, + agentType: 'auto', + agentPath: null, }, hotkeys: { ssh: [