diff options
author | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2019-02-26 16:20:46 +1300 |
---|---|---|
committer | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2019-02-26 16:23:19 +1300 |
commit | b12aaed21a4ecc442bcb3f19d14471abda18d290 (patch) | |
tree | 1dfd83ae69db1da77996c97e80d569cf86f1a799 | |
parent | 0ea62e678790b26ca21aace8e8923de7d11a14b3 (diff) | |
download | patchfoo-b12aaed21a4ecc442bcb3f19d14471abda18d290.tar.gz patchfoo-b12aaed21a4ecc442bcb3f19d14471abda18d290.zip |
Handle missing ssb-friends method
-rw-r--r-- | lib/app.js | 2 | ||||
-rw-r--r-- | lib/serve.js | 14 |
2 files changed, 14 insertions, 2 deletions
@@ -105,7 +105,7 @@ function App(sbot, config) { this.sbot.status && 'status', 'channels', 'tags', - 'friends', + this.sbot.friends && 'friends', 'search', 'live', 'compose', 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, [ |