📄 | README.md |
📄 | confirm.js |
📄 | index.js |
📄 | package.json |
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
}
}
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
opts.content
: content value to publishredirectBase
: base url for redirect on message publish successurl
: url for a web page for the user to confirm publishing the message
publishguard.privatePublishGetUrl(opts, cb(err, url))
: async
opts.content
: content value to publish, encrypted to recipient keysopts.recps
: recipient keys to encrypt the content value to withprivate-box
redirectBase
: base url for redirect on message publish successurl
: url for a web page for the user to confirm publishing the message
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