forked from rDrama/rDrama
give an error message in /comments to stop bad bug reports
parent
2c2657d613
commit
b13ec4f4c7
|
@ -218,33 +218,35 @@ def comment_idlist(v=None, page=1, sort="new", t="day", gt=0, lt=0, site=None):
|
||||||
comments = comments.offset(PAGE_SIZE * (page - 1)).limit(PAGE_SIZE + 1).all()
|
comments = comments.offset(PAGE_SIZE * (page - 1)).limit(PAGE_SIZE + 1).all()
|
||||||
return [x[0] for x in comments]
|
return [x[0] for x in comments]
|
||||||
|
|
||||||
if SITE != 'rdrama.net':
|
@app.get("/comments")
|
||||||
@app.get("/comments")
|
@auth_required
|
||||||
@auth_required
|
def all_comments(v:User):
|
||||||
def all_comments(v:User):
|
if SITE == 'rdrama.net':
|
||||||
try: page = max(int(request.values.get("page", 1)), 1)
|
abort(403, "Temporarily disabled!")
|
||||||
except: page = 1
|
|
||||||
|
|
||||||
sort=request.values.get("sort", "new")
|
try: page = max(int(request.values.get("page", 1)), 1)
|
||||||
t=request.values.get("t", "hour")
|
except: page = 1
|
||||||
|
|
||||||
try: gt=int(request.values.get("after", 0))
|
sort=request.values.get("sort", "new")
|
||||||
except: gt=0
|
t=request.values.get("t", "hour")
|
||||||
|
|
||||||
try: lt=int(request.values.get("before", 0))
|
try: gt=int(request.values.get("after", 0))
|
||||||
except: lt=0
|
except: gt=0
|
||||||
idlist = comment_idlist(v=v,
|
|
||||||
page=page,
|
|
||||||
sort=sort,
|
|
||||||
t=t,
|
|
||||||
gt=gt,
|
|
||||||
lt=lt,
|
|
||||||
site=SITE
|
|
||||||
)
|
|
||||||
|
|
||||||
comments = get_comments(idlist, v=v)
|
try: lt=int(request.values.get("before", 0))
|
||||||
next_exists = len(idlist) > PAGE_SIZE
|
except: lt=0
|
||||||
idlist = idlist[:PAGE_SIZE]
|
idlist = comment_idlist(v=v,
|
||||||
|
page=page,
|
||||||
|
sort=sort,
|
||||||
|
t=t,
|
||||||
|
gt=gt,
|
||||||
|
lt=lt,
|
||||||
|
site=SITE
|
||||||
|
)
|
||||||
|
|
||||||
if v.client: return {"data": [x.json(g.db) for x in comments]}
|
comments = get_comments(idlist, v=v)
|
||||||
return render_template("home_comments.html", v=v, sort=sort, t=t, page=page, comments=comments, standalone=True, next_exists=next_exists)
|
next_exists = len(idlist) > PAGE_SIZE
|
||||||
|
idlist = idlist[:PAGE_SIZE]
|
||||||
|
|
||||||
|
if v.client: return {"data": [x.json(g.db) for x in comments]}
|
||||||
|
return render_template("home_comments.html", v=v, sort=sort, t=t, page=page, comments=comments, standalone=True, next_exists=next_exists)
|
||||||
|
|
Loading…
Reference in New Issue