allow api v9

This commit is contained in:
Luna 2021-06-25 16:09:41 -03:00
parent 111444c545
commit abd2eb94e3
2 changed files with 13 additions and 5 deletions

View File

@ -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(
"""

12
run.py
View File

@ -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()