fix thumbnail url

This commit is contained in:
Morgan McMillian 2017-05-03 07:27:39 -07:00
parent 543e186dc8
commit f3ca3a1201

View file

@ -44,6 +44,7 @@ def on_receive_events(transaction):
text = "* " + get_displayname(event["user_id"]) + " " + event['content']['body'] text = "* " + get_displayname(event["user_id"]) + " " + event['content']['body']
elif event['content']['msgtype'] == 'm.image': elif event['content']['msgtype'] == 'm.image':
imgurl = app.config['MATRIX_HOST'] + '/_matrix/media/r0/download/' + event['content']['url'][6:] imgurl = app.config['MATRIX_HOST'] + '/_matrix/media/r0/download/' + event['content']['url'][6:]
thmburl = app.config['MATRIX_HOST'] + '/_matrix/media/r0/download/' + event['content']['info']['thumbnail_url'][6:]
value = {"type": "photo", "version": "1.0"} value = {"type": "photo", "version": "1.0"}
value["title"] = event['content']['body'] value["title"] = event['content']['body']
value["url"] = imgurl value["url"] = imgurl
@ -51,7 +52,7 @@ def on_receive_events(transaction):
value["height"] = event['content']['info']['h'] value["height"] = event['content']['info']['h']
value["thumbnail_width"] = event['content']['info']['thumbnail_info']['w'] value["thumbnail_width"] = event['content']['info']['thumbnail_info']['w']
value["thumbnail_height"] = event['content']['info']['thumbnail_info']['h'] value["thumbnail_height"] = event['content']['info']['thumbnail_info']['h']
value["thumbnail_url"] = self.api.get_download_url(event['content']['info']['thumbnail_url']) value["thumbnail_url"] = thmburl
rawitem = {"type": "io.pnut.core.oembed", "value": value} rawitem = {"type": "io.pnut.core.oembed", "value": value}
embed = [rawitem] embed = [rawitem]
if user: if user: