Skip to content

Latest commit

 

History

History
104 lines (64 loc) · 4.99 KB

README.md

File metadata and controls

104 lines (64 loc) · 4.99 KB

Sbot Native App for Firefox WebExtensions

This is an ALPHA quality native companion app to supply features for Firefox WebExtensions posting to the scuttlebutt platform.

This is needed 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. Through this communication channel, an add-on can call on features provided by this native app. 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.

Features provided 🐚

This is quite alpha software, I am quite happy that it actually runs... WebExtensions can post commands to sbot_native_app, the commands are in the following format:

{
    cmd: <the command>,
    data: <optional data>
}

The current implemented commands are:

whoami

This commands returns the default identity. It doesn't require any data parameter.

publish

This commands calls sbot.publish() passing the data argument to the call. It can be used to post to your feed. For sample usage, check out the Share on Scuttlebutt WebExtension

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.

Commentary, getting help

Actually, I kinda think the whole process 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:

Don't hesitate to reach out to me at:

  • Scuttlebutt: @gaQw6z30GpfsW9k8V5ED4pHrg8zmrqku24zTSAINhRg=.ed25519
  • Mastodon: @soapdog@toot.cafe
  • Twitter: @soapdog

Verifying your configuration on Windows 10

Run the verification script as:

$ npm run check-win

or

$ npm run check

Depending if you're running Windows 10 or other operating system.

Contributing

This is free software under the terms of the MIT license. I would love contributions to this WebExtension. I tried to make it as vanilla as possible to the point that it is quite naive. My objective is to make it approachable for new contributors with minimal knowledge of JS.

The WebExtension is running on a different and isolated DOM than the page being displayed so we don't need to worry about many stuff that is common to Web Development.

If you want to contribute, these are some ideas:

  • Need to expose more API calls.
  • Need a shim to make WebExtension developer life easier so they don't keep programming in such low-level API like ports.
  • Need robust setup code and instructions.

Sponsorship

Do you want a decentralized internet too? Are you worried about the loss of net neutrality and realized that radical decentralization is the way to fight back? Have some cryptobucks to spare? If you want to make a financial contribution to help me fund development of this and other dex focused software, I would love to receive contributions in the following cryptocurrencies:

  • Ethereum: 0x0bd1bbb25cc9dd2ce8ea1fba4e333ff091f671a9
  • Bitcoin: 1Px1PeVBJ2Mz1iC6UF8UZVXW7zPoonMVKJ
  • DASH: Xh5b2TfS7CTUgSMUENWUQFmTqZyk3DUdQX