Skip to content

Commit 97918d5

Browse files
committed
Universal package (MV2 for FF and MV3 for Chrome)
1 parent 4290065 commit 97918d5

File tree

5 files changed

+32
-7
lines changed

5 files changed

+32
-7
lines changed

.github/workflows/submit.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,12 @@ jobs:
4848
run: pnpm plasmo build --target=chrome-mv3
4949
- name: Build the extension (Firefox)
5050
run: |
51-
jq '.manifest.host_permissions = .manifest.optional_host_permissions | del(.manifest.optional_host_permissions)' package.json > temp.json && mv temp.json package.json # fix incomatibility with Chrome's MV3. See https://bugzilla.mozilla.org/show_bug.cgi?id=1766026
52-
pnpm plasmo build --target=firefox-mv3
51+
./scripts/firefox-mv2.sh
52+
pnpm plasmo build --target=firefox-mv2
5353
- name: Package the extension into zip artifacts
5454
run: |
5555
pnpm package --target=chrome-mv3
56-
pnpm package --target=firefox-mv3
56+
pnpm package --target=firefox-mv2
5757
- name: Browser Platform Publish (staging)
5858
uses: PlasmoHQ/bpp@v3
5959
if: env.CHANNEL == 'staging'

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "gitpod",
33
"displayName": "Gitpod",
4-
"version": "2.1.1",
4+
"version": "2.1.2",
55
"description": "The developer platform for on-demand cloud development environments. Create software faster and more securely.",
66
"author": "Gitpod <[email protected]>",
77
"homepage": "https://www.gitpod.io",
@@ -27,6 +27,7 @@
2727
"webext-additional-permissions": "^2.4.0",
2828
"webext-content-scripts": "^2.5.5",
2929
"webext-detect-page": "^4.1.1",
30+
"webext-domain-permission-toggle": "^4.0.1",
3031
"webext-dynamic-content-scripts": "v9",
3132
"webext-patterns": "^1.3.0",
3233
"webext-polyfill-kinda": "^1.0.2",
@@ -69,7 +70,7 @@
6970
],
7071
"browser_specific_settings": {
7172
"gecko": {
72-
"id": "{24229a4f-eecc-47dc-abad-e47674ea8169}"
73+
"id": "{dbcc42f9-c979-4f53-8a95-a102fbff3bbe}"
7374
}
7475
}
7576
}

pnpm-lock.yaml

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/firefox-mv2.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
jq '.manifest.optional_permissions = .manifest.optional_host_permissions | del(.manifest.optional_host_permissions)' package.json > temp.json && mv temp.json package.json # fix incompatibility with Firefox's MV3 implementation. See https://bugzilla.mozilla.org/show_bug.cgi?id=1766026

src/background.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
import { browser } from "webextension-polyfill-ts";
22
import 'webext-dynamic-content-scripts';
3-
import addDomainPermissionToggle from "~utils/domain-accept";
3+
import addDomainPermissionToggleMv2 from "webext-domain-permission-toggle";
4+
import addDomainPermissionToggleMv3 from "~utils/domain-accept";
45

5-
addDomainPermissionToggle();
6+
(async () => {
7+
if (browser.runtime.getManifest().manifest_version === 2) {
8+
addDomainPermissionToggleMv2();
9+
} else {
10+
addDomainPermissionToggleMv3();
11+
}
12+
})();
613

714
browser.runtime.onInstalled.addListener((details) => {
815
if (details.reason === "install") {

0 commit comments

Comments
 (0)