Add localhost c2s connections
This commit is contained in:
@ -77,6 +77,11 @@ async function getProsodyConfig (options: RegisterServerOptions): Promise<Prosod
|
||||
if (!/^\d+$/.test(port)) {
|
||||
throw new Error('Invalid port')
|
||||
}
|
||||
const enableC2s = (await options.settingsManager.getSetting('prosody-c2s') as boolean) || false
|
||||
const c2sPort = (await options.settingsManager.getSetting('prosody-c2s-port') as string) || '52822'
|
||||
if (!/^\d+$/.test(c2sPort)) {
|
||||
throw new Error('Invalid c2s port')
|
||||
}
|
||||
const prosodyDomain = await getProsodyDomain(options)
|
||||
const paths = await getProsodyFilePaths(options)
|
||||
|
||||
@ -96,7 +101,7 @@ async function getProsodyConfig (options: RegisterServerOptions): Promise<Prosod
|
||||
|
||||
const config = new ProsodyConfigContent(paths, prosodyDomain)
|
||||
config.useHttpAuthentication(authApiUrl)
|
||||
config.usePeertubeBosh(prosodyDomain, port)
|
||||
config.usePeertubeBosh(prosodyDomain, port, enableC2s, c2sPort)
|
||||
config.useMucHttpDefault(roomApiUrl)
|
||||
|
||||
// TODO: add a settings so that admin can choose? (on/off and duration)
|
||||
|
@ -168,10 +168,14 @@ class ProsodyConfigContent {
|
||||
this.authenticated.set('http_auth_url', url)
|
||||
}
|
||||
|
||||
usePeertubeBosh (prosodyDomain: string, port: string): void {
|
||||
usePeertubeBosh (prosodyDomain: string, port: string, enableC2s: boolean, c2sPort: string): void {
|
||||
this.global.set('c2s_require_encryption', false)
|
||||
this.global.set('interfaces', ['127.0.0.1', '::1'])
|
||||
this.global.set('c2s_ports', [])
|
||||
if (enableC2s) {
|
||||
this.global.set('c2s_ports', [c2sPort])
|
||||
} else {
|
||||
this.global.set('c2s_ports', [])
|
||||
}
|
||||
this.global.set('c2s_interfaces', ['127.0.0.1', '::1'])
|
||||
this.global.set('s2s_ports', [])
|
||||
this.global.set('s2s_interfaces', ['127.0.0.1', '::1'])
|
||||
|
Reference in New Issue
Block a user