Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.
Add default domain fallback to browser extension content script alias creation
Leendert de Borste8102021d85c
diff --git a/apps/browser-extension/src/entrypoints/background/VaultMessageHandler.ts b/apps/browser-extension/src/entrypoints/background/VaultMessageHandler.tsindex a26ae5bc5..ba9b8fc21 100644--- a/apps/browser-extension/src/entrypoints/background/VaultMessageHandler.ts+++ b/apps/browser-extension/src/entrypoints/background/VaultMessageHandler.ts@@ -448,14 +448,22 @@ export async function getEmailAddressesForVault(/*** Get default email domain for a vault.+ * Falls back to first private or public domain if no default is configured.*/export function handleGetDefaultEmailDomain(): Promise<stringResponse> {return (async (): Promise<stringResponse> => {try {const sqliteClient = await createVaultSqliteClient();- const defaultEmailDomain = sqliteClient.settings.getDefaultEmailDomain();+ let domain = sqliteClient.settings.getDefaultEmailDomain();- return { success: true, value: defaultEmailDomain ?? undefined };+ // If no default domain is configured, fall back to first private or public domain+ if (!domain) {+ const privateEmailDomains = await getItemWithFallback<string[]>('local:privateEmailDomains') ?? [];+ const publicEmailDomains = await getItemWithFallback<string[]>('local:publicEmailDomains') ?? [];+ domain = privateEmailDomains[0] || publicEmailDomains[0] || '';+ }++ return { success: true, value: domain || undefined };} catch (error) {console.error('Error getting default email domain:', error);return { success: false, error: await t('common.errors.unknownError') };diff --git a/apps/browser-extension/src/entrypoints/contentScript/Popup.ts b/apps/browser-extension/src/entrypoints/contentScript/Popup.tsindex 39e2e43d9..daafb1c7d 100644--- a/apps/browser-extension/src/entrypoints/contentScript/Popup.ts+++ b/apps/browser-extension/src/entrypoints/contentScript/Popup.ts@@ -305,7 +305,7 @@ export async function createAutofillPopup(input: HTMLInputElement, items: Item[]fields.push(createSystemField(FieldKey.LoginUrl, { value: serviceUrl }));}fields.push(createSystemField(FieldKey.LoginUsername, { value: identity.nickName }));- fields.push(createSystemField(FieldKey.LoginEmail, { value: `${identity.emailPrefix}@${domain}` }));+ fields.push(createSystemField(FieldKey.LoginEmail, { value: domain ? `${identity.emailPrefix}@${domain}` : identity.emailPrefix }));fields.push(createSystemField(FieldKey.LoginPassword, { value: password }));fields.push(createSystemField(FieldKey.AliasFirstName, { value: identity.firstName }));fields.push(createSystemField(FieldKey.AliasLastName, { value: identity.lastName }));