forked from MarseyWorld/MarseyWorld
fdfd
parent
ac42193546
commit
89423077ef
|
@ -31,7 +31,7 @@ app.wsgi_app = ProxyFix(app.wsgi_app, x_for=3)
|
||||||
app.url_map.strict_slashes = False
|
app.url_map.strict_slashes = False
|
||||||
|
|
||||||
app.config["SITE_NAME"]=environ.get("SITE_NAME").strip()
|
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['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
|
||||||
app.config['DATABASE_URL'] = environ.get("DATABASE_CONNECTION_POOL_URL",environ.get("DATABASE_URL"))
|
app.config['DATABASE_URL'] = environ.get("DATABASE_CONNECTION_POOL_URL",environ.get("DATABASE_URL"))
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ from files.classes.images import *
|
||||||
|
|
||||||
CF_KEY = environ.get("CLOUDFLARE_KEY").strip()
|
CF_KEY = environ.get("CLOUDFLARE_KEY").strip()
|
||||||
CF_ZONE = environ.get("CLOUDFLARE_ZONE").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):
|
def upload_file(file=None, resize=False, png=False):
|
||||||
|
@ -35,7 +35,7 @@ def upload_file(file=None, resize=False, png=False):
|
||||||
try:
|
try:
|
||||||
with open(filedir, 'rb') as f:
|
with open(filedir, 'rb') as f:
|
||||||
data={'image': base64.b64encode(f.read())}
|
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']
|
resp = req.json()['data']
|
||||||
url = resp['link'].replace(".png", "_d.png").replace(".jpg", "_d.jpg").replace(".jpeg", "_d.jpeg") + "?maxwidth=9999"
|
url = resp['link'].replace(".png", "_d.png").replace(".jpg", "_d.jpg").replace(".jpeg", "_d.jpeg") + "?maxwidth=9999"
|
||||||
except: return
|
except: return
|
||||||
|
|
|
@ -443,7 +443,7 @@ def admin_image_purge(v):
|
||||||
name = request.form.get("url")
|
name = request.form.get("url")
|
||||||
image = g.db.query(Image).filter(Image.text == name).first()
|
image = g.db.query(Image).filter(Image.text == name).first()
|
||||||
if image:
|
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"}
|
headers = {"Authorization": f"Bearer {CF_KEY}", "Content-Type": "application/json"}
|
||||||
data = {'files': [name]}
|
data = {'files': [name]}
|
||||||
url = f"https://api.cloudflare.com/client/v4/zones/{CF_ZONE}/purge_cache"
|
url = f"https://api.cloudflare.com/client/v4/zones/{CF_ZONE}/purge_cache"
|
||||||
|
|
|
@ -7,7 +7,7 @@ SERVER_ID = environ.get("DISCORD_SERVER_ID",'').strip()
|
||||||
CLIENT_ID = environ.get("DISCORD_CLIENT_ID",'').strip()
|
CLIENT_ID = environ.get("DISCORD_CLIENT_ID",'').strip()
|
||||||
CLIENT_SECRET = environ.get("DISCORD_CLIENT_SECRET",'').strip()
|
CLIENT_SECRET = environ.get("DISCORD_CLIENT_SECRET",'').strip()
|
||||||
BOT_TOKEN = environ.get("DISCORD_BOT_TOKEN").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"
|
DISCORD_ENDPOINT = "https://discordapp.com/api/v6"
|
||||||
WELCOME_CHANNEL="846509313941700618"
|
WELCOME_CHANNEL="846509313941700618"
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ WELCOME_CHANNEL="846509313941700618"
|
||||||
def join_discord(v):
|
def join_discord(v):
|
||||||
|
|
||||||
if v.is_banned != 0: return "You're banned"
|
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())
|
now=int(time.time())
|
||||||
|
|
||||||
|
|
|
@ -13,8 +13,8 @@ valid_username_regex = re.compile("^[a-zA-Z0-9_\-]{3,25}$")
|
||||||
valid_title_regex = re.compile("^((?!<).){3,100}$")
|
valid_title_regex = re.compile("^((?!<).){3,100}$")
|
||||||
valid_password_regex = re.compile("^.{8,100}$")
|
valid_password_regex = re.compile("^.{8,100}$")
|
||||||
|
|
||||||
youtubekey = environ.get("YOUTUBE_KEY").strip()
|
YOUTUBE_KEY = environ.get("YOUTUBE_KEY").strip()
|
||||||
coins_name = environ.get("COINS_NAME").strip()
|
COINS_NAME = environ.get("COINS_NAME").strip()
|
||||||
|
|
||||||
@app.post("/settings/profile")
|
@app.post("/settings/profile")
|
||||||
@auth_required
|
@auth_required
|
||||||
|
@ -426,13 +426,13 @@ def settings_css(v):
|
||||||
@auth_required
|
@auth_required
|
||||||
def settings_profilecss_get(v):
|
def settings_profilecss_get(v):
|
||||||
if v and v.is_banned and not v.unban_utc: return render_template("seized.html")
|
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)
|
return render_template("settings_profilecss.html", v=v)
|
||||||
|
|
||||||
@app.post("/settings/profilecss")
|
@app.post("/settings/profilecss")
|
||||||
@auth_required
|
@auth_required
|
||||||
def settings_profilecss(v):
|
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]
|
profilecss = request.form.get("profilecss").replace('\\', '')[:50000]
|
||||||
v.profilecss = profilecss
|
v.profilecss = profilecss
|
||||||
g.db.add(v)
|
g.db.add(v)
|
||||||
|
@ -614,7 +614,7 @@ def settings_song_change(v):
|
||||||
return redirect("/settings/profile")
|
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']
|
try: duration = req['items'][0]['contentDetails']['duration']
|
||||||
except:
|
except:
|
||||||
print(req)
|
print(req)
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<pre class="d-none d-md-inline-block"></pre>
|
<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>
|
<pre></pre>
|
||||||
<table class="table table-striped mb-5">
|
<table class="table table-striped mb-5">
|
||||||
<thead class="bg-primary text-white">
|
<thead class="bg-primary text-white">
|
||||||
|
|
|
@ -328,7 +328,7 @@
|
||||||
<label class="custom-control-label" for="animatedname"></label>
|
<label class="custom-control-label" for="animatedname"></label>
|
||||||
</div>
|
</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>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
</span>
|
</span>
|
||||||
<h2 class="h5">This account is private</h2>
|
<h2 class="h5">This account is private</h2>
|
||||||
<p class="text-muted">This user has enabled private mode to cloak their posting history.</p>
|
<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>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue