Chat Federation: using S2S if available.
* if both local and remote instance have external XMPP connections enabled, the user joins the remote room with his local account * some code refactoring (builtin.ts) Note: documentation and settings descriptions are to do. Related to #112
This commit is contained in:
@ -156,6 +156,7 @@ async function getProsodyConfig (options: RegisterServerOptionsV5): Promise<Pros
|
||||
const prosodyDomain = await getProsodyDomain(options)
|
||||
const paths = await getProsodyFilePaths(options)
|
||||
const roomType = settings['prosody-room-type'] === 'channel' ? 'channel' : 'video'
|
||||
const enableUserS2S = enableRoomS2S && !(settings['federation-no-remote-chat'] as boolean)
|
||||
let certificates: ProsodyConfigCertificates = false
|
||||
|
||||
const apikey = await getAPIKey(options)
|
||||
@ -203,7 +204,7 @@ async function getProsodyConfig (options: RegisterServerOptionsV5): Promise<Pros
|
||||
config.useExternalComponents(componentsPort, components)
|
||||
}
|
||||
|
||||
if (enableRoomS2S) {
|
||||
if (enableRoomS2S || enableUserS2S) {
|
||||
certificates = 'generate-self-signed'
|
||||
if (config.paths.certsDirIsCustom) {
|
||||
certificates = 'use-from-dir'
|
||||
@ -223,7 +224,7 @@ async function getProsodyConfig (options: RegisterServerOptionsV5): Promise<Pros
|
||||
if (networkInterface.match(/^[a-f0-9:]+$/)) return
|
||||
throw new Error('Invalid s2s interfaces')
|
||||
})
|
||||
config.useRoomS2S(s2sPort, s2sInterfaces)
|
||||
config.useS2S(s2sPort, s2sInterfaces, !enableUserS2S)
|
||||
}
|
||||
|
||||
const logExpiration = readLogExpiration(options, logExpirationSetting)
|
||||
|
@ -258,13 +258,17 @@ class ProsodyConfigContent {
|
||||
this.global.set('c2s_ports', [c2sPort])
|
||||
}
|
||||
|
||||
useRoomS2S (s2sPort: string, s2sInterfaces: string[]): void {
|
||||
useS2S (s2sPort: string, s2sInterfaces: string[], mucOnly: boolean): void {
|
||||
this.global.set('s2s_ports', [s2sPort])
|
||||
this.global.set('s2s_interfaces', s2sInterfaces)
|
||||
this.global.set('s2s_secure_auth', false)
|
||||
this.global.add('modules_enabled', 'tls') // required for s2s and co
|
||||
this.muc.add('modules_enabled', 's2s')
|
||||
this.muc.add('modules_enabled', 'dialback') // This allows s2s connections without certicicates!
|
||||
if (!mucOnly && this.authenticated) {
|
||||
this.authenticated.add('modules_enabled', 's2s')
|
||||
this.authenticated.add('modules_enabled', 'dialback') // This allows s2s connections without certicicates!
|
||||
}
|
||||
}
|
||||
|
||||
useExternalComponents (componentsPort: string, components: ExternalComponent[]): void {
|
||||
|
Reference in New Issue
Block a user