aboutsummaryrefslogtreecommitdiff
path: root/lib/app.js
diff options
context:
space:
mode:
authorcel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2019-02-04 00:02:39 -1000
committercel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2019-02-04 00:12:55 -1000
commitbe9a1da05281cc6c1c3569d2822ba8ff6e611c7b (patch)
treed84ce14818e799383c29186ad5ff0f975ed68dd2 /lib/app.js
parent54f2f24d48151bdcd501bcc58bb8934e9cef08a4 (diff)
downloadpatchfoo-be9a1da05281cc6c1c3569d2822ba8ff6e611c7b.tar.gz
patchfoo-be9a1da05281cc6c1c3569d2822ba8ff6e611c7b.zip
Show addresses more compactly
Handle missing port
Diffstat (limited to 'lib/app.js')
-rw-r--r--lib/app.js17
1 files changed, 6 insertions, 11 deletions
diff --git a/lib/app.js b/lib/app.js
index 644bf1a..86dcd87 100644
--- a/lib/app.js
+++ b/lib/app.js
@@ -43,6 +43,7 @@ function App(sbot, config) {
this.previewContacts = conf.previewContacts == null ? false : conf.previewContacts
this.useOoo = conf.ooo == null ? false : conf.ooo
this.ssbPort = 8008
+ this.portRegexp = new RegExp(':' + this.ssbPort + '$')
/*
var capsConfig = config.caps || {}
this.userInviteCap = capsConfig.userInvite
@@ -1053,17 +1054,7 @@ App.prototype.getAddresses = function (id) {
]
})
]),
- pull.map(function (addr) {
- var i = addr.lastIndexOf(':' + id)
- if (i > -1 && addr.length === i + id.length + 1) {
- return addr.substr(0, i)
- }
- var m = /^(?:net|onion):([^~;]*:[0-9]*)~shs:([0-9a-zA-Z/=+]{44})/.exec(addr)
- if (m && id === '@' + m[2] + '.ed25519') {
- return m[1]
- }
- return addr
- })
+ pull.map(u.extractHostPort.bind(this, id))
)
return pull(
@@ -1487,3 +1478,7 @@ App.prototype.listDrafts = function () {
})
})
}
+
+App.prototype.removeDefaultPort = function (addr) {
+ return addr.replace(this.portRegexp, '')
+}