forked from MarseyWorld/MarseyWorld
fds
parent
8d268268f1
commit
521eb16db7
|
@ -93,10 +93,10 @@ def post_pid_comment_cid(cid, pid=None, anything=None, v=None, sub=None):
|
|||
except: abort(404)
|
||||
|
||||
post = get_post(pid, v=v)
|
||||
|
||||
|
||||
if post.over_18 and not (v and v.over_18) and not session.get('over_18', 0) >= int(time.time()):
|
||||
if request.headers.get("Authorization"): return {'error': 'This content is not suitable for some users and situations.'}
|
||||
else: render_template("errors/nsfw.html", v=v)
|
||||
else: return render_template("errors/nsfw.html", v=v)
|
||||
|
||||
try: context = min(int(request.values.get("context", 0)), 8)
|
||||
except: context = 0
|
||||
|
|
|
@ -129,6 +129,10 @@ def post_id(pid, anything=None, v=None, sub=None):
|
|||
|
||||
post = get_post(pid, v=v)
|
||||
|
||||
if post.over_18 and not (v and v.over_18) and session.get('over_18', 0) < int(time.time()):
|
||||
if request.headers.get("Authorization") or request.headers.get("xhr"): return {"error":"Must be 18+ to view"}, 451
|
||||
return render_template("errors/nsfw.html", v=v)
|
||||
|
||||
if post.new or 'megathread' in post.title.lower(): defaultsortingcomments = 'new'
|
||||
elif v: defaultsortingcomments = v.defaultsortingcomments
|
||||
else: defaultsortingcomments = "top"
|
||||
|
@ -247,10 +251,6 @@ def post_id(pid, anything=None, v=None, sub=None):
|
|||
|
||||
post.views += 1
|
||||
g.db.add(post)
|
||||
if post.over_18 and not (v and v.over_18) and session.get('over_18', 0) < int(time.time()):
|
||||
if request.headers.get("Authorization") or request.headers.get("xhr"): return {"error":"Must be 18+ to view"}, 451
|
||||
return render_template("errors/nsfw.html", v=v)
|
||||
|
||||
g.db.commit()
|
||||
if request.headers.get("Authorization"): return post.json
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue