Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
akriventsev committed May 22, 2023
1 parent f44eee3 commit 457bed6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 14 deletions.
16 changes: 5 additions & 11 deletions tabby-ssh/src/components/sshTab.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,14 @@ export class SSHTabComponent extends BaseTerminalTabComponent<SSHProfile> implem
super.onFrontendReady()
}

async setupOneSession (injector: Injector, profile: SSHProfile, multiplex = true,backoff=false): Promise<SSHSession> {
async setupOneSession (injector: Injector, profile: SSHProfile, multiplex = true, backoff=false): Promise<SSHSession> {
let session = await this.sshMultiplexer.getSession(profile)
if (!multiplex || !session || !profile.options.reuseSession) {

if (backoff) {
profile.options.host = profile.options.backoffHost
profile.options.port = profile.options.backoffPort
profile.options.backoff = true
profile.options.backoff = true
}

session = new SSHSession(injector, profile)
if (profile.options.jumpHost) {
const jumpConnection = (await this.profilesService.getProfiles()).find(x => x.id === profile.options.jumpHost)
Expand Down Expand Up @@ -183,23 +181,19 @@ export class SSHTabComponent extends BaseTerminalTabComponent<SSHProfile> implem
super.attachSessionHandlers()
}

private async initializeSessionMaybeMultiplex (multiplex = true,backoff = false): Promise<void> {
this.sshSession = await this.setupOneSession(this.injector, this.profile, multiplex,backoff)
private async initializeSessionMaybeMultiplex (multiplex = true, backoff = false): Promise<void> {
this.sshSession = await this.setupOneSession(this.injector, this.profile, multiplex, backoff)
const session = new SSHShellSession(this.injector, this.sshSession, this.profile)

this.setSession(session)
this.attachSessionHandler(session.serviceMessage$, msg => {
msg = msg.replace(/\n/g, '\r\n ')
this.write(`\r${colors.black.bgWhite(' SSH ')} ${msg}\r\n`)
session.resize(this.size.columns, this.size.rows)
})
await session.start()


if (this.config.store.ssh.clearServiceMessagesOnConnect) {
this.frontend?.clear()
}

this.session?.resize(this.size.columns, this.size.rows)
}

Expand All @@ -212,7 +206,7 @@ export class SSHTabComponent extends BaseTerminalTabComponent<SSHProfile> implem
await this.initializeSessionMaybeMultiplex(false)
} catch (e) {
try {
await this.initializeSessionMaybeMultiplex(false,true)
await this.initializeSessionMaybeMultiplex(false, true)
} catch (error) {
this.write(colors.black.bgRed(' X ') + ' ' + colors.red(e.message) + '\r\n')
return
Expand Down
1 change: 0 additions & 1 deletion tabby-ssh/src/session/shell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ export class SSHShellSession extends BaseSession {
this.setLoginScriptsOptions(this.profile.options)
this.ssh.serviceMessage$.subscribe(m => this.serviceMessage.next(m))
}

async start (): Promise<void> {
if (!this.ssh) {
throw new Error('SSH session not set')
Expand Down
3 changes: 1 addition & 2 deletions tabby-ssh/src/session/ssh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,7 @@ export class SSHSession {
}
return new SFTPSession(this.sftp, this.injector)
}

getAttempt() {
getAttempt (): number {
return this.attempt
}
async start (): Promise<void> {
Expand Down

0 comments on commit 457bed6

Please sign in to comment.