41 lines
1.2 KiB
Python
41 lines
1.2 KiB
Python
from vona.config import the_funny_number
|
|
import asyncio
|
|
|
|
from flask import (
|
|
Blueprint,
|
|
jsonify,
|
|
)
|
|
|
|
apps = Blueprint("appservice", __name__)
|
|
|
|
# This implements both being a homeserver and
|
|
# being an appservice. Why? Maximum carnage.
|
|
|
|
# Endpoints invoked by the homeserver are put
|
|
# lower than ones invoked by the appservice.
|
|
|
|
|
|
@apps.route("/_matrix/client/v1/appservice/<app>/ping", methods=["POST"])
|
|
async def homeserver_ping(app):
|
|
# Sleeping here makes it more realistic
|
|
await asyncio.sleep(the_funny_number / 1000)
|
|
return jsonify({"duration_ms": the_funny_number})
|
|
|
|
|
|
@apps.route("/_matrix/client/v3/directory/list/appservice/<net>/<room>", methods=["PUT"])
|
|
@apps.route("/_matrix/app/v1/ping", methods=["POST"])
|
|
@apps.route("/_matrix/app/v1/transactions/<txnId>", methods=["PUT"])
|
|
@apps.route("/_matrix/app/v1/thirdparty/protocol/<protocol>")
|
|
@apps.route("/_matrix/app/v1/rooms/<room>")
|
|
@apps.route("/_matrix/app/v1/users/<user>")
|
|
async def empty_dict(**kwargs):
|
|
return jsonify({})
|
|
|
|
|
|
@apps.route("/_matrix/app/v1/thirdparty/location")
|
|
@apps.route("/_matrix/app/v1/thirdparty/location/<protocol>")
|
|
@apps.route("/_matrix/app/v1/thirdparty/user")
|
|
@apps.route("/_matrix/app/v1/thirdparty/user/<protocol>")
|
|
async def empty_array(**kwargs):
|
|
return jsonify([])
|