diff --git a/files/routes/admin.py b/files/routes/admin.py
index f86f22b87..85d59703e 100644
--- a/files/routes/admin.py
+++ b/files/routes/admin.py
@@ -27,8 +27,25 @@ if SITE_NAME == 'PCM': cc = "splash mountain"
else: cc = "country club"
month = datetime.now().strftime('%B')
-@app.get("/admin/grassed")
+
+
+@app.post("/admin/sex")
@admin_level_required(3)
+def sex(v):
+ data = {'access_token': GUMROAD_TOKEN}
+
+ emails = [x['email'] for x in requests.get(f'https://api.gumroad.com/v2/products/{GUMROAD_ID}/subscribers', data=data, timeout=5).json()["subscribers"]]
+
+ for u in g.db.query(User).filter(User.patron > 0).all():
+ if u.email.lower() not in emails:
+ print(u.username)
+
+ return "sex"
+
+
+
+@app.get("/admin/grassed")
+@admin_level_required(2)
def grassed(v):
users = g.db.query(User).filter(User.ban_reason.like('grass award used by @%')).all()
@@ -159,7 +176,7 @@ def club_ban(v, username):
@admin_level_required(2)
@validate_formkey
def make_meme_admin(v, username):
- if 'pcm' in request.host or (SITE_NAME == 'Drama' and v.admin_level > 2) or ('rama' not in request.host and 'pcm' not in request.host):
+ if request.host == 'pcmemes.net' or (SITE_NAME == 'Drama' and v.admin_level > 2) or (request.host != 'rdrama.net' and request.host != 'pcmemes.net'):
user = get_user(username)
if not user: abort(404)
user.admin_level = 1
@@ -173,7 +190,7 @@ def make_meme_admin(v, username):
@admin_level_required(2)
@validate_formkey
def remove_meme_admin(v, username):
- if 'pcm' in request.host or (SITE_NAME == 'Drama' and v.admin_level > 2) or ('rama' not in request.host and 'pcm' not in request.host):
+ if request.host == 'pcmemes.net' or (SITE_NAME == 'Drama' and v.admin_level > 2) or (request.host != 'rdrama.net' and request.host != 'pcmemes.net'):
user = get_user(username)
if not user: abort(404)
user.admin_level = 0
@@ -187,34 +204,27 @@ def remove_meme_admin(v, username):
@admin_level_required(3)
@validate_formkey
def monthly(v):
- if 'pcm' in request.host or (SITE_NAME == 'Drama' and v.admin_level > 2) or ('rama' not in request.host and 'pcm' not in request.host):
- thing = g.db.query(AwardRelationship).order_by(AwardRelationship.id.desc()).first().id
+ if request.host == 'rdrama.net' and v.id != 1: abort (403)
- data = {'access_token': GUMROAD_TOKEN}
+ thing = g.db.query(AwardRelationship).order_by(AwardRelationship.id.desc()).first().id
- response = [x['email'] for x in requests.get(f'https://api.gumroad.com/v2/products/{GUMROAD_ID}/subscribers', data=data, timeout=5).json()["subscribers"]]
- emails = []
+ data = {'access_token': GUMROAD_TOKEN}
- for email in response:
- if email.endswith("@gmail.com"):
- email=email.split('@')[0]
- email=email.split('+')[0]
- email=email.replace('.','').replace('_','')
- email=f"{email}@gmail.com"
- emails.append(email.lower())
+ emails = [x['email'] for x in requests.get(f'https://api.gumroad.com/v2/products/{GUMROAD_ID}/subscribers', data=data, timeout=5).json()["subscribers"]]
- for u in g.db.query(User).filter(User.patron > 0).all():
- if u.patron == 5 or u.email and u.email.lower() in emails or u.id == 1379:
- if u.patron == 1: procoins = 2500
- elif u.patron == 2: procoins = 5000
- elif u.patron == 3: procoins = 10000
- elif u.patron == 4: procoins = 25000
- elif u.patron == 5: procoins = 50000
- else: print(u.username)
- u.procoins += procoins
- g.db.add(u)
- send_repeatable_notification(u.id, f"You were given {procoins} Marseybux for the month of {month}! You can use them to buy awards in the [shop](/shop).")
- g.db.commit()
+ for u in g.db.query(User).filter(User.patron > 0).all():
+ if u.patron == 5 or u.email and u.email.lower() in emails or u.id == 1379:
+ if u.patron == 1: procoins = 2500
+ elif u.patron == 2: procoins = 5000
+ elif u.patron == 3: procoins = 10000
+ elif u.patron == 4: procoins = 25000
+ elif u.patron == 5: procoins = 50000
+ else: print(u.username)
+ u.procoins += procoins
+ g.db.add(u)
+ send_repeatable_notification(u.id, f"You were given {procoins} Marseybux for the month of {month}! You can use them to buy awards in the [shop](/shop).")
+ g.db.commit()
+
return {"message": "Monthly coins granted"}
diff --git a/files/routes/comments.py b/files/routes/comments.py
index cf066f666..77414d537 100644
--- a/files/routes/comments.py
+++ b/files/routes/comments.py
@@ -55,7 +55,7 @@ def post_pid_comment_cid(cid, pid=None, anything=None, v=None):
if not pid:
if comment.parent_submission: pid = comment.parent_submission
- elif "rama" in request.host: pid = 6489
+ elif request.host == "rdrama.net": pid = 6489
elif 'pcmemes.net' == request.host: pid = 2487
else: pid = 1
@@ -340,7 +340,7 @@ def api_comment(v):
g.db.add(n)
- if "rama" in request.host and "ivermectin" in c.body.lower():
+ if request.host == "rdrama.net" and "ivermectin" in c.body.lower():
c.is_banned = True
c.ban_reason = "AutoJanny"
@@ -414,7 +414,7 @@ def api_comment(v):
c.upvotes += 1
g.db.add(c)
- if "rama" in request.host and len(c.body) >= 1000 and "<" not in body and "" not in body_html:
+ if request.host == "rdrama.net" and len(c.body) >= 1000 and "<" not in body and "" not in body_html:
body = random.choice(LONGPOST_REPLIES)
body_md = CustomRenderer().render(mistletoe.Document(body))
@@ -449,7 +449,7 @@ def api_comment(v):
- if "rama" in request.host and random.random() < 0.001:
+ if request.host == "rdrama.net" and random.random() < 0.001:
body = "zoz"
body_md = CustomRenderer().render(mistletoe.Document(body))
@@ -713,7 +713,7 @@ def edit_comment(cid, v):
c.body = body[:10000]
c.body_html = body_html
- if "rama" in request.host and "ivermectin" in c.body_html.lower():
+ if request.host == "rdrama.net" and "ivermectin" in c.body_html.lower():
c.is_banned = True
c.ban_reason = "AutoJanny"
diff --git a/files/routes/login.py b/files/routes/login.py
index 827c3c2cc..f5a3f1b2b 100644
--- a/files/routes/login.py
+++ b/files/routes/login.py
@@ -273,12 +273,6 @@ def sign_up_post(v):
email = request.values.get("email").strip().lower()
- if email.endswith("@gmail.com"):
- email=email.split('@')[0]
- email=email.split('+')[0]
- email=email.replace('.','').replace('_','')
- email=f"{email}@gmail.com"
-
if not email: email = None
existing_account = get_user(username, graceful=True)
@@ -352,23 +346,12 @@ def get_forgot():
def post_forgot():
username = request.values.get("username").lstrip('@')
- email = request.values.get("email",'').strip().lower()
-
- email=email.replace("_","\_")
+ email = request.values.get("email",'').strip().lower().replace("_","\_")
user = g.db.query(User).filter(
User.username.ilike(username),
User.email.ilike(email)).first()
- if not user and email.endswith("@gmail.com"):
- email=email.split('@')[0]
- email=email.split('+')[0]
- email=email.replace('.','').replace('_','')
- email=f"{email}@gmail.com"
- user = g.db.query(User).filter(
- User.username.ilike(username),
- User.email.ilike(email)).first()
-
if user:
now = int(time.time())
token = generate_hash(f"{user.id}+{now}+forgot+{user.login_nonce}")
@@ -494,16 +477,6 @@ def request_2fa_disable():
email=request.values.get("email").strip().lower()
- if email != user.email and email.endswith("@gmail.com"):
- email=email.split('@')[0]
- email=email.split('+')[0]
- email=email.replace('.','').replace('_','')
- email=f"{email}@gmail.com"
- if email != user.email:
- return render_template(f"message.html",
- title="Removal request received",
- message="If username, password, and email match, we will send you an email.")
-
password =request.values.get("password")
if not user.verifyPass(password):
diff --git a/files/routes/posts.py b/files/routes/posts.py
index 09f8be979..4b6380d92 100644
--- a/files/routes/posts.py
+++ b/files/routes/posts.py
@@ -491,7 +491,7 @@ def edit_post(pid, v):
p.body_html = body_html
- if "rama" in request.host and "ivermectin" in body_html.lower():
+ if request.host == "rdrama.net" and "ivermectin" in body_html.lower():
p.is_banned = True
p.ban_reason = "AutoJanny"
@@ -1054,7 +1054,7 @@ def submit_post(v):
add_notif(cid, user.id)
- if "rama" in request.host and "ivermectin" in new_post.body_html.lower():
+ if request.host == "rdrama.net" and "ivermectin" in new_post.body_html.lower():
new_post.is_banned = True
new_post.ban_reason = "AutoJanny"
diff --git a/files/routes/settings.py b/files/routes/settings.py
index f59822572..5166cfe4c 100644
--- a/files/routes/settings.py
+++ b/files/routes/settings.py
@@ -493,24 +493,13 @@ def gumroad(v):
if not (v.email and v.is_activated): return {"error": f"You must have a verified email to verify {patron} status and claim your rewards"}, 400
- data = {'access_token': GUMROAD_TOKEN,}
+ data = {'access_token': GUMROAD_TOKEN, 'email': v.email}
+ response = requests.get('https://api.gumroad.com/v2/sales', data=data).json()["sales"]
- response = [x['email'] for x in requests.get(f'https://api.gumroad.com/v2/products/{GUMROAD_ID}/subscribers', data=data, timeout=5).json()["subscribers"]]
- emails = []
+ if len(response) == 0: return {"error": "Email not found"}, 404
- for email in response:
- if email.endswith("@gmail.com"):
- email=email.split('@')[0]
- email=email.split('+')[0]
- email=email.replace('.','').replace('_','')
- email=f"{email}@gmail.com"
- emails.append(email.lower())
-
- if v.email.lower() not in emails: return {"error": "Email not found"}, 404
-
- response = requests.get('https://api.gumroad.com/v2/sales', data=data, timeout=5).json()["sales"][0]
+ response = response[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()
@@ -610,12 +599,6 @@ def settings_security_post(v):
new_email = request.values.get("new_email","").strip().lower()
- if new_email.endswith("@gmail.com"):
- new_email=new_email.split('@')[0]
- new_email=new_email.split('+')[0]
- new_email=new_email.replace('.','').replace('_','')
- new_email=f"{new_email}@gmail.com"
-
if new_email == v.email:
return render_template("settings_security.html", v=v, error="That email is already yours!")
diff --git a/files/templates/CHRISTMAS/admin/awards.html b/files/templates/CHRISTMAS/admin/awards.html
index 8cfeba731..3ed992536 100644
--- a/files/templates/CHRISTMAS/admin/awards.html
+++ b/files/templates/CHRISTMAS/admin/awards.html
@@ -31,7 +31,7 @@
Give awards
- {% if 'rdrama.net' not in request.host or v.admin_level > 2 %}
+ {% if request.host != 'rdrama.net' or v.admin_level > 2 %}