aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md38
-rw-r--r--enable-plugin.js27
2 files changed, 44 insertions, 21 deletions
diff --git a/README.md b/README.md
index 38e6ec3..488f6c3 100644
--- a/README.md
+++ b/README.md
@@ -25,49 +25,45 @@ SSB](http://git.scuttlebot.io/%25VaSj08AbdhIa4itK4z8Z91G80o2h5OhRLCEEO6MhAcU%3D.
## Requirements
-- [scuttlebot][] with adjusted max blobs config
-- [ssb-npm-registry][]
+- [ssb-server][]
+- [ssb-npm][]
- [git-ssb][]
-Scuttlebot's max blobs config must be adjusted to allow for the installation
-of patchfoo with `ssb-npm-registry` to complete, because of the size of native
-module dependencies. To do this, run sbot server with these options when you
-are going to do the install:
-`sbot server --blobs.max 30000000`
-Or put this in your `~/.ssb/config` to make the setting persist:
-`{"blobs":{"max":30000000}}`
-
## Install
+patchfoo can run either as a standalone process or as an ssb-server plugin.
+
+Running as a ssb-server plugin is faster and uses less resources. But it requires you to run ssb-server from the command-line, or use a ssb-server distribution that allows installing ssb-server plugins.
+
+Running as a standalone process can work while you are running a ssb-server distribution such as Patchwork, Patchbay, or Oasis. It also could potentially work with ssb-server implementations other than the Node.js one.
+
+### Install as a standalone process
+
```sh
git clone ssb://%YAg1hicat+2GELjE2QJzDwlAWcx0ML+1sXEdsWwvdt8=.sha256 patchfoo
cd patchfoo
-npm install --registry=http://localhost:8043/
+ssb-npm install
npm start
```
-Alternatively, install as an sbot plugin (advanced):
+### Install as a ssb-server plugin
```sh
cd ~/.ssb/node_modules
git clone ssb://%YAg1hicat+2GELjE2QJzDwlAWcx0ML+1sXEdsWwvdt8=.sha256 patchfoo
cd patchfoo
-npm install --registry=http://localhost:8043/
-sbot plugins.enable patchfoo
-# restart sbot
+ssb-npm install
+node enable-plugin.js
```
## Install extras
To most effectively render things, patchfoo needs the `ssb-backlinks`
-and `ssb-private` scuttlebot plugins:
+and `ssb-private` ssb-server plugins. If you are using a ssb-server distribution like Patchwork, Patchbay or Oasis's ssb-server, these are already included. If you are using ssb-server from the command-line, the plugins have to be installed separately:
```sh
sbot plugins.install ssb-backlinks
-sbot plugins.enable ssb-backlinks
sbot plugins.install ssb-private
-sbot plugins.enable ssb-private
-# restart sbot
```
## Config
@@ -146,9 +142,9 @@ To make config options persistent, set them in `~/.ssb/config`, e.g.:
- Show network status
- Add UI for using pub invites
-[scuttlebot]: %M0TrM+oJT2i/phUJO/fZ2wkK2AN2FB1xK0tqR7SNj58=.sha256
+[ssb-server]: %M0TrM+oJT2i/phUJO/fZ2wkK2AN2FB1xK0tqR7SNj58=.sha256
[patchbay]: %s9mSFATE4RGyJx9wgH22lBrvD4CgUQW4yeguSWWjtqc=.sha256
-[ssb-npm-registry]: %pFqjcdVKHqsrtOjVEAVZeCF0iY4s+3Hr0vA3EFCq5UM=.sha256
+[ssb-npm]: %iqhz/sQCZCSp91JYAqfQPzHuDYrjw1geKPf1wJ1CvlA=.sha256
[git-ssb]: %n92DiQh7ietE+R+X/I403LQoyf2DtR3WQfCkDKlheQU=.sha256
## Certifications
diff --git a/enable-plugin.js b/enable-plugin.js
new file mode 100644
index 0000000..2586b7e
--- /dev/null
+++ b/enable-plugin.js
@@ -0,0 +1,27 @@
+// Work around broken plugins.enable RPC method
+
+var fs = require('fs')
+var path = require('path')
+
+var pluginName = require('./package').name
+
+var ssbAppname = process.env.ssb_appname || 'ssb'
+var ssbPath = process.env.ssb_path ||
+ path.join(require('os').homedir(), '.' + ssbAppname)
+var confPath = path.join(ssbPath, 'config')
+var confPathTmp = confPath + '~'
+var confData = fs.existsSync(confPath)
+ ? fs.readFileSync(confPath, 'utf8')
+ : 'null'
+var conf = JSON.parse(confData) || {}
+
+var plugins = conf.plugins || (conf.plugins = {})
+if (plugins[pluginName]) {
+ console.log(pluginName + ' already enabled')
+ process.exit(0)
+}
+plugins[pluginName] = true
+
+fs.writeFileSync(confPathTmp, JSON.stringify(conf, 0, 2))
+fs.renameSync(confPathTmp, confPath)
+console.log(pluginName + ' enabled. Restart ssb-server.')