diff --git a/browser-extension/src/entrypoints/background/PopupMessageHandler.ts b/browser-extension/src/entrypoints/background/PopupMessageHandler.ts index 4e8940a8f..c922e87d7 100644 --- a/browser-extension/src/entrypoints/background/PopupMessageHandler.ts +++ b/browser-extension/src/entrypoints/background/PopupMessageHandler.ts @@ -7,7 +7,7 @@ import { BoolResponse } from '../../utils/types/messaging/BoolResponse'; export function handleOpenPopup() : Promise { return (async () : Promise => { browser.windows.create({ - url: browser.runtime.getURL('/popup.html?mode=inline_unlock'), + url: browser.runtime.getURL('/popup.html?mode=inline_unlock&expanded=true'), type: 'popup', width: 400, height: 600, @@ -23,7 +23,7 @@ export function handleOpenPopup() : Promise { export function handlePopupWithCredential(message: any) : Promise { return (async () : Promise => { browser.windows.create({ - url: browser.runtime.getURL(`/popup.html#/credentials/${message.credentialId}`), + url: browser.runtime.getURL(`/popup.html?expanded=true#/credentials/${message.credentialId}`), type: 'popup', width: 400, height: 600, diff --git a/browser-extension/src/entrypoints/popup/components/EmailPreview.tsx b/browser-extension/src/entrypoints/popup/components/EmailPreview.tsx index 4143e14e9..bd383f44f 100644 --- a/browser-extension/src/entrypoints/popup/components/EmailPreview.tsx +++ b/browser-extension/src/entrypoints/popup/components/EmailPreview.tsx @@ -26,8 +26,8 @@ export const EmailPreview: React.FC = ({ email }) => { */ const isPublicDomain = async (emailAddress: string): Promise => { // Get metadata from storage - const storageResult = await chrome.storage.session.get(['publicEmailDomains']); - return storageResult.publicEmailDomains.some(domain => emailAddress.toLowerCase().endsWith(domain)); + const publicEmailDomains = await storage.getItem('session:publicEmailDomains') as string[] ?? []; + return publicEmailDomains.some(domain => emailAddress.toLowerCase().endsWith(domain)); }; useEffect(() => { diff --git a/browser-extension/src/entrypoints/popup/index.html b/browser-extension/src/entrypoints/popup/index.html index 6799776dc..ed9919dcf 100644 --- a/browser-extension/src/entrypoints/popup/index.html +++ b/browser-extension/src/entrypoints/popup/index.html @@ -6,8 +6,16 @@ AliasVault + - +
diff --git a/browser-extension/src/entrypoints/popup/pages/CredentialDetails.tsx b/browser-extension/src/entrypoints/popup/pages/CredentialDetails.tsx index e87a4559f..7abce820f 100644 --- a/browser-extension/src/entrypoints/popup/pages/CredentialDetails.tsx +++ b/browser-extension/src/entrypoints/popup/pages/CredentialDetails.tsx @@ -18,15 +18,15 @@ const CredentialDetails: React.FC = () => { const { setIsInitialLoading } = useLoading(); /** - * Check if the current page is a popup. + * Check if the current page is an expanded popup. */ const isPopup = () : boolean => { const urlParams = new URLSearchParams(window.location.search); - return urlParams.get('popup') === 'true'; + return urlParams.get('expanded') === 'true'; }; /** - * Open the credential details in a new popup. + * Open the credential details in a new expanded popup. */ const openInNewPopup = () : void => { const width = 380; @@ -35,7 +35,7 @@ const CredentialDetails: React.FC = () => { const top = window.screen.height / 2 - height / 2; window.open( - `popup.html?popup=true#/credentials/${id}`, + `popup.html?expanded=true#/credentials/${id}`, 'CredentialDetails', `width=${width},height=${height},left=${left},top=${top},popup=true` ); diff --git a/browser-extension/src/entrypoints/popup/pages/EmailDetails.tsx b/browser-extension/src/entrypoints/popup/pages/EmailDetails.tsx index 308b1c8bc..a646b9ab6 100644 --- a/browser-extension/src/entrypoints/popup/pages/EmailDetails.tsx +++ b/browser-extension/src/entrypoints/popup/pages/EmailDetails.tsx @@ -81,15 +81,15 @@ const EmailDetails: React.FC = () => { }; /** - * Check if the current page is a popup. + * Check if the current page is an expanded popup. */ const isPopup = () : boolean => { const urlParams = new URLSearchParams(window.location.search); - return urlParams.get('popup') === 'true'; + return urlParams.get('expanded') === 'true'; }; /** - * Open the credential details in a new popup. + * Open the credential details in a new expanded popup. */ const openInNewPopup = () : void => { const width = 800; @@ -98,7 +98,7 @@ const EmailDetails: React.FC = () => { const top = window.screen.height / 2 - height / 2; window.open( - `popup.html?popup=true#/emails/${id}`, + `popup.html?expanded=true#/emails/${id}`, 'EmailDetails', `width=${width},height=${height},left=${left},top=${top},popup=true` ); diff --git a/browser-extension/src/utils/WebApiService.ts b/browser-extension/src/utils/WebApiService.ts index d05077040..673f6a6f8 100644 --- a/browser-extension/src/utils/WebApiService.ts +++ b/browser-extension/src/utils/WebApiService.ts @@ -287,26 +287,24 @@ export class WebApiService { * Get the current access token from storage. */ private async getAccessToken(): Promise { - const token = await chrome.storage.local.get('accessToken'); - return token.accessToken ?? null; + const token = await storage.getItem('local:accessToken') as string; + return token ?? null; } /** * Get the current refresh token from storage. */ private async getRefreshToken(): Promise { - const token = await chrome.storage.local.get('refreshToken'); - return token.refreshToken ?? null; + const token = await storage.getItem('local:refreshToken') as string; + return token ?? null; } /** * Update both access and refresh tokens in storage. */ private async updateTokens(accessToken: string, refreshToken: string): Promise { - await chrome.storage.local.set({ - accessToken, - refreshToken - }); + await storage.setItem('local:accessToken', accessToken); + await storage.setItem('local:refreshToken', refreshToken); } /**