git ssb

7+

dinoworm 🐛 / patchcore



Commit 8787f12fef0041838b95781c8ab99865010468f5

use latest ssb-client and remove blobs hack

ssbc/patchwork#580
Matt McKegg committed on 7/26/2017, 4:24:24 AM
Parent: af2008b48a9d597cb4374d5e2fb4523a29106aa1

Files changed

package.jsonchanged
sbot.jschanged
package.jsonView
@@ -48,9 +48,9 @@
4848 "pull-stream": "^3.5.0",
4949 "simple-mime": "^0.1.0",
5050 "sorted-array-functions": "^1.0.0",
5151 "split-buffer": "^1.0.0",
52- "ssb-client": "^4.4.0",
52 + "ssb-client": "^4.5.0",
5353 "ssb-config": "^2.2.0",
5454 "ssb-feed": "^2.3.0",
5555 "ssb-keys": "^7.0.9",
5656 "ssb-markdown": "^3.3.0",
sbot.jsView
@@ -173,26 +173,9 @@
173173 }),
174174 addBlob: rec.async((stream, cb) => {
175175 return pull(
176176 stream,
177- Hash(function (err, id) {
178- if (err) return cb(err)
179- // completely UGLY hack to tell when the blob has been sucessfully written...
180- var start = Date.now()
181- var n = 5
182- next()
183-
184- function next () {
185- setTimeout(function () {
186- sbot.blobs.has(id, function (_, has) {
187- if (has) return cb(null, id)
188- if (n--) next()
189- else cb(new Error('write failed'))
190- })
191- }, Date.now() - start)
192- }
193- }),
194- sbot.blobs.add()
177 + sbot.blobs.add(cb)
195178 )
196179 }),
197180 gossipConnect: rec.async(function (opts, cb) {
198181 sbot.gossip.connect(opts, cb)
@@ -250,19 +233,4 @@
250233 // api.sbot.hook.feed(msg)
251234 }
252235 }
253236 }
254-
255-function Hash (onHash) {
256- var buffers = []
257- return pull.through(function (data) {
258- buffers.push(typeof data === 'string'
259- ? new Buffer(data, 'utf8')
260- : data
261- )
262- }, function (err) {
263- if (err && !onHash) throw err
264- var b = buffers.length > 1 ? Buffer.concat(buffers) : buffers[0]
265- var h = '&' + ssbKeys.hash(b)
266- onHash && onHash(err, h)
267- })
268-}

Built with git-ssb-web