Files: 851531c0e3ba49e7d6301e1941f7cf92e8f91628 / README.md
Native companion app
This repository also contains a native companion app that is able to supply features for Firefox WebExtensions posting to the scuttlebutt platform.
This is useful because there are no WebExtension APIs for TCP and UDP so we can't implement the correct protocols for scuttlebutt. Instead we have a way to use the Native Messaging API to establish communication between a native application (this app) and an authorized WebExtension. We can think of it much like we do with back-end and front-end web programming, this app is the back-end providing features and all the authorized add-ons are front-end interfacing with Firefox users.
Be aware that the companion app is not a requirement, Patchfox can use WebSockets to communicate with a running sbot. So you can run Patchfox in parallel with other clients that start their own sbot or even start it from the command-line with sbot serve
. Still, this companion app makes it effortless to use Patchfox.
Dependencies
This native application is NodeJS based and you need to have a recent version of it installed.
How to setup the native app
You need to install the dependencies first:
$ npm install
After that the procedure changes depending on which OS you're running as the configuration of native apps differs by operating system with Windows being a quite convoluted process. To setup the application, meaning place the correct app manifest json in the correct place and fix the paths, run:
$ npm run setup-win
or
$ npm run setup
Depending if you're running Windows 10 or other operating system. Also, if you are running under a unix-like system, you will need to double check the shebang invocation on top of the index.js
file to make sure that it points to your NodeJS location. I tried using env
there but it didn't work when started from inside Firefox, so it is hardcoded to the default location of NodeJS installation.
Be aware that the setup procedure will place hardcoded paths in files critical for running this app. If you move this application to a different folder or rename any folder in its path, you'll need to run this setup again.
Verifying your configuration
Run the verification script as:
$ npm run check-win
or
$ npm run check
Depending if you're running Windows 10 or other operating system.
How to install the add-on
On Firefox Nightly (or Firefox Dev Edition) go to about:debugging and use the load temporary add-on button to browse your files. Select the manifest.json file included with this repository in the webextension/build
folder.
To learn more about WebExtension development and debugging, go to MDN Web Docs - WebExtensions.
Commentary, getting help
Actually, I kinda think the whole process for native app communication is quite bad from a developer ergonomics perspective and I have no idea why Google implemented it like that in the first place but it set a precedent and now Firefox is doing it similarly. I am trying to supply some configuration verification scripts but in case everything fails, read the documentation about WebExtensions and native messaging to get back on track:
Built with git-ssb-web