diff --git a/keepassxc-browser/_locales/en/messages.json b/keepassxc-browser/_locales/en/messages.json index d586cc0..bff1136 100644 --- a/keepassxc-browser/_locales/en/messages.json +++ b/keepassxc-browser/_locales/en/messages.json @@ -1023,11 +1023,11 @@ "description": "Clear credentials timeout help text." }, "optionsConnectionTimeout": { - "message": "KeepassXC connection timeout (seconds, 2-60).", + "message": "KeepassXC connection timeout: $1 seconds", "description": "Connection timeout label text." }, "optionsConnectionTimeoutHelpText": { - "message": "When KeePassXC browser extension tries to connect to to keepass, this timeout value is used", + "message": "When KeePassXC browser extension tries to connect to to keepass, this timeout value is used. Default value is 1.5. Maximum is 60.0.", "description": "Connection timeout label text." }, "optionsVersionInfoText": { diff --git a/keepassxc-browser/background/keepass.js b/keepassxc-browser/background/keepass.js index 8ad3564..08dfdd9 100755 --- a/keepassxc-browser/background/keepass.js +++ b/keepassxc-browser/background/keepass.js @@ -804,11 +804,7 @@ keepass.disableAutomaticReconnect = function() { keepass.reconnectLoop = null; }; -keepass.reconnect = async function(tab = null, connectionTimeout = -1) { - if (connectionTimeout === -1) { - connectionTimeout = page.settings.connectionTimeout * 1000; - } - +keepass.reconnect = async function(tab = null, connectionTimeout = page.settings.connectionTimeout) { keepassClient.connectToNative(); keepass.generateNewKeyPair(); const keyChangeResult = await keepass.changePublicKeys(tab, !!connectionTimeout, connectionTimeout).catch(() => false); diff --git a/keepassxc-browser/background/page.js b/keepassxc-browser/background/page.js index fbe17ec..a0a76c1 100755 --- a/keepassxc-browser/background/page.js +++ b/keepassxc-browser/background/page.js @@ -14,7 +14,7 @@ const defaultSettings = { bannerPosition: BannerPosition.TOP, checkUpdateKeePassXC: CHECK_UPDATE_NEVER, clearCredentialsTimeout: 10, - connectionTimeout: 2, + connectionTimeout: 1500, colorTheme: 'system', credentialSorting: SORT_BY_GROUP_AND_TITLE, debugLogging: false, diff --git a/keepassxc-browser/managed_storage.json b/keepassxc-browser/managed_storage.json index a09abf0..1db4369 100644 --- a/keepassxc-browser/managed_storage.json +++ b/keepassxc-browser/managed_storage.json @@ -53,7 +53,7 @@ "type": "integer" }, "connectionTimeout": { - "title": "Connection timeout to KeePassXC. Default (seconds): 2", + "title": "Connection timeout to KeePassXC. Default (seconds): 1.5", "type": "integer" }, "colorTheme": { diff --git a/keepassxc-browser/options/options.html b/keepassxc-browser/options/options.html index 35683e0..d8e672d 100644 --- a/keepassxc-browser/options/options.html +++ b/keepassxc-browser/options/options.html @@ -534,10 +534,8 @@
- -
- -
+ +
diff --git a/keepassxc-browser/options/options.js b/keepassxc-browser/options/options.js index 840f8c3..fabab29 100644 --- a/keepassxc-browser/options/options.js +++ b/keepassxc-browser/options/options.js @@ -114,7 +114,7 @@ options.initGeneralSettings = async function() { $('#tab-general-settings input[type=radio]#checkUpdateOneMonth').value = CHECK_UPDATE_ONE_MONTH; $('#tab-general-settings input[type=radio]#checkUpdateNever').value = CHECK_UPDATE_NEVER; - $('#tab-general-settings input[type=range]').value = options.settings['redirectAllowance']; + $('#tab-general-settings #redirectAllowance').value = options.settings['redirectAllowance']; $('#redirectAllowanceLabel').textContent = tr('optionsRedirectAllowance', options.settings['redirectAllowance'] === 11 ? 'Infinite' : String(options.settings['redirectAllowance'])); @@ -124,7 +124,9 @@ options.initGeneralSettings = async function() { $('#tab-general-settings input#defaultGroup').value = options.settings['defaultGroup']; $('#tab-general-settings input#defaultPasskeyGroup').value = options.settings['defaultPasskeyGroup']; $('#tab-general-settings input#clearCredentialTimeout').value = options.settings['clearCredentialsTimeout']; - $('#tab-general-settings input#connectionTimeout').value = options.settings['connectionTimeout']; + const connectionTimeout = (options.settings['connectionTimeout']/1000); + $('#tab-general-settings input#connectionTimeout').value = connectionTimeout; + $('#connectionTimeoutLabel').textContent = tr('optionsConnectionTimeout', String(connectionTimeout)); const generalSettingsRadioInputs = document.querySelectorAll('#tab-general-settings input[type=radio]'); for (const radio of generalSettingsRadioInputs) { @@ -173,17 +175,22 @@ options.initGeneralSettings = async function() { await options.saveSettings(); }); + // Change label text dynamically with the range input + $('#tab-general-settings input#connectionTimeout').addEventListener('input', function(e) { + $('#connectionTimeoutLabel').textContent = tr('optionsConnectionTimeout', e.target.value); + }); + $('#tab-general-settings input#connectionTimeout').addEventListener('change', async function(e) { - if (e.target.valueAsNumber < 2 || e.target.valueAsNumber > 60) { + if (e.target.valueAsNumber < 1.5 || e.target.valueAsNumber > 60) { return; } - options.settings['connectionTimeout'] = e.target.valueAsNumber; + options.settings['connectionTimeout'] = e.target.valueAsNumber * 1000; await options.saveSettings(); }); // Change label text dynamically with the range input - $('#tab-general-settings input[type=range]').addEventListener('input', function(e) { + $('#tab-general-settings input#redirectAllowance').addEventListener('input', function(e) { const currentValue = e.target.valueAsNumber === 11 ? 'Infinite' : e.target.value; $('#redirectAllowanceLabel').textContent = tr('optionsRedirectAllowance', currentValue); });