diff --git a/litecord/blueprints/auth.py b/litecord/blueprints/auth.py index f36ebc7..dda3e4f 100644 --- a/litecord/blueprints/auth.py +++ b/litecord/blueprints/auth.py @@ -131,7 +131,11 @@ async def _register_with_invite(): @bp.route("/login", methods=["POST"]) async def login(): j = await request.get_json() - email, password = j["email"], j["password"] + try: + email, password = j["email"], j["password"] + except KeyError: + # hack for api v9 + email, password = j["login"], j["password"] row = await app.db.fetchrow( """ diff --git a/run.py b/run.py index 2776547..a9d69c0 100644 --- a/run.py +++ b/run.py @@ -129,6 +129,9 @@ def make_app(): return app +PREFIXES = ("/api/v6", "/api/v7", "/api/v8", "/api/v9") + + def set_blueprints(app_): """Set the blueprints for a given app instance""" bps = { @@ -167,12 +170,13 @@ def set_blueprints(app_): } for bp, suffix in bps.items(): - url_prefix = f'/api/v6{suffix or ""}' + for prefix in PREFIXES: + url_prefix = f'{prefix}{suffix or ""}' - if suffix == -1: - url_prefix = "" + if suffix == -1: + url_prefix = "" - app_.register_blueprint(bp, url_prefix=url_prefix) + app_.register_blueprint(bp, url_prefix=url_prefix) app = make_app()