parent
6b4b75c891
commit
40b54076e0
2 changed files with 8 additions and 7 deletions
|
@ -157,20 +157,20 @@ def new_message(event, user):
|
||||||
|
|
||||||
elif event['content']['msgtype'] == 'm.image':
|
elif event['content']['msgtype'] == 'm.image':
|
||||||
text = event['content']['body'] + "\n"
|
text = event['content']['body'] + "\n"
|
||||||
text += app.config['MATRIX_HOST'] + '/_matrix/media/r0/download/' + event['content']['url'][6:]
|
text += app.config['MATRIX_URL'] + '/_matrix/media/r0/download/' + event['content']['url'][6:]
|
||||||
embed = [raw_from_event(event)]
|
embed = [raw_from_event(event)]
|
||||||
|
|
||||||
elif event['content']['msgtype'] == 'm.video':
|
elif event['content']['msgtype'] == 'm.video':
|
||||||
text = event['content']['body'] + "\n"
|
text = event['content']['body'] + "\n"
|
||||||
text += app.config['MATRIX_HOST'] + '/_matrix/media/r0/download/' + event['content']['url'][6:]
|
text += app.config['MATRIX_URL'] + '/_matrix/media/r0/download/' + event['content']['url'][6:]
|
||||||
|
|
||||||
elif event['content']['msgtype'] == 'm.audio':
|
elif event['content']['msgtype'] == 'm.audio':
|
||||||
text = event['content']['body'] + "\n"
|
text = event['content']['body'] + "\n"
|
||||||
text += app.config['MATRIX_HOST'] + '/_matrix/media/r0/download/' + event['content']['url'][6:]
|
text += app.config['MATRIX_URL'] + '/_matrix/media/r0/download/' + event['content']['url'][6:]
|
||||||
|
|
||||||
elif event['content']['msgtype'] == 'm.file':
|
elif event['content']['msgtype'] == 'm.file':
|
||||||
text = event['content']['body'] + "\n"
|
text = event['content']['body'] + "\n"
|
||||||
text += app.config['MATRIX_HOST'] + '/_matrix/media/r0/download/' + event['content']['url'][6:]
|
text += app.config['MATRIX_URL'] + '/_matrix/media/r0/download/' + event['content']['url'][6:]
|
||||||
|
|
||||||
else:
|
else:
|
||||||
logger.debug('-unknown msg type- ' + event['content']['msgtype'])
|
logger.debug('-unknown msg type- ' + event['content']['msgtype'])
|
||||||
|
@ -208,7 +208,7 @@ def new_message(event, user):
|
||||||
|
|
||||||
def raw_from_event(event):
|
def raw_from_event(event):
|
||||||
|
|
||||||
url = app.config['MATRIX_HOST'] + '/_matrix/media/r0/download/' + event['content']['url'][6:]
|
url = app.config['MATRIX_URL'] + '/_matrix/media/r0/download/' + event['content']['url'][6:]
|
||||||
|
|
||||||
if event['content']['msgtype'] == 'm.image':
|
if event['content']['msgtype'] == 'm.image':
|
||||||
value = {'type': "photo", 'version': "1.0"}
|
value = {'type': "photo", 'version': "1.0"}
|
||||||
|
@ -224,7 +224,7 @@ def raw_from_event(event):
|
||||||
else:
|
else:
|
||||||
value['height'] = 200
|
value['height'] = 200
|
||||||
if 'thumbnail_info' in event['content']['info']:
|
if 'thumbnail_info' in event['content']['info']:
|
||||||
value['thumbnail_url'] = app.config['MATRIX_HOST'] + '/_matrix/media/r0/download/' + event['content']['info']['thumbnail_url'][6:]
|
value['thumbnail_url'] = app.config['MATRIX_URL'] + '/_matrix/media/r0/download/' + event['content']['info']['thumbnail_url'][6:]
|
||||||
if 'w' in event['content']['info']['thumbnail_info']:
|
if 'w' in event['content']['info']['thumbnail_info']:
|
||||||
value['thumbnail_width'] = event['content']['info']['thumbnail_info']['w']
|
value['thumbnail_width'] = event['content']['info']['thumbnail_info']['w']
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
SERVICE_DB: 'sqlite:///store.db' # URL for the service database
|
SERVICE_DB: 'sqlite:///store.db' # URL for the service database
|
||||||
LISTEN_PORT: 5000 # matrix app service port to listen on
|
LISTEN_PORT: 5000 # matrix app service port to listen on
|
||||||
MATRIX_HOST: 'https://localhost:8448' # URL of the matrix server
|
MATRIX_URL: 'https://<DOMAIN_NAME>' # public base URL of the matrix server
|
||||||
|
MATRIX_HOST: 'https://localhost:8448' # client URL of the matrix server
|
||||||
MATRIX_DOMAIN: '<DOMAIN_NAME>' # domain of the matrix server (right hand side of a matrix ID)
|
MATRIX_DOMAIN: '<DOMAIN_NAME>' # domain of the matrix server (right hand side of a matrix ID)
|
||||||
MATRIX_AS_ID: '<MATRIX_ID>' # matrix ID for the app service user
|
MATRIX_AS_ID: '<MATRIX_ID>' # matrix ID for the app service user
|
||||||
MATRIX_AS_TOKEN: '<AUTH_TOKEN>' # auth token for the app service user
|
MATRIX_AS_TOKEN: '<AUTH_TOKEN>' # auth token for the app service user
|
||||||
|
|
Loading…
Reference in a new issue