forked from rDrama/rDrama
dfdfdf
parent
ed2a9f40e6
commit
f794c6b18e
|
@ -3,7 +3,7 @@ from drama.helpers.wrappers import *
|
|||
from drama.helpers.alerts import *
|
||||
from drama.helpers.get import *
|
||||
from drama.classes.award import *
|
||||
from flask import g, jsonify, request
|
||||
from flask import g, request
|
||||
|
||||
|
||||
def banaward_trigger(post=None, comment=None):
|
||||
|
|
|
@ -249,8 +249,7 @@ def api_comment(v):
|
|||
return {"error": f"You already made that comment: {existing.permalink}"}, 409
|
||||
|
||||
if parent.author.any_block_exists(v) and not v.admin_level>=3:
|
||||
return jsonify(
|
||||
{"error": "You can't reply to users who have blocked you, or users you have blocked."}), 403
|
||||
return {"error": "You can't reply to users who have blocked you, or users you have blocked."}, 403
|
||||
|
||||
# get bot status
|
||||
is_bot = request.headers.get("X-User-Type","")=="Bot"
|
||||
|
|
|
@ -314,19 +314,9 @@ def changelog(v):
|
|||
# check if ids exist
|
||||
posts = get_posts(ids, v=v)
|
||||
|
||||
return {'html': lambda: render_template("changelog.html",
|
||||
v=v,
|
||||
listing=posts,
|
||||
next_exists=next_exists,
|
||||
sort=sort,
|
||||
t=t,
|
||||
page=page,
|
||||
),
|
||||
'api': lambda: jsonify({"data": [x.json for x in posts],
|
||||
"next_exists": next_exists
|
||||
}
|
||||
)
|
||||
}
|
||||
if request.headers.get("Authorization"): return {"data": [x.json for x in posts], "next_exists": next_exists}
|
||||
else: return render_template("changelog.html", v=v, listing=posts, next_exists=next_exists, sort=sort, t=t, page=page)
|
||||
|
||||
|
||||
@app.get("/random")
|
||||
@auth_desired
|
||||
|
|
|
@ -41,8 +41,7 @@ def oauth_authorize_prompt(v):
|
|||
|
||||
scopes = scopes_txt.split(',')
|
||||
if not scopes:
|
||||
return jsonify(
|
||||
{"oauth_error": "One or more scopes must be specified as a comma-separated list."}), 400
|
||||
return {"oauth_error": "One or more scopes must be specified as a comma-separated list."}, 400
|
||||
|
||||
for scope in scopes:
|
||||
if scope not in SCOPES:
|
||||
|
@ -103,8 +102,7 @@ def oauth_authorize_post(v):
|
|||
|
||||
scopes = scopes_txt.split(',')
|
||||
if not scopes:
|
||||
return jsonify(
|
||||
{"oauth_error": "One or more scopes must be specified as a comma-separated list"}), 400
|
||||
return {"oauth_error": "One or more scopes must be specified as a comma-separated list"}, 400
|
||||
|
||||
for scope in scopes:
|
||||
if scope not in SCOPES:
|
||||
|
@ -149,8 +147,7 @@ def oauth_grant():
|
|||
client_id=request.values.get("client_id"),
|
||||
client_secret=request.values.get("client_secret")).first()
|
||||
if not application:
|
||||
return jsonify(
|
||||
{"oauth_error": "Invalid `client_id` or `client_secret`"}), 401
|
||||
return {"oauth_error": "Invalid `client_id` or `client_secret`"}, 401
|
||||
if application.is_banned:
|
||||
return {"oauth_error": f"Application `{application.app_name}` is suspended."}, 403
|
||||
|
||||
|
@ -419,11 +416,7 @@ def reroll_oauth_tokens(aid, v):
|
|||
|
||||
g.db.add(a)
|
||||
|
||||
return jsonify({"message": "Tokens Rerolled",
|
||||
"id": a.client_id,
|
||||
"secret": a.client_secret
|
||||
}
|
||||
)
|
||||
return {"message": "Tokens Rerolled", "id": a.client_id, "secret": a.client_secret}
|
||||
|
||||
|
||||
@app.post("/oauth/rescind/<aid>")
|
||||
|
|
Loading…
Reference in New Issue