diff --git a/terminus-settings/src/recoveryProvider.ts b/terminus-settings/src/recoveryProvider.ts index 442e7e2f..ae230c33 100644 --- a/terminus-settings/src/recoveryProvider.ts +++ b/terminus-settings/src/recoveryProvider.ts @@ -6,7 +6,7 @@ import { SettingsTabComponent } from './components/settingsTab.component' @Injectable() export class RecoveryProvider extends TabRecoveryProvider { async recover (recoveryToken: any): Promise { - if (recoveryToken.type === 'app:settings') { + if (recoveryToken && recoveryToken.type === 'app:settings') { return { type: SettingsTabComponent } } return null diff --git a/terminus-ssh/src/components/sshTab.component.ts b/terminus-ssh/src/components/sshTab.component.ts index ea609087..24c8ef92 100644 --- a/terminus-ssh/src/components/sshTab.component.ts +++ b/terminus-ssh/src/components/sshTab.component.ts @@ -53,4 +53,11 @@ export class SSHTabComponent extends BaseTerminalTabComponent { this.session.resize(this.size.columns, this.size.rows) this.session.start() } + + async getRecoveryToken (): Promise { + return { + type: 'app:ssh-tab', + connection: this.connection, + } + } } diff --git a/terminus-ssh/src/index.ts b/terminus-ssh/src/index.ts index cc94dddc..93d151df 100644 --- a/terminus-ssh/src/index.ts +++ b/terminus-ssh/src/index.ts @@ -3,7 +3,7 @@ import { CommonModule } from '@angular/common' import { FormsModule } from '@angular/forms' import { NgbModule } from '@ng-bootstrap/ng-bootstrap' import { ToastrModule } from 'ngx-toastr' -import TerminusCoreModule, { ToolbarButtonProvider, ConfigProvider } from 'terminus-core' +import TerminusCoreModule, { ToolbarButtonProvider, ConfigProvider, TabRecoveryProvider } from 'terminus-core' import { SettingsTabProvider } from 'terminus-settings' import { EditConnectionModalComponent } from './components/editConnectionModal.component' @@ -15,6 +15,7 @@ import { SSHTabComponent } from './components/sshTab.component' import { ButtonProvider } from './buttonProvider' import { SSHConfigProvider } from './config' import { SSHSettingsTabProvider } from './settings' +import { RecoveryProvider } from './recoveryProvider' @NgModule({ imports: [ @@ -28,6 +29,7 @@ import { SSHSettingsTabProvider } from './settings' { provide: ToolbarButtonProvider, useClass: ButtonProvider, multi: true }, { provide: ConfigProvider, useClass: SSHConfigProvider, multi: true }, { provide: SettingsTabProvider, useClass: SSHSettingsTabProvider, multi: true }, + { provide: TabRecoveryProvider, useClass: RecoveryProvider, multi: true }, ], entryComponents: [ EditConnectionModalComponent, diff --git a/terminus-ssh/src/recoveryProvider.ts b/terminus-ssh/src/recoveryProvider.ts new file mode 100644 index 00000000..b9966919 --- /dev/null +++ b/terminus-ssh/src/recoveryProvider.ts @@ -0,0 +1,17 @@ +import { Injectable } from '@angular/core' +import { TabRecoveryProvider, RecoveredTab } from 'terminus-core' + +import { SSHTabComponent } from './components/sshTab.component' + +@Injectable() +export class RecoveryProvider extends TabRecoveryProvider { + async recover (recoveryToken: any): Promise { + if (recoveryToken && recoveryToken.type === 'app:ssh-tab') { + return { + type: SSHTabComponent, + options: { connection: recoveryToken.connection }, + } + } + return null + } +} diff --git a/terminus-ssh/src/services/ssh.service.ts b/terminus-ssh/src/services/ssh.service.ts index 715e6b66..2c3f93bb 100644 --- a/terminus-ssh/src/services/ssh.service.ts +++ b/terminus-ssh/src/services/ssh.service.ts @@ -159,7 +159,6 @@ export class SSHService { keepaliveInterval: session.connection.keepaliveInterval, keepaliveCountMax: session.connection.keepaliveCountMax, readyTimeout: session.connection.readyTimeout, - debug: (...x) => console.log(...x), hostVerifier: digest => { log('SHA256 fingerprint: ' + digest) return true diff --git a/terminus-terminal/src/recoveryProvider.ts b/terminus-terminal/src/recoveryProvider.ts index 1c5f9ab7..c63fcef7 100644 --- a/terminus-terminal/src/recoveryProvider.ts +++ b/terminus-terminal/src/recoveryProvider.ts @@ -5,14 +5,8 @@ import { TerminalTabComponent } from './components/terminalTab.component' @Injectable() export class RecoveryProvider extends TabRecoveryProvider { - constructor ( - // private sessions: SessionsService, - ) { - super() - } - async recover (recoveryToken: any): Promise { - if (recoveryToken.type === 'app:terminal-tab') { + if (recoveryToken && recoveryToken.type === 'app:terminal-tab') { return { type: TerminalTabComponent, options: { sessionOptions: recoveryToken.sessionOptions },