Skip to content

Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.

Make extension work with iframes (#541)

Leendert de Borstde85430998b2
diff --git a/browser-extensions/chrome/manifest.json b/browser-extensions/chrome/manifest.json
index 99c6f5de4..9c41f2348 100644
--- a/browser-extensions/chrome/manifest.json
+++ b/browser-extensions/chrome/manifest.json
@@ -31,7 +31,8 @@
"content_scripts": [
{
"matches": ["<all_urls>"],
- "js": ["contentScript.ts"]
+ "js": ["contentScript.ts"],
+ "all_frames": true
}
],
"host_permissions": [
diff --git a/browser-extensions/chrome/src/contentScript/Filter.ts b/browser-extensions/chrome/src/contentScript/Filter.ts
index 7707dd8f0..584268e2f 100644
--- a/browser-extensions/chrome/src/contentScript/Filter.ts
+++ b/browser-extensions/chrome/src/contentScript/Filter.ts
@@ -45,13 +45,13 @@ export function filterCredentials(credentials: Credential[], currentUrl: string,
'page', 'site', 'secure', 'password', 'access', 'member',
'user', 'profile', 'auth', 'session', 'inloggen',
'registreren', 'registratie', 'free', 'gratis', 'create',
- 'new'
+ 'new', 'aanmelden', 'inschrijven', 'nieuwsbrief', 'schrijf'
]);
const titleWords = pageTitle.toLowerCase()
.split(/\s+/)
.filter(word =>
- word.length > 2 && // Filter out words shorter than 3 characters
+ word.length > 3 && // Filter out words shorter than 4 characters
!badWords.has(word.toLowerCase()) // Filter out generic words
);
diff --git a/browser-extensions/chrome/src/contentScript/Popup.ts b/browser-extensions/chrome/src/contentScript/Popup.ts
index b3c1aa537..fce465559 100644
--- a/browser-extensions/chrome/src/contentScript/Popup.ts
+++ b/browser-extensions/chrome/src/contentScript/Popup.ts
@@ -224,7 +224,26 @@ export function createAutofillPopup(input: HTMLInputElement, credentials: Creden
});
createButton.addEventListener('click', async () => {
- const serviceName = await createEditNamePopup(document.title);
+ // Determine service name based on conditions
+ let suggestedName = document.title;
+
+ // First try to extract the last part after common divider characters
+ const dividerMatch = document.title.match(/[\s]*[|\-–—/\\]+[\s]*([^|\-–—/\\]+)$/);
+ if (dividerMatch && dividerMatch[1].trim().split(/\s+/).length === 1) {
+ // If we found a match and it's a single word, use it
+ suggestedName = dividerMatch[1].trim();
+ } else {
+ // Fall back to previous logic for long titles
+ const wordCount = document.title.trim().split(/\s+/).length;
+ if (wordCount > 3) {
+ // Extract main domain + extension by taking last 2 parts of hostname
+ const domainParts = window.location.hostname.replace(/^www\./, '').split('.');
+ const mainDomain = domainParts.slice(-2).join('.');
+ suggestedName = mainDomain;
+ }
+ }
+
+ const serviceName = await createEditNamePopup(suggestedName);
if (!serviceName) return; // User cancelled
const loadingPopup = createLoadingPopup(input, 'Creating new identity...');