From e78619fc755e217d605b50d763a5167be9f30db7 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Mon, 20 Dec 2021 01:27:49 +0200 Subject: [PATCH 1/8] fsdsfd --- files/templates/CHRISTMAS/authforms.html | 4 ++-- files/templates/CHRISTMAS/default.html | 4 ++-- files/templates/CHRISTMAS/login.html | 4 ++-- files/templates/CHRISTMAS/login_2fa.html | 2 +- files/templates/CHRISTMAS/settings.html | 4 ++-- files/templates/CHRISTMAS/sign_up.html | 4 ++-- files/templates/CHRISTMAS/sign_up_failed_ref.html | 2 +- files/templates/CHRISTMAS/tailwind.html | 2 +- files/templates/authforms.html | 4 ++-- files/templates/default.html | 4 ++-- files/templates/log.html | 4 ++-- files/templates/login.html | 2 +- files/templates/login_2fa.html | 2 +- files/templates/settings.html | 2 +- files/templates/settings2.html | 4 ++-- files/templates/sign_up.html | 2 +- files/templates/sign_up_failed_ref.html | 2 +- files/templates/submit.html | 4 ++-- 18 files changed, 28 insertions(+), 28 deletions(-) diff --git a/files/templates/CHRISTMAS/authforms.html b/files/templates/CHRISTMAS/authforms.html index 14621fde95..e5f452f7e0 100644 --- a/files/templates/CHRISTMAS/authforms.html +++ b/files/templates/CHRISTMAS/authforms.html @@ -14,11 +14,11 @@ {% if v %} - + {% if v.agendaposter %}{% elif v.css %}{% endif %} {% else %} - + {% endif %} diff --git a/files/templates/CHRISTMAS/default.html b/files/templates/CHRISTMAS/default.html index 85f0b91492..9e4f9133f1 100644 --- a/files/templates/CHRISTMAS/default.html +++ b/files/templates/CHRISTMAS/default.html @@ -186,9 +186,9 @@ {% block stylesheets %} - + - + diff --git a/files/templates/CHRISTMAS/login.html b/files/templates/CHRISTMAS/login.html index 7ce58f56b8..8753f7a803 100644 --- a/files/templates/CHRISTMAS/login.html +++ b/files/templates/CHRISTMAS/login.html @@ -13,9 +13,9 @@ Login - {{'SITE_NAME' | app_config}} {% endblock %} - + - + diff --git a/files/templates/CHRISTMAS/login_2fa.html b/files/templates/CHRISTMAS/login_2fa.html index 4bd1c95e41..4441dd7e7a 100644 --- a/files/templates/CHRISTMAS/login_2fa.html +++ b/files/templates/CHRISTMAS/login_2fa.html @@ -13,7 +13,7 @@ 2-Step Login - {{'SITE_NAME' | app_config}} - + diff --git a/files/templates/CHRISTMAS/settings.html b/files/templates/CHRISTMAS/settings.html index a6be1cb675..db60eb16f0 100644 --- a/files/templates/CHRISTMAS/settings.html +++ b/files/templates/CHRISTMAS/settings.html @@ -28,9 +28,9 @@ {% block stylesheets %} - + - + diff --git a/files/templates/CHRISTMAS/sign_up.html b/files/templates/CHRISTMAS/sign_up.html index a74dd6ee77..a864f0c0d1 100644 --- a/files/templates/CHRISTMAS/sign_up.html +++ b/files/templates/CHRISTMAS/sign_up.html @@ -26,9 +26,9 @@ {% if ref_user %}{{ref_user.username}} invites you to {{'SITE_NAME' | app_config}}{% else %}Sign up - {{'SITE_NAME' | app_config}}{% endif %} - + - + diff --git a/files/templates/CHRISTMAS/sign_up_failed_ref.html b/files/templates/CHRISTMAS/sign_up_failed_ref.html index 97ad6790f8..d16eea7213 100644 --- a/files/templates/CHRISTMAS/sign_up_failed_ref.html +++ b/files/templates/CHRISTMAS/sign_up_failed_ref.html @@ -31,7 +31,7 @@ {% if ref_user %}{{ref_user.username}} invites you to {{'SITE_NAME' | app_config}}{% else %}{{'SITE_NAME' | app_config}}{% endif %} - + diff --git a/files/templates/CHRISTMAS/tailwind.html b/files/templates/CHRISTMAS/tailwind.html index 05260c2994..c66ce26796 100644 --- a/files/templates/CHRISTMAS/tailwind.html +++ b/files/templates/CHRISTMAS/tailwind.html @@ -5,7 +5,7 @@ - + Flask + Tailwind CSS diff --git a/files/templates/authforms.html b/files/templates/authforms.html index 514d334815..81a97854a4 100644 --- a/files/templates/authforms.html +++ b/files/templates/authforms.html @@ -14,11 +14,11 @@ {% if v %} - + {% if v.agendaposter %}{% elif v.css %}{% endif %} {% else %} - + {% endif %} diff --git a/files/templates/default.html b/files/templates/default.html index 904d91cc36..89fd62f619 100644 --- a/files/templates/default.html +++ b/files/templates/default.html @@ -6,12 +6,12 @@ {% if v %} - + {% if v.agendaposter %}{% elif v.css %}{% endif %} {% else %} - + {% endif %} diff --git a/files/templates/log.html b/files/templates/log.html index 23fced5e87..c58ce9e1e0 100644 --- a/files/templates/log.html +++ b/files/templates/log.html @@ -6,11 +6,11 @@ {% block content %} {% if v %} - + {% if v.agendaposter %}{% elif v.css %}{% endif %} {% else %} - + {% endif %}
diff --git a/files/templates/login.html b/files/templates/login.html index 12673e6246..2579c3d9fa 100644 --- a/files/templates/login.html +++ b/files/templates/login.html @@ -17,7 +17,7 @@ {% endblock %} - + diff --git a/files/templates/login_2fa.html b/files/templates/login_2fa.html index d7bf2426a8..5fe1b347ce 100644 --- a/files/templates/login_2fa.html +++ b/files/templates/login_2fa.html @@ -13,7 +13,7 @@ 2-Step Login - {{'SITE_NAME' | app_config}} - + diff --git a/files/templates/settings.html b/files/templates/settings.html index 4b302d344a..7e1f010b88 100644 --- a/files/templates/settings.html +++ b/files/templates/settings.html @@ -33,7 +33,7 @@ - + {% if v.agendaposter %}{% elif v.css %}{% endif %} diff --git a/files/templates/settings2.html b/files/templates/settings2.html index a8a475fcea..643570d596 100644 --- a/files/templates/settings2.html +++ b/files/templates/settings2.html @@ -38,10 +38,10 @@ {% if v %} - + {% else %} - + {% endif %} diff --git a/files/templates/sign_up.html b/files/templates/sign_up.html index 2cb21cf6b8..3022a462b4 100644 --- a/files/templates/sign_up.html +++ b/files/templates/sign_up.html @@ -30,7 +30,7 @@ {% if ref_user %}{{ref_user.username}} invites you to {{'SITE_NAME' | app_config}}{% else %}Sign up - {{'SITE_NAME' | app_config}}{% endif %} - + diff --git a/files/templates/sign_up_failed_ref.html b/files/templates/sign_up_failed_ref.html index 63dfb751d8..1abe8b2aba 100644 --- a/files/templates/sign_up_failed_ref.html +++ b/files/templates/sign_up_failed_ref.html @@ -31,7 +31,7 @@ {% if ref_user %}{{ref_user.username}} invites you to {{'SITE_NAME' | app_config}}{% else %}{{'SITE_NAME' | app_config}}{% endif %} - + diff --git a/files/templates/submit.html b/files/templates/submit.html index 15f76c4e41..65c6e74ea4 100644 --- a/files/templates/submit.html +++ b/files/templates/submit.html @@ -25,11 +25,11 @@ {% block stylesheets %} {% if v %} - + {% if v.agendaposter %}{% elif v.css %}{% endif %} {% else %} - + {% endif %} {% endblock %} From a1bac3f4600265226b294dcc68cac0d974c7f458 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Mon, 20 Dec 2021 01:31:15 +0200 Subject: [PATCH 2/8] sdffsd --- files/routes/admin.py | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/files/routes/admin.py b/files/routes/admin.py index 144e17e627..be2086c276 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -826,24 +826,18 @@ def ban_user(user_id, v): if not user: abort(400) if days > 0: - if message: - text = f"Your account has been suspended for {days} days for the following reason:\n\n> {message}" - else: - text = f"Your account has been suspended for {days} days." - user.ban(admin=v, reason=reason, days=days) - + if message: text = f"Your account has been suspended for {days} days for the following reason:\n\n> {message}" + else: text = f"Your account has been suspended for {days} days." else: - if message: - text = f"Your account has been permanently suspended for the following reason:\n\n> {message}" - else: - text = "Your account has been permanently suspended." + if message: text = f"Your account has been permanently suspended for the following reason:\n\n> {message}" + else: text = "Your account has been permanently suspended." - user.ban(admin=v, reason=reason) + user.ban(admin=v, reason=reason, days=days) if request.values.get("alts", ""): for x in user.alts: if x.admin_level > 0: break - x.ban(admin=v, reason=reason) + user.ban(admin=v, reason=reason, days=days) send_notification(user.id, text) From 4ba1f16278a1d47437ff44c75b1c408c870101ae Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Mon, 20 Dec 2021 01:31:47 +0200 Subject: [PATCH 3/8] sfddsf --- files/routes/admin.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/files/routes/admin.py b/files/routes/admin.py index be2086c276..0df68cd639 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -824,13 +824,6 @@ def ban_user(user_id, v): message = request.values.get("reason", "").strip()[:256] if not user: abort(400) - - if days > 0: - if message: text = f"Your account has been suspended for {days} days for the following reason:\n\n> {message}" - else: text = f"Your account has been suspended for {days} days." - else: - if message: text = f"Your account has been permanently suspended for the following reason:\n\n> {message}" - else: text = "Your account has been permanently suspended." user.ban(admin=v, reason=reason, days=days) @@ -839,6 +832,13 @@ def ban_user(user_id, v): if x.admin_level > 0: break user.ban(admin=v, reason=reason, days=days) + if days > 0: + if message: text = f"Your account has been suspended for {days} days for the following reason:\n\n> {message}" + else: text = f"Your account has been suspended for {days} days." + else: + if message: text = f"Your account has been permanently suspended for the following reason:\n\n> {message}" + else: text = "Your account has been permanently suspended." + send_notification(user.id, text) if days == 0: duration = "permanent" From 9ade838e8da148329d2d7748485fd96052efa47c Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Mon, 20 Dec 2021 01:36:26 +0200 Subject: [PATCH 4/8] dfsfsd --- files/routes/settings.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/files/routes/settings.py b/files/routes/settings.py index 6a587b4de7..cba7e49f75 100644 --- a/files/routes/settings.py +++ b/files/routes/settings.py @@ -389,6 +389,11 @@ def settings_profile_post(v): if theme == "win98": v.themecolor = "30409f" updated = True + theme2 = request.values.get("theme2") + if theme2: + v.theme2 = theme2 + updated = True + quadrant = request.values.get("quadrant") if quadrant and 'pcmemes.net' == request.host.lower(): v.quadrant = quadrant From 28b5288a1099a2c3ba4e7f58309cc12abd03893c Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Mon, 20 Dec 2021 02:06:25 +0200 Subject: [PATCH 5/8] fsdfsd --- files/templates/award_modal.html | 4 ---- 1 file changed, 4 deletions(-) diff --git a/files/templates/award_modal.html b/files/templates/award_modal.html index 7a8de17c32..b4c0a9be68 100644 --- a/files/templates/award_modal.html +++ b/files/templates/award_modal.html @@ -66,10 +66,6 @@ background-color: var(--primary)!important; } - .award-columns { - column-count: 2; - } - @media (min-width: 767.98px) { .award-columns { column-count: 7 !important; From 6e46f32e334a4b39a6983a94c8113396d64e6e69 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Mon, 20 Dec 2021 02:09:03 +0200 Subject: [PATCH 6/8] sdffds --- files/routes/settings.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/files/routes/settings.py b/files/routes/settings.py index cba7e49f75..5cc689a280 100644 --- a/files/routes/settings.py +++ b/files/routes/settings.py @@ -530,8 +530,12 @@ def gumroad(v): response = requests.get('https://api.gumroad.com/v2/sales', data=data, timeout=5).json()["sales"][0] tier = tiers[response["variants_and_quantity"]] + if v.patron == tier: return {"error": f"{patron} rewards already claimed"}, 400 + existing = g.db.query(User.id).filter_by(email=v.email, is_activated=True, patron=tier).one_or_none() + if existing: return {"error": f"{patron} rewards already claimed on another account"}, 400 + if v.patron: badge = v.has_badge(20+tier) if badge: g.db.delete(badge) From db1bdd176e3c135c4718b493d38596449538ce56 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Mon, 20 Dec 2021 02:26:22 +0200 Subject: [PATCH 7/8] fdsfds --- files/templates/CHRISTMAS/authforms.html | 4 ++-- files/templates/CHRISTMAS/default.html | 4 ++-- files/templates/CHRISTMAS/login.html | 4 ++-- files/templates/CHRISTMAS/login_2fa.html | 2 +- files/templates/CHRISTMAS/settings.html | 4 ++-- files/templates/CHRISTMAS/sign_up.html | 4 ++-- files/templates/CHRISTMAS/sign_up_failed_ref.html | 2 +- files/templates/CHRISTMAS/tailwind.html | 2 +- files/templates/authforms.html | 4 ++-- files/templates/comments.html | 2 +- files/templates/default.html | 4 ++-- files/templates/log.html | 4 ++-- files/templates/login.html | 2 +- files/templates/login_2fa.html | 2 +- files/templates/settings.html | 2 +- files/templates/settings2.html | 4 ++-- files/templates/sign_up.html | 2 +- files/templates/sign_up_failed_ref.html | 2 +- files/templates/submit.html | 4 ++-- 19 files changed, 29 insertions(+), 29 deletions(-) diff --git a/files/templates/CHRISTMAS/authforms.html b/files/templates/CHRISTMAS/authforms.html index e5f452f7e0..ce67ea509e 100644 --- a/files/templates/CHRISTMAS/authforms.html +++ b/files/templates/CHRISTMAS/authforms.html @@ -14,11 +14,11 @@ {% if v %} - + {% if v.agendaposter %}{% elif v.css %}{% endif %} {% else %} - + {% endif %} diff --git a/files/templates/CHRISTMAS/default.html b/files/templates/CHRISTMAS/default.html index 9e4f9133f1..0bc6ff11a5 100644 --- a/files/templates/CHRISTMAS/default.html +++ b/files/templates/CHRISTMAS/default.html @@ -186,9 +186,9 @@ {% block stylesheets %} - + - + diff --git a/files/templates/CHRISTMAS/login.html b/files/templates/CHRISTMAS/login.html index 8753f7a803..ed057f2548 100644 --- a/files/templates/CHRISTMAS/login.html +++ b/files/templates/CHRISTMAS/login.html @@ -13,9 +13,9 @@ Login - {{'SITE_NAME' | app_config}} {% endblock %} - + - + diff --git a/files/templates/CHRISTMAS/login_2fa.html b/files/templates/CHRISTMAS/login_2fa.html index 4441dd7e7a..290e139245 100644 --- a/files/templates/CHRISTMAS/login_2fa.html +++ b/files/templates/CHRISTMAS/login_2fa.html @@ -13,7 +13,7 @@ 2-Step Login - {{'SITE_NAME' | app_config}} - + diff --git a/files/templates/CHRISTMAS/settings.html b/files/templates/CHRISTMAS/settings.html index db60eb16f0..14a3b23313 100644 --- a/files/templates/CHRISTMAS/settings.html +++ b/files/templates/CHRISTMAS/settings.html @@ -28,9 +28,9 @@ {% block stylesheets %} - + - + diff --git a/files/templates/CHRISTMAS/sign_up.html b/files/templates/CHRISTMAS/sign_up.html index a864f0c0d1..947a915041 100644 --- a/files/templates/CHRISTMAS/sign_up.html +++ b/files/templates/CHRISTMAS/sign_up.html @@ -26,9 +26,9 @@ {% if ref_user %}{{ref_user.username}} invites you to {{'SITE_NAME' | app_config}}{% else %}Sign up - {{'SITE_NAME' | app_config}}{% endif %} - + - + diff --git a/files/templates/CHRISTMAS/sign_up_failed_ref.html b/files/templates/CHRISTMAS/sign_up_failed_ref.html index d16eea7213..157c12d4ac 100644 --- a/files/templates/CHRISTMAS/sign_up_failed_ref.html +++ b/files/templates/CHRISTMAS/sign_up_failed_ref.html @@ -31,7 +31,7 @@ {% if ref_user %}{{ref_user.username}} invites you to {{'SITE_NAME' | app_config}}{% else %}{{'SITE_NAME' | app_config}}{% endif %} - + diff --git a/files/templates/CHRISTMAS/tailwind.html b/files/templates/CHRISTMAS/tailwind.html index c66ce26796..7d92c1955a 100644 --- a/files/templates/CHRISTMAS/tailwind.html +++ b/files/templates/CHRISTMAS/tailwind.html @@ -5,7 +5,7 @@ - + Flask + Tailwind CSS diff --git a/files/templates/authforms.html b/files/templates/authforms.html index 81a97854a4..03c8671f76 100644 --- a/files/templates/authforms.html +++ b/files/templates/authforms.html @@ -14,11 +14,11 @@ {% if v %} - + {% if v.agendaposter %}{% elif v.css %}{% endif %} {% else %} - + {% endif %} diff --git a/files/templates/comments.html b/files/templates/comments.html index ac4e4cf7aa..fa2934d584 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -324,7 +324,7 @@ {% endif %} - {{score}} + {{score}} {% if v and request.path.startswith('/@') and v.admin_level == 0 %} {% if voted==-1 %} diff --git a/files/templates/default.html b/files/templates/default.html index 89fd62f619..e868a9b979 100644 --- a/files/templates/default.html +++ b/files/templates/default.html @@ -6,12 +6,12 @@ {% if v %} - + {% if v.agendaposter %}{% elif v.css %}{% endif %} {% else %} - + {% endif %} diff --git a/files/templates/log.html b/files/templates/log.html index c58ce9e1e0..dd1d693158 100644 --- a/files/templates/log.html +++ b/files/templates/log.html @@ -6,11 +6,11 @@ {% block content %} {% if v %} - + {% if v.agendaposter %}{% elif v.css %}{% endif %} {% else %} - + {% endif %}
diff --git a/files/templates/login.html b/files/templates/login.html index 2579c3d9fa..48a07dc678 100644 --- a/files/templates/login.html +++ b/files/templates/login.html @@ -17,7 +17,7 @@ {% endblock %} - + diff --git a/files/templates/login_2fa.html b/files/templates/login_2fa.html index 5fe1b347ce..112e13d839 100644 --- a/files/templates/login_2fa.html +++ b/files/templates/login_2fa.html @@ -13,7 +13,7 @@ 2-Step Login - {{'SITE_NAME' | app_config}} - + diff --git a/files/templates/settings.html b/files/templates/settings.html index 7e1f010b88..b21e4c639e 100644 --- a/files/templates/settings.html +++ b/files/templates/settings.html @@ -33,7 +33,7 @@ - + {% if v.agendaposter %}{% elif v.css %}{% endif %} diff --git a/files/templates/settings2.html b/files/templates/settings2.html index 643570d596..84f9a816e7 100644 --- a/files/templates/settings2.html +++ b/files/templates/settings2.html @@ -38,10 +38,10 @@ {% if v %} - + {% else %} - + {% endif %} diff --git a/files/templates/sign_up.html b/files/templates/sign_up.html index 3022a462b4..9165b45bc5 100644 --- a/files/templates/sign_up.html +++ b/files/templates/sign_up.html @@ -30,7 +30,7 @@ {% if ref_user %}{{ref_user.username}} invites you to {{'SITE_NAME' | app_config}}{% else %}Sign up - {{'SITE_NAME' | app_config}}{% endif %} - + diff --git a/files/templates/sign_up_failed_ref.html b/files/templates/sign_up_failed_ref.html index 1abe8b2aba..24057af908 100644 --- a/files/templates/sign_up_failed_ref.html +++ b/files/templates/sign_up_failed_ref.html @@ -31,7 +31,7 @@ {% if ref_user %}{{ref_user.username}} invites you to {{'SITE_NAME' | app_config}}{% else %}{{'SITE_NAME' | app_config}}{% endif %} - + diff --git a/files/templates/submit.html b/files/templates/submit.html index 65c6e74ea4..57dadeafc3 100644 --- a/files/templates/submit.html +++ b/files/templates/submit.html @@ -25,11 +25,11 @@ {% block stylesheets %} {% if v %} - + {% if v.agendaposter %}{% elif v.css %}{% endif %} {% else %} - + {% endif %} {% endblock %} From efff0400ef5a941335fc06c500d7e18f5caf8df4 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Mon, 20 Dec 2021 02:27:25 +0200 Subject: [PATCH 8/8] fsfs --- files/helpers/jinja2.py | 2 +- files/mail/__init__.py | 6 +-- files/routes/admin.py | 28 +++++++------- files/routes/awards.py | 6 +-- files/routes/comments.py | 4 +- files/routes/discord.py | 2 +- files/routes/front.py | 8 ++-- files/routes/login.py | 12 +++--- files/routes/oauth.py | 8 ++-- files/routes/posts.py | 24 ++++++------ files/routes/search.py | 6 +-- files/routes/settings.py | 84 ++++++++++++++++++++-------------------- files/routes/static.py | 30 +++++++------- files/routes/users.py | 56 +++++++++++++-------------- files/routes/votes.py | 4 +- 15 files changed, 140 insertions(+), 140 deletions(-) diff --git a/files/helpers/jinja2.py b/files/helpers/jinja2.py index 090aa33745..0ee962549a 100644 --- a/files/helpers/jinja2.py +++ b/files/helpers/jinja2.py @@ -20,7 +20,7 @@ def post_embed(id, v): p = get_post(id, v, graceful=True) - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}submission_listing.html", listing=[p], v=v) diff --git a/files/mail/__init__.py b/files/mail/__init__.py index 450bd1278d..853dbb796d 100644 --- a/files/mail/__init__.py +++ b/files/mail/__init__.py @@ -61,7 +61,7 @@ def activate(v): token = request.values.get("token", "").strip() if int(time.time()) - timestamp > 3600: - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}message.html", v=v, title="Verification link expired.", message="That link has expired. Visit your settings to send yourself another verification email."), 410 @@ -74,7 +74,7 @@ def activate(v): abort(404) if user.is_activated and user.email == email: - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}message_success.html", v=v, title="Email already verified.", message="Email already verified."), 404 @@ -90,6 +90,6 @@ def activate(v): g.db.add(user) g.db.commit() - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}message_success.html", v=v, title="Email verified.", message=f"Your email {email} has been verified. Thank you.") diff --git a/files/routes/admin.py b/files/routes/admin.py index 0df68cd639..2c6816a8b3 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -45,7 +45,7 @@ def distribute(v, cid): @admin_level_required(2) def truescore(v): users = g.db.query(User).order_by(User.truecoins.desc()).limit(25).all() - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}truescore.html", v=v, users=users) @@ -254,7 +254,7 @@ def post_rules(v): def shadowbanned(v): if not (v and v.admin_level > 1): abort(404) users = [x for x in g.db.query(User).filter(User.shadowbanned != None).all()] - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}shadowbanned.html", v=v, users=users) @@ -264,7 +264,7 @@ def shadowbanned(v): def agendaposters(v): if not (v and v.admin_level > 1): abort(404) users = [x for x in g.db.query(User).filter_by(agendaposter = True).all()] - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}agendaposters.html", v=v, users=users) @@ -284,7 +284,7 @@ def image_posts_listing(v): next_exists = (len(posts) > 25) posts = get_posts(posts[:25], v=v) - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}admin/image_posts.html", v=v, listing=posts, next_exists=next_exists, page=page, sort="new") @@ -306,7 +306,7 @@ def reported_posts(v): listing = get_posts(listing, v=v) - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}admin/reported_posts.html", next_exists=next_exists, listing=listing, page=page, v=v) @@ -330,7 +330,7 @@ def reported_comments(v): listing = get_comments(listing, v=v) - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}admin/reported_comments.html", next_exists=next_exists, @@ -344,7 +344,7 @@ def reported_comments(v): def admin_home(v): with open('disablesignups', 'r') as f: x = f.read() - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}admin/admin_home.html", v=v, x=x) @@ -370,7 +370,7 @@ def badge_grant_get(v): "no_user": "That user doesn't exist." } - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}admin/badge_grant.html", v=v, @@ -438,7 +438,7 @@ def users_list(v): next_exists = (len(users) > 25) users = users[:25] - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}admin/new_users.html", v=v, @@ -452,7 +452,7 @@ def users_list(v): def alt_votes_get(v): if not request.values.get("u1") or not request.values.get("u2"): - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}admin/alt_votes.html", v=v) @@ -550,7 +550,7 @@ def alt_votes_get(v): data['u2_only_comment_downs'] // len( u2_comment_downs) if u2_comment_downs else 0 - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}admin/alt_votes.html", u1=u1, @@ -597,7 +597,7 @@ def admin_removed(v): posts = get_posts(ids, v=v) - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}admin/removed_posts.html", v=v, @@ -623,7 +623,7 @@ def admin_removed_comments(v): comments = get_comments(ids, v=v) - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}admin/removed_comments.html", v=v, @@ -1126,7 +1126,7 @@ def admin_dump_cache(v): def admin_banned_domains(v): banned_domains = g.db.query(BannedDomain).all() - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}admin/banned_domains.html", v=v, banned_domains=banned_domains) diff --git a/files/routes/awards.py b/files/routes/awards.py index 1db10fb22d..8e043844e3 100644 --- a/files/routes/awards.py +++ b/files/routes/awards.py @@ -69,7 +69,7 @@ def shop(v): val["price"] = int(val["price"]*discount) sales = g.db.query(Vote.id).count() + g.db.query(CommentVote.id).count() - g.db.query(func.sum(User.coins)).scalar() - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}shop.html", awards=list(AWARDS.values()), v=v, sales=sales) @@ -505,7 +505,7 @@ def award_comment(cid, v): @app.get("/admin/awards") @admin_level_required(2) def admin_userawards_get(v): - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' if v.admin_level != 3: @@ -518,7 +518,7 @@ def admin_userawards_get(v): @admin_level_required(2) @validate_formkey def admin_userawards_post(v): - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' try: u = request.values.get("username").strip() diff --git a/files/routes/comments.py b/files/routes/comments.py index ecd7d447a8..1ecf12668f 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -602,7 +602,7 @@ def api_comment(v): g.db.commit() if request.headers.get("Authorization"): return c.json - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}comments.html", v=v, comments=[c]) @@ -686,7 +686,7 @@ def edit_comment(cid, v): if ban.reason: reason += f" {ban.reason}" if request.headers.get("Authorization"): return {'error': f'A blacklisted domain was used.'}, 400 - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}comment_failed.html", action=f"/edit_comment/{c.id}", diff --git a/files/routes/discord.py b/files/routes/discord.py index 8ae79db89e..bc382fc06c 100644 --- a/files/routes/discord.py +++ b/files/routes/discord.py @@ -98,7 +98,7 @@ def discord_redirect(v): requests.delete(url, headers=headers, timeout=5) if g.db.query(User).filter(User.id!=v.id, User.discord_id==x["id"]).first(): - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}message.html", title="Discord account already linked.", error="That Discord account is already in use by another user.", v=v) diff --git a/files/routes/front.py b/files/routes/front.py index bbe8395ac0..2e18b5b8b8 100644 --- a/files/routes/front.py +++ b/files/routes/front.py @@ -107,7 +107,7 @@ def notifications(v): if request.headers.get("Authorization"): return {"data":[x.json for x in listing]} - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}notifications.html", v=v, @@ -192,7 +192,7 @@ def front_all(v): g.db.commit() if request.headers.get("Authorization"): return {"data": [x.json for x in posts], "next_exists": next_exists} - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}home.html", v=v, listing=posts, next_exists=next_exists, sort=sort, t=t, page=page) @@ -303,7 +303,7 @@ def changelog(v): posts = get_posts(ids, v=v) if request.headers.get("Authorization"): return {"data": [x.json for x in posts], "next_exists": next_exists} - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}changelog.html", v=v, listing=posts, next_exists=next_exists, sort=sort, t=t, page=page) @@ -447,6 +447,6 @@ def all_comments(v): idlist = idlist[:25] if request.headers.get("Authorization"): return {"data": [x.json for x in comments]} - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}home_comments.html", v=v, sort=sort, t=t, page=page, comments=comments, standalone=True, next_exists=next_exists) \ No newline at end of file diff --git a/files/routes/login.py b/files/routes/login.py index 80dd264781..1aecccb900 100644 --- a/files/routes/login.py +++ b/files/routes/login.py @@ -16,7 +16,7 @@ def login_get(v): if v: return redirect(redir) - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}login.html", failed=False, @@ -190,7 +190,7 @@ def sign_up_get(v): ref_user = None if ref_user and (ref_user.id in session.get("history", [])): - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}sign_up_failed_ref.html") @@ -209,7 +209,7 @@ def sign_up_get(v): error = request.values.get("error", None) - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}sign_up.html", formkey=formkey, @@ -459,7 +459,7 @@ def post_reset(v): now = int(time.time()) if now - timestamp > 600: - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}message.html", title="Password reset expired", @@ -473,7 +473,7 @@ def post_reset(v): abort(404) if not password == confirm_password: - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}reset_password.html", v=user, @@ -486,7 +486,7 @@ def post_reset(v): g.db.commit() - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}message_success.html", title="Password reset successful!", diff --git a/files/routes/oauth.py b/files/routes/oauth.py index cf37f208d1..fb29effab4 100644 --- a/files/routes/oauth.py +++ b/files/routes/oauth.py @@ -13,7 +13,7 @@ def authorize_prompt(v): client_id = request.values.get("client_id") application = g.db.query(OauthApp).filter_by(client_id=client_id).first() if not application: return {"oauth_error": "Invalid `client_id`"}, 401 - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}oauth.html", v=v, application=application) @@ -208,7 +208,7 @@ def admin_app_id(v, aid): posts=get_posts(pids, v=v) - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}admin/app.html", v=v, @@ -237,7 +237,7 @@ def admin_app_id_comments(v, aid): comments=get_comments(cids, v=v) - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}admin/app.html", v=v, @@ -254,7 +254,7 @@ def admin_apps_list(v): apps = g.db.query(OauthApp).all() - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}admin/apps.html", v=v, apps=apps) diff --git a/files/routes/posts.py b/files/routes/posts.py index acac27771b..4987fd2a8c 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -81,7 +81,7 @@ def publish(pid, v): @auth_required def submit_get(v): - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}submit.html", v=v) @@ -92,7 +92,7 @@ def submit_get(v): @app.get("/logged_out/post//") @auth_desired def post_id(pid, anything=None, v=None): - if v and v.oldsite: template2 = '' + if not v or v.oldsite: template2 = '' else: template2 = 'CHRISTMAS/' if not v and not request.path.startswith('/logged_out') and not request.headers.get("Authorization"): return redirect(f"/logged_out{request.full_path}") @@ -324,7 +324,7 @@ def viewmore(v, pid, sort, offset): if len(comments) == len(comments2): offset = None comments = comments2 - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}comments.html", v=v, comments=comments, render_replies=True, pid=pid, sort=sort, offset=offset) @@ -371,7 +371,7 @@ def morecomments(v, cid): c = g.db.query(Comment).filter_by(id=cid).first() comments = c.replies - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}comments.html", v=v, comments=comments, render_replies=True) @@ -786,7 +786,7 @@ def submit_post(v): domain_obj = get_domain(domain) if domain_obj: if request.headers.get("Authorization"): return {"error":domain_obj.reason}, 400 - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}submit.html", v=v, error=domain_obj.reason, title=title, url=url, body=request.values.get("body", "")), 400 elif "twitter.com" == domain: @@ -809,13 +809,13 @@ def submit_post(v): if not url and not request.values.get("body") and not request.files.get("file", None): if request.headers.get("Authorization"): return {"error": "`url` or `body` parameter required."}, 400 - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}submit.html", v=v, error="Please enter a url or some text.", title=title, url=url, body=request.values.get("body", "")), 400 if not title: if request.headers.get("Authorization"): return {"error": "Please enter a better title"}, 400 - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}submit.html", v=v, error="Please enter a better title.", title=title, url=url, body=request.values.get("body", "")), 400 @@ -907,14 +907,14 @@ def submit_post(v): if len(str(body)) > 10000: if request.headers.get("Authorization"): return {"error":"10000 character limit for text body."}, 400 - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}submit.html", v=v, error="10000 character limit for text body.", title=title, url=url, body=request.values.get("body", "")), 400 if len(url) > 2048: if request.headers.get("Authorization"): return {"error":"2048 character limit for URLs."}, 400 - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}submit.html", v=v, error="2048 character limit for URLs.", title=title, url=url,body=request.values.get("body", "")), 400 @@ -951,7 +951,7 @@ def submit_post(v): body += f"\n\n{url}" else: if request.headers.get("Authorization"): return {"error": f"Image/Video files only"}, 400 - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}submit.html", v=v, error=f"Image/Video files only."), 400 @@ -972,7 +972,7 @@ def submit_post(v): reason = f"Remove the {ban.domain} link from your post and try again." if ban.reason: reason += f" {ban.reason}" if request.headers.get("Authorization"): return {"error": reason}, 403 - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}submit.html", v=v, error=reason, title=title, url=url, body=request.values.get("body", "")), 403 @@ -1034,7 +1034,7 @@ def submit_post(v): if not file.content_type.startswith(('image/', 'video/')): if request.headers.get("Authorization"): return {"error": f"File type not allowed"}, 400 - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}submit.html", v=v, error=f"File type not allowed.", title=title, body=request.values.get("body", "")), 400 diff --git a/files/routes/search.py b/files/routes/search.py index 0f196602f4..05c79a9025 100644 --- a/files/routes/search.py +++ b/files/routes/search.py @@ -161,7 +161,7 @@ def searchposts(v): domain_obj=None if request.headers.get("Authorization"): return {"total":total, "data":[x.json for x in posts]} - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}search.html", v=v, @@ -253,7 +253,7 @@ def searchcomments(v): comments = get_comments(ids, v=v) if request.headers.get("Authorization"): return {"total":total, "data":[x.json for x in comments]} - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}search_comments.html", v=v, query=query, total=total, page=page, comments=comments, sort=sort, t=t, next_exists=next_exists) @@ -284,6 +284,6 @@ def searchusers(v): if request.headers.get("Authorization"): return [x.json for x in users] - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}search_users.html", v=v, query=query, total=total, page=page, users=users, sort=sort, t=t, next_exists=next_exists) \ No newline at end of file diff --git a/files/routes/settings.py b/files/routes/settings.py index 5cc689a280..c64b658de0 100644 --- a/files/routes/settings.py +++ b/files/routes/settings.py @@ -126,7 +126,7 @@ def settings_profile_post(v): v.bio_html = None g.db.add(v) g.db.commit() - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}settings_profile.html", v=v, msg="Your bio has been updated.") @@ -135,7 +135,7 @@ def settings_profile_post(v): v.sig_html = None g.db.add(v) g.db.commit() - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}settings_profile.html", v=v, msg="Your sig has been updated.") @@ -144,7 +144,7 @@ def settings_profile_post(v): v.friends_html = None g.db.add(v) g.db.commit() - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}settings_profile.html", v=v, msg="Your friends list has been updated.") @@ -153,7 +153,7 @@ def settings_profile_post(v): v.enemies_html = None g.db.add(v) g.db.commit() - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}settings_profile.html", v=v, msg="Your enemies list has been updated.") @@ -177,7 +177,7 @@ def settings_profile_post(v): return {"error": reason}, 401 if len(sig_html) > 1000: - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}settings_profile.html", v=v, @@ -187,7 +187,7 @@ def settings_profile_post(v): v.sig_html=sig_html g.db.add(v) g.db.commit() - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}settings_profile.html", v=v, @@ -213,7 +213,7 @@ def settings_profile_post(v): return {"error": reason}, 401 if len(friends_html) > 2000: - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}settings_profile.html", v=v, @@ -234,7 +234,7 @@ def settings_profile_post(v): v.friends_html=friends_html g.db.add(v) g.db.commit() - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}settings_profile.html", v=v, @@ -258,7 +258,7 @@ def settings_profile_post(v): return {"error": reason}, 401 if len(enemies_html) > 2000: - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}settings_profile.html", v=v, @@ -280,7 +280,7 @@ def settings_profile_post(v): v.enemies_html=enemies_html g.db.add(v) g.db.commit() - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}settings_profile.html", v=v, @@ -307,7 +307,7 @@ def settings_profile_post(v): bio += f"\n\n{url}" else: if request.headers.get("Authorization"): return {"error": f"Image/Video files only"}, 400 - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}settings_profile.html", v=v, error=f"Image/Video files only."), 400 @@ -316,7 +316,7 @@ def settings_profile_post(v): bans = filter_comment_html(bio_html) if len(bio_html) > 10000: - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}settings_profile.html", v=v, @@ -347,7 +347,7 @@ def settings_profile_post(v): v.bio_html=bio_html g.db.add(v) g.db.commit() - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}settings_profile.html", v=v, @@ -445,14 +445,14 @@ def filters(v): filters=request.values.get("filters")[:1000].strip() if filters == v.custom_filter_list: - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}settings_filters.html", v=v, error="You didn't change anything") v.custom_filter_list=filters g.db.add(v) g.db.commit() - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}settings_filters.html", v=v, msg="Your custom filters have been updated.") @@ -474,7 +474,7 @@ def changelogsub(v): @auth_required @validate_formkey def namecolor(v): - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' color = str(request.values.get("color", "")).strip() @@ -490,7 +490,7 @@ def namecolor(v): @auth_required @validate_formkey def themecolor(v): - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' themecolor = str(request.values.get("themecolor", "")).strip() @@ -530,7 +530,7 @@ def gumroad(v): response = requests.get('https://api.gumroad.com/v2/sales', data=data, timeout=5).json()["sales"][0] tier = tiers[response["variants_and_quantity"]] - + if v.patron == tier: return {"error": f"{patron} rewards already claimed"}, 400 existing = g.db.query(User.id).filter_by(email=v.email, is_activated=True, patron=tier).one_or_none() @@ -570,7 +570,7 @@ def gumroad(v): @auth_required @validate_formkey def titlecolor(v): - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' titlecolor = str(request.values.get("titlecolor", "")).strip() @@ -586,7 +586,7 @@ def titlecolor(v): @auth_required @validate_formkey def verifiedcolor(v): - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' verifiedcolor = str(request.values.get("verifiedcolor", "")).strip() @@ -718,7 +718,7 @@ def settings_log_out_others(v): submitted_password = request.values.get("password", "").strip() if not v.verifyPass(submitted_password): - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}settings_security.html", v=v, error="Incorrect Password"), 401 @@ -730,7 +730,7 @@ def settings_log_out_others(v): g.db.commit() - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}settings_security.html", v=v, msg="All other devices have been logged out") @@ -768,7 +768,7 @@ def settings_images_profile(v): g.db.commit() - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}settings_profile.html", v=v, msg="Profile picture successfully updated.") @@ -796,7 +796,7 @@ def settings_images_banner(v): g.db.add(v) g.db.commit() - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}settings_profile.html", v=v, msg="Banner successfully updated.") @@ -812,7 +812,7 @@ def settings_delete_profile(v): g.db.add(v) g.db.commit() - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}settings_profile.html", v=v, msg="Profile picture successfully removed.") @@ -828,7 +828,7 @@ def settings_delete_banner(v): g.db.add(v) g.db.commit() - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}settings_profile.html", v=v, msg="Banner successfully removed.") @@ -837,7 +837,7 @@ def settings_delete_banner(v): @auth_required def settings_blockedpage(v): - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}settings_blocks.html", v=v) @@ -845,7 +845,7 @@ def settings_blockedpage(v): @auth_required def settings_css_get(v): - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}settings_css.html", v=v) @@ -860,7 +860,7 @@ def settings_css(v): g.db.add(v) g.db.commit() - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}settings_css.html", v=v) @@ -869,7 +869,7 @@ def settings_css(v): def settings_profilecss_get(v): if v.truecoins < 1000 and not v.patron and v.admin_level == 0 : return f"You must have +1000 {COINS_NAME} or be a paypig to set profile css." - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}settings_profilecss.html", v=v) @@ -884,7 +884,7 @@ def settings_profilecss(v): g.db.add(v) g.db.commit() - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}settings_profilecss.html", v=v) @@ -954,7 +954,7 @@ def settings_unblock_user(v): @auth_required def settings_apps(v): - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}settings_apps.html", v=v) @@ -978,7 +978,7 @@ def settings_remove_discord(v): @auth_required def settings_content_get(v): - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}settings_filters.html", v=v) @@ -993,14 +993,14 @@ def settings_name_change(v): new_name=request.values.get("name").strip() if new_name==v.username: - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}settings_profile.html", v=v, error="You didn't change anything") if not re.match(valid_username_regex, new_name): - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}settings_profile.html", v=v, @@ -1016,7 +1016,7 @@ def settings_name_change(v): ).first() if x and x.id != v.id: - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}settings_profile.html", v=v, @@ -1054,7 +1054,7 @@ def settings_song_change(v): id = song.split("v=")[1] elif song.startswith("https://youtu.be/"): id = song.split("https://youtu.be/")[1] - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}settings_profile.html", v=v, error=f"Not a youtube link.") @@ -1071,19 +1071,19 @@ def settings_song_change(v): req = requests.get(f"https://www.googleapis.com/youtube/v3/videos?id={id}&key={YOUTUBE_KEY}&part=contentDetails", timeout=5).json() duration = req['items'][0]['contentDetails']['duration'] if duration == 'P0D': - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}settings_profile.html", v=v, error=f"Can't use a live youtube video!") if "H" in duration: - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}settings_profile.html", v=v, error=f"Duration of the video must not exceed 10 minutes.") if "M" in duration: duration = int(duration.split("PT")[1].split("M")[0]) if duration > 10: - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}settings_profile.html", v=v, error=f"Duration of the video must not exceed 10 minutes.") @@ -1105,7 +1105,7 @@ def settings_song_change(v): try: ydl.download([f"https://youtube.com/watch?v={id}"]) except Exception as e: print(e) - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}settings_profile.html", v=v, @@ -1128,7 +1128,7 @@ def settings_song_change(v): @auth_required @validate_formkey def settings_title_change(v): - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' if v.flairchanged: abort(403) diff --git a/files/routes/static.py b/files/routes/static.py index 504a3d6cad..27797366e4 100644 --- a/files/routes/static.py +++ b/files/routes/static.py @@ -16,7 +16,7 @@ site_name = environ.get("SITE_NAME").strip() @auth_desired def emojis(v): emojis = (x.replace('.webp','') for x in os.listdir("files/assets/images/emojis")) - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}emojis.html", v=v, emojis=emojis) @@ -70,7 +70,7 @@ def participation_stats(v): } - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}admin/content_stats.html", v=v, title="Content Statistics", data=data) @@ -161,7 +161,7 @@ def cached_chart(days): def patrons(v): users = g.db.query(User).filter(User.patron > 0).order_by(User.patron.desc(), User.id).all() - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}patrons.html", v=v, users=users) @@ -170,7 +170,7 @@ def patrons(v): @auth_desired def admins(v): admins = g.db.query(User).filter(User.admin_level>0).order_by(User.truecoins.desc()).all() - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}admins.html", v=v, admins=admins) @@ -205,7 +205,7 @@ def log(v): admins = [x[0] for x in g.db.query(User.username).filter(User.admin_level > 1).all()] - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}log.html", v=v, admins=admins, types=types, admin=admin, type=kind, actions=actions, next_exists=next_exists, page=page) @@ -231,7 +231,7 @@ def log_item(id, v): if v and v.admin_level > 1: types = ACTIONTYPES else: types = ACTIONTYPES2 - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}log.html", v=v, actions=[action], next_exists=False, page=1, action=action, admins=admins, types=types) @@ -242,7 +242,7 @@ def favicon(): @app.get("/api") @auth_desired def api(v): - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}api.html", v=v) @@ -252,7 +252,7 @@ def api(v): @auth_required def contact(v): - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}contact.html", v=v) @@ -264,7 +264,7 @@ def submit_contact(v): message = f'This message has been sent automatically to all admins via [/contact](/contact), user email is "{v.email}"\n\nMessage:\n\n' + request.values.get("message", "") send_admin(v.id, message) g.db.commit() - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}contact.html", v=v, msg="Your message has been sent.") @@ -336,7 +336,7 @@ def settings(v): def settings_profile(v): - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}settings_profile.html", v=v) @@ -344,7 +344,7 @@ def settings_profile(v): @app.get("/badges") @auth_desired def badges(v): - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}badges.html", v=v, badges=BADGES) @@ -360,7 +360,7 @@ def blocks(v): users.append(get_account(x.user_id)) targets.append(get_account(x.target_id)) - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}blocks.html", v=v, users=users, targets=targets) @@ -369,7 +369,7 @@ def blocks(v): def banned(v): users = [x for x in g.db.query(User).filter(User.is_banned > 0, User.unban_utc == 0).all()] - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}banned.html", v=v, users=users) @@ -377,7 +377,7 @@ def banned(v): @auth_desired def formatting(v): - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}formatting.html", v=v) @@ -390,7 +390,7 @@ def serviceworker(): def settings_security(v): - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}settings_security.html", v=v, diff --git a/files/routes/users.py b/files/routes/users.py index 9afc5111d4..7d99c4a1c0 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -35,7 +35,7 @@ def upvoters(v, username): users = sorted(users2, key=lambda x: x[1], reverse=True)[:25] - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}voters.html", v=v, users=users, name='Up', name2=f'@{username} biggest simps') @@ -56,7 +56,7 @@ def downvoters(v, username): users = sorted(users2, key=lambda x: x[1], reverse=True)[:25] - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}voters.html", v=v, users=users, name='Down', name2=f'@{username} biggest haters') @@ -77,7 +77,7 @@ def upvoting(v, username): users = sorted(users2, key=lambda x: x[1], reverse=True)[:25] - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}voters.html", v=v, users=users, name='Up', name2=f'Who @{username} simps for') @@ -98,7 +98,7 @@ def downvoting(v, username): users = sorted(users2, key=lambda x: x[1], reverse=True)[:25] - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}voters.html", v=v, users=users, name='Down', name2=f'Who @{username} hates') @@ -162,7 +162,7 @@ def steal(v): @auth_desired def rentoids(v): users = g.db.query(User).filter(User.rent_utc > 0).all() - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}rentoids.html", v=v, users=users) @@ -173,7 +173,7 @@ def thiefs(v): successful = g.db.query(User).filter(User.steal_utc > 0).all() failed = g.db.query(User).filter(User.fail_utc > 0).all() failed2 = g.db.query(User).filter(User.fail2_utc > 0).all() - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}thiefs.html", v=v, successful=successful, failed=failed, failed2=failed2) @@ -287,10 +287,10 @@ def leaderboard(v): if 'pcmemes.net' == request.host: users6 = users.order_by(User.basedcount.desc()).limit(10).all() - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}leaderboard.html", v=v, users1=users1, users2=users2, users3=users3, users4=users4, users5=users5, users6=users6, users7=users7, users9=users9) - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}leaderboard.html", v=v, users1=users1, users2=users2, users3=users3, users4=users4, users5=users5, users7=users7, users9=users9) @@ -453,7 +453,7 @@ def messagereply(v): g.db.commit() - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}comments.html", v=v, comments=[new_comment]) @@ -514,7 +514,7 @@ def followers(username, v): # if 'rdrama.net' in request.host and u.id == 147: abort(404) ids = [x[0] for x in g.db.query(Follow.user_id).filter_by(target_id=u.id).all()] users = g.db.query(User).filter(User.id.in_(ids)).all() - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}followers.html", v=v, u=u, users=users) @@ -525,19 +525,19 @@ def following(username, v): # if 'rdrama.net' in request.host and u.id == 147: abort(404) ids = [x[0] for x in g.db.query(Follow.target_id).filter_by(user_id=u.id).all()] users = g.db.query(User).filter(User.id.in_(ids)).all() - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}following.html", v=v, u=u, users=users) @app.get("/views") @auth_required def visitors(v): - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' if 'rdrama.net' in request.host and v.admin_level < 1 and not v.patron: return render_template(f"{template}errors/patron.html", v=v) viewers=sorted(v.viewers, key = lambda x: x.last_view_utc, reverse=True) - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}viewers.html", v=v, viewers=viewers) @@ -562,7 +562,7 @@ def u_username(username, v=None): if u.reserved: if request.headers.get("Authorization"): return {"error": f"That username is reserved for: {u.reserved}"} - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}userpage_reserved.html", u=u, v=v) @@ -589,26 +589,26 @@ def u_username(username, v=None): if v and u.id == LLM_ID: if int(time.time()) - v.rent_utc > 600: if request.headers.get("Authorization"): return {"error": "That userpage is private"} - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}userpage_private.html", time=int(time.time()), u=u, v=v) else: if request.headers.get("Authorization"): return {"error": "That userpage is private"} - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}userpage_private.html", time=int(time.time()), u=u, v=v) if v and hasattr(u, 'is_blocking') and u.is_blocking: if request.headers.get("Authorization"): return {"error": f"You are blocking @{u.username}."} - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}userpage_blocking.html", u=u, v=v) if v and v.admin_level < 2 and hasattr(u, 'is_blocked') and u.is_blocked: if request.headers.get("Authorization"): return {"error": "This person is blocking you."} - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}userpage_blocked.html", u=u, v=v) @@ -634,7 +634,7 @@ def u_username(username, v=None): if u.unban_utc: if request.headers.get("Authorization"): {"data": [x.json for x in listing]} - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}userpage.html", unban=u.unban_string, @@ -650,7 +650,7 @@ def u_username(username, v=None): if request.headers.get("Authorization"): return {"data": [x.json for x in listing]} - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}userpage.html", u=u, @@ -684,7 +684,7 @@ def u_username_comments(username, v=None): if u.reserved: if request.headers.get("Authorization"): return {"error": f"That username is reserved for: {u.reserved}"} - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}userpage_reserved.html", u=u, @@ -695,24 +695,24 @@ def u_username_comments(username, v=None): if v and u.id == LLM_ID: if int(time.time()) - v.rent_utc > 600: if request.headers.get("Authorization"): return {"error": "That userpage is private"} - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}userpage_private.html", time=int(time.time()), u=u, v=v) else: if request.headers.get("Authorization"): return {"error": "That userpage is private"} - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}userpage_private.html", time=int(time.time()), u=u, v=v) if v and hasattr(u, 'is_blocking') and u.is_blocking: if request.headers.get("Authorization"): return {"error": f"You are blocking @{u.username}."} - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}userpage_blocking.html", u=u, v=v) if v and v.admin_level < 2 and hasattr(u, 'is_blocked') and u.is_blocked: if request.headers.get("Authorization"): return {"error": "This person is blocking you."} - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}userpage_blocked.html", u=u, v=v) @@ -765,7 +765,7 @@ def u_username_comments(username, v=None): is_following = (v and user.has_follower(v)) if request.headers.get("Authorization"): return {"data": [c.json for c in listing]} - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}userpage_comments.html", u=user, v=v, listing=listing, page=page, sort=sort, t=t,next_exists=next_exists, is_following=is_following, standalone=True) @@ -893,7 +893,7 @@ def saved_posts(v, username): listing = get_posts(ids, v=v) if request.headers.get("Authorization"): return {"data": [x.json for x in listing]} - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}userpage.html", u=v, @@ -923,7 +923,7 @@ def saved_comments(v, username): if request.headers.get("Authorization"): return {"data": [x.json for x in listing]} - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}userpage_comments.html", u=v, diff --git a/files/routes/votes.py b/files/routes/votes.py index 3eece91263..42b454dd0d 100644 --- a/files/routes/votes.py +++ b/files/routes/votes.py @@ -15,7 +15,7 @@ defaultcolor = environ.get("DEFAULT_COLOR").strip() @limiter.limit("5/second;60/minute;200/hour") @auth_desired def admin_vote_info_get(v): - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' if v and v.shadowbanned: return render_template('errors/500.html', error=True, v=v), 500 @@ -57,7 +57,7 @@ def admin_vote_info_get(v): else: abort(400) - if v and v.oldsite: template = '' + if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' return render_template(f"{template}votes.html", v=v,