From fa9ee756d20a77b7fd6beaf1c7c708cf71488007 Mon Sep 17 00:00:00 2001 From: Vadhvis Date: Tue, 9 Jul 2024 11:21:35 +0300 Subject: [PATCH 1/3] SSH Lag Fix --- tabby-ssh/src/polyfills.ts | 8 ++++++++ tabby-ssh/src/session/ssh.ts | 2 ++ 2 files changed, 10 insertions(+) diff --git a/tabby-ssh/src/polyfills.ts b/tabby-ssh/src/polyfills.ts index 0893d22e..8872290d 100644 --- a/tabby-ssh/src/polyfills.ts +++ b/tabby-ssh/src/polyfills.ts @@ -1,4 +1,12 @@ +import 'ssh2'; const nodeCrypto = require('crypto') const browserDH = require('diffie-hellman/browser') nodeCrypto.createDiffieHellmanGroup = browserDH.createDiffieHellmanGroup nodeCrypto.createDiffieHellman = browserDH.createDiffieHellman + +// Declare function missing from @types +declare module 'ssh2' { + interface Client { + setNoDelay(enable?: boolean): this; + } +} \ No newline at end of file diff --git a/tabby-ssh/src/session/ssh.ts b/tabby-ssh/src/session/ssh.ts index 6bc354ef..bb1de94d 100644 --- a/tabby-ssh/src/session/ssh.ts +++ b/tabby-ssh/src/session/ssh.ts @@ -218,6 +218,8 @@ export class SSHSession { const resultPromise: Promise = new Promise(async (resolve, reject) => { ssh.on('ready', () => { connected = true + // Fix SSH Lagging + ssh.setNoDelay(true); if (this.savedPassword) { this.passwordStorage.savePassword(this.profile, this.savedPassword) } From 4ed4d756c9589d91d1d3708b453da61aed444442 Mon Sep 17 00:00:00 2001 From: Vadhvis Date: Tue, 9 Jul 2024 11:32:02 +0300 Subject: [PATCH 2/3] Remove semicolons --- tabby-ssh/src/polyfills.ts | 4 ++-- tabby-ssh/src/session/ssh.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tabby-ssh/src/polyfills.ts b/tabby-ssh/src/polyfills.ts index 8872290d..da48c261 100644 --- a/tabby-ssh/src/polyfills.ts +++ b/tabby-ssh/src/polyfills.ts @@ -1,4 +1,4 @@ -import 'ssh2'; +import 'ssh2' const nodeCrypto = require('crypto') const browserDH = require('diffie-hellman/browser') nodeCrypto.createDiffieHellmanGroup = browserDH.createDiffieHellmanGroup @@ -7,6 +7,6 @@ nodeCrypto.createDiffieHellman = browserDH.createDiffieHellman // Declare function missing from @types declare module 'ssh2' { interface Client { - setNoDelay(enable?: boolean): this; + setNoDelay(enable?: boolean): this } } \ No newline at end of file diff --git a/tabby-ssh/src/session/ssh.ts b/tabby-ssh/src/session/ssh.ts index bb1de94d..2ad99325 100644 --- a/tabby-ssh/src/session/ssh.ts +++ b/tabby-ssh/src/session/ssh.ts @@ -219,7 +219,7 @@ export class SSHSession { ssh.on('ready', () => { connected = true // Fix SSH Lagging - ssh.setNoDelay(true); + ssh.setNoDelay(true) if (this.savedPassword) { this.passwordStorage.savePassword(this.profile, this.savedPassword) } From 2b65bb4b141640697934e9aa4f381f8869c688b7 Mon Sep 17 00:00:00 2001 From: Vadhvis Date: Tue, 9 Jul 2024 11:39:37 +0300 Subject: [PATCH 3/3] Linting Fix: Switch to function property --- tabby-ssh/src/polyfills.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tabby-ssh/src/polyfills.ts b/tabby-ssh/src/polyfills.ts index da48c261..06235b1f 100644 --- a/tabby-ssh/src/polyfills.ts +++ b/tabby-ssh/src/polyfills.ts @@ -7,6 +7,6 @@ nodeCrypto.createDiffieHellman = browserDH.createDiffieHellman // Declare function missing from @types declare module 'ssh2' { interface Client { - setNoDelay(enable?: boolean): this + setNoDelay: (enable?: boolean) => this } -} \ No newline at end of file +}