From 89423077efb517002112a93c52166d325b62c1a3 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Thu, 5 Aug 2021 16:43:54 +0200 Subject: [PATCH] fdfd --- files/__main__.py | 2 +- files/helpers/images.py | 4 ++-- files/routes/admin.py | 2 +- files/routes/discord.py | 4 ++-- files/routes/settings.py | 10 +++++----- files/templates/leaderboard.html | 2 +- files/templates/settings_profile.html | 2 +- files/templates/userpage_private.html | 2 +- 8 files changed, 14 insertions(+), 14 deletions(-) diff --git a/files/__main__.py b/files/__main__.py index eb3386420..e66533913 100644 --- a/files/__main__.py +++ b/files/__main__.py @@ -31,7 +31,7 @@ app.wsgi_app = ProxyFix(app.wsgi_app, x_for=3) app.url_map.strict_slashes = False app.config["SITE_NAME"]=environ.get("SITE_NAME").strip() -app.config["coins_name"]=environ.get("COINS_NAME").strip() +app.config["COINS_NAME"]=environ.get("COINS_NAME").strip() app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False app.config['DATABASE_URL'] = environ.get("DATABASE_CONNECTION_POOL_URL",environ.get("DATABASE_URL")) diff --git a/files/helpers/images.py b/files/helpers/images.py index e68265d65..759947636 100644 --- a/files/helpers/images.py +++ b/files/helpers/images.py @@ -6,7 +6,7 @@ from files.classes.images import * CF_KEY = environ.get("CLOUDFLARE_KEY").strip() CF_ZONE = environ.get("CLOUDFLARE_ZONE").strip() -imgurkey = environ.get("IMGUR_KEY").strip() +IMGUR_KEY = environ.get("IMGUR_KEY").strip() def upload_file(file=None, resize=False, png=False): @@ -35,7 +35,7 @@ def upload_file(file=None, resize=False, png=False): try: with open(filedir, 'rb') as f: data={'image': base64.b64encode(f.read())} - req = requests.post('https://api.imgur.com/3/upload.json', headers = {"Authorization": f"Client-ID {imgurkey}"}, data=data) + req = requests.post('https://api.imgur.com/3/upload.json', headers = {"Authorization": f"Client-ID {IMGUR_KEY}"}, data=data) resp = req.json()['data'] url = resp['link'].replace(".png", "_d.png").replace(".jpg", "_d.jpg").replace(".jpeg", "_d.jpeg") + "?maxwidth=9999" except: return diff --git a/files/routes/admin.py b/files/routes/admin.py index 1d657296f..21e6cdd22 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -443,7 +443,7 @@ def admin_image_purge(v): name = request.form.get("url") image = g.db.query(Image).filter(Image.text == name).first() if image: - requests.delete(f'https://api.imgur.com/3/image/{image.deletehash}', headers = {"Authorization": f"Client-ID {imgurkey}"}) + requests.delete(f'https://api.imgur.com/3/image/{image.deletehash}', headers = {"Authorization": f"Client-ID {IMGUR_KEY}"}) headers = {"Authorization": f"Bearer {CF_KEY}", "Content-Type": "application/json"} data = {'files': [name]} url = f"https://api.cloudflare.com/client/v4/zones/{CF_ZONE}/purge_cache" diff --git a/files/routes/discord.py b/files/routes/discord.py index 3e2f0582d..6e29b5fc7 100644 --- a/files/routes/discord.py +++ b/files/routes/discord.py @@ -7,7 +7,7 @@ SERVER_ID = environ.get("DISCORD_SERVER_ID",'').strip() CLIENT_ID = environ.get("DISCORD_CLIENT_ID",'').strip() CLIENT_SECRET = environ.get("DISCORD_CLIENT_SECRET",'').strip() BOT_TOKEN = environ.get("DISCORD_BOT_TOKEN").strip() -coins_name = environ.get("COINS_NAME").strip() +COINS_NAME = environ.get("COINS_NAME").strip() DISCORD_ENDPOINT = "https://discordapp.com/api/v6" WELCOME_CHANNEL="846509313941700618" @@ -16,7 +16,7 @@ WELCOME_CHANNEL="846509313941700618" def join_discord(v): if v.is_banned != 0: return "You're banned" - if v.admin_level == 0 and v.coins < 150: return f"You must earn 150 {coins_name} before entering the Discord server. You earn {coins_name} by making posts/comments and getting upvoted." + if v.admin_level == 0 and v.coins < 150: return f"You must earn 150 {COINS_NAME} before entering the Discord server. You earn {COINS_NAME} by making posts/comments and getting upvoted." now=int(time.time()) diff --git a/files/routes/settings.py b/files/routes/settings.py index 8fbf9127d..b9436d6ae 100644 --- a/files/routes/settings.py +++ b/files/routes/settings.py @@ -13,8 +13,8 @@ valid_username_regex = re.compile("^[a-zA-Z0-9_\-]{3,25}$") valid_title_regex = re.compile("^((?!<).){3,100}$") valid_password_regex = re.compile("^.{8,100}$") -youtubekey = environ.get("YOUTUBE_KEY").strip() -coins_name = environ.get("COINS_NAME").strip() +YOUTUBE_KEY = environ.get("YOUTUBE_KEY").strip() +COINS_NAME = environ.get("COINS_NAME").strip() @app.post("/settings/profile") @auth_required @@ -426,13 +426,13 @@ def settings_css(v): @auth_required def settings_profilecss_get(v): if v and v.is_banned and not v.unban_utc: return render_template("seized.html") - if v.coins < 1000 and not v.patron: return f"You must have +1000 {coins_name} or be a patron to set profile css." + if v.coins < 1000 and not v.patron: return f"You must have +1000 {COINS_NAME} or be a patron to set profile css." return render_template("settings_profilecss.html", v=v) @app.post("/settings/profilecss") @auth_required def settings_profilecss(v): - if v.coins < 1000 and not v.patron: return f"You must have +1000 {coins_name} or be a patron to set profile css." + if v.coins < 1000 and not v.patron: return f"You must have +1000 {COINS_NAME} or be a patron to set profile css." profilecss = request.form.get("profilecss").replace('\\', '')[:50000] v.profilecss = profilecss g.db.add(v) @@ -614,7 +614,7 @@ def settings_song_change(v): return redirect("/settings/profile") - req = requests.get(f"https://www.googleapis.com/youtube/v3/videos?id={id}&key={youtubekey}&part=contentDetails").json() + req = requests.get(f"https://www.googleapis.com/youtube/v3/videos?id={id}&key={YOUTUBE_KEY}&part=contentDetails").json() try: duration = req['items'][0]['contentDetails']['duration'] except: print(req) diff --git a/files/templates/leaderboard.html b/files/templates/leaderboard.html index 118220455..91fbc3fa3 100644 --- a/files/templates/leaderboard.html +++ b/files/templates/leaderboard.html @@ -4,7 +4,7 @@ {% block content %}

-
Top 25 by {{"coins_name" | app_config}}
+
Top 25 by {{"COINS_NAME" | app_config}}

 
diff --git a/files/templates/settings_profile.html b/files/templates/settings_profile.html
index 267e94eda..427af0934 100644
--- a/files/templates/settings_profile.html
+++ b/files/templates/settings_profile.html
@@ -328,7 +328,7 @@
 										
 
-									Enable animated username (only available to users in the {{"coins_name" | app_config}} leaderboard and patrons)
+									Enable animated username (only available to users in the {{"COINS_NAME" | app_config}} leaderboard and patrons)
diff --git a/files/templates/userpage_private.html b/files/templates/userpage_private.html
index 446480e84..6988b9252 100644
--- a/files/templates/userpage_private.html
+++ b/files/templates/userpage_private.html
@@ -11,7 +11,7 @@
 			

This account is private

This user has enabled private mode to cloak their posting history.

- +