git ssb

3+

cel / ssb-publishguard



Tree: 5a3cd636ffd4211ee7958de59fc2011a7d6f58eb

Files: 5a3cd636ffd4211ee7958de59fc2011a7d6f58eb / README.md

2608 bytesRaw

ssb-publishguard

Intercept publishing messages with a prompt in a local web browser.

With this scuttlebot plugin installed, any call to sbot.publish or sbot.private.publish will trigger opening a web browser with a form to confirm or cancel publishing the proposed message.

The purpose of this to give the user a final review of any message that their scuttlebot client is going to publish. This may help reduce the likelihood of publishing accidental, malformed, duplicate, or poorly-thought-out messages.

Install

ln -rs . ~/.ssb/node_modules/ssb-publishguard
sbot plugins.enable ssb-publishguard
# restart sbot server

Config

{
  "publishguard": {
    "browser": "dillo", // command to spawn confirm page
    "port": 0, // port number to listen on if not using ssb-ws
  }
}

If publishguard detects ssb-ws, it will use ssb-ws as the web server. Otherwise, it will spawn its own web server, on the localhost port specified in the config, or a random port if none (0) is specified.

Usage

It wraps the publish and private.publish sbot calls, so you can continue using those.

Additional methods allow integration via HTTP redirects instead of spawning a browser:

publishguard.publishGetUrl(opts, cb(err, url)) : async

publishguard.privatePublishGetUrl(opts, cb(err, url)) : async

If redirectBase is specified, if the user allows a message to be publish through publishguard, their browser will redirect to the redirectBase
concatenated with the URL-encoded message id. This is so if you are building an SSB web app, you can seamlessly integrate with publishguard by redirecting to it and then getting a redirect back.

If redirectBase is not specified, after approving publish, the user will receive a simple page showing the resulting message JSON.

License

© 2018-2019 cel @f/6sQ6d...

Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. This file is offered as-is, without any warranty.

Built with git-ssb-web