mirror of
https://github.com/Eugeny/tabby.git
synced 2025-07-20 02:18:01 +00:00
Merge pull request #8726 from Clem-Fern/profiles-rework
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { BaseTerminalProfile, InputProcessingOptions, LoginScriptsOptions } from 'tabby-terminal'
|
||||
import { ConnectableTerminalProfile, InputProcessingOptions, LoginScriptsOptions } from 'tabby-terminal'
|
||||
|
||||
export enum SSHAlgorithmType {
|
||||
HMAC = 'hmac',
|
||||
@@ -7,7 +7,7 @@ export enum SSHAlgorithmType {
|
||||
HOSTKEY = 'serverHostKey',
|
||||
}
|
||||
|
||||
export interface SSHProfile extends BaseTerminalProfile {
|
||||
export interface SSHProfile extends ConnectableTerminalProfile {
|
||||
options: SSHProfileOptions
|
||||
}
|
||||
|
||||
|
@@ -113,8 +113,8 @@ export class SFTPPanelComponent {
|
||||
|
||||
async openCreateDirectoryModal (): Promise<void> {
|
||||
const modal = this.ngbModal.open(SFTPCreateDirectoryModalComponent)
|
||||
const directoryName = await modal.result
|
||||
if (directoryName !== '') {
|
||||
const directoryName = await modal.result.catch(() => null)
|
||||
if (directoryName?.trim()) {
|
||||
this.sftp.mkdir(path.join(this.path, directoryName)).then(() => {
|
||||
this.notifications.notice('The directory was created successfully')
|
||||
this.navigate(path.join(this.path, directoryName))
|
||||
|
@@ -75,7 +75,7 @@ export class SSHProfileSettingsComponent {
|
||||
modal.componentInstance.prompt = `Password for ${this.profile.options.user}@${this.profile.options.host}`
|
||||
modal.componentInstance.password = true
|
||||
try {
|
||||
const result = await modal.result
|
||||
const result = await modal.result.catch(() => null)
|
||||
if (result?.value) {
|
||||
this.passwordStorage.savePassword(this.profile, result.value)
|
||||
this.hasSavedPassword = true
|
||||
@@ -89,11 +89,13 @@ export class SSHProfileSettingsComponent {
|
||||
}
|
||||
|
||||
async addPrivateKey () {
|
||||
const ref = await this.fileProviders.selectAndStoreFile(`private key for ${this.profile.name}`)
|
||||
this.profile.options.privateKeys = [
|
||||
...this.profile.options.privateKeys!,
|
||||
ref,
|
||||
]
|
||||
const ref = await this.fileProviders.selectAndStoreFile(`private key for ${this.profile.name}`).catch(() => null)
|
||||
if (ref) {
|
||||
this.profile.options.privateKeys = [
|
||||
...this.profile.options.privateKeys!,
|
||||
ref,
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
removePrivateKey (path: string) {
|
||||
|
@@ -61,12 +61,4 @@ h3 SSH
|
||||
(ngModelChange)='config.save()'
|
||||
)
|
||||
|
||||
.form-line
|
||||
.header
|
||||
.title(translate) Clear terminal after connection
|
||||
toggle(
|
||||
[(ngModel)]='config.store.ssh.clearServiceMessagesOnConnect',
|
||||
(ngModelChange)='config.save()',
|
||||
)
|
||||
|
||||
.alert.alert-info(translate) SSH connection management is now done through the "Profiles & connections" tab
|
||||
|
@@ -83,7 +83,7 @@ export class SSHTabComponent extends ConnectableTerminalTabComponent<SSHProfile>
|
||||
|
||||
const jumpSession = await this.setupOneSession(
|
||||
this.injector,
|
||||
this.profilesService.getConfigProxyForProfile(jumpConnection),
|
||||
this.profilesService.getConfigProxyForProfile<SSHProfile>(jumpConnection),
|
||||
)
|
||||
|
||||
jumpSession.ref()
|
||||
@@ -163,10 +163,6 @@ export class SSHTabComponent extends ConnectableTerminalTabComponent<SSHProfile>
|
||||
|
||||
await session.start()
|
||||
|
||||
if (this.config.store.ssh.clearServiceMessagesOnConnect) {
|
||||
this.frontend?.clear()
|
||||
}
|
||||
|
||||
this.session?.resize(this.size.columns, this.size.rows)
|
||||
}
|
||||
|
||||
|
@@ -11,7 +11,6 @@ export class SSHConfigProvider extends ConfigProvider {
|
||||
x11Display: null,
|
||||
knownHosts: [],
|
||||
verifyHostKeys: true,
|
||||
clearServiceMessagesOnConnect: true,
|
||||
},
|
||||
hotkeys: {
|
||||
'restart-ssh-session': [],
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import { Injectable, InjectFlags, Injector } from '@angular/core'
|
||||
import { ProfileProvider, NewTabParameters, PartialProfile, TranslateService } from 'tabby-core'
|
||||
import { NewTabParameters, PartialProfile, TranslateService, QuickConnectProfileProvider } from 'tabby-core'
|
||||
import * as ALGORITHMS from 'ssh2/lib/protocol/constants'
|
||||
import { SSHProfileSettingsComponent } from './components/sshProfileSettings.component'
|
||||
import { SSHTabComponent } from './components/sshTab.component'
|
||||
@@ -8,10 +8,9 @@ import { ALGORITHM_BLACKLIST, SSHAlgorithmType, SSHProfile } from './api'
|
||||
import { SSHProfileImporter } from './api/importer'
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class SSHProfilesService extends ProfileProvider<SSHProfile> {
|
||||
export class SSHProfilesService extends QuickConnectProfileProvider<SSHProfile> {
|
||||
id = 'ssh'
|
||||
name = 'SSH'
|
||||
supportsQuickConnect = true
|
||||
settingsComponent = SSHProfileSettingsComponent
|
||||
configDefaults = {
|
||||
options: {
|
||||
@@ -45,6 +44,7 @@ export class SSHProfilesService extends ProfileProvider<SSHProfile> {
|
||||
reuseSession: true,
|
||||
input: { backspace: 'backspace' },
|
||||
},
|
||||
clearServiceMessagesOnConnect: true,
|
||||
}
|
||||
|
||||
constructor (
|
||||
|
@@ -34,7 +34,7 @@ export class SSHMultiplexerService {
|
||||
if (!jumpConnection) {
|
||||
return key
|
||||
}
|
||||
const jumpProfile = this.profilesService.getConfigProxyForProfile(jumpConnection)
|
||||
const jumpProfile = this.profilesService.getConfigProxyForProfile<SSHProfile>(jumpConnection)
|
||||
key += '$' + await this.getMultiplexerKey(jumpProfile)
|
||||
}
|
||||
return key
|
||||
|
@@ -210,7 +210,6 @@ export class SSHSession {
|
||||
if (!await this.verifyHostKey(handshake)) {
|
||||
this.ssh.end()
|
||||
reject(new Error('Host key verification failed'))
|
||||
return
|
||||
}
|
||||
this.logger.info('Handshake complete:', handshake)
|
||||
resolve()
|
||||
@@ -300,7 +299,7 @@ export class SSHSession {
|
||||
const modal = this.ngbModal.open(PromptModalComponent)
|
||||
modal.componentInstance.prompt = `Username for ${this.profile.options.host}`
|
||||
try {
|
||||
const result = await modal.result
|
||||
const result = await modal.result.catch(() => null)
|
||||
this.authUsername = result?.value ?? null
|
||||
} catch {
|
||||
this.authUsername = 'root'
|
||||
@@ -428,11 +427,7 @@ export class SSHSession {
|
||||
const modal = this.ngbModal.open(HostKeyPromptModalComponent)
|
||||
modal.componentInstance.selector = selector
|
||||
modal.componentInstance.digest = this.hostKeyDigest
|
||||
try {
|
||||
return await modal.result
|
||||
} catch {
|
||||
return false
|
||||
}
|
||||
return modal.result.catch(() => false)
|
||||
}
|
||||
return true
|
||||
}
|
||||
@@ -495,7 +490,7 @@ export class SSHSession {
|
||||
modal.componentInstance.showRememberCheckbox = true
|
||||
|
||||
try {
|
||||
const result = await modal.result
|
||||
const result = await modal.result.catch(() => null)
|
||||
if (result) {
|
||||
if (result.remember) {
|
||||
this.savedPassword = result.value
|
||||
|
@@ -53,6 +53,6 @@ export class CommonSFTPContextMenu extends SFTPContextMenuItemProvider {
|
||||
const modal = this.ngbModal.open(SFTPDeleteModalComponent)
|
||||
modal.componentInstance.item = item
|
||||
modal.componentInstance.sftp = session
|
||||
await modal.result
|
||||
await modal.result.catch(() => {return})
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user