mirror of
https://github.com/keepassxreboot/keepassxc-browser.git
synced 2026-03-11 08:54:43 +00:00
added option for connection timeout used when browser extension is trying to connect to KeePassXC
This commit is contained in:
parent
2fb4b371e6
commit
5923319c92
8 changed files with 58 additions and 4 deletions
|
|
@ -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."
|
||||
|
|
|
|||
|
|
@ -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."
|
||||
|
|
|
|||
|
|
@ -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."
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -531,6 +531,16 @@
|
|||
<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">
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
@ -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;
|
||||
|
|
@ -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)
|
||||
);
|
||||
|
||||
|
|
@ -891,7 +901,7 @@ const getBrowserId = function(userAgent) {
|
|||
return `${query.name} ${getVersion(userAgent, query.findStr)}`;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return 'Other/Unknown';
|
||||
};
|
||||
|
||||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue