mirror of
https://github.com/Eugeny/tabby.git
synced 2025-10-04 22:14:55 +00:00
reenabled @typescript-eslint/prefer-nullish-coalescing
This commit is contained in:
@@ -123,7 +123,7 @@ export class SSHSession extends BaseSession {
|
||||
|
||||
constructor (public connection: SSHConnection) {
|
||||
super()
|
||||
this.scripts = connection.scripts || []
|
||||
this.scripts = connection.scripts ?? []
|
||||
this.destroyed$.subscribe(() => {
|
||||
for (const port of this.forwardedPorts) {
|
||||
if (port.type === PortForwardType.Local) {
|
||||
@@ -232,7 +232,7 @@ export class SSHSession extends BaseSession {
|
||||
|
||||
this.ssh.on('x11', (details, accept, reject) => {
|
||||
this.logger.info(`Incoming X11 connection from ${details.srcIP}:${details.srcPort}`)
|
||||
const displaySpec = process.env.DISPLAY || ':0'
|
||||
const displaySpec = process.env.DISPLAY ?? ':0'
|
||||
this.logger.debug(`Trying display ${displaySpec}`)
|
||||
const xHost = displaySpec.split(':')[0]
|
||||
const xDisplay = parseInt(displaySpec.split(':')[1].split('.')[0] || '0')
|
||||
@@ -273,15 +273,14 @@ export class SSHSession extends BaseSession {
|
||||
await fw.startLocalListener((accept, reject, sourceAddress, sourcePort, targetAddress, targetPort) => {
|
||||
this.logger.info(`New connection on ${fw}`)
|
||||
this.ssh.forwardOut(
|
||||
sourceAddress || '127.0.0.1',
|
||||
sourcePort || 0,
|
||||
sourceAddress ?? '127.0.0.1',
|
||||
sourcePort ?? 0,
|
||||
targetAddress,
|
||||
targetPort,
|
||||
(err, stream) => {
|
||||
if (err) {
|
||||
this.emitServiceMessage(colors.bgRed.black(' X ') + ` Remote has rejected the forwarded connection to ${targetAddress}:${targetPort} via ${fw}: ${err}`)
|
||||
reject()
|
||||
return
|
||||
return reject()
|
||||
}
|
||||
if (stream) {
|
||||
const socket = accept()
|
||||
@@ -345,7 +344,7 @@ export class SSHSession extends BaseSession {
|
||||
|
||||
kill (signal?: string): void {
|
||||
if (this.shell) {
|
||||
this.shell.signal(signal || 'TERM')
|
||||
this.shell.signal(signal ?? 'TERM')
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -47,9 +47,9 @@ export class EditConnectionModalComponent {
|
||||
|
||||
async ngOnInit () {
|
||||
this.hasSavedPassword = !!await this.passwordStorage.loadPassword(this.connection)
|
||||
this.connection.algorithms = this.connection.algorithms || {}
|
||||
this.connection.scripts = this.connection.scripts || []
|
||||
this.connection.auth = this.connection.auth || null
|
||||
this.connection.algorithms = this.connection.algorithms ?? {}
|
||||
this.connection.scripts = this.connection.scripts ?? []
|
||||
this.connection.auth = this.connection.auth ?? null
|
||||
|
||||
for (const k of Object.values(SSHAlgorithmType)) {
|
||||
if (!this.connection.algorithms[k]) {
|
||||
|
@@ -127,7 +127,7 @@ export class SSHSettingsTabComponent {
|
||||
this.childGroups = []
|
||||
|
||||
for (const connection of this.connections) {
|
||||
connection.group = connection.group || null
|
||||
connection.group = connection.group ?? null
|
||||
let group = this.childGroups.find(x => x.name === connection.group)
|
||||
if (!group) {
|
||||
group = {
|
||||
|
@@ -249,12 +249,12 @@ export class SSHService {
|
||||
try {
|
||||
ssh.connect({
|
||||
host: session.connection.host,
|
||||
port: session.connection.port || 22,
|
||||
port: session.connection.port ?? 22,
|
||||
username: session.connection.user,
|
||||
password: session.connection.privateKey ? undefined : '',
|
||||
privateKey: privateKey || undefined,
|
||||
privateKey: privateKey ?? undefined,
|
||||
tryKeyboard: true,
|
||||
agent: agent || undefined,
|
||||
agent: agent ?? undefined,
|
||||
agentForward: session.connection.agentForward && !!agent,
|
||||
keepaliveInterval: session.connection.keepaliveInterval,
|
||||
keepaliveCountMax: session.connection.keepaliveCountMax,
|
||||
@@ -284,7 +284,7 @@ export class SSHService {
|
||||
} as any)
|
||||
} catch (e) {
|
||||
this.toastr.error(e.message)
|
||||
reject(e)
|
||||
return reject(e)
|
||||
}
|
||||
|
||||
let keychainPasswordUsed = false
|
||||
@@ -398,12 +398,10 @@ export class SSHService {
|
||||
{ connection }
|
||||
) as SSHTabComponent
|
||||
if (connection.color) {
|
||||
(this.app.getParentTab(tab) || tab).color = connection.color
|
||||
(this.app.getParentTab(tab) ?? tab).color = connection.color
|
||||
}
|
||||
|
||||
setTimeout(() => {
|
||||
this.app.activeTab?.emitFocused()
|
||||
})
|
||||
setTimeout(() => this.app.activeTab?.emitFocused())
|
||||
|
||||
return tab
|
||||
} catch (error) {
|
||||
|
Reference in New Issue
Block a user