combine endpoints

pull/171/head
Aevann 2023-07-12 04:13:40 +03:00
parent 05fd2c60dd
commit 8c95a9e9d2
1 changed files with 4 additions and 9 deletions

View File

@ -737,20 +737,15 @@ def is_available(name:str):
return {name: True}
@app.get("/id/<int:id>")
@limiter.limit(DEFAULT_RATELIMIT)
@limiter.limit(DEFAULT_RATELIMIT, key_func=get_ID)
@auth_required
def user_id(v, id):
user = get_account(id)
return redirect(user.url)
@app.route("/id/<int:id>/<path:path>")
@limiter.limit(DEFAULT_RATELIMIT)
@limiter.limit(DEFAULT_RATELIMIT, key_func=get_ID)
@auth_required
def user_id_path(v, id, path):
def user_id(v, id, path=''):
user = get_account(id)
return redirect(f'/@{user.username}/{path}')
if path:
return redirect(f'/@{user.username}/{path}')
return redirect(f'/@{user.username}')
@app.get("/u/<username>")
@limiter.limit(DEFAULT_RATELIMIT)