git ssb

2+

mixmix / ticktack



Commit be227038215cfd41dc8aee4c1ece14657a72abce

store whether each pub follows me

mix irving committed on 5/31/2018, 1:38:37 AM
Parent: 4f85a663f11b42d3b209019fcf598a738e7e43ee

Files changed

backup/async/exportIdentity.jschanged
backup/async/exportIdentity.jsView
@@ -24,14 +24,14 @@
2424 var backup = {
2525 exportDate: new Date().toISOString(),
2626 secret: fs.readFileSync(secretFile, 'utf8'),
2727 gossip: require(gossipFile)
28- // gossip: JSON.parse(fs.readFileSync(gossipFile)),
2928 }
3029
3130 onceTrue(api.sbot.obs.connection, sbot => {
3231 parallel([
3332 getLatestSequence,
33+ getGossipFollowers,
3434 getPeersSequence
3535 ], save)
3636
3737 function getLatestSequence (done) {
@@ -42,8 +42,21 @@
4242 done(null)
4343 })
4444 }
4545
46+ function getGossipFollowers (done) {
47+ // the peers in gossip list who follow me
48+ sbot.friends.get({ dest: sbot.id }, (err, followers) => {
49+ if (err) return done(err)
50+
51+ backup.gossip.forEach(record => {
52+ if (followers[record.key]) record.followsMe = true
53+ })
54+
55+ done(null)
56+ })
57+ }
58+
4659 function getPeersSequence (done) {
4760 sbot.friends.get({ source: sbot.id }, (err, d) => {
4861 if (err) return done(err)
4962

Built with git-ssb-web