git ssb


cel / ssb-publishguard

cel committed Add useTermux optionLatest: 93b45af on 2/24/2020, 1:12:07 AM


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.


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


  "publishguard": {
    "browser": "dillo", // command to spawn confirm page
    "port": 0, // port number to listen on if not using ssb-ws
    "useTermux": false, // use Termux API confirm dialog, instead of browser page

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.


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.


© 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