electron 11 cleanup

This commit is contained in:
Eugene Pankov
2020-12-24 14:03:14 +01:00
parent e87f6e7af0
commit 0ca971a289
87 changed files with 9169 additions and 8285 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "terminus-ssh",
"version": "1.0.104-nightly.0",
"version": "1.0.123-nightly.0",
"description": "SSH connection manager for Terminus",
"keywords": [
"terminus-builtin-plugin"

View File

@@ -18,7 +18,7 @@ export enum SSHAlgorithmType {
HMAC = 'hmac',
KEX = 'kex',
CIPHER = 'cipher',
HOSTKEY = 'serverHostKey'
HOSTKEY = 'serverHostKey',
}
export interface SSHConnection {
@@ -45,7 +45,7 @@ export interface SSHConnection {
}
export enum PortForwardType {
Local, Remote, Dynamic
Local, Remote, Dynamic,
}
export class ForwardedPort {
@@ -230,11 +230,11 @@ export class SSHSession extends BaseSession {
this.ssh.on('x11', (details, accept, reject) => {
this.logger.info(`Incoming X11 connection from ${details.srcIP}:${details.srcPort}`)
let displaySpec = process.env.DISPLAY || ':0'
const displaySpec = process.env.DISPLAY || ':0'
this.logger.debug(`Trying display ${displaySpec}`)
let xHost = displaySpec.split(':')[0]
let xDisplay = parseInt(displaySpec.split(':')[1].split('.')[0] || '0')
let xPort = xDisplay < 100 ? xDisplay + 6000 : xDisplay
const xHost = displaySpec.split(':')[0]
const xDisplay = parseInt(displaySpec.split(':')[1].split('.')[0] || '0')
const xPort = xDisplay < 100 ? xDisplay + 6000 : xDisplay
const socket = displaySpec.startsWith('/') ? createConnection(displaySpec) : new Socket()
if (!displaySpec.startsWith('/')) {

View File

@@ -14,7 +14,7 @@ import { Subscription } from 'rxjs'
/** @hidden */
@Component({
selector: 'ssh-tab',
template: BaseTerminalTabComponent.template + require<string>('./sshTab.component.pug'),
template: BaseTerminalTabComponent.template + (require('./sshTab.component.pug') as string),
styles: [require('./sshTab.component.scss'), ...BaseTerminalTabComponent.styles],
animations: BaseTerminalTabComponent.animations,
})
@@ -91,7 +91,7 @@ export class SSHTabComponent extends BaseTerminalTabComponent {
session.serviceMessage$.subscribe(msg => {
this.write('\r\n' + colors.black.bgWhite(' SSH ') + ' ' + msg + '\r\n')
this.write(`\r\n${colors.black.bgWhite(' SSH ')} ${msg}\r\n`)
session.resize(this.size.columns, this.size.rows)
})

View File

@@ -87,7 +87,7 @@ export class SSHService {
try {
const result = await modal.result
passphrase = result?.value
} catch (e) { }
} catch { }
parsedKey = sshpk.parsePrivateKey(
privateKey,
'auto',
@@ -269,7 +269,7 @@ export class SSHService {
sock: session.jumpStream,
authHandler: methodsLeft => {
while (true) {
let method = authMethodsLeft.shift()
const method = authMethodsLeft.shift()
if (!method) {
return false
}
@@ -348,8 +348,8 @@ export class SSHService {
})
}
let groups: { name: string, connections: SSHConnection[] }[] = []
let connections = this.config.store.ssh.connections
const groups: { name: string, connections: SSHConnection[] }[] = []
const connections = this.config.store.ssh.connections
for (const connection of connections) {
connection.group = connection.group || null
let group = groups.find(x => x.name === connection.group)

View File

@@ -1,3 +1,4 @@
import type { MenuItemConstructorOptions } from 'electron'
import { execFile } from 'child_process'
import { Injectable } from '@angular/core'
import { ConfigService, BaseTabComponent, TabContextMenuItemProvider, TabHeaderComponent, HostAppService, Platform } from 'terminus-core'
@@ -36,7 +37,7 @@ export class WinSCPContextMenu extends TabContextMenuItemProvider {
}
}
async getItems (tab: BaseTabComponent, tabHeader?: TabHeaderComponent): Promise<Electron.MenuItemConstructorOptions[]> {
async getItems (tab: BaseTabComponent, tabHeader?: TabHeaderComponent): Promise<MenuItemConstructorOptions[]> {
if (this.hostApp.platform !== Platform.Windows || tabHeader) {
return []
}
@@ -75,7 +76,7 @@ export class WinSCPContextMenu extends TabContextMenuItemProvider {
if (!path) {
return
}
let args = [await this.getURI(connection)]
const args = [await this.getURI(connection)]
if ((!connection.auth || connection.auth === 'publicKey') && connection.privateKey) {
args.push('/privatekey')
args.push(connection.privateKey)