From 3d7737387c20340aad3d9d08505c22a486cde8b1 Mon Sep 17 00:00:00 2001 From: justcool393 Date: Tue, 15 Nov 2022 10:55:00 -0600 Subject: [PATCH] use default config vlaue const everywhere --- files/helpers/alerts.py | 2 +- files/helpers/const.py | 4 ++-- files/helpers/mail.py | 2 +- files/routes/comments.py | 2 +- files/routes/jinja2.py | 3 ++- files/routes/login.py | 2 +- files/routes/users.py | 4 ++-- files/templates/header.html | 4 ++-- files/templates/home.html | 2 +- files/templates/sign_up.html | 4 ++-- 10 files changed, 15 insertions(+), 14 deletions(-) diff --git a/files/helpers/alerts.py b/files/helpers/alerts.py index ee76ce7a1..4b238ff6e 100644 --- a/files/helpers/alerts.py +++ b/files/helpers/alerts.py @@ -103,7 +103,7 @@ def NOTIFY_USERS(text, v): return notify_users - bots -if PUSHER_ID != 'blahblahblah': +if PUSHER_ID != DEFAULT_CONFIG_VALUE: beams_client = PushNotifications(instance_id=PUSHER_ID, secret_key=PUSHER_KEY) def pusher_thread(interests, title, notifbody, url): diff --git a/files/helpers/const.py b/files/helpers/const.py index 2faa81c6e..b2c3be74f 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -455,8 +455,8 @@ LEADERBOARD_LIMIT = PAGE_SIZE HOUSE_JOIN_COST = 500 HOUSE_SWITCH_COST = 2000 -DONATE_SERVICE = "Gumroad" if not KOFI_TOKEN or KOFI_TOKEN == 'blahblahblah' else "KoFi" -DONATE_LINK = GUMROAD_LINK if not KOFI_TOKEN or KOFI_TOKEN == 'blahblahblah' else KOFI_LINK +DONATE_SERVICE = "Gumroad" if not KOFI_TOKEN or KOFI_TOKEN == DEFAULT_CONFIG_VALUE else "KoFi" +DONATE_LINK = GUMROAD_LINK if not KOFI_TOKEN or KOFI_TOKEN == DEFAULT_CONFIG_VALUE else KOFI_LINK TIERS_ID_TO_NAME = { 1: "Paypig", diff --git a/files/helpers/mail.py b/files/helpers/mail.py index ceaa11144..9b7531068 100644 --- a/files/helpers/mail.py +++ b/files/helpers/mail.py @@ -9,7 +9,7 @@ from urllib.parse import quote from flask import render_template def send_mail(to_address, subject, html): - if MAILGUN_KEY == 'blahblahblah': return + if MAILGUN_KEY == DEFAULT_CONFIG_VALUE: return url = f"https://api.mailgun.net/v3/{SITE}/messages" auth = ("api", MAILGUN_KEY) data = {"from": EMAIL, diff --git a/files/routes/comments.py b/files/routes/comments.py index 30208a5b6..6d54822dc 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -316,7 +316,7 @@ def comment(v): n = Notification(comment_id=c.id, user_id=x) g.db.add(n) - if parent.author.id != v.id and PUSHER_ID != 'blahblahblah' and not v.shadowbanned: + if parent.author.id != v.id and PUSHER_ID != DEFAULT_CONFIG_VALUE and not v.shadowbanned: interests = f'{SITE}{parent.author.id}' title = f'New reply by @{c.author_name}' diff --git a/files/routes/jinja2.py b/files/routes/jinja2.py index e1ab668c3..392544362 100644 --- a/files/routes/jinja2.py +++ b/files/routes/jinja2.py @@ -64,5 +64,6 @@ def inject_constants(): "DONATE_LINK":DONATE_LINK, "DONATE_SERVICE":DONATE_SERVICE, "BAN_EVASION_DOMAIN":BAN_EVASION_DOMAIN, "HOUSE_JOIN_COST":HOUSE_JOIN_COST, "HOUSE_SWITCH_COST":HOUSE_SWITCH_COST, "IMAGE_FORMATS":IMAGE_FORMATS, "PAGE_SIZES":PAGE_SIZES, "THEMES":THEMES, "COMMENT_SORTS":COMMENT_SORTS, "SORTS":SORTS, - "TIME_FILTERS":TIME_FILTERS, "HOUSES":HOUSES, "TIERS_ID_TO_NAME":TIERS_ID_TO_NAME, + "TIME_FILTERS":TIME_FILTERS, "HOUSES":HOUSES, "TIERS_ID_TO_NAME":TIERS_ID_TO_NAME, + "DEFAULT_CONFIG_VALUE":DEFAULT_CONFIG_VALUE } diff --git a/files/routes/login.py b/files/routes/login.py index da62949fe..c9ed6f87d 100644 --- a/files/routes/login.py +++ b/files/routes/login.py @@ -252,7 +252,7 @@ def sign_up_post(v): if existing_account: return signup_error("An account with that username already exists.") - if TURNSTILE_SITEKEY != 'blahblahblah': + if TURNSTILE_SITEKEY != DEFAULT_CONFIG_VALUE: token = request.values.get("cf-turnstile-response") if not token: return signup_error("Unable to verify captcha [1].") diff --git a/files/routes/users.py b/files/routes/users.py index b43245ad5..3425d86b1 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -461,7 +461,7 @@ def message2(v, username): g.db.add(notif) - if PUSHER_ID != 'blahblahblah' and not v.shadowbanned: + if PUSHER_ID != DEFAULT_CONFIG_VALUE and not v.shadowbanned: interests = f'{SITE}{user.id}' title = f'New message from @{username}' @@ -534,7 +534,7 @@ def messagereply(v): notif = Notification(comment_id=c.id, user_id=user_id) g.db.add(notif) - if PUSHER_ID != 'blahblahblah' and not v.shadowbanned: + if PUSHER_ID != DEFAULT_CONFIG_VALUE and not v.shadowbanned: interests = f'{SITE}{user_id}' title = f'New message from @{v.username}' diff --git a/files/templates/header.html b/files/templates/header.html index b8ace4593..16789a31d 100644 --- a/files/templates/header.html +++ b/files/templates/header.html @@ -254,7 +254,7 @@ Bugs/Suggestions - {% if TELEGRAM_LINK != 'blahblahblah' %} + {% if TELEGRAM_LINK != DEFAULT_CONFIG_VALUE %} Telegram Channel {% endif %} @@ -321,7 +321,7 @@ Bugs/Suggestions - {% if TELEGRAM_LINK != 'blahblahblah' %} + {% if TELEGRAM_LINK != DEFAULT_CONFIG_VALUE %} Telegram Channel {% endif %} diff --git a/files/templates/home.html b/files/templates/home.html index 326ef3cd7..6e3458774 100644 --- a/files/templates/home.html +++ b/files/templates/home.html @@ -173,7 +173,7 @@ {% endif %} -{% if request.path == '/' and PUSHER_ID != 'blahblahblah' and v %} +{% if request.path == '/' and PUSHER_ID != DEFAULT_CONFIG_VALUE and v %}
{{SITE}}{{v.id}}
{{PUSHER_ID}}
diff --git a/files/templates/sign_up.html b/files/templates/sign_up.html index b53b64555..17d2cc43e 100644 --- a/files/templates/sign_up.html +++ b/files/templates/sign_up.html @@ -100,7 +100,7 @@ - {% if turnstile != 'blahblahblah' %} + {% if turnstile != DEFAULT_CONFIG_VALUE %}
{% endif %} @@ -130,7 +130,7 @@ -{% if turnstile != 'blahblahblah' %} +{% if turnstile != DEFAULT_CONFIG_VALUE %} {% endif %}