fd
This commit is contained in:
parent
ee7226448e
commit
0c75d5b7c8
10 changed files with 29 additions and 15 deletions
|
@ -196,7 +196,7 @@ def get_awards(v):
|
||||||
return jsonify(return_value)
|
return jsonify(return_value)
|
||||||
|
|
||||||
|
|
||||||
@app.put("/post/<pid>/awards")
|
@app.post("/post/<pid>/awards")
|
||||||
@auth_required
|
@auth_required
|
||||||
@validate_formkey
|
@validate_formkey
|
||||||
def award_post(pid, v):
|
def award_post(pid, v):
|
||||||
|
@ -258,10 +258,11 @@ def award_post(pid, v):
|
||||||
post.author.received_award_count += 1
|
post.author.received_award_count += 1
|
||||||
g.db.add(post.author)
|
g.db.add(post.author)
|
||||||
|
|
||||||
|
g.db.commit()
|
||||||
return {"message": "Award given!"}
|
return {"message": "Award given!"}
|
||||||
|
|
||||||
|
|
||||||
@app.put("/comment/<cid>/awards")
|
@app.post("/comment/<cid>/awards")
|
||||||
@auth_required
|
@auth_required
|
||||||
@validate_formkey
|
@validate_formkey
|
||||||
def award_comment(cid, v):
|
def award_comment(cid, v):
|
||||||
|
@ -322,6 +323,7 @@ def award_comment(cid, v):
|
||||||
c.author.received_award_count += 1
|
c.author.received_award_count += 1
|
||||||
g.db.add(c.author)
|
g.db.add(c.author)
|
||||||
|
|
||||||
|
g.db.commit()
|
||||||
return {"message": "Award given!"}
|
return {"message": "Award given!"}
|
||||||
|
|
||||||
@app.get("/admin/user_award")
|
@app.get("/admin/user_award")
|
||||||
|
|
|
@ -149,4 +149,6 @@ def discord_redirect(v):
|
||||||
|
|
||||||
requests.patch(url, headers=headers, json=data)
|
requests.patch(url, headers=headers, json=data)
|
||||||
|
|
||||||
|
g.db.commit()
|
||||||
|
|
||||||
return redirect(f"https://discord.com/channels/{SERVER_ID}/{WELCOME_CHANNEL}")
|
return redirect(f"https://discord.com/channels/{SERVER_ID}/{WELCOME_CHANNEL}")
|
|
@ -92,6 +92,9 @@ def notifications(v):
|
||||||
if c not in listing:
|
if c not in listing:
|
||||||
listing.append(c)
|
listing.append(c)
|
||||||
|
|
||||||
|
|
||||||
|
g.db.commit()
|
||||||
|
|
||||||
return render_template("notifications.html",
|
return render_template("notifications.html",
|
||||||
v=v,
|
v=v,
|
||||||
notifications=listing,
|
notifications=listing,
|
||||||
|
|
|
@ -154,6 +154,9 @@ def login_post():
|
||||||
# check for previous page
|
# check for previous page
|
||||||
|
|
||||||
redir = request.form.get("redirect", "/").replace("/logged_out", "")
|
redir = request.form.get("redirect", "/").replace("/logged_out", "")
|
||||||
|
|
||||||
|
g.db.commit()
|
||||||
|
|
||||||
return redirect(redir)
|
return redirect(redir)
|
||||||
|
|
||||||
|
|
||||||
|
@ -506,6 +509,8 @@ def post_reset(v):
|
||||||
user.passhash = hash_password(password)
|
user.passhash = hash_password(password)
|
||||||
g.db.add(user)
|
g.db.add(user)
|
||||||
|
|
||||||
|
g.db.commit()
|
||||||
|
|
||||||
return render_template("message_success.html",
|
return render_template("message_success.html",
|
||||||
title="Password reset successful!",
|
title="Password reset successful!",
|
||||||
message="Login normally to access your account.")
|
message="Login normally to access your account.")
|
||||||
|
@ -590,6 +595,8 @@ def reset_2fa():
|
||||||
|
|
||||||
g.db.add(user)
|
g.db.add(user)
|
||||||
|
|
||||||
|
g.db.commit()
|
||||||
|
|
||||||
return render_template("message_success.html",
|
return render_template("message_success.html",
|
||||||
title="Two-factor authentication removed.",
|
title="Two-factor authentication removed.",
|
||||||
message="Login normally to access your account.")
|
message="Login normally to access your account.")
|
||||||
|
|
|
@ -114,10 +114,10 @@ def admin_app_approve(v, aid):
|
||||||
|
|
||||||
g.db.add(new_auth)
|
g.db.add(new_auth)
|
||||||
|
|
||||||
g.db.commit()
|
|
||||||
|
|
||||||
send_notification(NOTIFICATIONS_ACCOUNT, user, f"Your application `{app.app_name}` has been approved. Here's your access token: `{access_token}`\nPlease check the guide [here](/api) if you don't know what to do next.")
|
send_notification(NOTIFICATIONS_ACCOUNT, user, f"Your application `{app.app_name}` has been approved. Here's your access token: `{access_token}`\nPlease check the guide [here](/api) if you don't know what to do next.")
|
||||||
|
|
||||||
|
g.db.commit()
|
||||||
|
|
||||||
return {"message": f"{app.app_name} approved"}
|
return {"message": f"{app.app_name} approved"}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1182,8 +1182,6 @@ def toggle_post_nsfw(pid, v):
|
||||||
)
|
)
|
||||||
g.db.add(ma)
|
g.db.add(ma)
|
||||||
|
|
||||||
g.db.flush()
|
|
||||||
|
|
||||||
g.db.commit()
|
g.db.commit()
|
||||||
|
|
||||||
if post.over_18: return {"message": "Post has been marked as +18!"}
|
if post.over_18: return {"message": "Post has been marked as +18!"}
|
||||||
|
@ -1200,9 +1198,6 @@ def save_post(pid, v):
|
||||||
|
|
||||||
g.db.add(new_save)
|
g.db.add(new_save)
|
||||||
|
|
||||||
try: g.db.flush()
|
|
||||||
except: g.db.rollback()
|
|
||||||
|
|
||||||
g.db.commit()
|
g.db.commit()
|
||||||
|
|
||||||
return {"message": "Post saved!"}
|
return {"message": "Post saved!"}
|
||||||
|
|
|
@ -402,6 +402,8 @@ def settings_security_post(v):
|
||||||
|
|
||||||
g.db.add(v)
|
g.db.add(v)
|
||||||
|
|
||||||
|
g.db.commit()
|
||||||
|
|
||||||
return redirect("/settings/security?msg=" +
|
return redirect("/settings/security?msg=" +
|
||||||
escape("Your password has been changed."))
|
escape("Your password has been changed."))
|
||||||
|
|
||||||
|
@ -456,6 +458,8 @@ def settings_security_post(v):
|
||||||
v.mfa_secret = secret
|
v.mfa_secret = secret
|
||||||
g.db.add(v)
|
g.db.add(v)
|
||||||
|
|
||||||
|
g.db.commit()
|
||||||
|
|
||||||
return redirect("/settings/security?msg=" +
|
return redirect("/settings/security?msg=" +
|
||||||
escape("Two-factor authentication enabled."))
|
escape("Two-factor authentication enabled."))
|
||||||
|
|
||||||
|
@ -561,6 +565,7 @@ def settings_delete_profile(v):
|
||||||
v.highres = None
|
v.highres = None
|
||||||
v.profileurl = None
|
v.profileurl = None
|
||||||
g.db.add(v)
|
g.db.add(v)
|
||||||
|
g.db.commit()
|
||||||
return render_template("settings_profile.html", v=v,
|
return render_template("settings_profile.html", v=v,
|
||||||
msg="Profile picture successfully removed.")
|
msg="Profile picture successfully removed.")
|
||||||
|
|
||||||
|
@ -582,8 +587,6 @@ def settings_delete_banner(v):
|
||||||
def settings_blockedpage(v):
|
def settings_blockedpage(v):
|
||||||
|
|
||||||
|
|
||||||
#users=[x.target for x in v.blocked]
|
|
||||||
|
|
||||||
return render_template("settings_blocks.html",
|
return render_template("settings_blocks.html",
|
||||||
v=v)
|
v=v)
|
||||||
|
|
||||||
|
|
|
@ -53,6 +53,7 @@ def steal(v):
|
||||||
g.db.add(u)
|
g.db.add(u)
|
||||||
send_notification(NOTIFICATIONS_ACCOUNT, u, f"Some [grubby little rentoid](/@{v.username}) has absconded with 700 of your hard-earned dramacoins to fuel his Funko Pop addiction. Stop being so trusting.")
|
send_notification(NOTIFICATIONS_ACCOUNT, u, f"Some [grubby little rentoid](/@{v.username}) has absconded with 700 of your hard-earned dramacoins to fuel his Funko Pop addiction. Stop being so trusting.")
|
||||||
send_notification(NOTIFICATIONS_ACCOUNT, v, f"You have successfully shorted your heroic landlord 700 dramacoins in rent. You're slightly less materially poor, but somehow even moreso morally. Are you proud of yourself?")
|
send_notification(NOTIFICATIONS_ACCOUNT, v, f"You have successfully shorted your heroic landlord 700 dramacoins in rent. You're slightly less materially poor, but somehow even moreso morally. Are you proud of yourself?")
|
||||||
|
g.db.commit()
|
||||||
return {"message": "Attempt successful!"}
|
return {"message": "Attempt successful!"}
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
@ -397,6 +398,7 @@ def u_username(username, v=None):
|
||||||
viewer_id = v.id)
|
viewer_id = v.id)
|
||||||
|
|
||||||
g.db.add(view)
|
g.db.add(view)
|
||||||
|
g.db.commit()
|
||||||
|
|
||||||
|
|
||||||
if u.is_private and (not v or (v.id != u.id and v.admin_level < 3)):
|
if u.is_private and (not v or (v.id != u.id and v.admin_level < 3)):
|
||||||
|
|
|
@ -126,7 +126,7 @@
|
||||||
f.append("note", this.note)
|
f.append("note", this.note)
|
||||||
|
|
||||||
let response = await fetch(target, {
|
let response = await fetch(target, {
|
||||||
method: "PUT",
|
method: "POST",
|
||||||
body: f
|
body: f
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue