mirror of
https://github.com/bsedin/matrix-webhook.git
synced 2026-04-09 03:15:40 +00:00
allow direct formatted_body
This was initially designed and implemented in #6 Co-authored-by: Gerhard Bräunlich <gerhard.braeunlich@id.ethz.ch>
This commit is contained in:
@@ -54,12 +54,17 @@ async def handler(request):
|
||||
if data["key"] != conf.API_KEY:
|
||||
return create_json_response(HTTPStatus.UNAUTHORIZED, "Invalid API key")
|
||||
|
||||
if "formatted_body" in data:
|
||||
formatted_body = data["formatted_body"]
|
||||
else:
|
||||
formatted_body = markdown(str(data["body"]), extensions=["extra"])
|
||||
|
||||
room_id = request.path[1:]
|
||||
content = {
|
||||
"msgtype": "m.text",
|
||||
"body": data["body"],
|
||||
"format": "org.matrix.custom.html",
|
||||
"formatted_body": markdown(str(data["body"]), extensions=["extra"]),
|
||||
"formatted_body": formatted_body,
|
||||
}
|
||||
for _ in range(10):
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user