option to show an empty entry selection screen

This commit is contained in:
antelle 2021-04-28 23:29:13 +02:00
parent 991388d4cd
commit b07cea9049
No known key found for this signature in database
GPG Key ID: 63C9777AAB7C563C
5 changed files with 20 additions and 1 deletions

View File

@ -428,7 +428,11 @@ const ProtocolHandlers = {
entries = filter.getEntries().length > 0;
if (!entries.length) {
throw makeError(Errors.noMatches);
if (AppSettingsModel.extensionFocusIfEmpty) {
filter.useUrl = false;
} else {
throw makeError(Errors.noMatches);
}
}
}

View File

@ -48,6 +48,7 @@ const DefaultAppSettings = {
disableOfflineStorage: false, // don't cache loaded files in offline storage
shortLivedStorageToken: false, // short-lived sessions in cloud storage providers
extensionFocusIfLocked: true, // focus KeeWeb if a browser extension tries to connect while KeeWeb is locked
extensionFocusIfEmpty: true, // show the entry selection screen if there's no match found by URL
yubiKeyShowIcon: true, // show an icon to open OTP codes from YubiKey
yubiKeyAutoOpen: false, // auto-load one-time codes when there are open files

View File

@ -652,6 +652,7 @@
"setBrowserNotEnabled": "Browser integration is not enabled, extensions won't be able to connect to KeeWeb. Use the checkboxes below to enable it:",
"setBrowserEnablePerBrowser": "Enable browser integration using the checkboxes below:",
"setBrowserFocusIfLocked": "Open KeeWeb if a browser extension tries to connect while there's no open file",
"setBrowserFocusIfEmpty": "Show the entry selection screen if there's no match found by URL",
"setBrowserOtherBrowsers": "Other browsers",
"setBrowserExtensionFor": "for {}",
"setBrowserExtensionNotSupported": "Not supported",

View File

@ -20,6 +20,7 @@ class SettingsBrowserView extends View {
events = {
'change .check-enable-for-browser': 'changeEnableForBrowser',
'change .settings__browser-focus-if-locked': 'changeFocusIfLocked',
'change .settings__browser-focus-if-empty': 'changeFocusIfEmpty',
'change .settings__browser-session-ask-get': 'changeSessionAskGet',
'change .settings__browser-session-ask-save': 'changeSessionAskSave',
'change .settings__browser-session-file-check': 'changeSessionFileAccess',
@ -37,6 +38,7 @@ class SettingsBrowserView extends View {
desktop: Features.isDesktop,
icon: Features.browserIcon,
focusIfLocked: AppSettingsModel.extensionFocusIfLocked,
focusIfEmpty: AppSettingsModel.extensionFocusIfEmpty,
sessions: BrowserExtensionConnector.sessions.map((session) => {
const fileAccess = this.getSessionFileAccess(session);
return {
@ -157,6 +159,11 @@ class SettingsBrowserView extends View {
this.render();
}
changeFocusIfEmpty(e) {
AppSettingsModel.extensionFocusIfEmpty = e.target.checked;
this.render();
}
changeSessionAskGet(e) {
const clientId = e.target.dataset.clientId;
const askGet = e.target.value;

View File

@ -73,6 +73,12 @@
{{#if focusIfLocked}}checked{{/if}} />
<label for="settings__browser-focus-if-locked">{{res 'setBrowserFocusIfLocked'}}</label>
</div>
<div>
<input type="checkbox" class="settings__input input-base settings__browser-focus-if-empty"
id="settings__browser-focus-if-empty"
{{#if focusIfEmpty}}checked{{/if}} />
<label for="settings__browser-focus-if-empty">{{res 'setBrowserFocusIfEmpty'}}</label>
</div>
<h2>{{res 'setBrowserSessions'}}</h2>
{{#if sessions.length}}