diff --git a/env b/env index 60295303f..8f7c33d1f 100644 --- a/env +++ b/env @@ -18,9 +18,6 @@ SPAM_SIMILAR_COUNT_THRESHOLD=10 COMMENT_SPAM_SIMILAR_THRESHOLD=0.5 COMMENT_SPAM_COUNT_THRESHOLD=10 DEFAULT_TIME_FILTER=all -GUMROAD_TOKEN=blahblahblah -GUMROAD_LINK=https://marsey1.gumroad.com/l/tfcvri -GUMROAD_ID=tfcvri CARD_VIEW=0 DISABLE_DOWNVOTES=0 DUES=10 diff --git a/files/__main__.py b/files/__main__.py index 762f0de8d..17a0868f2 100644 --- a/files/__main__.py +++ b/files/__main__.py @@ -27,7 +27,6 @@ faulthandler.enable() app.config["SITE_ID"]=environ.get("SITE_ID").strip() app.config["SITE_TITLE"]=environ.get("SITE_TITLE").strip() -app.config["GUMROAD_LINK"]=environ.get("GUMROAD_LINK", "https://marsey1.gumroad.com/l/tfcvri").strip() app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False app.config['DATABASE_URL'] = environ.get("DATABASE_URL", "postgresql://postgres@localhost:5432") app.config['SECRET_KEY'] = environ.get('MASTER_KEY') diff --git a/files/routes/admin.py b/files/routes/admin.py index 50ca1ea9d..25b521bb2 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -18,9 +18,6 @@ from datetime import datetime import requests from urllib.parse import quote, urlencode -GUMROAD_ID = environ.get("GUMROAD_ID", "tfcvri").strip() -GUMROAD_TOKEN = environ.get("GUMROAD_TOKEN", "").strip() - month = datetime.now().strftime('%B') @@ -411,38 +408,6 @@ def remove_meme_admin(v, username): return {"message": "Meme admin removed!"} -@app.post("/admin/monthly") -@limiter.limit("1/day") -@admin_level_required(3) -def monthly(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, User.patron_utc == 0).all(): - if u.patron > 4 or u.email and u.email.lower() in emails: - procoins = procoins_li[u.patron] - u.procoins += procoins - g.db.add(u) - send_repeatable_notification(u.id, f"@{v.username} has given you {procoins} Marseybux for the month of {month}! You can use them to buy awards in the [shop](/shop).") - elif u.patron == 1 and u.admin_level > 0: - procoins = 2500 - u.procoins += procoins - g.db.add(u) - send_repeatable_notification(u.id, f"@{v.username} has given you {procoins} Marseybux for the month of {month}! You can use them to buy awards in the [shop](/shop).") - else: print(u.username) - - ma = ModAction( - kind="monthly", - user_id=v.id - ) - g.db.add(ma) - - g.db.commit() - - return {"message": "Monthly coins granted"} - - @app.get("/admin/shadowbanned") @auth_required def shadowbanned(v): diff --git a/files/routes/settings.py b/files/routes/settings.py index b7b39ca0e..e58ab31f8 100644 --- a/files/routes/settings.py +++ b/files/routes/settings.py @@ -13,9 +13,6 @@ from files.helpers.discord import add_role from shutil import copyfile import requests -GUMROAD_TOKEN = environ.get("GUMROAD_TOKEN", "").strip() -GUMROAD_ID = environ.get("GUMROAD_ID", "tfcvri").strip() - tiers={ "(Paypig)": 1, "(Renthog)": 2, @@ -366,48 +363,6 @@ def themecolor(v): g.db.commit() return redirect("/settings/profile") -@app.post("/settings/gumroad") -@limiter.limit("1/second;30/minute;200/hour;1000/day") -@auth_required -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, 'email': v.email} - response = requests.get('https://api.gumroad.com/v2/sales', data=data, timeout=5).json()["sales"] - - if len(response) == 0: return {"error": "Email not found"}, 404 - - response = response[0] - tier = tiers[response["variants_and_quantity"]] - if v.patron == tier: return {"error": f"{patron} rewards already claimed"}, 400 - - procoins = procoins_li[tier] - procoins_li[v.patron] - if procoins < 0: return {"error": f"{patron} rewards already claimed"}, 400 - - existing = g.db.query(User.id).filter(User.email == v.email, User.is_activated == True, User.patron >= tier).one_or_none() - if existing: return {"error": f"{patron} rewards already claimed on another account"}, 400 - - v.patron = tier - if v.discord_id: add_role(v, f"{tier}") - - v.procoins += procoins - send_repeatable_notification(v.id, f"You have received {procoins} Marseybux! You can use them to buy awards in the [shop](/shop).") - - if v.patron > 1 and v.verified == None: v.verified = "Verified" - - g.db.add(v) - - if not v.has_badge(20+tier): - new_badge = Badge(badge_id=20+tier, user_id=v.id) - g.db.add(new_badge) - g.db.flush() - send_notification(v.id, f"@AutoJanny has given you the following profile badge:\n\n\n\n{new_badge.name}") - - g.db.commit() - - return {"message": f"{patron} rewards claimed!"} - @app.post("/settings/titlecolor") @limiter.limit("1/second;30/minute;200/hour;1000/day") @auth_required diff --git a/files/templates/admin/awards.html b/files/templates/admin/awards.html index fd685336f..38cfb3a29 100644 --- a/files/templates/admin/awards.html +++ b/files/templates/admin/awards.html @@ -63,5 +63,4 @@
- {% endblock %} diff --git a/files/templates/errors/patron.html b/files/templates/errors/patron.html index 5198f8d21..6cd95cec2 100644 --- a/files/templates/errors/patron.html +++ b/files/templates/errors/patron.html @@ -13,7 +13,6 @@This page is only available to patrons:
- {{config('GUMROAD_LINK')}}