aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorcel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2018-01-26 22:47:14 -1000
committercel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2018-01-26 22:47:14 -1000
commitb1f5bccd58e994f7c32298cb8509a77914b0a0c8 (patch)
tree57d376cbdd7adcb4ab08aec5d775e330f39c0be5 /lib
parent713049a7b0039a73ca35c2ce1ef6a47ee621d3aa (diff)
downloadpatchfoo-b1f5bccd58e994f7c32298cb8509a77914b0a0c8.tar.gz
patchfoo-b1f5bccd58e994f7c32298cb8509a77914b0a0c8.zip
Handle hooked sbot.get
Diffstat (limited to 'lib')
-rw-r--r--lib/app.js12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/app.js b/lib/app.js
index 297c170..6909846 100644
--- a/lib/app.js
+++ b/lib/app.js
@@ -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})
})