Commit cfa33aa58de8d7d7f6608e54b5aa5a4e7db080b9
pass caps.shs to invite sbot
Dominic Tarr committed on 8/18/2017, 8:37:33 AMParent: 9469eaafc9482e2d17b32da95e903b8bf02737a4
Files changed
invite.js | changed |
invite.js | ||
---|---|---|
@@ -7,9 +7,10 @@ | ||
7 | 7 … | exports.needs = nest({ |
8 | 8 … | 'sbot.async.publish': 'first', |
9 | 9 … | 'sbot.async.gossipConnect': 'first', |
10 | 10 … | 'contact.async.followerOf': 'first', |
11 | - 'keys.sync.id': 'first' | |
11 … | + 'keys.sync.id': 'first', | |
12 … | + 'config.sync.load': 'first' | |
12 | 13 … | }) |
13 | 14 … | |
14 | 15 … | exports.gives = nest({ |
15 | 16 … | 'invite.async.accept': true, |
@@ -20,8 +21,11 @@ | ||
20 | 21 … | function accept (invite, cb) { |
21 | 22 … | var progress = Value('Connecting...') |
22 | 23 … | var data = ref.parseInvite(invite) |
23 | 24 … | var id = api.keys.sync.id() |
25 … | + | |
26 … | + var config = api.config.sync.load() | |
27 … | + | |
24 | 28 … | if (!data) return cb(new Error('Not a valid invite code. Please make sure you copied the entire code and try again.')) |
25 | 29 … | |
26 | 30 … | api.sbot.async.gossipConnect(data.remote, function (err) { |
27 | 31 … | if (err) console.log(err) |
@@ -29,9 +33,10 @@ | ||
29 | 33 … | |
30 | 34 … | // connect to the remote pub using the invite code |
31 | 35 … | ssbClient(null, { |
32 | 36 … | remote: data.invite, |
33 | - manifest: { invite: {use: 'async'}, getAddress: 'async' } | |
37 … | + manifest: { invite: {use: 'async'}, getAddress: 'async' }, | |
38 … | + appKey: config.caps.shs | |
34 | 39 … | }, function (err, sbot) { |
35 | 40 … | if (err) return cb(err) |
36 | 41 … | progress.set('Requesting follow...') |
37 | 42 … | |
@@ -81,9 +86,9 @@ | ||
81 | 86 … | var id = api.keys.sync.id() |
82 | 87 … | var data = ref.parseInvite(invite) |
83 | 88 … | api.contact.async.followerOf(id, data.key, function (_, follows) { |
84 | 89 … | if (follows) console.log('already following', cb()) |
85 | - else accept(invite, cb) | |
90 … | + else console.log('accept invite:'+invite, accept(invite, cb)) | |
86 | 91 … | }) |
87 | 92 … | } |
88 | 93 … | }) |
89 | 94 … | } |
Built with git-ssb-web