Skip to content

webap-api/webap-browser-extension

Repository files navigation

WebAP Browser Extension

This is a browser extension that implements the WebAP API (still an idea), exposing it to web applications.

It is currently in development, not yet in usable state.

The first release will be proof of concept, not ready for "productive" usage.

Until there is a reasonably stable data model and API, it it will remain with major version 0 and not committed for backwards compatibility.

Try it out

Still a prototype or proof of concept, so don't expect much.

The extension is not yet published on the chrome web store or any other store, so it must be built and installed locally.

Tested on Pleroma. it requires support to WebFinger, the Mastodon apps API, OAuth 2.0 Authentication and ActivityPub Client to Server (C2S).

Installation

  1. Clone this repo
  2. Install dependencies with npm install
  3. Run the dev version with npm start
    • At this point, the extension code will be built into the folder dist
  4. On your browser, go to the extensions management page (e.g. chrome://extensions/)
  5. Turn on the Developer mode
  6. Click on Load unpacked
  7. Select the dist folder

Setup

  1. Go to the extension options (screenshot here: #6)
  2. Add an account with an arbitrary alias of your choice and your account identifier with the format dellagustindev@blob.cat
  3. Click Authorize and follow the instructions
    • If everything goes right, you will see your account listed under Accounts, the Authorize button will not be visible anymore

Send post using the WebAP API

  1. Open and arbitrary webpage
  2. Go to the webpage console
  3. Run the code below
const clients = await WebAP.getClients();
clients[0].postToOutbox({
  "type": "Create",
  "to": [
    "https://www.w3.org/ns/activitystreams#Public"
  ],
  "object": {
    "published": new Date(),
    "type": "Note",
    "to": [
      "https://www.w3.org/ns/activitystreams#Public"
    ],
    "content": "This is a message sent with the WebAP API, learn more at https://github.com/webap-api"
  }
});

Now check your account, you should see the message there as if you posted it (well, you did post it!).

References

The initial state of the repository and tooling setup is largely based on podStation.

Many of the concepts were inspired or even copied from Joule, which analogously implement the WebLN API.