aboutsummaryrefslogtreecommitdiff
path: root/lib/app.js
diff options
context:
space:
mode:
authorcel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2019-04-13 10:06:10 -1000
committercel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2019-04-13 10:07:27 -1000
commit47422c2f0b901f475d35e7b15cc1356617b2c7ea (patch)
treef4a1e92799f1d3775ee2779e9138033a81694d75 /lib/app.js
parent4d1395740db1ddebaa558f2c27d29ab772e74936 (diff)
downloadpatchfoo-47422c2f0b901f475d35e7b15cc1356617b2c7ea.tar.gz
patchfoo-47422c2f0b901f475d35e7b15cc1356617b2c7ea.zip
Use Host header in publishguard redirect base
so can redirect to e.g. 'localhost' instead of '[::1]'
Diffstat (limited to 'lib/app.js')
-rw-r--r--lib/app.js30
1 files changed, 1 insertions, 29 deletions
diff --git a/lib/app.js b/lib/app.js
index 25b5a94..cd4691f 100644
--- a/lib/app.js
+++ b/lib/app.js
@@ -54,8 +54,7 @@ function App(sbot, config) {
// sha256('peer-invites:DEVELOPMENT')
*/
- var host1 = /:/.test(this.host) ? '[' + this.host + ']' : this.host
- this.baseUrl = 'http://' + host1 + ':' + this.port
+ this.hostname = (/:/.test(this.host) ? '[' + this.host + ']' : this.host) + this.port
this.dir = path.join(config.path, conf.dir || 'patchfoo')
this.scriptDir = path.join(this.dir, conf.scriptDir || 'script')
this.draftsDir = path.join(this.dir, conf.draftsDir || 'drafts')
@@ -283,33 +282,6 @@ App.prototype.getMsgDecryptedOoo = function (key, cb) {
})
}
-App.prototype.publishMayRedirect = function (content, cb) {
- var publishguard = this.sbot.publishguard
- if (Array.isArray(content.recps)) {
- var recps = content.recps.map(u.linkDest)
- if (publishguard && publishguard.privatePublishGetUrl) {
- return publishguard.privatePublishGetUrl({
- content: content,
- recps: recps,
- redirectBase: this.baseUrl + '/'
- }, onPublishGetUrl)
- }
- this.privatePublish(content, recps, cb)
- } else {
- if (publishguard && publishguard.publishGetUrl) {
- return publishguard.publishGetUrl({
- content: content,
- redirectBase: this.baseUrl + '/'
- }, onPublishGetUrl)
- }
- this.sbot.publish(content, cb)
- }
- function onPublishGetUrl(err, url) {
- if (err) return cb(err)
- cb({redirectUrl: url})
- }
-}
-
App.prototype.privatePublish = function (content, recps, cb) {
if (this.private && typeof this.private.publish === 'function') {
return this.sbot.private.publish(content, recps, cb)