Skip to content

Commit 292d584

Browse files
committed
feat: upgrade to Manifest V3 in Edge and Opera
1 parent cb6af14 commit 292d584

File tree

4 files changed

+22
-16
lines changed

4 files changed

+22
-16
lines changed

gulpfile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const isProduction = process.env.NODE_ENV === 'production';
2424
const enableContributions =
2525
(process.env.ENABLE_CONTRIBUTIONS || 'true') === 'true';
2626

27-
const mv3 = ['chrome'].includes(targetEnv);
27+
const mv3 = ['chrome', 'edge', 'opera'].includes(targetEnv);
2828

2929
const distDir = path.join(__dirname, 'dist', targetEnv);
3030

src/assets/manifest/edge.json

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"manifest_version": 2,
2+
"manifest_version": 3,
33
"name": "__MSG_extensionName__",
44
"description": "__MSG_extensionDescription__",
55
"version": "0.1.0",
@@ -18,11 +18,15 @@
1818
"activeTab",
1919
"notifications",
2020
"webRequest",
21-
"webRequestBlocking",
22-
"<all_urls>"
21+
"declarativeNetRequest",
22+
"scripting"
2323
],
2424

25-
"content_security_policy": "default-src 'self'; style-src 'self' 'unsafe-inline'; img-src * data:; connect-src *; object-src 'none'; media-src 'none'; child-src 'none'; form-action 'none';",
25+
"host_permissions": ["<all_urls>"],
26+
27+
"content_security_policy": {
28+
"extension_pages": "default-src 'self'; style-src 'self' 'unsafe-inline'; img-src * data:; connect-src *; object-src 'none'; media-src 'none'; child-src 'none'; form-action 'none';"
29+
},
2630

2731
"icons": {
2832
"16": "src/assets/icons/app/icon-16.png",
@@ -36,7 +40,7 @@
3640
"128": "src/assets/icons/app/icon-128.png"
3741
},
3842

39-
"browser_action": {
43+
"action": {
4044
"default_icon": {
4145
"16": "src/assets/icons/app/icon-16.png",
4246
"19": "src/assets/icons/app/icon-19.png",
@@ -52,12 +56,11 @@
5256

5357
"options_ui": {
5458
"page": "src/options/index.html",
55-
"chrome_style": false,
5659
"open_in_tab": true
5760
},
5861

5962
"background": {
60-
"page": "src/background/index.html"
63+
"service_worker": "src/background/script.js"
6164
},
6265

6366
"content_scripts": [

src/assets/manifest/opera.json

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"manifest_version": 2,
2+
"manifest_version": 3,
33
"name": "__MSG_extensionName__",
44
"description": "__MSG_extensionDescription__",
55
"version": "0.1.0",
@@ -18,11 +18,15 @@
1818
"activeTab",
1919
"notifications",
2020
"webRequest",
21-
"webRequestBlocking",
22-
"<all_urls>"
21+
"declarativeNetRequest",
22+
"scripting"
2323
],
2424

25-
"content_security_policy": "default-src 'self'; style-src 'self' 'unsafe-inline'; img-src * data:; connect-src *; object-src 'none'; media-src 'none'; child-src 'none'; form-action 'none';",
25+
"host_permissions": ["<all_urls>"],
26+
27+
"content_security_policy": {
28+
"extension_pages": "default-src 'self'; style-src 'self' 'unsafe-inline'; img-src * data:; connect-src *; object-src 'none'; media-src 'none'; child-src 'none'; form-action 'none';"
29+
},
2630

2731
"icons": {
2832
"16": "src/assets/icons/app/icon-16.png",
@@ -36,7 +40,7 @@
3640
"128": "src/assets/icons/app/icon-128.png"
3741
},
3842

39-
"browser_action": {
43+
"action": {
4044
"default_icon": {
4145
"16": "src/assets/icons/app/icon-16.png",
4246
"19": "src/assets/icons/app/icon-19.png",
@@ -52,12 +56,11 @@
5256

5357
"options_ui": {
5458
"page": "src/options/index.html",
55-
"chrome_style": false,
5659
"open_in_tab": true
5760
},
5861

5962
"background": {
60-
"page": "src/background/index.html"
63+
"service_worker": "src/background/script.js"
6164
},
6265

6366
"content_scripts": [

webpack.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const isProduction = process.env.NODE_ENV === 'production';
1414
const enableContributions =
1515
(process.env.ENABLE_CONTRIBUTIONS || 'true') === 'true';
1616

17-
const mv3 = ['chrome'].includes(targetEnv);
17+
const mv3 = ['chrome', 'edge', 'opera'].includes(targetEnv);
1818

1919
const provideExtApi = !['firefox', 'safari'].includes(targetEnv);
2020

0 commit comments

Comments
 (0)