git ssb

0+

Dominic / ssb-ooo



Commit ada2e9cac25f910004c85ab51e8d6b3ece0805b4

expose status

Dominic Tarr committed on 11/9/2017, 12:25:47 AM
Parent: b77b50b17bad4787bb16fa8c11a4d2eefabdf0b9

Files changed

index.jschanged
index.jsView
@@ -55,8 +55,9 @@
5555 function get (id, cb) {
5656 gq.query(id, function (err, msg) {
5757 if(err) return cb(err)
5858 store.add(msg, function (err, data) {
59 + data.ooo = true
5960 cb(null, data)
6061 })
6162 })
6263 }
@@ -67,12 +68,23 @@
6768 if(id.raw) fn(id.id, cb)
6869 else
6970 fn(id, function (err, value) {
7071 if(!err) cb(null, value)
71- else get(id, cb)
72 + else get(id, function (err, data) {
73 + if(err) cb(err)
74 + else cb(null, data.value)
75 + })
7276 })
7377 })
7478
79 + sbot.status.hook(function (fn, args) {
80 + var status = fn()
81 + status.ooo = {}
82 + for(var id in gq.state)
83 + status.ooo[id] = gq.state[id]
84 + return status
85 + })
86 +
7587 sbot.on('rpc:connect', function (rpc, isClient) {
7688 if(isClient) {
7789 var stream = gq.createStream(rpc.id)
7890 pull(stream, rpc.ooo.stream(function () {}), stream)
@@ -87,6 +99,4 @@
8799 get: get
88100 }
89101 }
90102
91-
92-

Built with git-ssb-web