mirror of
https://github.com/Eugeny/tabby
synced 2024-11-15 01:17:14 +00:00
fixed #4931 - allow empty username to work with winscp integration
This commit is contained in:
parent
064bcb31d8
commit
8ff130ebfd
6 changed files with 9 additions and 11 deletions
|
@ -44,7 +44,7 @@ export abstract class ProfileProvider<P extends Profile> {
|
||||||
|
|
||||||
abstract getBuiltinProfiles (): Promise<PartialProfile<P>[]>
|
abstract getBuiltinProfiles (): Promise<PartialProfile<P>[]>
|
||||||
|
|
||||||
abstract getNewTabParameters (profile: PartialProfile<P>): Promise<NewTabParameters<BaseTabComponent>>
|
abstract getNewTabParameters (profile: P): Promise<NewTabParameters<BaseTabComponent>>
|
||||||
|
|
||||||
getSuggestedName (profile: PartialProfile<P>): string|null {
|
getSuggestedName (profile: PartialProfile<P>): string|null {
|
||||||
return null
|
return null
|
||||||
|
|
|
@ -45,19 +45,17 @@ export class LocalProfilesService extends ProfileProvider<LocalProfile> {
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
async getNewTabParameters (profile: PartialProfile<LocalProfile>): Promise<NewTabParameters<TerminalTabComponent>> {
|
async getNewTabParameters (profile: LocalProfile): Promise<NewTabParameters<TerminalTabComponent>> {
|
||||||
profile = deepClone(profile)
|
profile = deepClone(profile)
|
||||||
|
|
||||||
if (!profile.options?.cwd) {
|
if (!profile.options.cwd) {
|
||||||
if (this.app.activeTab instanceof TerminalTabComponent && this.app.activeTab.session) {
|
if (this.app.activeTab instanceof TerminalTabComponent && this.app.activeTab.session) {
|
||||||
profile.options ??= {}
|
|
||||||
profile.options.cwd = await this.app.activeTab.session.getWorkingDirectory() ?? undefined
|
profile.options.cwd = await this.app.activeTab.session.getWorkingDirectory() ?? undefined
|
||||||
}
|
}
|
||||||
if (this.app.activeTab instanceof SplitTabComponent) {
|
if (this.app.activeTab instanceof SplitTabComponent) {
|
||||||
const focusedTab = this.app.activeTab.getFocusedTab()
|
const focusedTab = this.app.activeTab.getFocusedTab()
|
||||||
|
|
||||||
if (focusedTab instanceof TerminalTabComponent && focusedTab.session) {
|
if (focusedTab instanceof TerminalTabComponent && focusedTab.session) {
|
||||||
profile.options ??= {}
|
|
||||||
profile.options.cwd = await focusedTab.session.getWorkingDirectory() ?? undefined
|
profile.options.cwd = await focusedTab.session.getWorkingDirectory() ?? undefined
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,7 +73,7 @@ export class SSHProfilesService extends ProfileProvider<SSHProfile> {
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
|
|
||||||
async getNewTabParameters (profile: PartialProfile<SSHProfile>): Promise<NewTabParameters<SSHTabComponent>> {
|
async getNewTabParameters (profile: SSHProfile): Promise<NewTabParameters<SSHTabComponent>> {
|
||||||
return {
|
return {
|
||||||
type: SSHTabComponent,
|
type: SSHTabComponent,
|
||||||
inputs: { profile },
|
inputs: { profile },
|
||||||
|
|
|
@ -28,8 +28,8 @@ export class SSHService {
|
||||||
return this.detectedWinSCPPath ?? this.config.store.ssh.winSCPPath
|
return this.detectedWinSCPPath ?? this.config.store.ssh.winSCPPath
|
||||||
}
|
}
|
||||||
|
|
||||||
async getWinSCPURI (profile: SSHProfile, cwd?: string): Promise<string> {
|
async getWinSCPURI (profile: SSHProfile, cwd?: string, username?: string): Promise<string> {
|
||||||
let uri = `scp://${profile.options.user}`
|
let uri = `scp://${username ?? profile.options.user}`
|
||||||
const password = await this.passwordStorage.loadPassword(profile)
|
const password = await this.passwordStorage.loadPassword(profile)
|
||||||
if (password) {
|
if (password) {
|
||||||
uri += ':' + encodeURIComponent(password)
|
uri += ':' + encodeURIComponent(password)
|
||||||
|
@ -43,7 +43,7 @@ export class SSHService {
|
||||||
if (!path) {
|
if (!path) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const args = [await this.getWinSCPURI(session.profile)]
|
const args = [await this.getWinSCPURI(session.profile, undefined, session.authUsername ?? undefined)]
|
||||||
if (session.activePrivateKey) {
|
if (session.activePrivateKey) {
|
||||||
args.push('/privatekey')
|
args.push('/privatekey')
|
||||||
args.push(session.activePrivateKey)
|
args.push(session.activePrivateKey)
|
||||||
|
|
|
@ -56,12 +56,12 @@ export class SSHSession extends BaseSession {
|
||||||
|
|
||||||
agentPath?: string
|
agentPath?: string
|
||||||
activePrivateKey: string|null = null
|
activePrivateKey: string|null = null
|
||||||
|
authUsername: string|null = null
|
||||||
|
|
||||||
private remainingAuthMethods: AuthMethod[] = []
|
private remainingAuthMethods: AuthMethod[] = []
|
||||||
private serviceMessage = new Subject<string>()
|
private serviceMessage = new Subject<string>()
|
||||||
private keyboardInteractivePrompt = new Subject<KeyboardInteractivePrompt>()
|
private keyboardInteractivePrompt = new Subject<KeyboardInteractivePrompt>()
|
||||||
private keychainPasswordUsed = false
|
private keychainPasswordUsed = false
|
||||||
private authUsername: string|null = null
|
|
||||||
|
|
||||||
private passwordStorage: PasswordStorageService
|
private passwordStorage: PasswordStorageService
|
||||||
private ngbModal: NgbModal
|
private ngbModal: NgbModal
|
||||||
|
|
|
@ -55,7 +55,7 @@ export class TelnetProfilesService extends ProfileProvider<TelnetProfile> {
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
async getNewTabParameters (profile: PartialProfile<TelnetProfile>): Promise<NewTabParameters<TelnetTabComponent>> {
|
async getNewTabParameters (profile: TelnetProfile): Promise<NewTabParameters<TelnetTabComponent>> {
|
||||||
return {
|
return {
|
||||||
type: TelnetTabComponent,
|
type: TelnetTabComponent,
|
||||||
inputs: { profile },
|
inputs: { profile },
|
||||||
|
|
Loading…
Reference in a new issue