diff --git a/browser-extensions/chrome/src/app/App.tsx b/browser-extensions/chrome/src/app/App.tsx index df9527635..0f511ef32 100644 --- a/browser-extensions/chrome/src/app/App.tsx +++ b/browser-extensions/chrome/src/app/App.tsx @@ -44,7 +44,7 @@ const App: React.FC = () => { { path: '/credentials/:id', element: , showBackButton: true, title: 'Credential details' }, { path: '/emails', element: , showBackButton: false }, { path: '/emails/:id', element: , showBackButton: true, title: 'Email details' }, - { path: '/settings', element: , showBackButton: true, title: 'Settings' }, + { path: '/settings', element: , showBackButton: false }, ]; useEffect(() => { diff --git a/browser-extensions/chrome/src/app/pages/EmailsList.tsx b/browser-extensions/chrome/src/app/pages/EmailsList.tsx index 903f85b71..1043a4e40 100644 --- a/browser-extensions/chrome/src/app/pages/EmailsList.tsx +++ b/browser-extensions/chrome/src/app/pages/EmailsList.tsx @@ -117,8 +117,8 @@ const EmailsList: React.FC = () => { if (emails.length === 0) { return (
-
-

Emails

+
+

Emails

@@ -132,8 +132,8 @@ const EmailsList: React.FC = () => { return (
-
-

Emails

+
+

Emails

diff --git a/browser-extensions/chrome/src/app/pages/Settings.tsx b/browser-extensions/chrome/src/app/pages/Settings.tsx index 09afd3bc6..f31ef6c4c 100644 --- a/browser-extensions/chrome/src/app/pages/Settings.tsx +++ b/browser-extensions/chrome/src/app/pages/Settings.tsx @@ -1,5 +1,5 @@ import React, { useEffect, useState, useCallback } from 'react'; -import { DISABLED_SITES_KEY } from '../../contentScript/Popup'; +import { DISABLED_SITES_KEY, GLOBAL_POPUP_ENABLED_KEY } from '../../contentScript/Popup'; /** * Popup settings type. @@ -8,6 +8,7 @@ type PopupSettings = { disabledUrls: string[]; currentUrl: string; isEnabled: boolean; + isGloballyEnabled: boolean; } /** @@ -17,7 +18,8 @@ const Settings: React.FC = () => { const [settings, setSettings] = useState({ disabledUrls: [], currentUrl: '', - isEnabled: true + isEnabled: true, + isGloballyEnabled: true }); /** @@ -36,16 +38,19 @@ const Settings: React.FC = () => { const tab = await getCurrentTab(); const currentUrl = new URL(tab.url || '').hostname; - // Load disabled URLs from chrome.storage.local - chrome.storage.local.get([DISABLED_SITES_KEY], (result) => { + // Load settings from chrome.storage.local + chrome.storage.local.get([DISABLED_SITES_KEY, GLOBAL_POPUP_ENABLED_KEY], (result) => { const disabledUrls = result[DISABLED_SITES_KEY] || []; + const isGloballyEnabled = result[GLOBAL_POPUP_ENABLED_KEY] !== false; // Default to true if not set + setSettings({ disabledUrls, currentUrl, - isEnabled: !disabledUrls.includes(currentUrl) + isEnabled: !disabledUrls.includes(currentUrl), + isGloballyEnabled }); }); - }, []); // No dependencies needed since it only uses external APIs + }, []); useEffect(() => { loadSettings(); @@ -88,45 +93,91 @@ const Settings: React.FC = () => { })); }; + const toggleGlobalPopup = async () : Promise => { + const newGloballyEnabled = !settings.isGloballyEnabled; + + await chrome.storage.local.set({ + [GLOBAL_POPUP_ENABLED_KEY]: newGloballyEnabled + }); + + setSettings(prev => ({ + ...prev, + isGloballyEnabled: newGloballyEnabled + })); + }; + return ( -
-
-

Popup Settings

+
+
+

Settings

-
-
-
-

- You can disable the autofill popup by either dismissing the popup or enabling/disabling via the button below. -

-
-
-
-

{settings.currentUrl}

-

- Popup is {settings.isEnabled ? 'enabled' : 'disabled'} for this site -

+ {/* Global Settings Section */} +
+

Global Settings

+
+
+
+
+

Autofill Popup

+

+ {settings.isGloballyEnabled ? 'Active on all sites (unless disabled below)' : 'Disabled on all sites'} +

+
+
-
- -
+ + + {/* Site-Specific Settings Section */} +
+

Site-Specific Settings

+
+
+
+ Control the autofill popup behavior for individual websites. You can disable it for specific sites that you don't want the popup to appear on. +
+ +
+
+

Current Site: {settings.currentUrl}

+

+ {settings.isEnabled ? 'Popup is active' : 'Popup is disabled'} +

+
+ +
+ +
+ +
+
+
+
); }; diff --git a/browser-extensions/chrome/src/background/VaultMessageHandler.ts b/browser-extensions/chrome/src/background/VaultMessageHandler.ts index e1c83fe1c..33462e7ab 100644 --- a/browser-extensions/chrome/src/background/VaultMessageHandler.ts +++ b/browser-extensions/chrome/src/background/VaultMessageHandler.ts @@ -146,9 +146,7 @@ export async function handleGetCredentials( try { const sqliteClient = await createVaultSqliteClient(vaultState); - const credentials = sqliteClient.getAllCredentials(); - sendResponse({ credentials: credentials, status: 'OK' }); } catch (error) { console.error('Error getting credentials:', error); diff --git a/browser-extensions/chrome/src/contentScript/Popup.ts b/browser-extensions/chrome/src/contentScript/Popup.ts index 3f2ea738d..6e7753034 100644 --- a/browser-extensions/chrome/src/contentScript/Popup.ts +++ b/browser-extensions/chrome/src/contentScript/Popup.ts @@ -786,14 +786,18 @@ function createCredentialList(credentials: Credential[], input: HTMLInputElement } export const DISABLED_SITES_KEY = 'aliasvault_disabled_sites'; +export const GLOBAL_POPUP_ENABLED_KEY = 'aliasvault_global_popup_enabled'; /** * Check if auto-popup is disabled for current site */ export async function isAutoShowPopupDisabled(): Promise { - const result = await chrome.storage.local.get(DISABLED_SITES_KEY); - const disabledSites = result[DISABLED_SITES_KEY] || []; - return disabledSites.includes(window.location.hostname); + const settings = await chrome.storage.local.get([DISABLED_SITES_KEY, GLOBAL_POPUP_ENABLED_KEY]); + const disabledUrls = settings[DISABLED_SITES_KEY] || []; + const isGloballyEnabled = settings[GLOBAL_POPUP_ENABLED_KEY] !== false; + const currentHostname = window.location.hostname; + + return !isGloballyEnabled || disabledUrls.includes(currentHostname); } /** diff --git a/docs/misc/dev/browser-extensions.md b/docs/misc/dev/browser-extensions.md index 95849da76..a47124287 100644 --- a/docs/misc/dev/browser-extensions.md +++ b/docs/misc/dev/browser-extensions.md @@ -49,6 +49,8 @@ npm run test In order to test for client side issues, here is a list of public websites that have caused issues in the past and can be used to test whether the extension is (still) working correctly. ### Websites that have caused issues +The following websites have been known to cause issues in the past (but should be fixed now). + | Website | Reason | | --- | --- | | https://www.paprika-shopping.nl/nieuwsbrief/newsletter-register-landing.html | Popup CSS style conflicts |