From a20f3af5130a17199713d2e480e8d4760a8fda42 Mon Sep 17 00:00:00 2001 From: Seb Julliand Date: Mon, 27 May 2024 11:28:42 +0200 Subject: [PATCH 1/5] Added Keepalive interval login settings + fixed privatekeypath update Signed-off-by: Seb Julliand --- src/api/IBMi.ts | 2 +- src/locale/ids/da.json | 2 ++ src/locale/ids/en.json | 2 ++ src/locale/ids/fr.json | 2 ++ src/webviews/login/index.ts | 6 ++++-- src/webviews/settings/index.ts | 7 ++++++- 6 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/api/IBMi.ts b/src/api/IBMi.ts index 46af114f2..3ba5cb7eb 100644 --- a/src/api/IBMi.ts +++ b/src/api/IBMi.ts @@ -123,7 +123,7 @@ export default class IBMi { async connect(connectionObject: ConnectionData, reconnecting?: boolean, reloadServerSettings: boolean = false): Promise<{ success: boolean, error?: any }> { return await Tools.withContext("code-for-ibmi:connecting", async () => { try { - connectionObject.keepaliveInterval = 35000; + connectionObject.keepaliveInterval = connectionObject.keepaliveInterval === undefined ? 35000 : connectionObject.keepaliveInterval; configVars.replaceAll(connectionObject); diff --git a/src/locale/ids/da.json b/src/locale/ids/da.json index 5f3de6001..b1490a394 100644 --- a/src/locale/ids/da.json +++ b/src/locale/ids/da.json @@ -197,6 +197,8 @@ "JOB_STATUS": "Job status", "JOB_USER": "Job bruger", "jvm.info": "JVM information", + "keepaliveInterval":"Keepalive interval", + "keepaliveInterval.description":"How often (in milliseconds) to send SSH-level keepalive packets to the server. Set to 0 to disable.", "length": "Længde", "LibraryListView.addToLibraryList.addedLib": "Bibliotek {0} blev tilføjet til bibliotekslisten.", "LibraryListView.addToLibraryList.alreadyInList": "Bibliotek {0} er allerede i bibliotekslisten.", diff --git a/src/locale/ids/en.json b/src/locale/ids/en.json index faff6b5dd..ab97d02d2 100644 --- a/src/locale/ids/en.json +++ b/src/locale/ids/en.json @@ -197,6 +197,8 @@ "JOB_STATUS": "Job status", "JOB_USER": "Job user", "jvm.info": "JVM information", + "keepaliveInterval":"Keepalive interval", + "keepaliveInterval.description":"How often (in milliseconds) to send SSH-level keepalive packets to the server. Set to 0 to disable.", "length": "Length", "LibraryListView.addToLibraryList.addedLib": "Library {0} was added to the library list.", "LibraryListView.addToLibraryList.alreadyInList": "Library {0} was already in the library list.", diff --git a/src/locale/ids/fr.json b/src/locale/ids/fr.json index bf155d54c..8c6ae29bf 100644 --- a/src/locale/ids/fr.json +++ b/src/locale/ids/fr.json @@ -197,6 +197,8 @@ "JOB_STATUS": "Status du job", "JOB_USER": "Utilisateur", "jvm.info": "Information JVM", + "keepaliveInterval":"Intervalle keepalive", + "keepaliveInterval.description":"Définit l'intervalle (en millisecondes) entre deux envois au serveur SSH du signal keepalive. Mettre 0 pour désactiver.", "length": "Longueur", "LibraryListView.addToLibraryList.addedLib": "La bibliohtèque {0} a été ajoutée à la liste des bibliothèques.", "LibraryListView.addToLibraryList.alreadyInList": "La bibliohtèque {0} est déjà dans la liste des bibliothèques.", diff --git a/src/webviews/login/index.ts b/src/webviews/login/index.ts index b1924e58a..a49e7a7fd 100644 --- a/src/webviews/login/index.ts +++ b/src/webviews/login/index.ts @@ -1,10 +1,10 @@ import vscode from "vscode"; -import { ConnectionConfiguration, ConnectionManager, GlobalConfiguration } from "../../api/Configuration"; +import { ConnectionConfiguration, ConnectionManager } from "../../api/Configuration"; import { CustomUI, Section } from "../../api/CustomUI"; import IBMi from "../../api/IBMi"; import { disconnect, instance } from "../../instantiate"; -import { ConnectionData } from '../../typings'; import { t } from "../../locale"; +import { ConnectionData } from '../../typings'; type NewLoginSettings = ConnectionData & { savePassword: boolean @@ -30,6 +30,7 @@ export class Login { .addInput(`host`, t(`login.host`), undefined, { minlength: 1 }) .addInput(`port`, t(`login.port`), ``, { default: `22`, minlength: 1, maxlength: 5, regexTest: `^\\d+$` }) .addInput(`username`, t(`username`), undefined, { minlength: 1, maxlength: 10 }) + .addInput(`keepaliveInterval`, t('keepaliveInterval'), t('keepaliveInterval.description'), { default: '35000', regexTest: `^\\d*$` }) .addParagraph(t(`login.authDecision`)) .addPassword(`password`, t(`password`)) .addCheckbox(`savePassword`, t(`login.savePassword`)) @@ -55,6 +56,7 @@ export class Login { page.panel.dispose(); data.port = Number(data.port); + data.keepaliveInterval = Number(data.keepaliveInterval); data.privateKeyPath = data.privateKeyPath?.trim() ? data.privateKeyPath : undefined; if (data.name) { const existingConnection = ConnectionManager.getByName(data.name); diff --git a/src/webviews/settings/index.ts b/src/webviews/settings/index.ts index 91c90de98..d7147bca8 100644 --- a/src/webviews/settings/index.ts +++ b/src/webviews/settings/index.ts @@ -343,6 +343,7 @@ export class SettingsUI { .addInput(`host`, t(`login.host`), undefined, { default: stored.host, minlength: 1 }) .addInput(`port`, t(`login.port`), undefined, { default: String(stored.port), minlength: 1, maxlength: 5, regexTest: `^\\d+$` }) .addInput(`username`, t(`username`), undefined, { default: stored.username, minlength: 1 }) + .addInput(`keepaliveInterval`, t('keepaliveInterval'), t('keepaliveInterval.description'), { default: String(stored.keepaliveInterval !== undefined ? stored.keepaliveInterval : 35000), regexTest: `^\\d*$` }) .addParagraph(t(`login.authDecision`)) .addPassword(`password`, `${t(`password`)}${storedPassword ? ` (${t(`stored`)})` : ``}`, t(`login.password.label`)) .addFile(`privateKeyPath`, `${t(`privateKey`)}${stored.privateKeyPath ? ` (${t(`current`)}: ${stored.privateKeyPath})` : ``}`, t(`login.privateKey.label`) + ' ' + t(`login.privateKey.support`)) @@ -368,7 +369,7 @@ export class SettingsUI { default: if (data.password) { - data.privateKeyPath = undefined; + delete data.privateKeyPath; if (data.password !== storedPassword) { // New password was entered, so store the password // and remove the private key path from the data @@ -382,11 +383,15 @@ export class SettingsUI { await ConnectionManager.deleteStoredPassword(context, name); vscode.window.showInformationMessage(t(`login.privateKey.updated`, name)); } + else{ + delete data.privateKeyPath; + } break; } //Fix values before assigning the data data.port = Number(data.port); + data.keepaliveInterval = Number(data.keepaliveInterval); delete data.password; delete data.buttons; From cb9d1f34a170f6d26ee1c44e909986af95424c74 Mon Sep 17 00:00:00 2001 From: Seb Julliand Date: Mon, 27 May 2024 11:35:50 +0200 Subject: [PATCH 2/5] Store keepaliveInterval for new connections Signed-off-by: Seb Julliand --- src/webviews/login/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/webviews/login/index.ts b/src/webviews/login/index.ts index a49e7a7fd..94e5f13ec 100644 --- a/src/webviews/login/index.ts +++ b/src/webviews/login/index.ts @@ -69,6 +69,7 @@ export class Login { name: data.name, host: data.host, port: data.port, + keepaliveInterval: data.keepaliveInterval, username: data.username, privateKeyPath: data.privateKeyPath }; From 34fbacba9be7f48d3e9048034dadf6b578c184c2 Mon Sep 17 00:00:00 2001 From: Christian Jorgensen Date: Tue, 28 May 2024 18:03:22 +0200 Subject: [PATCH 3/5] Add danish translation --- src/locale/ids/da.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/locale/ids/da.json b/src/locale/ids/da.json index b1490a394..136f64f55 100644 --- a/src/locale/ids/da.json +++ b/src/locale/ids/da.json @@ -198,7 +198,7 @@ "JOB_USER": "Job bruger", "jvm.info": "JVM information", "keepaliveInterval":"Keepalive interval", - "keepaliveInterval.description":"How often (in milliseconds) to send SSH-level keepalive packets to the server. Set to 0 to disable.", + "keepaliveInterval.description":"Frekvens (millisekunder) for afsendelsen af SSH keepalive pakker til serveren. Sæt til 0 for at deaktivere.", "length": "Længde", "LibraryListView.addToLibraryList.addedLib": "Bibliotek {0} blev tilføjet til bibliotekslisten.", "LibraryListView.addToLibraryList.alreadyInList": "Bibliotek {0} er allerede i bibliotekslisten.", From 6ff3137bc8fed5da646d6023a25a374441233f58 Mon Sep 17 00:00:00 2001 From: Seb Julliand Date: Wed, 29 May 2024 13:00:21 +0200 Subject: [PATCH 4/5] Reverted private key fix Signed-off-by: Seb Julliand --- src/webviews/settings/index.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/webviews/settings/index.ts b/src/webviews/settings/index.ts index d7147bca8..7c635ac52 100644 --- a/src/webviews/settings/index.ts +++ b/src/webviews/settings/index.ts @@ -369,7 +369,7 @@ export class SettingsUI { default: if (data.password) { - delete data.privateKeyPath; + data.privateKeyPath = undefined; if (data.password !== storedPassword) { // New password was entered, so store the password // and remove the private key path from the data @@ -383,9 +383,6 @@ export class SettingsUI { await ConnectionManager.deleteStoredPassword(context, name); vscode.window.showInformationMessage(t(`login.privateKey.updated`, name)); } - else{ - delete data.privateKeyPath; - } break; } From 587bc3839dff09c2e1190536226196c48c165488 Mon Sep 17 00:00:00 2001 From: worksofliam Date: Tue, 4 Jun 2024 11:34:17 -0400 Subject: [PATCH 5/5] Build commit. Signed-off-by: worksofliam