diff --git a/keepassxc-browser/_locales/en/messages.json b/keepassxc-browser/_locales/en/messages.json index b58595d0..bff11360 100644 --- a/keepassxc-browser/_locales/en/messages.json +++ b/keepassxc-browser/_locales/en/messages.json @@ -1022,6 +1022,14 @@ "message": "Credentials are cleared from background tabs after the timeout and permissions for those pages will be asked again.", "description": "Clear credentials timeout help text." }, + "optionsConnectionTimeout": { + "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. Default value is 1.5. Maximum is 60.0.", + "description": "Connection timeout label text." + }, "optionsVersionInfoText": { "message": "KeePassXC-Browser needs KeePassXC to retrieve credentials.", "description": "Settings page version info text." diff --git a/keepassxc-browser/background/keepass.js b/keepassxc-browser/background/keepass.js index c1d13670..31ab97f0 100755 --- a/keepassxc-browser/background/keepass.js +++ b/keepassxc-browser/background/keepass.js @@ -804,7 +804,12 @@ keepass.disableAutomaticReconnect = function() { keepass.reconnectLoop = null; }; -keepass.reconnect = async function(tab = null, connectionTimeout = 1500) { +keepass.reconnect = async function(tab = null, connectionTimeout = CONNECTION_TIMEOUT) { + if (arguments.length < 2) { + connectionTimeout = page.settings.connectionTimeout; + } + + connectionTimeout = Math.min(60000, Math.max(CONNECTION_TIMEOUT, 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 4020a1b4..c2fce28b 100755 --- a/keepassxc-browser/background/page.js +++ b/keepassxc-browser/background/page.js @@ -14,6 +14,7 @@ const defaultSettings = { bannerPosition: BannerPosition.TOP, checkUpdateKeePassXC: CHECK_UPDATE_NEVER, clearCredentialsTimeout: 10, + connectionTimeout: CONNECTION_TIMEOUT, colorTheme: 'system', credentialSorting: SORT_BY_GROUP_AND_TITLE, debugLogging: false, @@ -47,6 +48,7 @@ page.autoSubmitPerformed = false; page.attributeMenuItems = []; page.blockedTabs = []; page.clearCredentialsTimeout = null; +page.connectionTimeout = null; page.currentRequest = {}; page.currentTabId = -1; page.isFirefox = false; diff --git a/keepassxc-browser/common/global.js b/keepassxc-browser/common/global.js index 10f58f60..bcf5a44a 100755 --- a/keepassxc-browser/common/global.js +++ b/keepassxc-browser/common/global.js @@ -24,6 +24,9 @@ const CHECK_UPDATE_THREE_DAYS = 3; const CHECK_UPDATE_ONE_WEEK = 7; const CHECK_UPDATE_ONE_MONTH = 30; +// Default value for connection timeout +const CONNECTION_TIMEOUT = 1500; + const URL_WILDCARD = '1kpxcwc1'; const schemeSegment = '(\\*|http|https|ws|wss|ftp)'; const hostSegment = '(\\*|(?:\\*\\.)?(?:[^/*]+))?'; diff --git a/keepassxc-browser/managed_storage.json b/keepassxc-browser/managed_storage.json index 21af9b8e..1db43692 100644 --- a/keepassxc-browser/managed_storage.json +++ b/keepassxc-browser/managed_storage.json @@ -52,6 +52,10 @@ "title": "Clear credential info from tabs after timeout. Default (seconds): 10", "type": "integer" }, + "connectionTimeout": { + "title": "Connection timeout to KeePassXC. Default (seconds): 1.5", + "type": "integer" + }, "colorTheme": { "title": "Extension color scheme. Default: system", "type": "string" diff --git a/keepassxc-browser/options/options.html b/keepassxc-browser/options/options.html index 4dd97d08..d8e672d5 100644 --- a/keepassxc-browser/options/options.html +++ b/keepassxc-browser/options/options.html @@ -531,6 +531,14 @@
+ + +