diff options
Diffstat (limited to 'lib/app.js')
-rw-r--r-- | lib/app.js | 40 |
1 files changed, 40 insertions, 0 deletions
@@ -977,6 +977,46 @@ App.prototype.getAddresses = function (id) { ) } +App.prototype.isPub = function (id, cb) { + if (!this.sbot.backlinks) { + return pull( + this.sbot.links({ + dest: id, + rel: 'pub' + }), + pull.take(1), + pull.collect(function (err, links) { + if (err) return cb(err) + cb(null, links.length == 1) + }) + ) + } + return pull( + this.sbot.backlinks.read({ + limit: 1, + query: [ + {$filter: { + dest: id, + value: { + content: { + type: 'pub', + address: { + key: id, + host: {$truthy: true}, + port: {$truthy: true}, + } + } + } + }} + ] + }), + pull.collect(function (err, msgs) { + if (err) return cb(err) + cb(null, msgs.length == 1) + }) + ) +} + App.prototype.getIdeaTitle = function (id, cb) { if (!this.sbot.backlinks) return cb(null, String(id).substr(0, 8) + '…') pull( |