Revert getProsodyDomain. Broken when not on localhot.

This commit is contained in:
John Livingston 2021-05-06 14:04:16 +02:00
parent 5650d6aed8
commit fec219a909
4 changed files with 14 additions and 8 deletions

View File

@ -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

View File

@ -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": [

View File

@ -1,10 +1,12 @@
async function getProsodyDomain (options: RegisterServerOptions): Promise<string> {
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 {

View File

@ -115,7 +115,7 @@ function changeHttpBindRoute ({ peertubeHelpers }: RegisterServerOptions, port:
proxyReqPathResolver: async (_req: Request): Promise<string> => {
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?
}