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 {
|
export interface SSHConnection {
|
||||||
name?: string
|
name?: string
|
||||||
host: string
|
host: string
|
||||||
|
port: number
|
||||||
user: string
|
user: string
|
||||||
password?: string
|
password?: string
|
||||||
privateKey?: string
|
privateKey?: string
|
||||||
|
@ -13,6 +13,14 @@
|
|||||||
[(ngModel)]='connection.host',
|
[(ngModel)]='connection.host',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
.form-group
|
||||||
|
label Port
|
||||||
|
input.form-control(
|
||||||
|
type='number',
|
||||||
|
placeholder='22',
|
||||||
|
[(ngModel)]='connection.post',
|
||||||
|
)
|
||||||
|
|
||||||
.form-group
|
.form-group
|
||||||
label Username
|
label Username
|
||||||
input.form-control(
|
input.form-control(
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
type='text',
|
type='text',
|
||||||
[(ngModel)]='quickTarget',
|
[(ngModel)]='quickTarget',
|
||||||
autofocus,
|
autofocus,
|
||||||
placeholder='Quick connect: [user@]host',
|
placeholder='Quick connect: [user@]host[:port]',
|
||||||
(keyup.enter)='quickConnect()'
|
(keyup.enter)='quickConnect()'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -31,12 +31,18 @@ export class SSHModalComponent {
|
|||||||
quickConnect () {
|
quickConnect () {
|
||||||
let user = 'root'
|
let user = 'root'
|
||||||
let host = this.quickTarget
|
let host = this.quickTarget
|
||||||
|
let port = 22
|
||||||
if (host.includes('@')) {
|
if (host.includes('@')) {
|
||||||
[user, host] = host.split('@')
|
[user, host] = host.split('@')
|
||||||
}
|
}
|
||||||
|
if (host.includes(':')) {
|
||||||
|
port = parseInt(host.split(':')[1])
|
||||||
|
host = host.split(':')[0]
|
||||||
|
}
|
||||||
|
|
||||||
let connection: SSHConnection = {
|
let connection: SSHConnection = {
|
||||||
name: this.quickTarget,
|
name: this.quickTarget,
|
||||||
host, user,
|
host, user, port
|
||||||
}
|
}
|
||||||
window.localStorage.lastConnection = JSON.stringify(connection)
|
window.localStorage.lastConnection = JSON.stringify(connection)
|
||||||
this.connect(connection)
|
this.connect(connection)
|
||||||
|
@ -21,6 +21,7 @@ export class SSHSettingsTabComponent {
|
|||||||
let connection: SSHConnection = {
|
let connection: SSHConnection = {
|
||||||
name: '',
|
name: '',
|
||||||
host: '',
|
host: '',
|
||||||
|
port: 22,
|
||||||
user: 'root',
|
user: 'root',
|
||||||
}
|
}
|
||||||
let modal = this.ngbModal.open(EditConnectionModalComponent)
|
let modal = this.ngbModal.open(EditConnectionModalComponent)
|
||||||
|
@ -100,6 +100,7 @@ export class SSHService {
|
|||||||
|
|
||||||
ssh.connect({
|
ssh.connect({
|
||||||
host: connection.host,
|
host: connection.host,
|
||||||
|
port: connection.port || 22,
|
||||||
username: connection.user,
|
username: connection.user,
|
||||||
password: privateKey ? undefined : '',
|
password: privateKey ? undefined : '',
|
||||||
privateKey,
|
privateKey,
|
||||||
|
Loading…
Reference in New Issue
Block a user