ejabberd: Enable mod_http_upload

- Upgrade existing config.

Tests:

- Install ejabberd. Configuration is set as expected and ejabberd is
  running.

- Upgrade from existing ejabberd install. Configuration is set as
  expected and ejabberd is running.

- Send a file between two users in dino-im and Conversations app.

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
James Valleroy 2022-07-09 07:45:18 -04:00 committed by Sunil Mohan Adapa
parent ce1347b172
commit 39aac9228b
No known key found for this signature in database
GPG Key ID: 43EA1CFF0AA7C5F2
3 changed files with 31 additions and 1 deletions

View File

@ -50,7 +50,7 @@ class EjabberdApp(app_module.App):
app_id = 'ejabberd'
_version = 4
_version = 5
def __init__(self):
"""Create components for the app."""

View File

@ -4,3 +4,11 @@ ProxyPassReverse /bosh/ http://localhost:5443/bosh/
<Proxy http://localhost:5443/bosh/*>
Require all granted
</Proxy>
##
## Proxy for XEP-0363 HTTP File Upload
##
<Location /upload/>
ProxyPreserveHost On
ProxyPass http://localhost:5443/upload/
</Location>

View File

@ -55,6 +55,28 @@ def setup(domainname: str):
listen_port['tls'] = False
if 'use_turn' in listen_port:
conf['listen'].remove(listen_port) # Use coturn instead
if listen_port['port'] == 5443:
# Enable XEP-0363 HTTP File Upload
listen_port['request_handlers']['/upload'] = 'mod_http_upload'
origin_key = scalarstring.DoubleQuotedScalarString(
'Access-Control-Allow-Origin')
origin_value = scalarstring.DoubleQuotedScalarString('https://@HOST@')
methods_key = scalarstring.DoubleQuotedScalarString(
'Access-Control-Allow-Methods')
methods_value = scalarstring.DoubleQuotedScalarString(
'GET,HEAD,PUT,OPTIONS')
headers_key = scalarstring.DoubleQuotedScalarString(
'Access-Control-Allow-Headers')
headers_value = scalarstring.DoubleQuotedScalarString('Content-Type')
conf['modules']['mod_http_upload'] = {
'put_url': 'https://@HOST@/upload',
'custom_headers': {
origin_key: origin_value,
methods_key: methods_value,
headers_key: headers_value,
},
}
conf['auth_method'] = 'ldap'
conf['ldap_servers'] = [scalarstring.DoubleQuotedScalarString('localhost')]