Commit 1fac221a92fbdaf25995c5519565812349b9df29
Merge branch 'master' into patch-router
mix irving committed on 8/7/2017, 4:38:55 AMParent: 23cb22e8f3709df0332639004c5a655ace3fc07a
Parent: 34c4a94f3baa311c5602618ea2ff80e6245b7c62
Files changed
package.json | changed |
sbot.js | changed |
package.json | ||
---|---|---|
@@ -1,7 +1,7 @@ | ||
1 | 1 … | { |
2 | 2 … | "name": "patchcore", |
3 | - "version": "1.8.1", | |
3 … | + "version": "1.8.2", | |
4 | 4 … | "description": "minimal core for ssb clients", |
5 | 5 … | "main": "index.js", |
6 | 6 … | "scripts": { |
7 | 7 … | "start": "electro example", |
@@ -48,9 +48,9 @@ | ||
48 | 48 … | "pull-stream": "^3.5.0", |
49 | 49 … | "simple-mime": "^0.1.0", |
50 | 50 … | "sorted-array-functions": "^1.0.0", |
51 | 51 … | "split-buffer": "^1.0.0", |
52 | - "ssb-client": "^4.4.0", | |
52 … | + "ssb-client": "^4.5.0", | |
53 | 53 … | "ssb-config": "^2.2.0", |
54 | 54 … | "ssb-feed": "^2.3.0", |
55 | 55 … | "ssb-keys": "^7.0.9", |
56 | 56 … | "ssb-markdown": "^3.3.0", |
sbot.js | ||
---|---|---|
@@ -173,26 +173,9 @@ | ||
173 | 173 … | }), |
174 | 174 … | addBlob: rec.async((stream, cb) => { |
175 | 175 … | return pull( |
176 | 176 … | 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) | |
195 | 178 … | ) |
196 | 179 … | }), |
197 | 180 … | gossipConnect: rec.async(function (opts, cb) { |
198 | 181 … | sbot.gossip.connect(opts, cb) |
@@ -250,19 +233,4 @@ | ||
250 | 233 … | // api.sbot.hook.feed(msg) |
251 | 234 … | } |
252 | 235 … | } |
253 | 236 … | } |
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