From cd942c18a2f67bf3e6df63d0e48db54d4058c93a Mon Sep 17 00:00:00 2001 From: Aevann Date: Tue, 16 May 2023 06:45:54 +0300 Subject: [PATCH] rename the over_18 cookie key in a last ditch attempt to relieve the duplicate cookie victims of infinite +18 warnings --- files/routes/comments.py | 2 +- files/routes/errors.py | 2 +- files/routes/posts.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/files/routes/comments.py b/files/routes/comments.py index 105d83b5a..9fc17c4c4 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -47,7 +47,7 @@ def post_pid_comment_cid(cid, pid=None, anything=None, v=None, sub=None): post = get_post(post, v=v) - if post.over_18 and not (v and v.over_18) and not session.get('over_18', 0) >= int(time.time()): + if post.over_18 and not (v and v.over_18) and not session.get('over_18_cookies', 0) >= int(time.time()): if v and v.client: abort(403, "This content is not suitable for some users and situations!") else: return render_template("errors/nsfw.html", v=v), 403 diff --git a/files/routes/errors.py b/files/routes/errors.py index 21b2a9684..a6681b1be 100644 --- a/files/routes/errors.py +++ b/files/routes/errors.py @@ -65,7 +65,7 @@ def error_500(e): @limiter.limit('1/second', scope=rpath) @limiter.limit(DEFAULT_RATELIMIT) def allow_nsfw(): - session["over_18"] = int(time.time()) + 3600 + session["over_18_cookies"] = int(time.time()) + 3600 redir = request.values.get("redir", "/") if is_site_url(redir): return redirect(redir) return redirect('/') diff --git a/files/routes/posts.py b/files/routes/posts.py index 8a2c87ad9..d098871d2 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -89,7 +89,7 @@ def post_id(pid, anything=None, v=None, sub=None): p = get_post(pid, v=v) if not User.can_see(v, p): abort(403) - if p.over_18 and not (v and v.over_18) and session.get('over_18', 0) < int(time.time()): + if p.over_18 and not (v and v.over_18) and session.get('over_18_cookies', 0) < int(time.time()): if g.is_api_or_xhr: abort(451, "Must be 18+ to view") return render_template("errors/nsfw.html", v=v)