git ssb

7+

dinoworm 🐛 / patchcore



Commit cfa33aa58de8d7d7f6608e54b5aa5a4e7db080b9

pass caps.shs to invite sbot

Dominic Tarr committed on 8/18/2017, 8:37:33 AM
Parent: 9469eaafc9482e2d17b32da95e903b8bf02737a4

Files changed

invite.jschanged
invite.jsView
@@ -7,9 +7,10 @@
77 exports.needs = nest({
88 'sbot.async.publish': 'first',
99 'sbot.async.gossipConnect': 'first',
1010 'contact.async.followerOf': 'first',
11- 'keys.sync.id': 'first'
11 + 'keys.sync.id': 'first',
12 + 'config.sync.load': 'first'
1213 })
1314
1415 exports.gives = nest({
1516 'invite.async.accept': true,
@@ -20,8 +21,11 @@
2021 function accept (invite, cb) {
2122 var progress = Value('Connecting...')
2223 var data = ref.parseInvite(invite)
2324 var id = api.keys.sync.id()
25 +
26 + var config = api.config.sync.load()
27 +
2428 if (!data) return cb(new Error('Not a valid invite code. Please make sure you copied the entire code and try again.'))
2529
2630 api.sbot.async.gossipConnect(data.remote, function (err) {
2731 if (err) console.log(err)
@@ -29,9 +33,10 @@
2933
3034 // connect to the remote pub using the invite code
3135 ssbClient(null, {
3236 remote: data.invite,
33- manifest: { invite: {use: 'async'}, getAddress: 'async' }
37 + manifest: { invite: {use: 'async'}, getAddress: 'async' },
38 + appKey: config.caps.shs
3439 }, function (err, sbot) {
3540 if (err) return cb(err)
3641 progress.set('Requesting follow...')
3742
@@ -81,9 +86,9 @@
8186 var id = api.keys.sync.id()
8287 var data = ref.parseInvite(invite)
8388 api.contact.async.followerOf(id, data.key, function (_, follows) {
8489 if (follows) console.log('already following', cb())
85- else accept(invite, cb)
90 + else console.log('accept invite:'+invite, accept(invite, cb))
8691 })
8792 }
8893 })
8994 }

Built with git-ssb-web