git ssb

2+

mixmix / ticktack



Commit 551f04896e6e23abbd4d9c5e0cce0839cf27da9d

Merge pull request #87 from ticktackim/autopub2

add multiple auto invite support
mix irving authored on 2/6/2018, 10:45:33 AM
GitHub committed on 2/6/2018, 10:45:33 AM
Parent: 995a327f60be262d0cbf324678a9fd80c6305a3e
Parent: 3c1fa0eb2d1683293c08cd3ba12a247424bf2c5a

Files changed

app/html/app.jschanged
default-config.jsonchanged
ssb-config.jsonchanged
app/html/app.jsView
@@ -77,26 +77,27 @@
7777
7878 }
7979
8080 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+
8287 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+ })
100101 }
101102 }
102103
default-config.jsonView
@@ -2,10 +2,11 @@
22 "_port": 43750,
33 "_blobsPort": 43751,
44 "_ws": { "port": 43751 },
55 "_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+ ]
711 }
812
9-
10-
11-
ssb-config.jsonView
@@ -1,3 +1,7 @@
11 {
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+ ]
36 }
7+

Built with git-ssb-web