diff options
author | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2017-11-17 00:33:18 -0500 |
---|---|---|
committer | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2017-11-17 00:37:42 -0500 |
commit | 59bfa01faf1939dc6b327b05439cb0b23cfddcfa (patch) | |
tree | 55f2a6f56468bc7b414b8f34917a686070a4f9eb | |
parent | bd6854a5a3e40146624f733f7de3250be6075629 (diff) | |
download | patchfoo-59bfa01faf1939dc6b327b05439cb0b23cfddcfa.tar.gz patchfoo-59bfa01faf1939dc6b327b05439cb0b23cfddcfa.zip |
Show pub addresses
-rw-r--r-- | lib/app.js | 35 | ||||
-rw-r--r-- | lib/serve.js | 11 |
2 files changed, 46 insertions, 0 deletions
@@ -764,3 +764,38 @@ App.prototype._getVotes = function (id, cb) { }) ) } + +App.prototype.getAddresses = function (id) { + if (!this.sbot.backlinks) { + if (!this.warned1) { + this.warned1 = true + console.trace('Getting peer addresses requires the ssb-backlinks plugin') + } + return pull.empty() + } + return pull( + this.sbot.backlinks.read({ + reverse: true, + query: [ + {$filter: { + dest: id, + value: { + content: { + type: 'pub', + address: { + key: id, + host: {$truthy: true}, + port: {$truthy: true}, + } + } + } + }}, + {$map: ['value', 'content', 'address']} + ] + }), + pull.map(function (addr) { + return addr.host + ':' + addr.port + }), + pull.unique() + ) +} diff --git a/lib/serve.js b/lib/serve.js index d709cbd..e05acd5 100644 --- a/lib/serve.js +++ b/lib/serve.js @@ -1563,6 +1563,17 @@ Serve.prototype.wrapUserFeed = function (isScrolled, id) { self.aboutDescription(id) ]) ]), + isScrolled ? '' : ph('tr', [ + ph('td'), + ph('td', pull( + self.app.getAddresses(id), + pull.map(function (address) { + return ph('div', [ + ph('code', address) + ]) + }) + )) + ]), ph('tr', [ ph('td'), ph('td', [ |