From fec219a9097d866db338b486e52dc7c05a4e546b Mon Sep 17 00:00:00 2001 From: John Livingston Date: Thu, 6 May 2021 14:04:16 +0200 Subject: [PATCH] Revert getProsodyDomain. Broken when not on localhot. --- CHANGELOG.md | 4 ++++ package.json | 2 +- server/lib/prosody/config/domain.ts | 14 ++++++++------ server/lib/routers/webchat.ts | 2 +- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 73022474..b1fda828 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## v2.1.2 + +* Fix: revert 2.1.1, and revert using the real domain for prosody + ## v2.1.1 ### Fixes diff --git a/package.json b/package.json index 540d0044..0345b48e 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "peertube-plugin-livechat", "description": "PeerTube plugin livechat", - "version": "2.1.1", + "version": "2.1.2", "author": "John Livingston", "bugs": "https://github.com/JohnXLivingston/peertube-plugin-livechat/issues", "clientScripts": [ diff --git a/server/lib/prosody/config/domain.ts b/server/lib/prosody/config/domain.ts index 42b897f8..a3f1e5af 100644 --- a/server/lib/prosody/config/domain.ts +++ b/server/lib/prosody/config/domain.ts @@ -1,10 +1,12 @@ async function getProsodyDomain (options: RegisterServerOptions): Promise { - const url = options.peertubeHelpers.config.getWebserverUrl() - const matches = url.match(/^https?:\/\/([^:/]*)(:\d+)?(\/|$)/) - if (!matches) { - throw new Error(`Cant get a domain name from url '${url}'`) - } - return matches[1] + return 'localhost' + // FIXME: there is something that is not working with this configuration. + // const url = options.peertubeHelpers.config.getWebserverUrl() + // const matches = url.match(/^https?:\/\/([^:/]*)(:\d+)?(\/|$)/) + // if (!matches) { + // throw new Error(`Cant get a domain name from url '${url}'`) + // } + // return matches[1] } export { diff --git a/server/lib/routers/webchat.ts b/server/lib/routers/webchat.ts index d252811a..40d5dd80 100644 --- a/server/lib/routers/webchat.ts +++ b/server/lib/routers/webchat.ts @@ -115,7 +115,7 @@ function changeHttpBindRoute ({ peertubeHelpers }: RegisterServerOptions, port: proxyReqPathResolver: async (_req: Request): Promise => { return '/http-bind' // should not be able to access anything else }, - preserveHostHdr: true, + // preserveHostHdr: true, parseReqBody: true // Note that setting this to false overrides reqAsBuffer and reqBodyEncoding below. // FIXME: should we remove cookies? }