remove more auth desireds on some routes

no need for the user at all here
This commit is contained in:
justcool393 2023-02-24 03:57:35 -08:00 committed by GitHub
parent ff09ba4209
commit ce04999fb2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 18 deletions

View file

@ -363,9 +363,7 @@ def changeloglist(v=None, sort="new", page=1, t="all", site=None):
@app.get("/random_post")
@auth_desired
def random_post(v):
def random_post():
p = g.db.query(Submission.id).filter(Submission.deleted_utc == 0, Submission.is_banned == False, Submission.private == False).order_by(func.random()).first()
if p: p = p[0]
@ -375,8 +373,7 @@ def random_post(v):
@app.get("/random_user")
@auth_desired
def random_user(v):
def random_user():
u = g.db.query(User.username).order_by(func.random()).first()
if u: u = u[0]

View file

@ -110,15 +110,13 @@ def chart():
@app.get("/weekly_chart")
@auth_desired
def weekly_chart(v):
def weekly_chart():
file = cached_chart(kind="weekly", site=SITE)
f = send_file(file)
return f
@app.get("/daily_chart")
@auth_desired
def daily_chart(v):
def daily_chart():
file = cached_chart(kind="daily", site=SITE)
f = send_file(file)
return f

View file

@ -516,8 +516,7 @@ def unsubscribe(v, post_id):
return {"message": "Post unsubscribed!"}
@app.get("/report_bugs")
@auth_required
def reportbugs(v):
def reportbugs():
return redirect(f'/post/{BUG_THREAD}')
@app.post("/@<username>/message")
@ -714,15 +713,13 @@ def api_is_available(name):
else:
return {name: True}
@app.get("/id/<id>")
@auth_desired
def user_id(v, id):
@app.get("/id/<int:id>")
def user_id(id:int):
user = get_account(id)
return redirect(user.url)
@app.get("/u/<username>")
@auth_desired
def redditor_moment_redirect(v, username):
def redditor_moment_redirect(username:str):
return redirect(f"/@{username}")
@app.get("/@<username>/followers")
@ -1009,8 +1006,7 @@ def user_profile_uid(v, id):
@app.get("/@<username>/pic")
@limiter.exempt
@auth_required
def user_profile_name(v, username):
def user_profile_name(username:str):
name = f"/@{username}/pic"
path = cache.get(name)