git ssb

2+

mixmix / ticktack



Commit 45747ccda7b06223e42c0ead8833c062687d0d80

Merge branch 'ebt' into export-full

mix irving committed on 5/22/2018, 10:22:23 PM
Parent: 5d4d175f2895574c5670910407ca9436c1154f06
Parent: 275c10f68df818ea212601d260752d2256a9ce4e

Files changed

app/html/app.jschanged
app/html/app.jsView
@@ -1,6 +1,6 @@
11 const nest = require('depnest')
2-const { h, Value } = require('mutant')
2+const { h, Value, onceTrue } = require('mutant')
33
44 exports.gives = nest('app.html.app')
55
66 exports.needs = nest({
@@ -12,15 +12,17 @@
1212 'keys.sync.id': 'first',
1313 'router.sync.router': 'first',
1414 'settings.sync.get': 'first',
1515 'settings.sync.set': 'first',
16-
1716 'invite.async.autofollow': 'first',
1817 'config.sync.load': 'first',
1918 'sbot.async.friendsGet': 'first',
20- 'sbot.async.get': 'first'
19+ 'sbot.async.get': 'first',
20+ 'sbot.obs.connection': 'first' // EBT
2121 })
2222
23+var count = 0 // TODO - rm
24+
2325 exports.create = (api) => {
2426 var view
2527
2628 return nest({
@@ -33,12 +35,32 @@
3335 api.history.obs.location()(loc => console.log('location:', loc))
3436
3537 startApp()
3638
39+ onceTrue(api.sbot.obs.connection, server => getMySeq(server)) // EBT
40+
3741 return app
3842 }
3943 })
4044
45+ function getMySeq (server) {
46+ server.ebt.remoteFeedSequence((err, data) => {
47+ server.latestSequence(server.id, (err, seq) => {
48+ console.log(`${count} mins`)
49+ count = count + 1
50+ console.log('actual seq:', seq)
51+ console.log(JSON.stringify(data, null, 2))
52+ console.log('ticktack pubs', [
53+ '@7xMrWP8708+LDvaJrRMRQJEixWYp4Oipa9ohqY7+NyQ=.ed25519',
54+ '@MflVZCcOBOUe6BLrm/8TyirkTu9/JtdnIJALcd8v5bc=.ed25519'
55+ ])
56+ console.log('------------------')
57+ })
58+ })
59+
60+ setTimeout(() => getMySeq(server), 60000)
61+ }
62+
4163 function renderLocation (loc) {
4264 var page = api.router.sync.router(loc)
4365 if (page) {
4466 view.set([
@@ -85,19 +107,25 @@
85107 console.log('no invites')
86108 return
87109 }
88110
89- var self_id = api.config.sync.load().keys.id
90- api.sbot.async.friendsGet({dest: self_id}, function (err, friends) {
91- // if you have less than 5 followers, maybe use the autoinvite
92- if (Object.keys(friends).length <= 5) {
93- invites.forEach(invite => {
94- console.log('using invite:', invite)
95- api.invite.async.autofollow(invite, (err, follows) => {
96- if (err) console.error('Autofollow error:', err)
97- else console.log('Autofollow success', follows)
98- })
111+ useInvites(invites)
112+ // TODO change it so that if you already have a bunch of friends you unfollow the pubs after they follow you?
113+
114+ // var myKey = api.config.sync.load().keys.id
115+ // api.sbot.async.friendsGet({dest: myKey}, function (err, friends) {
116+ // // if you have less than 5 followers, maybe use the autoinvite
117+ // if (Object.keys(friends).length <= 5) useInvites(invites)
118+ // else console.log('no autoinvite - you have friends already')
119+ // })
120+
121+ function useInvites (invites) {
122+ invites.forEach(invite => {
123+ console.log('using invite:', invite)
124+ api.invite.async.autofollow(invite, (err, follows) => {
125+ if (err) console.error('Autofollow error:', err)
126+ else console.log('Autofollow success', follows)
99127 })
100- } else { console.log('no autoinvite - you have friends already') }
101- })
128+ })
129+ }
102130 }
103131 }

Built with git-ssb-web