aboutsummaryrefslogtreecommitdiff
path: root/lib
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
parent0ea62e678790b26ca21aace8e8923de7d11a14b3 (diff)
downloadpatchfoo-b12aaed21a4ecc442bcb3f19d14471abda18d290.tar.gz
patchfoo-b12aaed21a4ecc442bcb3f19d14471abda18d290.zip
Handle missing ssb-friends method
Diffstat (limited to 'lib')
-rw-r--r--lib/app.js2
-rw-r--r--lib/serve.js14
2 files changed, 14 insertions, 2 deletions
diff --git a/lib/app.js b/lib/app.js
index 86dcd87..cdbc93c 100644
--- a/lib/app.js
+++ b/lib/app.js
@@ -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, [