1
1
mirror of https://github.com/Eugeny/tabby.git synced 2024-11-23 21:34:13 +03:00

allow specifying the SSH port (fixes #269)

This commit is contained in:
Eugene Pankov 2018-01-04 21:13:46 +01:00
parent 15c23eb7dd
commit 9c257b0002
6 changed files with 19 additions and 2 deletions

View File

@ -3,6 +3,7 @@ import { BaseSession } from 'terminus-terminal'
export interface SSHConnection {
name?: string
host: string
port: number
user: string
password?: string
privateKey?: string

View File

@ -13,6 +13,14 @@
[(ngModel)]='connection.host',
)
.form-group
label Port
input.form-control(
type='number',
placeholder='22',
[(ngModel)]='connection.post',
)
.form-group
label Username
input.form-control(

View File

@ -3,7 +3,7 @@
type='text',
[(ngModel)]='quickTarget',
autofocus,
placeholder='Quick connect: [user@]host',
placeholder='Quick connect: [user@]host[:port]',
(keyup.enter)='quickConnect()'
)

View File

@ -31,12 +31,18 @@ export class SSHModalComponent {
quickConnect () {
let user = 'root'
let host = this.quickTarget
let port = 22
if (host.includes('@')) {
[user, host] = host.split('@')
}
if (host.includes(':')) {
port = parseInt(host.split(':')[1])
host = host.split(':')[0]
}
let connection: SSHConnection = {
name: this.quickTarget,
host, user,
host, user, port
}
window.localStorage.lastConnection = JSON.stringify(connection)
this.connect(connection)

View File

@ -21,6 +21,7 @@ export class SSHSettingsTabComponent {
let connection: SSHConnection = {
name: '',
host: '',
port: 22,
user: 'root',
}
let modal = this.ngbModal.open(EditConnectionModalComponent)

View File

@ -100,6 +100,7 @@ export class SSHService {
ssh.connect({
host: connection.host,
port: connection.port || 22,
username: connection.user,
password: privateKey ? undefined : '',
privateKey,