GithubHelp home page GithubHelp logo

soapdog / sbot_native_app Goto Github PK

View Code? Open in Web Editor NEW
4.0 2.0 1.0 43 KB

Companion native app to provide scuttlebutt features for WebExtensions through native messaging API

Batchfile 1.27% JavaScript 98.73%
scuttlebutt sbot webextension decentralized

sbot_native_app's Introduction

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: @[email protected]
  • 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

sbot_native_app's People

Contributors

soapdog avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

yilab

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.