forked from rDrama/rDrama
fdfd
parent
7417d74999
commit
7ab9e9bbe7
|
@ -205,7 +205,7 @@ def themecolor(v):
|
||||||
g.db.add(v)
|
g.db.add(v)
|
||||||
return redirect("/settings/profile")
|
return redirect("/settings/profile")
|
||||||
|
|
||||||
@app.get("/settings/gumroad")
|
@app.post("/settings/gumroad")
|
||||||
@auth_required
|
@auth_required
|
||||||
@validate_formkey
|
@validate_formkey
|
||||||
def gumroad(v):
|
def gumroad(v):
|
||||||
|
@ -221,16 +221,13 @@ def gumroad(v):
|
||||||
response = requests.get('https://api.gumroad.com/v2/sales', data=data).json()["sales"]
|
response = requests.get('https://api.gumroad.com/v2/sales', data=data).json()["sales"]
|
||||||
|
|
||||||
if len(response) == 0:
|
if len(response) == 0:
|
||||||
return render_template("settings_profile.html",
|
return jsonify({"error": "Email not found"})
|
||||||
v=v,
|
|
||||||
error="Email not found")
|
|
||||||
|
|
||||||
response = response[0]
|
response = response[0]
|
||||||
tier = tiers[response["variants_and_quantity"]]
|
tier = tiers[response["variants_and_quantity"]]
|
||||||
if v.patron == tier:
|
if v.patron == tier:
|
||||||
return render_template("settings_profile.html",
|
return jsonify({"error": "Patron rewards already claimed"})
|
||||||
v=v,
|
|
||||||
error="Patron status already verified")
|
|
||||||
v.patron = tier
|
v.patron = tier
|
||||||
|
|
||||||
grant_awards = {}
|
grant_awards = {}
|
||||||
|
@ -267,9 +264,7 @@ def gumroad(v):
|
||||||
g.db.bulk_save_objects(_awards)
|
g.db.bulk_save_objects(_awards)
|
||||||
|
|
||||||
g.db.add(v)
|
g.db.add(v)
|
||||||
return render_template("settings_profile.html",
|
return jsonify({"message": "Patron rewards claimed"})
|
||||||
v=v,
|
|
||||||
msg="Patron status verified!")
|
|
||||||
|
|
||||||
@app.post("/settings/titlecolor")
|
@app.post("/settings/titlecolor")
|
||||||
@auth_required
|
@auth_required
|
||||||
|
|
|
@ -138,7 +138,7 @@
|
||||||
<div class="footer">
|
<div class="footer">
|
||||||
|
|
||||||
<div class="d-flex">
|
<div class="d-flex">
|
||||||
<a class="btn btn-success" href="/settings/gumroad">Claim patron rewards</a>
|
<a class="btn btn-success" href="javascript:void(0)" onclick="post_toast('/settings/gumroad')">Claim patron rewards</a>
|
||||||
{% if v.email %}
|
{% if v.email %}
|
||||||
<input class="btn btn-primary ml-auto"
|
<input class="btn btn-primary ml-auto"
|
||||||
type="submit" value="Update email">
|
type="submit" value="Update email">
|
||||||
|
|
Loading…
Reference in New Issue