Websocket for builtin Prosody. WIP

This commit is contained in:
John Livingston
2022-08-24 17:55:24 +02:00
parent 507da6e042
commit 6f8c7b8a93
4 changed files with 104 additions and 40 deletions

View File

@ -130,7 +130,7 @@ async function getProsodyConfig (options: RegisterServerOptions): Promise<Prosod
config.useAnonymous()
}
config.useHttpAuthentication(authApiUrl)
config.usePeertubeBosh(prosodyDomain, port)
config.usePeertubeBoshAndWebsocket(prosodyDomain, port)
config.useMucHttpDefault(roomApiUrl)
if (enableC2s) {

View File

@ -156,6 +156,7 @@ class ProsodyConfigContent {
'uptime', // Report how long server has been running
'ping', // Replies to XMPP pings with pongs
'bosh', // Enable BOSH clients, aka "Jabber over HTTP"
'websocket', // Enable Websocket clients
'posix' // POSIX functionality, sends server to background, enables syslog, etc.
// 'pep', // Enables users to publish their avatar, mood, activity, playing music and more
// 'vcard_legacy' // Conversion between legacy vCard and PEP Avatar, vcard
@ -200,7 +201,7 @@ class ProsodyConfigContent {
this.authenticated.set('http_auth_url', url)
}
usePeertubeBosh (prosodyDomain: string, port: string): void {
usePeertubeBoshAndWebsocket (prosodyDomain: string, port: string): void {
this.global.set('c2s_require_encryption', false)
this.global.set('interfaces', ['127.0.0.1', '::1'])
this.global.set('c2s_ports', [])
@ -213,12 +214,14 @@ class ProsodyConfigContent {
this.global.set('https_interfaces', ['127.0.0.1', '::1'])
this.global.set('consider_bosh_secure', true)
this.global.set('consider_websocket_secure', true)
if (this.anon) {
this.anon.set('trusted_proxies', ['127.0.0.1', '::1'])
this.anon.set('allow_anonymous_s2s', false)
this.anon.add('modules_enabled', 'http')
this.anon.add('modules_enabled', 'bosh')
this.anon.add('modules_enabled', 'websocket')
this.anon.set('http_host', prosodyDomain)
this.anon.set('http_external_url', 'http://' + prosodyDomain)
}
@ -232,6 +235,7 @@ class ProsodyConfigContent {
this.authenticated.set('allow_anonymous_s2s', false)
this.authenticated.add('modules_enabled', 'http')
this.authenticated.add('modules_enabled', 'bosh')
this.authenticated.add('modules_enabled', 'websocket')
this.authenticated.set('http_host', prosodyDomain)
this.authenticated.set('http_external_url', 'http://' + prosodyDomain)
}