aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/app.js3
-rw-r--r--lib/render-msg.js2
2 files changed, 4 insertions, 1 deletions
diff --git a/lib/app.js b/lib/app.js
index 8b6d897..c647d39 100644
--- a/lib/app.js
+++ b/lib/app.js
@@ -36,6 +36,9 @@ function App(sbot, config) {
this.previewContacts = conf.previewContacts == null ? false : conf.previewContacts
this.useOoo = conf.ooo == null ? false : conf.ooo
+ var host1 = /:/.test(this.host) ? '[' + this.host + ']' : this.host
+ this.baseUrl = 'http://' + host1 + ':' + this.port
+
var base = conf.base || '/'
this.opts = {
base: base,
diff --git a/lib/render-msg.js b/lib/render-msg.js
index d02497e..694f8d0 100644
--- a/lib/render-msg.js
+++ b/lib/render-msg.js
@@ -1184,7 +1184,7 @@ RenderMsg.prototype.npmPackages = function (cb) {
singlePkg ? h('p',
h('code',
'npm install --registry=' +
- 'http://' + self.app.host + ':' + self.app.port +
+ self.app.baseUrl +
'/npm-registry/' + encodeURIComponent(self.msg.key) + ' ' +
singlePkgSpec),
) : '',