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:
parent
15c23eb7dd
commit
9c257b0002
@ -3,6 +3,7 @@ import { BaseSession } from 'terminus-terminal'
|
||||
export interface SSHConnection {
|
||||
name?: string
|
||||
host: string
|
||||
port: number
|
||||
user: string
|
||||
password?: string
|
||||
privateKey?: string
|
||||
|
@ -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(
|
||||
|
@ -3,7 +3,7 @@
|
||||
type='text',
|
||||
[(ngModel)]='quickTarget',
|
||||
autofocus,
|
||||
placeholder='Quick connect: [user@]host',
|
||||
placeholder='Quick connect: [user@]host[:port]',
|
||||
(keyup.enter)='quickConnect()'
|
||||
)
|
||||
|
||||
|
@ -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)
|
||||
|
@ -21,6 +21,7 @@ export class SSHSettingsTabComponent {
|
||||
let connection: SSHConnection = {
|
||||
name: '',
|
||||
host: '',
|
||||
port: 22,
|
||||
user: 'root',
|
||||
}
|
||||
let modal = this.ngbModal.open(EditConnectionModalComponent)
|
||||
|
@ -100,6 +100,7 @@ export class SSHService {
|
||||
|
||||
ssh.connect({
|
||||
host: connection.host,
|
||||
port: connection.port || 22,
|
||||
username: connection.user,
|
||||
password: privateKey ? undefined : '',
|
||||
privateKey,
|
||||
|
Loading…
Reference in New Issue
Block a user