diff options
author | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2018-01-26 22:47:14 -1000 |
---|---|---|
committer | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2018-01-26 22:47:14 -1000 |
commit | b1f5bccd58e994f7c32298cb8509a77914b0a0c8 (patch) | |
tree | 57d376cbdd7adcb4ab08aec5d775e330f39c0be5 | |
parent | 713049a7b0039a73ca35c2ce1ef6a47ee621d3aa (diff) | |
download | patchfoo-b1f5bccd58e994f7c32298cb8509a77914b0a0c8.tar.gz patchfoo-b1f5bccd58e994f7c32298cb8509a77914b0a0c8.zip |
Handle hooked sbot.get
-rw-r--r-- | lib/app.js | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -343,9 +343,19 @@ App.prototype.getNameSync = function (name) { return about && about.name } +function sbotGet(sbot, id, cb) { + // try sbot.get via ssb-ooo a50da3928500f3ac0fbead0a1b335a3dd5bbc096 first + sbot.get({id: id, raw: true}, function (err, value) { + if (err && err.message === 'Param 0 must by of type number') { + return sbot.get(id, cb) + } + cb(err, value) + }) +} + function getMsgWithValue(sbot, id, cb) { if (!id) return cb() - sbot.get(id, function (err, value) { + sbotGet(sbot, id, function (err, value) { if (err) return cb(err) cb(null, {key: id, value: value}) }) |