aboutsummaryrefslogtreecommitdiff
path: root/lib/serve.js
diff options
context:
space:
mode:
authorcel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2019-02-26 16:20:46 +1300
committercel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2019-02-26 16:23:19 +1300
commitb12aaed21a4ecc442bcb3f19d14471abda18d290 (patch)
tree1dfd83ae69db1da77996c97e80d569cf86f1a799 /lib/serve.js
parent0ea62e678790b26ca21aace8e8923de7d11a14b3 (diff)
downloadpatchfoo-b12aaed21a4ecc442bcb3f19d14471abda18d290.tar.gz
patchfoo-b12aaed21a4ecc442bcb3f19d14471abda18d290.zip
Handle missing ssb-friends method
Diffstat (limited to 'lib/serve.js')
-rw-r--r--lib/serve.js14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/serve.js b/lib/serve.js
index a3082c6..9ef292a 100644
--- a/lib/serve.js
+++ b/lib/serve.js
@@ -1788,8 +1788,20 @@ Serve.prototype.phIdAvatar = function (id) {
Serve.prototype.friends = function (path) {
var self = this
+ var friends = self.app.sbot.friends
+ if (!friends) return pull(
+ pull.once('missing ssb-friends plugin'),
+ this.wrapPage('friends'),
+ self.respondSink(400)
+ )
+ if (!friends.createFriendStream) return pull(
+ pull.once('missing friends.createFriendStream method'),
+ this.wrapPage('friends'),
+ self.respondSink(400)
+ )
+
pull(
- self.app.sbot.friends.createFriendStream({hops: 1}),
+ friends.createFriendStream({hops: 1}),
self.renderIdsList(),
u.hyperwrap(function (items, cb) {
cb(null, [