|
|
@ -727,28 +727,38 @@ class NotifyMatrix(NotifyBase):
|
|
|
|
# "content_uri": "mxc://example.com/a-unique-key"
|
|
|
|
# "content_uri": "mxc://example.com/a-unique-key"
|
|
|
|
# }
|
|
|
|
# }
|
|
|
|
|
|
|
|
|
|
|
|
if self.version == MatrixVersion.V3:
|
|
|
|
# FUTURE if self.version == MatrixVersion.V3:
|
|
|
|
# Prepare our payload
|
|
|
|
# FUTURE # Prepare our payload
|
|
|
|
payloads.append({
|
|
|
|
# FUTURE payloads.append({
|
|
|
|
"body": attachment.name,
|
|
|
|
# FUTURE "body": attachment.name,
|
|
|
|
"info": {
|
|
|
|
# FUTURE "info": {
|
|
|
|
"mimetype": attachment.mimetype,
|
|
|
|
# FUTURE "mimetype": attachment.mimetype,
|
|
|
|
"size": len(attachment),
|
|
|
|
# FUTURE "size": len(attachment),
|
|
|
|
},
|
|
|
|
# FUTURE },
|
|
|
|
"msgtype": "m.image",
|
|
|
|
# FUTURE "msgtype": "m.image",
|
|
|
|
"url": response.get('content_uri'),
|
|
|
|
# FUTURE "url": response.get('content_uri'),
|
|
|
|
})
|
|
|
|
# FUTURE })
|
|
|
|
|
|
|
|
|
|
|
|
else:
|
|
|
|
# FUTURE else:
|
|
|
|
# Prepare our payload
|
|
|
|
# FUTURE # Prepare our payload
|
|
|
|
payloads.append({
|
|
|
|
# FUTURE payloads.append({
|
|
|
|
"info": {
|
|
|
|
# FUTURE "info": {
|
|
|
|
"mimetype": attachment.mimetype,
|
|
|
|
# FUTURE "mimetype": attachment.mimetype,
|
|
|
|
},
|
|
|
|
# FUTURE },
|
|
|
|
"msgtype": "m.image",
|
|
|
|
# FUTURE "msgtype": "m.image",
|
|
|
|
"body": "tta.webp",
|
|
|
|
# FUTURE "body": "tta.webp",
|
|
|
|
"url": response.get('content_uri'),
|
|
|
|
# FUTURE "url": response.get('content_uri'),
|
|
|
|
})
|
|
|
|
# FUTURE })
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Prepare our payload
|
|
|
|
|
|
|
|
payloads.append({
|
|
|
|
|
|
|
|
"info": {
|
|
|
|
|
|
|
|
"mimetype": attachment.mimetype,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
"msgtype": "m.image",
|
|
|
|
|
|
|
|
"body": "tta.webp",
|
|
|
|
|
|
|
|
"url": response.get('content_uri'),
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
return payloads
|
|
|
|
return payloads
|
|
|
|
|
|
|
|
|
|
|
@ -1131,11 +1141,12 @@ class NotifyMatrix(NotifyBase):
|
|
|
|
or self.port == default_port else f':{self.port}')
|
|
|
|
or self.port == default_port else f':{self.port}')
|
|
|
|
|
|
|
|
|
|
|
|
if path == '/upload':
|
|
|
|
if path == '/upload':
|
|
|
|
if self.version == MatrixVersion.V3:
|
|
|
|
# FUTURE if self.version == MatrixVersion.V3:
|
|
|
|
url += MATRIX_V3_MEDIA_PATH + path
|
|
|
|
# FUTURE url += MATRIX_V3_MEDIA_PATH + path
|
|
|
|
|
|
|
|
|
|
|
|
else:
|
|
|
|
# FUTURE else:
|
|
|
|
url += MATRIX_V2_MEDIA_PATH + path
|
|
|
|
# FUTURE url += MATRIX_V2_MEDIA_PATH + path
|
|
|
|
|
|
|
|
url += MATRIX_V2_MEDIA_PATH + path
|
|
|
|
|
|
|
|
|
|
|
|
params = {'filename': attachment.name}
|
|
|
|
params = {'filename': attachment.name}
|
|
|
|
with open(attachment.path, 'rb') as fp:
|
|
|
|
with open(attachment.path, 'rb') as fp:
|
|
|
|