Commit 3c1fa0eb2d1683293c08cd3ba12a247424bf2c5a
add multiple auto invite support
mix committed on 2/6/2018, 10:44:32 AMParent: 995a327f60be262d0cbf324678a9fd80c6305a3e
Files changed
app/html/app.js | changed |
default-config.json | changed |
ssb-config.json | changed |
app/html/app.js | ||
---|---|---|
@@ -77,26 +77,27 @@ | ||
77 | 77 | |
78 | 78 | } |
79 | 79 | |
80 | 80 | function autoPub () { |
81 | - var invite = api.config.sync.load().autoinvite | |
81 | + var invites = api.config.sync.load().autoinvites | |
82 | + if(!invites) { | |
83 | + console.log('no invites') | |
84 | + return | |
85 | + } | |
86 | + | |
82 | 87 | var self_id = api.config.sync.load().keys.id |
83 | - if(invite) { | |
84 | - api.sbot.async.friendsGet({dest: self_id}, function (err, friends) { | |
85 | - //if you have less than 5 followers, maybe use the autoinvite | |
86 | - if(Object.keys(friends).length <= 5) | |
87 | - api.invite.async.autofollow( | |
88 | - invite, | |
89 | - function (err, follows) { | |
90 | - if (err) console.error('Autofollow error:', err) | |
91 | - else console.log('Autofollow success', follows) | |
92 | - } | |
93 | - ) | |
94 | - else | |
95 | - console.log('no autoinvite - you have friends already') | |
96 | - }) | |
97 | - } | |
98 | - else | |
99 | - console.log('no invite') | |
88 | + api.sbot.async.friendsGet({dest: self_id}, function (err, friends) { | |
89 | + //if you have less than 5 followers, maybe use the autoinvite | |
90 | + if(Object.keys(friends).length <= 5) | |
91 | + invites.forEach(invite => { | |
92 | + console.log('using invite:', invite) | |
93 | + api.invite.async.autofollow(invite, (err, follows) => { | |
94 | + if (err) console.error('Autofollow error:', err) | |
95 | + else console.log('Autofollow success', follows) | |
96 | + }) | |
97 | + }) | |
98 | + else | |
99 | + console.log('no autoinvite - you have friends already') | |
100 | + }) | |
100 | 101 | } |
101 | 102 | } |
102 | 103 |
default-config.json | ||
---|---|---|
@@ -2,10 +2,11 @@ | ||
2 | 2 | "_port": 43750, |
3 | 3 | "_blobsPort": 43751, |
4 | 4 | "_ws": { "port": 43751 }, |
5 | 5 | "_caps": {"shs": "ErgQF85hFQpUXp69IXtLW+nXDgFIOKKDOWFX/st2aWk="}, |
6 | - "autoinvite": "net:128.199.76.241:8008~shs:7xMrWP8708+LDvaJrRMRQJEixWYp4Oipa9ohqY7+NyQ=:oxWZicO67cnXBRyL/VorYknQK8BHkBnj6IRQFXgjGoA=" | |
6 | + "autoinvites": [ | |
7 | + "net:128.199.76.241:8008~shs:7xMrWP8708+LDvaJrRMRQJEixWYp4Oipa9ohqY7+NyQ=:oxWZicO67cnXBRyL/VorYknQK8BHkBnj6IRQFXgjGoA=", | |
8 | + | |
9 | + "138.68.27.255:8008:@MflVZCcOBOUe6BLrm/8TyirkTu9/JtdnIJALcd8v5bc=.ed25519~Mfz6xcajHDtH3Z2Dp4I7HT7K1l0MWxJxOftlEBct8jU=" | |
10 | + ] | |
7 | 11 | } |
8 | 12 | |
9 | - | |
10 | - | |
11 | - |
ssb-config.json | ||
---|---|---|
@@ -1,3 +1,7 @@ | ||
1 | 1 | { |
2 | - "autoinvite": "net:128.199.76.241:8008~shs:7xMrWP8708+LDvaJrRMRQJEixWYp4Oipa9ohqY7+NyQ=:oxWZicO67cnXBRyL/VorYknQK8BHkBnj6IRQFXgjGoA=" | |
2 | + "autoinvites": [ | |
3 | + "net:128.199.76.241:8008~shs:7xMrWP8708+LDvaJrRMRQJEixWYp4Oipa9ohqY7+NyQ=:oxWZicO67cnXBRyL/VorYknQK8BHkBnj6IRQFXgjGoA=", | |
4 | + "138.68.27.255:8008:@MflVZCcOBOUe6BLrm/8TyirkTu9/JtdnIJALcd8v5bc=.ed25519~Mfz6xcajHDtH3Z2Dp4I7HT7K1l0MWxJxOftlEBct8jU=" | |
5 | + ] | |
3 | 6 | } |
7 | + |
Built with git-ssb-web