Make ty happy
This commit is contained in:
@@ -248,8 +248,19 @@ async def user_devices(user):
|
||||
|
||||
@server.route("/_matrix/federation/v1/user/keys/query", methods=["POST"])
|
||||
async def user_keys():
|
||||
req = request.json
|
||||
|
||||
if (
|
||||
isinstance(req, dict)
|
||||
and "device_keys" in req
|
||||
and isinstance(req["device_keys"], dict)
|
||||
):
|
||||
device_keys = req["device_keys"]
|
||||
else:
|
||||
device_keys = {}
|
||||
|
||||
return jsonify({
|
||||
"device_keys": request.json.get("device_keys", {})
|
||||
"device_keys": device_keys
|
||||
})
|
||||
|
||||
|
||||
@@ -257,7 +268,10 @@ async def user_keys():
|
||||
async def invite_user_v2(room, txnId):
|
||||
invite_data = request.json
|
||||
|
||||
if "event" in invite_data:
|
||||
if (
|
||||
isinstance(invite_data, dict)
|
||||
and "event" in invite_data
|
||||
):
|
||||
if "room_version" in invite_data:
|
||||
if invite_data["room_version"] not in [str(i) for i in range(1, 10)]:
|
||||
return jsonify({
|
||||
@@ -292,10 +306,19 @@ async def invite_user_v2(room, txnId):
|
||||
@server.route("/_matrix/federation/v1/invite/<room>/<txnId>", methods=["PUT"])
|
||||
async def invite_user_v1(room, txnId):
|
||||
event = request.json
|
||||
content = event.get("content", {})
|
||||
if (
|
||||
isinstance(event, dict)
|
||||
and "content" in event
|
||||
and isinstance(event["content"], dict)
|
||||
):
|
||||
content = event["content"]
|
||||
else:
|
||||
content = {}
|
||||
|
||||
if (
|
||||
"content" in event
|
||||
isinstance(event, dict)
|
||||
and isinstance(content, dict)
|
||||
and "content" in event
|
||||
and "membership" in content
|
||||
and "state_key" in event
|
||||
and "room_id" in event
|
||||
@@ -325,7 +348,12 @@ async def space_hierachy(room):
|
||||
@server.route("/_matrix/federation/v1/org.matrix.msc4358/discover_common_rooms", methods=["POST"])
|
||||
@server.route("/_matrix/federation/v1/discover_common_rooms", methods=["POST"])
|
||||
async def discover_common_rooms():
|
||||
tags = request.json.get("room_participation_tags", [])
|
||||
req = request.json
|
||||
if isinstance(req, dict):
|
||||
tags = req.get("room_participation_tags", [])
|
||||
else:
|
||||
tags = []
|
||||
|
||||
return jsonify({"recognised_tags": tags})
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user