mirror of
https://github.com/Eugeny/tabby
synced 2024-12-13 14:52:45 +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 getNewTabParameters (profile: PartialProfile<P>): Promise<NewTabParameters<BaseTabComponent>>
|
||||
abstract getNewTabParameters (profile: P): Promise<NewTabParameters<BaseTabComponent>>
|
||||
|
||||
getSuggestedName (profile: PartialProfile<P>): string|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)
|
||||
|
||||
if (!profile.options?.cwd) {
|
||||
if (!profile.options.cwd) {
|
||||
if (this.app.activeTab instanceof TerminalTabComponent && this.app.activeTab.session) {
|
||||
profile.options ??= {}
|
||||
profile.options.cwd = await this.app.activeTab.session.getWorkingDirectory() ?? undefined
|
||||
}
|
||||
if (this.app.activeTab instanceof SplitTabComponent) {
|
||||
const focusedTab = this.app.activeTab.getFocusedTab()
|
||||
|
||||
if (focusedTab instanceof TerminalTabComponent && focusedTab.session) {
|
||||
profile.options ??= {}
|
||||
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 {
|
||||
type: SSHTabComponent,
|
||||
inputs: { profile },
|
||||
|
|
|
@ -28,8 +28,8 @@ export class SSHService {
|
|||
return this.detectedWinSCPPath ?? this.config.store.ssh.winSCPPath
|
||||
}
|
||||
|
||||
async getWinSCPURI (profile: SSHProfile, cwd?: string): Promise<string> {
|
||||
let uri = `scp://${profile.options.user}`
|
||||
async getWinSCPURI (profile: SSHProfile, cwd?: string, username?: string): Promise<string> {
|
||||
let uri = `scp://${username ?? profile.options.user}`
|
||||
const password = await this.passwordStorage.loadPassword(profile)
|
||||
if (password) {
|
||||
uri += ':' + encodeURIComponent(password)
|
||||
|
@ -43,7 +43,7 @@ export class SSHService {
|
|||
if (!path) {
|
||||
return
|
||||
}
|
||||
const args = [await this.getWinSCPURI(session.profile)]
|
||||
const args = [await this.getWinSCPURI(session.profile, undefined, session.authUsername ?? undefined)]
|
||||
if (session.activePrivateKey) {
|
||||
args.push('/privatekey')
|
||||
args.push(session.activePrivateKey)
|
||||
|
|
|
@ -56,12 +56,12 @@ export class SSHSession extends BaseSession {
|
|||
|
||||
agentPath?: string
|
||||
activePrivateKey: string|null = null
|
||||
authUsername: string|null = null
|
||||
|
||||
private remainingAuthMethods: AuthMethod[] = []
|
||||
private serviceMessage = new Subject<string>()
|
||||
private keyboardInteractivePrompt = new Subject<KeyboardInteractivePrompt>()
|
||||
private keychainPasswordUsed = false
|
||||
private authUsername: string|null = null
|
||||
|
||||
private passwordStorage: PasswordStorageService
|
||||
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 {
|
||||
type: TelnetTabComponent,
|
||||
inputs: { profile },
|
||||
|
|
Loading…
Reference in a new issue