Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions keepassxc-browser/_locales/de/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -1018,6 +1018,14 @@
"message": "Anmeldedaten werden nach dem Timeout aus Hintergrund-Tabs entfernt. Für diese Seiten wird erneut um Erlaubnis gebeten.",
"description": "Clear credentials timeout help text."
},
"optionsConnectionTimeout": {
"message": "KeepassXC Zeitlimit für die Verbindung (Sekunden, 2-60).",
"description": "Connection timeout label text."
},
"optionsConnectionTimeoutHelpText": {
"message": "Wenn die KeePassXC Browser Erweiterung versucht, sich mit KeePass zu verbinden, wird dieses Zeitlimit verwendet.",
"description": "Connection timeout label text."
},
"optionsVersionInfoText": {
"message": "KeePassXC-Browser benötigt KeePassXC, um Anmeldedaten abzurufen.",
"description": "Settings page version info text."
Expand Down
8 changes: 8 additions & 0 deletions keepassxc-browser/_locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 (seconds, 2-60).",
"description": "Connection timeout label text."
},
"optionsConnectionTimeoutHelpText": {
"message": "When KeePassXC browser extension tries to connect to to keepass, this timeout value is used",
"description": "Connection timeout label text."
},
"optionsVersionInfoText": {
"message": "KeePassXC-Browser needs KeePassXC to retrieve credentials.",
"description": "Settings page version info text."
Expand Down
8 changes: 8 additions & 0 deletions keepassxc-browser/_locales/en_GB/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -1018,6 +1018,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 (seconds, 2-60).",
"description": "Connection timeout label text."
},
"optionsConnectionTimeoutHelpText": {
"message": "When KeePassXC browser extension tries to connect to to keepass, this timeout value is used",
"description": "Connection timeout label text."
},
"optionsVersionInfoText": {
"message": "KeePassXC-Browser needs KeePassXC to retrieve credentials.",
"description": "Settings page version info text."
Expand Down
6 changes: 5 additions & 1 deletion keepassxc-browser/background/keepass.js
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,11 @@ keepass.disableAutomaticReconnect = function() {
keepass.reconnectLoop = null;
};

keepass.reconnect = async function(tab = null, connectionTimeout = 1500) {
keepass.reconnect = async function(tab = null, connectionTimeout = -1) {
if (connectionTimeout == -1) {
connectionTimeout = page.settings.connectionTimeout * 1000;
}

keepassClient.connectToNative();
keepass.generateNewKeyPair();
const keyChangeResult = await keepass.changePublicKeys(tab, !!connectionTimeout, connectionTimeout).catch(() => false);
Expand Down
2 changes: 2 additions & 0 deletions keepassxc-browser/background/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const defaultSettings = {
bannerPosition: BannerPosition.TOP,
checkUpdateKeePassXC: CHECK_UPDATE_NEVER,
clearCredentialsTimeout: 10,
connectionTimeout: 2,
colorTheme: 'system',
credentialSorting: SORT_BY_GROUP_AND_TITLE,
debugLogging: false,
Expand Down Expand Up @@ -47,6 +48,7 @@ page.autoSubmitPerformed = false;
page.attributeMenuItems = [];
page.blockedTabs = [];
page.clearCredentialsTimeout = null;
page.connectionTimeout = null;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This variable is not used, and not needed.

page.currentRequest = {};
page.currentTabId = -1;
page.isFirefox = false;
Expand Down
4 changes: 4 additions & 0 deletions keepassxc-browser/managed_storage.json
Original file line number Diff line number Diff line change
Expand Up @@ -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): 2",
"type": "integer"
},
"colorTheme": {
"title": "Extension color scheme. Default: system",
"type": "string"
Expand Down
10 changes: 10 additions & 0 deletions keepassxc-browser/options/options.html
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,16 @@ <h2 class="pb-3 mt-0" data-i18n="optionsGeneralSettingsTab"></h2>
<div class="form-text" data-i18n="optionsClearCredentialsTimeoutHelpText"></div>
</div>


<!-- Keepass connectiontimeout -->
<div class="form-group mt-2 pb-1">
<label for="connectionTimeout" data-i18n="optionsConnectionTimeout"></label>
<div class="input-group w-25 mt-2">
<input class="form-control form-control-sm" type="number" id="connectionTimeout" min="2" max="60" required>
</div>
<div class="form-text" data-i18n="optionsConnectionTimeoutHelpText"></div>
</div>

<!-- Debug logging -->
<div class="form-group mt-2 pb-1">
<div class="form-check form-switch">
Expand Down
16 changes: 13 additions & 3 deletions keepassxc-browser/options/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ 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 generalSettingsRadioInputs = document.querySelectorAll('#tab-general-settings input[type=radio]');
for (const radio of generalSettingsRadioInputs) {
Expand Down Expand Up @@ -172,6 +173,15 @@ options.initGeneralSettings = async function() {
await options.saveSettings();
});

$('#tab-general-settings input#connectionTimeout').addEventListener('change', async function(e) {
if (e.target.valueAsNumber < 2 || e.target.valueAsNumber > 60) {
return;
}

options.settings['connectionTimeout'] = e.target.valueAsNumber;
await options.saveSettings();
});

// Change label text dynamically with the range input
$('#tab-general-settings input[type=range]').addEventListener('input', function(e) {
const currentValue = e.target.valueAsNumber === 11 ? 'Infinite' : e.target.value;
Expand Down Expand Up @@ -726,7 +736,7 @@ options.initSitePreferences = function() {

// Page URL
row.children[0].children[0].children[0].value = url;
row.children[0].children[0]?.addEventListener('dblclick', (e) =>
row.children[0].children[0]?.addEventListener('dblclick', (e) =>
enterEditMode(e, row, inputField, editButton, cancelButton, saveButton)
);

Expand Down Expand Up @@ -891,7 +901,7 @@ const getBrowserId = function(userAgent) {
return `${query.name} ${getVersion(userAgent, query.findStr)}`;
}
}

return 'Other/Unknown';
};

Expand Down Expand Up @@ -919,7 +929,7 @@ const updateDropdownPosition = function(e, dropdown) {
if (!rect) {
return;
}

const zoom = getComputedStyle(document.body).zoom || 1;
const scrollTop = document.defaultView.scrollY / zoom;
const scrollLeft = document.defaultView?.scrollX / zoom;
Expand Down