The Codebase Consistency Update
This commit is contained in:
@@ -1,12 +1,23 @@
|
||||
from flask import Blueprint, jsonify, request, send_file
|
||||
from vona.federation import send_join
|
||||
import vona.globals as globals
|
||||
import vona.config as config
|
||||
|
||||
import asyncio
|
||||
import random
|
||||
import os
|
||||
|
||||
client = Blueprint("c2s", __name__)
|
||||
from flask import (
|
||||
Blueprint,
|
||||
jsonify,
|
||||
request,
|
||||
send_file,
|
||||
)
|
||||
|
||||
client = Blueprint("client", __name__)
|
||||
|
||||
from .groups import groups
|
||||
|
||||
client.register_blueprint(groups)
|
||||
|
||||
|
||||
@client.route("/_matrix/client/v3/account/password", methods=["POST"])
|
||||
@@ -22,10 +33,10 @@ client = Blueprint("c2s", __name__)
|
||||
@client.route("/_matrix/client/v3/logout", methods=["POST"])
|
||||
@client.route("/_matrix/client/r0/logout", methods=["POST"])
|
||||
@client.route("/_matrix/client/v3/rooms/<room>/invite", methods=["POST"])
|
||||
@client.route("/_matrix/client/v3/rooms/<roomId>/leave", methods=["POST"])
|
||||
@client.route("/_matrix/client/r0/rooms/<roomId>/leave", methods=["POST"])
|
||||
@client.route("/_matrix/client/v3/rooms/<roomId>/read_markers", methods=["POST"])
|
||||
@client.route("/_matrix/client/r0/rooms/<roomId>/read_markers", methods=["POST"])
|
||||
@client.route("/_matrix/client/v3/rooms/<room>/leave", methods=["POST"])
|
||||
@client.route("/_matrix/client/r0/rooms/<room>/leave", methods=["POST"])
|
||||
@client.route("/_matrix/client/v3/rooms/<room>/read_markers", methods=["POST"])
|
||||
@client.route("/_matrix/client/r0/rooms/<room>/read_markers", methods=["POST"])
|
||||
@client.route("/_matrix/client/v3/rooms/<room>/typing/<user>", methods=["PUT"])
|
||||
@client.route("/_matrix/client/api/v1/rooms/<room>/typing/<user>", methods=["PUT"])
|
||||
@client.route("/_matrix/client/v3/keys/device_signing/upload", methods=["POST"])
|
||||
@@ -101,10 +112,10 @@ async def lock(user):
|
||||
return jsonify({"locked": True})
|
||||
|
||||
|
||||
@client.route("/_matrix/client/api/v1/rooms/<roomId>/members")
|
||||
@client.route("/_matrix/client/v3/rooms/<roomId>/members")
|
||||
@client.route("/_matrix/client/r0/rooms/<roomId>/members")
|
||||
async def room_members(roomId):
|
||||
@client.route("/_matrix/client/api/v1/rooms/<room>/members")
|
||||
@client.route("/_matrix/client/v3/rooms/<room>/members")
|
||||
@client.route("/_matrix/client/r0/rooms/<room>/members")
|
||||
async def room_members(room):
|
||||
return jsonify({
|
||||
"chunk": [{
|
||||
"content": {
|
||||
@@ -112,9 +123,9 @@ async def room_members(roomId):
|
||||
"displayname": "Vona",
|
||||
"membership": "join"
|
||||
},
|
||||
"event_id": globals.make_event_id(seed=roomId),
|
||||
"event_id": globals.make_event_id(seed=room),
|
||||
"origin_server_ts": config.the_funny_number,
|
||||
"room_id": roomId,
|
||||
"room_id": room,
|
||||
"sender": f"@vona:{config.server_name}",
|
||||
"state_key": f"@vona:{config.server_name}",
|
||||
"type": "m.room.member",
|
||||
@@ -489,10 +500,10 @@ async def refresh():
|
||||
})
|
||||
|
||||
|
||||
@client.route("/_matrix/client/unstable/im.nheko.summary/rooms/<roomId>/summary")
|
||||
@client.route("/_matrix/client/unstable/im.nheko.summary/summary/<roomId>")
|
||||
@client.route("/_matrix/client/v1/room_summary/<roomId>")
|
||||
async def room_summary(roomId):
|
||||
@client.route("/_matrix/client/unstable/im.nheko.summary/rooms/<room>/summary")
|
||||
@client.route("/_matrix/client/unstable/im.nheko.summary/summary/<room>")
|
||||
@client.route("/_matrix/client/v1/room_summary/<room>")
|
||||
async def room_summary(room):
|
||||
return jsonify({
|
||||
"room_id": globals.make_event_id().replace("$", "!"),
|
||||
"avatar_url": f"mxc://{config.server_name}/cat",
|
||||
@@ -504,7 +515,7 @@ async def room_summary(roomId):
|
||||
"join_rule": "public",
|
||||
"room_type": "m.room",
|
||||
"membership": "join",
|
||||
"room_version": globals.room_version_from_id(roomId)
|
||||
"room_version": globals.room_version_from_id(room)
|
||||
})
|
||||
|
||||
|
||||
@@ -627,10 +638,10 @@ async def media_config():
|
||||
return jsonify({"m.upload.size": config.the_funny_number * 69420})
|
||||
|
||||
|
||||
@client.route("/_matrix/client/api/v1/profile/<userId>/<key>", methods=["GET", "PUT", "DELETE"])
|
||||
@client.route("/_matrix/client/v3/profile/<userId>/<key>", methods=["GET", "PUT", "DELETE"])
|
||||
@client.route("/_matrix/client/r0/profile/<userId>/<key>", methods=["GET", "PUT", "DELETE"])
|
||||
async def profile_keys(userId, key):
|
||||
@client.route("/_matrix/client/api/v1/profile/<user>/<key>", methods=["GET", "PUT", "DELETE"])
|
||||
@client.route("/_matrix/client/v3/profile/<user>/<key>", methods=["GET", "PUT", "DELETE"])
|
||||
@client.route("/_matrix/client/r0/profile/<user>/<key>", methods=["GET", "PUT", "DELETE"])
|
||||
async def profile_keys(user, key):
|
||||
if request.method == "GET":
|
||||
if key == "avatar_url":
|
||||
return jsonify({"avatar_url": f"mxc://{config.server_name}/cat"})
|
||||
@@ -645,19 +656,19 @@ 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):
|
||||
@client.route("/_matrix/client/v3/profile/<user>")
|
||||
@client.route("/_matrix/client/r0/profile/<user>")
|
||||
async def user_profile(user):
|
||||
return jsonify({
|
||||
"avatar_url": f"mxc://{config.server_name}/cat",
|
||||
"displayname": "Vona"
|
||||
})
|
||||
|
||||
|
||||
@client.route("/_matrix/client/api/v1/rooms/<roomId>/messages")
|
||||
@client.route("/_matrix/client/v3/rooms/<roomId>/messages")
|
||||
@client.route("/_matrix/client/r0/rooms/<roomId>/messages")
|
||||
async def room_messages(roomId):
|
||||
@client.route("/_matrix/client/api/v1/rooms/<room>/messages")
|
||||
@client.route("/_matrix/client/v3/rooms/<room>/messages")
|
||||
@client.route("/_matrix/client/r0/rooms/<room>/messages")
|
||||
async def room_messages(room):
|
||||
return jsonify({
|
||||
"chunk": [{
|
||||
"content": {
|
||||
@@ -668,7 +679,7 @@ async def room_messages(roomId):
|
||||
},
|
||||
"event_id": globals.make_event_id(),
|
||||
"origin_server_ts": config.the_funny_number,
|
||||
"room_id": roomId,
|
||||
"room_id": room,
|
||||
"sender": f"@vona:{config.server_name}",
|
||||
"type": "m.room.message"
|
||||
}],
|
||||
|
||||
Reference in New Issue
Block a user