From 819c2846f9924f313487a20dc09082c06dca0ea5 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Fri, 4 Feb 2022 06:21:47 +0200 Subject: [PATCH] fsd --- files/__main__.py | 2 +- files/helpers/wrappers.py | 73 ------------------------------------- files/routes/front.py | 76 ++++++++++++++++++++++++++++++++++++++- 3 files changed, 76 insertions(+), 75 deletions(-) diff --git a/files/__main__.py b/files/__main__.py index 91ab3ba2b..90d754306 100644 --- a/files/__main__.py +++ b/files/__main__.py @@ -69,7 +69,7 @@ limiter = Limiter( app, key_func=get_CF, default_limits=["3/second;30/minute;200/hour;1000/day"], - application_limits=["10/second;200/minute;5000/hour;12000/day"], + application_limits=["10/second;200/minute;5000/hour;10000/day"], storage_uri=environ.get("REDIS_URL", "redis://localhost") ) diff --git a/files/helpers/wrappers.py b/files/helpers/wrappers.py index 31e4e1bfb..6bf1563f9 100644 --- a/files/helpers/wrappers.py +++ b/files/helpers/wrappers.py @@ -30,79 +30,6 @@ def get_logged_in_user(): if not submitted_key: abort(401) elif not v.validate_formkey(submitted_key): abort(401) - - if v.patron_utc and v.patron_utc < time.time(): - v.patron = 0 - v.patron_utc = 0 - send_repeatable_notification(v.id, "Your paypig status has expired!") - g.db.add(v) - g.db.commit() - - if v.unban_utc and v.unban_utc < time.time(): - v.is_banned = 0 - v.unban_utc = 0 - v.ban_evade = 0 - send_repeatable_notification(v.id, "You have been unbanned!") - g.db.add(v) - g.db.commit() - - if v.agendaposter_expires_utc and v.agendaposter_expires_utc < time.time(): - v.agendaposter_expires_utc = 0 - v.agendaposter = None - send_repeatable_notification(v.id, "Your chud theme has expired!") - g.db.add(v) - badge = v.has_badge(26) - if badge: g.db.delete(badge) - g.db.commit() - - if v.flairchanged and v.flairchanged < time.time(): - v.flairchanged = None - send_repeatable_notification(v.id, "Your flair lock has expired. You can now change your flair!") - g.db.add(v) - badge = v.has_badge(96) - if badge: g.db.delete(badge) - g.db.commit() - - if v.marseyawarded and v.marseyawarded < time.time(): - v.marseyawarded = None - send_repeatable_notification(v.id, "Your marsey award has expired!") - g.db.add(v) - badge = v.has_badge(98) - if badge: g.db.delete(badge) - g.db.commit() - - if v.longpost and v.longpost < time.time(): - v.longpost = None - send_repeatable_notification(v.id, "Your pizzashill award has expired!") - g.db.add(v) - badge = v.has_badge(97) - if badge: g.db.delete(badge) - g.db.commit() - - if v.bird and v.bird < time.time(): - v.bird = None - send_repeatable_notification(v.id, "Your bird site award has expired!") - g.db.add(v) - badge = v.has_badge(95) - if badge: g.db.delete(badge) - g.db.commit() - - if v.progressivestack and v.progressivestack < time.time(): - v.progressivestack = None - send_repeatable_notification(v.id, "Your progressive stack has expired!") - g.db.add(v) - badge = v.has_badge(94) - if badge: g.db.delete(badge) - g.db.commit() - - if v.rehab and v.rehab < time.time(): - v.rehab = None - send_repeatable_notification(v.id, "Your rehab has finished!") - g.db.add(v) - badge = v.has_badge(109) - if badge: g.db.delete(badge) - g.db.commit() - return v def check_ban_evade(v): diff --git a/files/routes/front.py b/files/routes/front.py index 3aa3628ab..8dbc06e76 100644 --- a/files/routes/front.py +++ b/files/routes/front.py @@ -169,7 +169,81 @@ def front_all(v): posts = get_posts(ids, v=v) - if v and v.hidevotedon: posts = [x for x in posts if not hasattr(x, 'voted') or not x.voted] + if v: + if v.hidevotedon: posts = [x for x in posts if not hasattr(x, 'voted') or not x.voted] + + + if v.patron_utc and v.patron_utc < time.time(): + v.patron = 0 + v.patron_utc = 0 + send_repeatable_notification(v.id, "Your paypig status has expired!") + g.db.add(v) + g.db.commit() + + if v.unban_utc and v.unban_utc < time.time(): + v.is_banned = 0 + v.unban_utc = 0 + v.ban_evade = 0 + send_repeatable_notification(v.id, "You have been unbanned!") + g.db.add(v) + g.db.commit() + + if v.agendaposter_expires_utc and v.agendaposter_expires_utc < time.time(): + v.agendaposter_expires_utc = 0 + v.agendaposter = None + send_repeatable_notification(v.id, "Your chud theme has expired!") + g.db.add(v) + badge = v.has_badge(26) + if badge: g.db.delete(badge) + g.db.commit() + + if v.flairchanged and v.flairchanged < time.time(): + v.flairchanged = None + send_repeatable_notification(v.id, "Your flair lock has expired. You can now change your flair!") + g.db.add(v) + badge = v.has_badge(96) + if badge: g.db.delete(badge) + g.db.commit() + + if v.marseyawarded and v.marseyawarded < time.time(): + v.marseyawarded = None + send_repeatable_notification(v.id, "Your marsey award has expired!") + g.db.add(v) + badge = v.has_badge(98) + if badge: g.db.delete(badge) + g.db.commit() + + if v.longpost and v.longpost < time.time(): + v.longpost = None + send_repeatable_notification(v.id, "Your pizzashill award has expired!") + g.db.add(v) + badge = v.has_badge(97) + if badge: g.db.delete(badge) + g.db.commit() + + if v.bird and v.bird < time.time(): + v.bird = None + send_repeatable_notification(v.id, "Your bird site award has expired!") + g.db.add(v) + badge = v.has_badge(95) + if badge: g.db.delete(badge) + g.db.commit() + + if v.progressivestack and v.progressivestack < time.time(): + v.progressivestack = None + send_repeatable_notification(v.id, "Your progressive stack has expired!") + g.db.add(v) + badge = v.has_badge(94) + if badge: g.db.delete(badge) + g.db.commit() + + if v.rehab and v.rehab < time.time(): + v.rehab = None + send_repeatable_notification(v.id, "Your rehab has finished!") + g.db.add(v) + badge = v.has_badge(109) + if badge: g.db.delete(badge) + g.db.commit() if request.headers.get("Authorization"): return {"data": [x.json for x in posts], "next_exists": next_exists} return render_template("home.html", v=v, listing=posts, next_exists=next_exists, sort=sort, t=t, page=page, ccmode=ccmode)