aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/app.js35
-rw-r--r--lib/serve.js11
2 files changed, 46 insertions, 0 deletions
diff --git a/lib/app.js b/lib/app.js
index 7d8516a..5557b58 100644
--- a/lib/app.js
+++ b/lib/app.js
@@ -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', [