Commit be227038215cfd41dc8aee4c1ece14657a72abce
store whether each pub follows me
mix irving committed on 5/31/2018, 1:38:37 AMParent: 4f85a663f11b42d3b209019fcf598a738e7e43ee
Files changed
backup/async/exportIdentity.js | changed |
backup/async/exportIdentity.js | ||
---|---|---|
@@ -24,14 +24,14 @@ | ||
24 | 24 | var backup = { |
25 | 25 | exportDate: new Date().toISOString(), |
26 | 26 | secret: fs.readFileSync(secretFile, 'utf8'), |
27 | 27 | gossip: require(gossipFile) |
28 | - // gossip: JSON.parse(fs.readFileSync(gossipFile)), | |
29 | 28 | } |
30 | 29 | |
31 | 30 | onceTrue(api.sbot.obs.connection, sbot => { |
32 | 31 | parallel([ |
33 | 32 | getLatestSequence, |
33 | + getGossipFollowers, | |
34 | 34 | getPeersSequence |
35 | 35 | ], save) |
36 | 36 | |
37 | 37 | function getLatestSequence (done) { |
@@ -42,8 +42,21 @@ | ||
42 | 42 | done(null) |
43 | 43 | }) |
44 | 44 | } |
45 | 45 | |
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 | + | |
46 | 59 | function getPeersSequence (done) { |
47 | 60 | sbot.friends.get({ source: sbot.id }, (err, d) => { |
48 | 61 | if (err) return done(err) |
49 | 62 |
Built with git-ssb-web