From 475c443979b6933ed8d7421a7b4aef619d6b51f8 Mon Sep 17 00:00:00 2001 From: cel Date: Sun, 14 Jun 2020 11:47:26 -0400 Subject: Update readme. Add enable plugin. - Use enable script instead of plugins.enable which is broken. plugins.enable is also no longer needed after plugins.install. - Recommend using ssb-npm command instead of ssb-npm-registry. Using ssb-npm command should be a little simpler and more obvious, since when you don't have the prerequisite you will get "command not found" which implies you need to install something, rather than the mysterious "connect ECONNREFUSED 127.0.0.1:8043" - Remove blobs.max setting. Recent ssb-npm hard-codes workarounds for sodium-native which is (was) the only oversized blob. - Don't need to say restart ssb-server; the commands will do that. - Explain installation as standalone process vs. as ssb-server plugin. - scuttlebot -> ssb-server --- enable-plugin.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 enable-plugin.js (limited to 'enable-plugin.js') 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.') -- cgit v1.2.3