From 731d0e8aa243bfcd9de8fcea3fd3cdd3d64bde14 Mon Sep 17 00:00:00 2001 From: cel Date: Sun, 18 Nov 2018 20:00:21 -1000 Subject: Fix status page --- lib/app.js | 12 ++++++++++++ lib/serve.js | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/app.js b/lib/app.js index b49b378..fb27e78 100644 --- a/lib/app.js +++ b/lib/app.js @@ -1102,3 +1102,15 @@ App.prototype.getShard = function (id, cb) { }) }) } + +App.prototype.sbotStatus = function (cb) { + /* sbot.status is a "sync" method. if we are a plugin, it is sync. if we are + * calling over muxrpc, it is async. */ + var status + try { + status = this.sbot.status(cb) + } catch(err) { + return cb(err) + } + if (typeof status === 'object' && status !== null) return cb(null, status) +} diff --git a/lib/serve.js b/lib/serve.js index 3db1c3c..4188269 100644 --- a/lib/serve.js +++ b/lib/serve.js @@ -795,7 +795,7 @@ Serve.prototype.status = function (ext) { ph('h3', 'Status'), pull( u.readNext(function (cb) { - self.app.sbot.status(function (err, status) { + self.app.sbotStatus(function (err, status) { cb(err, status && pull.once(status)) }) }), -- cgit v1.2.3