git ssb

2+

Dominic / ssb-client



Commit c1a9f36fb8654b836e254880ed4de71e4c9bf187

load manifest from opts or disk instead of loading all the plugins

Dominic Tarr committed on 12/19/2015, 10:39:39 PM
Parent: 74dbf51ecef0f7d93a03826128d2a3c421f941c9

Files changed

index.jschanged
index.jsView
@@ -1,26 +1,19 @@
11 var path = require('path')
22 var ssbKeys = require('ssb-keys')
33 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')
48
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'))
169
1710 module.exports = function (keys, opts, cb) {
1811 if (typeof keys == 'function') {
1912 cb = keys
2013 keys = null
2114 opts = null
22- }
15+ }
2316 if (typeof opts == 'function') {
2417 cb = opts
2518 opts = null
2619 }
@@ -30,6 +23,18 @@
3023 opts.host = opts.host || 'localhost'
3124 opts.port = opts.port || config.port
3225 opts.key = opts.key || keys.id
3326
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