diff --git a/packages/core/src/background/handlers/Extension.ts b/packages/core/src/background/handlers/Extension.ts index 1085cdfe..ab464cde 100644 --- a/packages/core/src/background/handlers/Extension.ts +++ b/packages/core/src/background/handlers/Extension.ts @@ -272,7 +272,7 @@ export default class Extension extends DotExtension { } private _windowOpen(path: AllowedPath): boolean { - const url = `${chrome.extension.getURL('index.html')}#${path}`; + const url = `${chrome.runtime.getURL('index.html')}#${path}`; if (!ALLOWED_PATH.includes(path)) { console.error('Not allowed to open the url:', url); diff --git a/packages/extension/manifest.json b/packages/extension/manifest.json index f96a3593..d4cabf65 100644 --- a/packages/extension/manifest.json +++ b/packages/extension/manifest.json @@ -4,13 +4,12 @@ "homepage_url": "https://github.com/PolymeshAssociation/polymesh-wallet", "name": "Polymesh Wallet", "short_name": "Polymesh", - "manifest_version": 2, + "manifest_version": 3, "permissions": ["storage"], "background": { - "scripts": ["background.js"], - "persistent": true + "service_worker": "background.js" }, - "browser_action": { + "action": { "default_title": "Polymesh", "default_popup": "index.html" }, @@ -29,6 +28,17 @@ "64": "images/icon-64.png", "128": "images/icon-128.png" }, - "web_accessible_resources": ["page.js"], - "content_security_policy": "script-src 'self' blob: 'unsafe-eval' 'wasm-eval'; object-src 'self'" + "web_accessible_resources": [ + { + "resources": [ + "page.js" + ], + "matches": [ + "*://*/*" + ] + } + ], + "content_security_policy": { + "extension_pages": "script-src 'self' 'wasm-unsafe-eval'; object-src 'self'" + } } diff --git a/packages/extension/src/background.ts b/packages/extension/src/background.ts index f18c3b3f..329eb415 100644 --- a/packages/extension/src/background.ts +++ b/packages/extension/src/background.ts @@ -12,8 +12,8 @@ import { PORTS } from '@polymeshassociation/extension-core/constants'; import { fatalErrorHandler } from '@polymeshassociation/extension-core/utils'; // setup the notification (same a FF default background, white text) -chrome.browserAction.setBadgeBackgroundColor({ color: '#d90000' }); -chrome.browserAction.setBadgeText({ text: '' }); +chrome.action.setBadgeBackgroundColor({ color: '#d90000' }); +chrome.action.setBadgeText({ text: '' }); // This listener is invoked every time the extension is installed, updated, or reloaded. chrome.runtime.onInstalled.addListener(() => { diff --git a/packages/extension/src/content.ts b/packages/extension/src/content.ts index a111686c..2cb92ebf 100644 --- a/packages/extension/src/content.ts +++ b/packages/extension/src/content.ts @@ -23,7 +23,7 @@ window.addEventListener('message', ({ data, source }: Message): void => { // inject our data injector const script = document.createElement('script'); -script.src = chrome.extension.getURL('page.js'); +script.src = chrome.runtime.getURL('page.js'); script.onload = (): void => { // remove the injecting tag when loaded diff --git a/packages/ui/src/components/View.tsx b/packages/ui/src/components/View.tsx index ffd5d086..46cefa62 100644 --- a/packages/ui/src/components/View.tsx +++ b/packages/ui/src/components/View.tsx @@ -15,7 +15,8 @@ function View({ children, className }: Props): React.ReactElement { const _theme = themes[theme]; const switchTheme = (theme: AvailableThemes): void => { - localStorage.setItem('theme', theme); + // move to chrome.storage if needed + // localStorage.setItem('theme', theme); setTheme(theme); };