diff --git a/drama/routes/oauth.py b/drama/routes/oauth.py index cae8f6f14..2baa4bc10 100644 --- a/drama/routes/oauth.py +++ b/drama/routes/oauth.py @@ -212,77 +212,6 @@ def admin_app_id_comments(v, aid): @admin_level_required(3) def admin_apps_list(v): - apps = g.db.query(OauthApp).options( - joinedload( - OauthApp.author)).filter( - OauthApp.client_id==None).order_by( - OauthApp.id.desc()).all() + apps = g.db.query(OauthApp).all() - return render_template("admin/apps.html", v=v, apps=apps) - - -@app.post("/oauth/reroll/") -@auth_required -def reroll_oauth_tokens(aid, v): - - aid = aid - - a = g.db.query(OauthApp).filter_by(id=aid).first() - - if a.author_id != v.id: - abort(403) - - a.client_id = secrets.token_urlsafe(64)[:64] - a.client_secret = secrets.token_urlsafe(128)[:128] - - g.db.add(a) - - return {"message": "Tokens Rerolled", "id": a.client_id, "secret": a.client_secret} - - -@app.post("/oauth/rescind/") -@auth_required -@validate_formkey -def oauth_rescind_app(aid, v): - - aid = aid - auth = g.db.query(ClientAuth).filter_by(id=aid).first() - - if auth.user_id != v.id: - abort(403) - - g.db.delete(auth) - - return {"message": f"{auth.application.app_name} Revoked"} - -@app.post("/release") -@auth_required -def oauth_release_auth(v): - - token=request.headers.get("Authorization").split()[1] - - auth = g.db.query(ClientAuth).filter_by(user_id=v.id, access_token=token).first() - if not auth: - abort(404) - - if not auth.refresh_token: - abort(400) - - auth.access_token_expire_utc=0 - g.db.add(auth) - - return {"message":"Authorization released"} - -@app.post("/kill") -@auth_required -def oauth_kill_auth(v): - - token=request.headers.get("Authorization").split()[1] - - auth = g.db.query(ClientAuth).filter_by(user_id=v.id, access_token=token).first() - if not auth: - abort(404) - - g.db.delete(auth) - - return {"message":"Authorization released"} + return render_template("admin/apps.html", v=v, apps=apps) \ No newline at end of file