From 9b7c66e9644594fa04a5b88ee37583093b9b84dd Mon Sep 17 00:00:00 2001 From: cel Date: Tue, 29 Jan 2019 00:11:45 -1000 Subject: Omit default ssb-server port --- lib/app.js | 1 + lib/render-msg.js | 2 +- lib/serve.js | 3 ++- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/app.js b/lib/app.js index 031077f..cb5075d 100644 --- a/lib/app.js +++ b/lib/app.js @@ -39,6 +39,7 @@ function App(sbot, config) { this.previewVotes = conf.previewVotes == null ? false : conf.previewVotes this.previewContacts = conf.previewContacts == null ? false : conf.previewContacts this.useOoo = conf.ooo == null ? false : conf.ooo + this.ssbPort = 8008 var host1 = /:/.test(this.host) ? '[' + this.host + ']' : this.host this.baseUrl = 'http://' + host1 + ':' + this.port diff --git a/lib/render-msg.js b/lib/render-msg.js index 9e33be6..2f265b9 100644 --- a/lib/render-msg.js +++ b/lib/render-msg.js @@ -751,7 +751,7 @@ RenderMsg.prototype.pub = function (cb) { if (err) return cb(err) self.wrapMini([ 'connects to ', pubLink, ' at ', - h('code', addr.host + ':' + addr.port)], cb) + h('code', addr.host + (addr.port === self.app.ssbPort ? '' : ':' + addr.port))], cb) }) } diff --git a/lib/serve.js b/lib/serve.js index 61e34da..11e451a 100644 --- a/lib/serve.js +++ b/lib/serve.js @@ -4129,6 +4129,7 @@ Serve.prototype.pub = function (path) { var id = String(path).substr(1) try { id = decodeURIComponent(id) } catch(e) {} + var portRegexp = new RegExp(':' + self.app.ssbPort + '$') pull( ph('section', [ ph('h3', ['Pub addresses: ', self.phIdLink(id)]), @@ -4136,7 +4137,7 @@ Serve.prototype.pub = function (path) { self.app.getAddresses(id), pull.map(function (address) { return ph('div', [ - ph('code', address) + ph('code', address.replace(portRegexp, '')) ]) }) ) -- cgit v1.2.3