Skip to content

Commit 9880be9

Browse files
committed
Added script to install native host
1 parent 9ae154f commit 9880be9

File tree

6 files changed

+29
-9
lines changed

6 files changed

+29
-9
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ webext/content-script.js.map
77
webext/background.js
88
webext/background.js.map
99
webext/ssb-client.js
10+
web-ext-artifacts/

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ Building
2626
Running
2727

2828
To use Scuttle Shell Browser you need an [ssb-server](https://github.com/ssbc/ssb-server) running on your machine (this is the case when you
29-
are running Patchwork). You need to install native messaging for the manifest in `host/scuttle_shell_browser.json`, see https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Native_messaging to learn how to do this on your platform. Note that you need to adapt the paths in the manifest file and that `host/host-script.js` must be executable.
29+
are running Patchwork). You need to install native messaging host by running
3030

31+
npm run-script setup:native-host
3132

3233
To run the example you need to have the extension intalled and access the example page.
3334

host/scuttle_shell_browser.json

Lines changed: 0 additions & 7 deletions
This file was deleted.

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55
"scripts": {
66
"build": "rollup -c",
77
"start:ext": "web-ext run --no-reload --bc -v -u \"http://localhost:9090/product-review.html\" -u \"about:debugging#/runtime/this-firefox\" --source-dir ./webext/",
8-
"serve": "http-server site -p 9090"
8+
"webext:build":"web-ext build",
9+
"webext:sign": "web-ext sign --api-key=$AMO_JWT_ISSUER --api-secret=$AMO_JWT_SECRET",
10+
"serve": "http-server site -p 9090",
11+
"setup:native-host": "node setup/native-host.js"
912
},
1013
"webExt": {
1114
"sourceDir": "webext/"

setup/native-host.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import {Setup} from "web-ext-native-msg"
2+
3+
const handlerAfterSetup = info => {
4+
const {configDirPath, shellScriptPath, manifestPath} = info;
5+
// do something
6+
};
7+
8+
const setup = new Setup({
9+
hostDescription: "Exposes an ssb-client to the scuttle shell browser extension",
10+
browser: "firefox",
11+
hostName: "scuttle_shell_browser",
12+
mainScriptFile: "host/host-script.js",
13+
chromeExtensionIds: ["chrome-extension://xxxxxx"],
14+
webExtensionIds: ["[email protected]"],
15+
overwriteConfig: true,
16+
callback: handlerAfterSetup,
17+
});
18+
19+
setup.run();

webext/.web-extension-id

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# This file was created by https://github.com/mozilla/web-ext
2+
# Your auto-generated extension ID for addons.mozilla.org is:
3+

0 commit comments

Comments
 (0)