Commit c1a9f36fb8654b836e254880ed4de71e4c9bf187
load manifest from opts or disk instead of loading all the plugins
Dominic Tarr committed on 12/19/2015, 10:39:39 PMParent: 74dbf51ecef0f7d93a03826128d2a3c421f941c9
Files changed
index.js | changed |
index.js | ||
---|---|---|
@@ -1,26 +1,19 @@ | ||
1 | 1 | var path = require('path') |
2 | 2 | var ssbKeys = require('ssb-keys') |
3 | 3 | var config = require('ssb-config') |
4 | +var SecretStack = require('secret-stack') | |
5 | +var explain = require('explain-error') | |
6 | +var cap = | |
7 | + new Buffer('1KHLiKZvAvjbY1ziZEHMXawbCEIM6qwjCDm3VYRan/s=', 'base64') | |
4 | 8 | |
5 | -var createSbot = require('scuttlebot') | |
6 | - .use(require('scuttlebot/plugins/master')) | |
7 | - .use(require('scuttlebot/plugins/gossip')) | |
8 | - .use(require('scuttlebot/plugins/friends')) | |
9 | - .use(require('scuttlebot/plugins/replicate')) | |
10 | - .use(require('scuttlebot/plugins/blobs')) | |
11 | - .use(require('scuttlebot/plugins/invite')) | |
12 | - .use(require('scuttlebot/plugins/block')) | |
13 | - .use(require('scuttlebot/plugins/local')) | |
14 | - .use(require('scuttlebot/plugins/logging')) | |
15 | - .use(require('scuttlebot/plugins/private')) | |
16 | 9 | |
17 | 10 | module.exports = function (keys, opts, cb) { |
18 | 11 | if (typeof keys == 'function') { |
19 | 12 | cb = keys |
20 | 13 | keys = null |
21 | 14 | opts = null |
22 | - } | |
15 | + } | |
23 | 16 | if (typeof opts == 'function') { |
24 | 17 | cb = opts |
25 | 18 | opts = null |
26 | 19 | } |
@@ -30,6 +23,18 @@ | ||
30 | 23 | opts.host = opts.host || 'localhost' |
31 | 24 | opts.port = opts.port || config.port |
32 | 25 | opts.key = opts.key || keys.id |
33 | 26 | |
34 | - createSbot.createClient({keys: keys})(opts, cb) | |
35 | -} | |
27 | + var createNode = SecretStack({appKey: cap}) | |
28 | + | |
29 | + var manifest = opts.manifest || (function () { | |
30 | + try { | |
31 | + return JSON.parse(fs.readFileSync( | |
32 | + path.join(config.path, 'manifest.json') | |
33 | + )) | |
34 | + } catch (err) { | |
35 | + throw explain(err, 'could not load manifest file') | |
36 | + } | |
37 | + })() | |
38 | + | |
39 | + createNode.createClient({keys: keys, manifest: manifest})(opts, cb) | |
40 | +} |
Built with git-ssb-web