MSC4014
This commit is contained in:
@@ -231,7 +231,13 @@ async def capabilities():
|
||||
"9": "stable",
|
||||
"10": "stable",
|
||||
"11": "stable",
|
||||
"12": "stable"
|
||||
"12": "stable",
|
||||
"org.matrix.msc3757.10": "stable",
|
||||
"org.matrix.msc3757.11": "stable",
|
||||
"org.matrix.hydra.11": "stable",
|
||||
"org.matrix.msc3667": "stable",
|
||||
"org.matrix.msc3787": "stable",
|
||||
"org.matrix.msc4014": "unstable",
|
||||
},
|
||||
"org.matrix.msc3244.room_capabilities": {
|
||||
"knock": {
|
||||
@@ -461,6 +467,7 @@ async def room_query(room):
|
||||
|
||||
return jsonify({})
|
||||
|
||||
|
||||
@client.route("/_matrix/client/v3/rooms/<room>/aliases")
|
||||
async def room_aliases(room):
|
||||
return jsonify({
|
||||
@@ -475,6 +482,7 @@ async def room_aliases(room):
|
||||
async def room_visibility(room):
|
||||
return jsonify({"visibility": "public"})
|
||||
|
||||
|
||||
@client.route("/_matrix/client/v3/search", methods=["POST"])
|
||||
async def search():
|
||||
room = globals.make_event_id().replace("$", "!")
|
||||
@@ -546,6 +554,7 @@ async def url_preview():
|
||||
"og:title": "cool cat"
|
||||
})
|
||||
|
||||
|
||||
@client.route("/_matrix/client/v1/media/preview_url")
|
||||
async def media_preview():
|
||||
response = send_file(config.cat)
|
||||
@@ -553,6 +562,7 @@ async def media_preview():
|
||||
response.headers["Content-Type"] = "image/jpg"
|
||||
return response
|
||||
|
||||
|
||||
@client.route("/_matrix/media/v3/upload", methods=["POST"])
|
||||
@client.route("/_matrix/media/r0/upload", methods=["POST"])
|
||||
@client.route("/_matrix/media/v1/create", methods=["POST"])
|
||||
@@ -581,6 +591,7 @@ async def profile_keys(userId, key):
|
||||
|
||||
return jsonify({})
|
||||
|
||||
|
||||
@client.route("/_matrix/client/v3/profile/<userId>")
|
||||
@client.route("/_matrix/client/r0/profile/<userId>")
|
||||
async def user_profile(userId):
|
||||
@@ -611,6 +622,7 @@ async def room_messages(roomId):
|
||||
"start": f"{os.urandom(16).hex()}"
|
||||
})
|
||||
|
||||
|
||||
@client.route("/_matrix/client/v3/keys/query", methods=["POST"])
|
||||
@client.route("/_matrix/client/r0/keys/query", methods=["POST"])
|
||||
async def query_keys():
|
||||
@@ -622,6 +634,7 @@ async def query_keys():
|
||||
"user_signing_keys": user
|
||||
})
|
||||
|
||||
|
||||
@client.route("/_matrix/client/api/v1/createRoom", methods=["POST"])
|
||||
@client.route("/_matrix/client/v3/createRoom", methods=["POST"])
|
||||
@client.route("/_matrix/client/r0/createRoom", methods=["POST"])
|
||||
|
||||
@@ -1,10 +1,32 @@
|
||||
from resolvematrix import ServerResolver
|
||||
import urllib.parse, time, json, httpx
|
||||
import vona.globals as globals
|
||||
import vona.config as config
|
||||
|
||||
http_client = globals.http_client()
|
||||
|
||||
versions = [
|
||||
"1",
|
||||
"2",
|
||||
"3",
|
||||
"4",
|
||||
"5",
|
||||
"6",
|
||||
"7",
|
||||
"8",
|
||||
"9",
|
||||
"10",
|
||||
"11",
|
||||
"12",
|
||||
"org.matrix.msc3757.10",
|
||||
"org.matrix.msc3757.11",
|
||||
"org.matrix.hydra.11",
|
||||
"org.matrix.msc3667",
|
||||
"org.matrix.msc3787",
|
||||
"org.matrix.msc4014",
|
||||
]
|
||||
|
||||
verparams = "&".join(f"ver={ver}" for ver in versions)
|
||||
|
||||
|
||||
def get_user_input(prompt):
|
||||
try:
|
||||
@@ -28,13 +50,11 @@ except Exception as e:
|
||||
print(f"Error reading server names: {e}")
|
||||
exit(1)
|
||||
|
||||
resolver = ServerResolver(client=http_client)
|
||||
|
||||
try:
|
||||
print("\nSending make_join request..")
|
||||
|
||||
make_join_response = http_client.get(
|
||||
path=f"/_matrix/federation/v1/make_join/{room_id}/%40{username}%3A{config.server_name}?ver=1&ver=2&ver=3&ver=4&ver=5&ver=6&ver=7&ver=8&ver=9&ver=10&ver=11&ver=12",
|
||||
path=f"/_matrix/federation/v1/make_join/{room_id}/%40{username}%3A{config.server_name}?{verparams}",
|
||||
destination=server_name,
|
||||
)
|
||||
|
||||
@@ -57,6 +77,16 @@ if make_join.get("room_version", "1") in ["1", "2"]:
|
||||
# NOTE: if we always make it opaque than Synapse will 500 lmao
|
||||
join_event["event_id"] = globals.make_event_id()
|
||||
|
||||
elif make_join.get("room_version", "1") == "org.matrix.msc4014":
|
||||
# dendrite dislikes this :p
|
||||
join_event["sender_key"] = globals.pubkey()
|
||||
|
||||
join_event["content"]["mxid_mapping"] = globals.sign_json({
|
||||
"sender_key": globals.pubkey(),
|
||||
"user_id": f"@{username}:{config.server_name}"
|
||||
})
|
||||
|
||||
|
||||
timestamp = input("\nTimestamp (leave blank for now):\n\t")
|
||||
try:
|
||||
join_event["origin_server_ts"] = int(timestamp)
|
||||
|
||||
Reference in New Issue
Block a user