master
Aevann1 2021-08-05 16:43:54 +02:00
parent ac42193546
commit 89423077ef
8 changed files with 14 additions and 14 deletions

View File

@ -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"))

View File

@ -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

View File

@ -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"

View File

@ -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())

View File

@ -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)

View File

@ -4,7 +4,7 @@
{% block content %}
<pre class="d-none d-md-inline-block"></pre>
<h5 style="font-weight:bold;text-align: center;">Top 25 by {{"coins_name" | app_config}}</h5>
<h5 style="font-weight:bold;text-align: center;">Top 25 by {{"COINS_NAME" | app_config}}</h5>
<pre></pre>
<table class="table table-striped mb-5">
<thead class="bg-primary text-white">

View File

@ -328,7 +328,7 @@
<label class="custom-control-label" for="animatedname"></label>
</div>
<span class="text-small-extra text-muted">Enable animated username (only available to users in the {{"coins_name" | app_config}} leaderboard and patrons)</span>
<span class="text-small-extra text-muted">Enable animated username (only available to users in the {{"COINS_NAME" | app_config}} leaderboard and patrons)</span>
</div>
</div>

View File

@ -11,7 +11,7 @@
</span>
<h2 class="h5">This account is private</h2>
<p class="text-muted">This user has enabled private mode to cloak their posting history.</p>
<!-- {% if u.id == 253 %}<a class="btn btn-primary" href="/@Landlord_Messiah/?rent=true">Pay Rent to View (500 {{"coins_name" | app_config}})</a>{% endif %} -->
<!-- {% if u.id == 253 %}<a class="btn btn-primary" href="/@Landlord_Messiah/?rent=true">Pay Rent to View (500 {{"COINS_NAME" | app_config}})</a>{% endif %} -->
</div>
</div>
</div>