Remove remaining gumroad stuff

This commit is contained in:
Julian Rota 2022-08-21 19:14:16 -04:00 committed by Ben Rog-Wilhelm
parent b94ca993da
commit 2d03dd1984
6 changed files with 0 additions and 86 deletions

3
env
View file

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

View file

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

View file

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

View file

@ -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![]({new_badge.path})\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

View file

@ -63,5 +63,4 @@
</form>
<pre></pre>
<div><a class="btn btn-danger" role="button" onclick="post_toast(this,'/admin/monthly')">Grant Monthly Marseybux</a></div>
{% endblock %}

View file

@ -13,7 +13,6 @@
<h1>401</h1>
<h5>Not Authorized</h5>
<p class="text-muted">This page is only available to patrons:</p>
<a rel="nofollow noopener noreferrer" href="{{config('GUMROAD_LINK')}}">{{config('GUMROAD_LINK')}}</a>
</div>
</div>
</div>