diff --git a/keepassxc-browser/_locales/en/messages.json b/keepassxc-browser/_locales/en/messages.json index 2897613..df6c8fa 100644 --- a/keepassxc-browser/_locales/en/messages.json +++ b/keepassxc-browser/_locales/en/messages.json @@ -351,10 +351,18 @@ "message": "Getting Started Guide - Setup Browser Integration", "description": "Popup Getting Started Guide link text." }, - "popupGettingStartedHide": { + "popupAlertHide": { "message": "Hide and don't show again.", - "description": "Getting Started Guide alert close button title." - }, + "description": "Hide alert close button title." + }, + "popupTroubleshootingText": { + "message": "Cannot connect to KeePassXC? Maybe our wiki page could help.", + "description": "Popup information message about Troubleshooting Guide." + }, + "popupTroubleshootingLinkText": { + "message": "Troubleshooting Guide", + "description": "Popup Troubleshooting Guide link text." + }, "popupCheckingStatus": { "message": "Checking status...", "description": "Checking status message in popup." diff --git a/keepassxc-browser/background/event.js b/keepassxc-browser/background/event.js index 8cb6964..c196b28 100755 --- a/keepassxc-browser/background/event.js +++ b/keepassxc-browser/background/event.js @@ -34,6 +34,7 @@ kpxcEvent.showStatus = async function(tab, configured, internalPoll) { error: errorMessage || null, usernameFieldDetected: page.tabs[tab.id].usernameFieldDetected, showGettingStartedGuideAlert: page.settings.showGettingStartedGuideAlert, + showTroubleshootingGuideAlert: page.settings.showTroubleshootingGuideAlert }; }; @@ -210,6 +211,13 @@ kpxcEvent.hideGettingStartedGuideAlert = async function(tab) { await kpxcEvent.onSaveSettings(tab, settings); }; +kpxcEvent.hideTroubleshootingGuideAlert = async function(tab) { + const settings = await kpxcEvent.onLoadSettings(); + settings.showTroubleshootingGuideAlert = false; + + await kpxcEvent.onSaveSettings(tab, settings); +}; + // All methods named in this object have to be declared BEFORE this! kpxcEvent.messageHandlers = { 'add_credentials': keepass.addCredentials, @@ -230,6 +238,7 @@ kpxcEvent.messageHandlers = { 'get_tab_information': kpxcEvent.onGetTabInformation, 'get_totp': keepass.getTotp, 'hide_getting_started_guide_alert': kpxcEvent.hideGettingStartedGuideAlert, + 'hide_troubleshooting_guide_alert': kpxcEvent.hideTroubleshootingGuideAlert, 'init_http_auth': kpxcEvent.initHttpAuth, 'is_connected': kpxcEvent.getIsKeePassXCAvailable, 'load_keyring': kpxcEvent.onLoadKeyRing, diff --git a/keepassxc-browser/background/page.js b/keepassxc-browser/background/page.js index 1c3a7c3..09edcd3 100755 --- a/keepassxc-browser/background/page.js +++ b/keepassxc-browser/background/page.js @@ -19,6 +19,7 @@ const defaultSettings = { redirectAllowance: 1, saveDomainOnly: true, showGettingStartedGuideAlert: true, + showTroubleshootingGuideAlert: true, showLoginFormIcon: true, showLoginNotifications: true, showNotifications: true, @@ -123,6 +124,10 @@ page.initSettings = async function() { page.settings.showGettingStartedGuideAlert = defaultSettings.showGettingStartedGuideAlert; } + if (!('showTroubleshootingGuideAlert' in page.settings)) { + page.settings.showTroubleshootingGuideAlert = defaultSettings.showTroubleshootingGuideAlert; + } + if (!('showLoginFormIcon' in page.settings)) { page.settings.showLoginFormIcon = defaultSettings.showLoginFormIcon; } diff --git a/keepassxc-browser/popups/popup.css b/keepassxc-browser/popups/popup.css index 64423a0..05be837 100644 --- a/keepassxc-browser/popups/popup.css +++ b/keepassxc-browser/popups/popup.css @@ -102,11 +102,9 @@ code { text-align: start; } -#update-available { - display: none; -} - -#getting-started-guide { +#update-available, +#getting-started-guide, +#troubleshooting-guide { display: none; } diff --git a/keepassxc-browser/popups/popup.html b/keepassxc-browser/popups/popup.html index fbe4ec0..7a0effb 100644 --- a/keepassxc-browser/popups/popup.html +++ b/keepassxc-browser/popups/popup.html @@ -32,7 +32,14 @@
- + + + +
+ +
+ +
diff --git a/keepassxc-browser/popups/popup.js b/keepassxc-browser/popups/popup.js index 46d9497..7d2a5ad 100644 --- a/keepassxc-browser/popups/popup.js +++ b/keepassxc-browser/popups/popup.js @@ -1,5 +1,7 @@ 'use strict'; +let reloadCount = 0; + HTMLElement.prototype.show = function() { this.style.display = 'block'; }; @@ -25,6 +27,13 @@ function statusResponse(r) { if (r.showGettingStartedGuideAlert) { $('#getting-started-guide').show(); } + + if (r.showTroubleshootingGuideAlert && reloadCount >= 2) { + $('#troubleshooting-guide').show(); + } + else { + $('#troubleshooting-guide').hide(); + } } else if (r.keePassXCAvailable && r.databaseClosed) { $('#database-error-message').textContent = r.error; $('#database-not-opened').show(); @@ -47,6 +56,8 @@ function statusResponse(r) { if (r.usernameFieldDetected) { $('#username-field-detected').show(); } + + reloadCount = 0; } } @@ -87,6 +98,12 @@ const sendMessageToTab = async function(message) { statusResponse(await browser.runtime.sendMessage({ action: 'reconnect' })); + + // Shows the Troubleshooting Guide alert every third time Reload button is pressed when popup is open + if (reloadCount > 2) { + reloadCount = 0; + } + reloadCount++; }); $('#reopen-database-button').addEventListener('click', async () => { @@ -125,6 +142,12 @@ const sendMessageToTab = async function(message) { }); }); + $('#troubleshooting-guide-alert-close-button').addEventListener('click', async () => { + await browser.runtime.sendMessage({ + action: 'hide_troubleshooting_guide_alert' + }); + }); + statusResponse(await browser.runtime.sendMessage({ action: 'get_status' }).catch((err) => {