From 434a61f15e19e63feaefbabee955ca4d38f23cca Mon Sep 17 00:00:00 2001 From: Skedley <48058984+Dudleyneedham@users.noreply.github.com> Date: Mon, 23 Sep 2024 13:50:12 +0200 Subject: [PATCH] fix: manifest v3 (#2666) * fix: manifest v3 * feat: updating the version * feat: updating the version date --- .../toggleIconChannel/toggleIconChannel.ts | 2 +- .../__snapshots__/Settings.test.tsx.snap | 4 +-- src/configuration/configuration.ts | 2 +- src/static/manifest.json | 27 ++++++++++++------- src/utilities/base64/base64.ts | 4 +-- .../storageEncryption/storageEncryption.ts | 4 +-- .../__snapshots__/GenericError.test.tsx.snap | 2 +- 7 files changed, 27 insertions(+), 18 deletions(-) diff --git a/src/channels/toggleIconChannel/toggleIconChannel.ts b/src/channels/toggleIconChannel/toggleIconChannel.ts index 59961e38e..d94798af3 100644 --- a/src/channels/toggleIconChannel/toggleIconChannel.ts +++ b/src/channels/toggleIconChannel/toggleIconChannel.ts @@ -13,7 +13,7 @@ export async function toggleIcon(): Promise { } export async function produceToggleIcon(): Promise { - await browser.browserAction.setIcon({ + await browser.action.setIcon({ path: { 16: 'icon/dark/16.png', 32: 'icon/dark/32.png', diff --git a/src/components/Settings/__snapshots__/Settings.test.tsx.snap b/src/components/Settings/__snapshots__/Settings.test.tsx.snap index 48d59be96..cc78418dc 100644 --- a/src/components/Settings/__snapshots__/Settings.test.tsx.snap +++ b/src/components/Settings/__snapshots__/Settings.test.tsx.snap @@ -115,7 +115,7 @@ exports[`Settings menu should be visible when menu button clicked 1`] = ` role="menuitem" tabindex="-1" > - Version 2024.9.11 + Version 2024.9.23 @@ -225,7 +225,7 @@ exports[`Settings should render the endpoint item in the internal build 1`] = ` role="menuitem" tabindex="-1" > - Version 2024.9.11 + Version 2024.9.23 diff --git a/src/configuration/configuration.ts b/src/configuration/configuration.ts index 00a4bb9a1..e52535012 100644 --- a/src/configuration/configuration.ts +++ b/src/configuration/configuration.ts @@ -25,7 +25,7 @@ export const internalFeatures: Features = { // Duplicates the value in src/static/manifest.json // We can’t use browser.runtime.getManifest().version, as it’s unavailable in injected scripts -const version = '2024.9.11'; +const version = '2024.9.23'; export const configuration: ConfigurationType = { version, diff --git a/src/static/manifest.json b/src/static/manifest.json index c1d21397a..fcc280f1a 100644 --- a/src/static/manifest.json +++ b/src/static/manifest.json @@ -1,11 +1,11 @@ { - "manifest_version": 2, + "manifest_version": 3, "name": "__MSG_manifest_name__", "short_name": "__MSG_manifest_short_name__", "description": "__MSG_manifest_description__", - "version": "2024.9.11", + "version": "2024.9.23", "default_locale": "en", - "browser_action": { + "action": { "default_icon": { "16": "icon/light/16.png", "32": "icon/light/32.png", @@ -15,10 +15,7 @@ "default_popup": "popup.html" }, "background": { - "scripts": [ - "js/backgroundScript.js" - ], - "persistent": true + "service_worker": "js/backgroundScript.js" }, "content_scripts": [ { @@ -41,8 +38,20 @@ "clipboardWrite", "storage" ], - "content_security_policy": "script-src 'self' 'wasm-eval'; object-src 'self';", + "host_permissions": [ + "*://*/*" + ], + "content_security_policy": { + "extension_pages": "script-src 'self' 'wasm-unsafe-eval'; object-src 'self'" + }, "web_accessible_resources": [ - "js/injectedScript.js" + { + "resources": [ + "js/injectedScript.js" + ], + "matches": [ + "*://*/*" + ] + } ] } diff --git a/src/utilities/base64/base64.ts b/src/utilities/base64/base64.ts index 54b88e909..4ae7396e6 100644 --- a/src/utilities/base64/base64.ts +++ b/src/utilities/base64/base64.ts @@ -5,11 +5,11 @@ import { TextEncoder } from '@polkadot/x-textencoder'; export function stringToBase64(input: string): string { const bytes = new TextEncoder().encode(input); const asciiString = String.fromCodePoint(...bytes); - return window.btoa(asciiString); + return btoa(asciiString); } export function base64ToString(base64: string): string { - const asciiString = window.atob(base64); + const asciiString = atob(base64); const bytes = Uint8Array.from(asciiString, (c) => c.charCodeAt(0)); return new TextDecoder().decode(bytes); } diff --git a/src/utilities/storageEncryption/storageEncryption.ts b/src/utilities/storageEncryption/storageEncryption.ts index c530185b0..07138bfaf 100644 --- a/src/utilities/storageEncryption/storageEncryption.ts +++ b/src/utilities/storageEncryption/storageEncryption.ts @@ -87,11 +87,11 @@ export async function decrypt( function arrayBufferToBase64(arrayBuffer: ArrayBuffer): string { const bytes = new Uint8Array(arrayBuffer); const asciiString = String.fromCodePoint(...bytes); - return window.btoa(asciiString); + return btoa(asciiString); } function base64ToArrayBuffer(base64: string): ArrayBuffer { - const asciiString = window.atob(base64); + const asciiString = atob(base64); return Uint8Array.from(asciiString, (c) => c.charCodeAt(0)).buffer; } diff --git a/src/views/GenericError/__snapshots__/GenericError.test.tsx.snap b/src/views/GenericError/__snapshots__/GenericError.test.tsx.snap index fcf96e3ab..f5737a0fb 100644 --- a/src/views/GenericError/__snapshots__/GenericError.test.tsx.snap +++ b/src/views/GenericError/__snapshots__/GenericError.test.tsx.snap @@ -30,7 +30,7 @@ exports[`GenericError should render generic error when an error happens 1`] = ` class="details" readonly="" > - Sporran@2024.9.11 + Sporran@2024.9.23 Testing GenericError