fd
This commit is contained in:
parent
5cafe16f4b
commit
f0f8624fff
7 changed files with 35 additions and 31 deletions
|
@ -76,7 +76,7 @@ class ModAction(Base, Stndrd, Age_times):
|
|||
return f'<a href="{self.target_comment.permalink}">comment</a>'
|
||||
|
||||
else:
|
||||
return ''
|
||||
return ""
|
||||
|
||||
@property
|
||||
def json(self):
|
||||
|
|
|
@ -29,7 +29,7 @@ def make_admin(v, username):
|
|||
if not user: abort(404)
|
||||
user.admin_level = 6
|
||||
g.db.add(user)
|
||||
return "", 204
|
||||
return {"message": "User has been made admin!"}
|
||||
|
||||
|
||||
@app.post("/@<username>/make_fake_admin")
|
||||
|
@ -39,7 +39,7 @@ def make_fake_admin(v, username):
|
|||
if not user: abort(404)
|
||||
user.admin_level = 1
|
||||
g.db.add(user)
|
||||
return "", 204
|
||||
return {"message": "User has been made fake admin!"}
|
||||
|
||||
|
||||
@app.post("/@<username>/remove_admin")
|
||||
|
@ -49,7 +49,7 @@ def remove_admin(v, username):
|
|||
if not user: abort(404)
|
||||
user.admin_level = 0
|
||||
g.db.add(user)
|
||||
return "", 204
|
||||
return {"message": "Admin removed!"}
|
||||
|
||||
|
||||
@app.get("/admin/shadowbanned")
|
||||
|
@ -197,11 +197,12 @@ def monthly(v):
|
|||
@validate_formkey
|
||||
def disablesignups(v):
|
||||
with open('./disablesignups', 'r+') as f:
|
||||
if f.read() == "yes": f.write("no")
|
||||
else: f.write("yes")
|
||||
|
||||
return "", 204
|
||||
|
||||
if f.read() == "yes":
|
||||
f.write("no")
|
||||
return {"message": "Signups enabed!"}
|
||||
else:
|
||||
f.write("yes")
|
||||
return {"message": "Signups disabled!"}
|
||||
|
||||
@app.get("/admin/badge_grant")
|
||||
@admin_level_required(4)
|
||||
|
@ -633,7 +634,7 @@ def shadowban(user_id, v):
|
|||
|
||||
cache.delete_memoized(frontlist)
|
||||
|
||||
return "", 204
|
||||
return {"message": "User shadowbanned!"}
|
||||
|
||||
|
||||
@app.post("/unshadowban/<user_id>")
|
||||
|
@ -657,7 +658,7 @@ def unshadowban(user_id, v):
|
|||
|
||||
cache.delete_memoized(frontlist)
|
||||
|
||||
return "", 204
|
||||
return {"message": "User unshadowbanned!"}
|
||||
|
||||
@app.post("/admin/verify/<user_id>")
|
||||
@admin_level_required(6)
|
||||
|
@ -666,7 +667,7 @@ def verify(user_id, v):
|
|||
user = g.db.query(User).filter_by(id=user_id).first()
|
||||
user.verified = "Verified"
|
||||
g.db.add(user)
|
||||
return "", 204
|
||||
return {"message": "User verfied!"}
|
||||
|
||||
@app.post("/admin/unverify/<user_id>")
|
||||
@admin_level_required(6)
|
||||
|
@ -675,7 +676,7 @@ def unverify(user_id, v):
|
|||
user = g.db.query(User).filter_by(id=user_id).first()
|
||||
user.verified = None
|
||||
g.db.add(user)
|
||||
return "", 204
|
||||
return {"message": "User unverified!"}
|
||||
|
||||
|
||||
@app.post("/admin/title_change/<user_id>")
|
||||
|
@ -844,7 +845,7 @@ def ban_post(post_id, v):
|
|||
|
||||
cache.delete_memoized(frontlist)
|
||||
|
||||
return "", 204
|
||||
return {"message": "Post removed!"}
|
||||
|
||||
|
||||
@app.post("/unban_post/<post_id>")
|
||||
|
@ -872,7 +873,7 @@ def unban_post(post_id, v):
|
|||
|
||||
cache.delete_memoized(frontlist)
|
||||
|
||||
return "", 204
|
||||
return {"message": "Post approved!"}
|
||||
|
||||
|
||||
@app.post("/distinguish/<post_id>")
|
||||
|
@ -895,7 +896,7 @@ def api_distinguish_post(post_id, v):
|
|||
|
||||
g.db.add(post)
|
||||
|
||||
return "", 204
|
||||
return {"message": "Post distinguished!"}
|
||||
|
||||
|
||||
@app.post("/sticky/<post_id>")
|
||||
|
@ -916,7 +917,9 @@ def api_sticky_post(post_id, v):
|
|||
|
||||
cache.delete_memoized(frontlist)
|
||||
|
||||
return "", 204
|
||||
g.db.flush()
|
||||
if post.stickied: return {"message": "Post pinned!"}
|
||||
else: return {"message": "Post unpinned!"}
|
||||
|
||||
@app.post("/pin/<post_id>")
|
||||
@auth_required
|
||||
|
@ -926,8 +929,10 @@ def api_pin_post(post_id, v):
|
|||
if post:
|
||||
post.is_pinned = not (post.is_pinned)
|
||||
g.db.add(post)
|
||||
g.db.flush()
|
||||
|
||||
return "", 204
|
||||
if post.is_pinned: return {"message": "Post pinned!"}
|
||||
else: return {"message": "Post unpinned!"}
|
||||
|
||||
@app.post("/ban_comment/<c_id>")
|
||||
@admin_level_required(1)
|
||||
|
@ -947,7 +952,7 @@ def api_ban_comment(c_id, v):
|
|||
target_comment_id=comment.id,
|
||||
)
|
||||
g.db.add(ma)
|
||||
return "", 204
|
||||
return {"message": "Comment removed!"}
|
||||
|
||||
|
||||
@app.post("/unban_comment/<c_id>")
|
||||
|
@ -971,7 +976,7 @@ def api_unban_comment(c_id, v):
|
|||
comment.is_approved = v.id
|
||||
|
||||
|
||||
return "", 204
|
||||
return {"message": "Comment approved!"}
|
||||
|
||||
|
||||
@app.post("/distinguish_comment/<c_id>")
|
||||
|
|
|
@ -79,8 +79,7 @@ def shop(v):
|
|||
def buy(v, award):
|
||||
if award not in AWARDS: abort(400)
|
||||
price = AWARDS[award]["price"]
|
||||
print(price)
|
||||
if v.coins < price: return render_template("shop.html", v=v, error="You don't have enough coins to buy this item.")
|
||||
if v.coins < price: return {"error": "Not enough coins!"}, 400
|
||||
v.coins -= price
|
||||
g.db.add(v)
|
||||
|
||||
|
@ -90,7 +89,7 @@ def buy(v, award):
|
|||
award = AwardRelationship(id=thing, user_id=v.id, kind=award)
|
||||
g.db.add(award)
|
||||
|
||||
return "", 204
|
||||
return {"message": "Award bought!"}
|
||||
|
||||
|
||||
def banaward_trigger(post=None, comment=None):
|
||||
|
@ -195,7 +194,7 @@ def award_post(pid, v):
|
|||
post.author.received_award_count += 1
|
||||
g.db.add(post.author)
|
||||
|
||||
return "", 204
|
||||
return {"message": "Award given!"}
|
||||
|
||||
|
||||
@app.put("/comment/<cid>/awards")
|
||||
|
@ -259,7 +258,7 @@ def award_comment(cid, v):
|
|||
c.author.received_award_count += 1
|
||||
g.db.add(c.author)
|
||||
|
||||
return "", 204
|
||||
return {"message": "Award given!"}
|
||||
|
||||
@app.get("/admin/user_award")
|
||||
@auth_required
|
||||
|
|
|
@ -828,7 +828,7 @@ def delete_comment(cid, v):
|
|||
cache.delete_memoized(comment_idlist)
|
||||
cache.delete_memoized(User.commentlisting, v)
|
||||
|
||||
return "", 204
|
||||
return {"message": "Comment deleted!"}
|
||||
|
||||
@app.post("/undelete/comment/<cid>")
|
||||
@auth_required
|
||||
|
@ -850,7 +850,7 @@ def undelete_comment(cid, v):
|
|||
cache.delete_memoized(comment_idlist)
|
||||
cache.delete_memoized(User.commentlisting, v)
|
||||
|
||||
return "", 204
|
||||
return {"message": "Comment undeleted!"}
|
||||
|
||||
|
||||
@app.post("/comment_pin/<cid>")
|
||||
|
|
|
@ -167,7 +167,7 @@ def get_profilecss(username):
|
|||
@app.get("/songs/<id>")
|
||||
def songs(id):
|
||||
try: id = int(id)
|
||||
except: return '', 400
|
||||
except: return "", 400
|
||||
user = g.db.query(User).filter_by(id=id).first()
|
||||
return redirect(f"/song/{user.song}.mp3")
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<i class="fad fa-trash-alt text-muted" style="font-size: 3.5rem;"></i>
|
||||
</div>
|
||||
|
||||
<p>Your comment will be removed everywhere on {{'SITE_NAME' | app_config}}. This action cannot be undone.</p>
|
||||
<p>Your comment will be removed everywhere on {{'SITE_NAME' | app_config}}. This action can be undone.</p>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
|
|
|
@ -22,9 +22,9 @@
|
|||
|
||||
<div class="h4 d-md-none">Delete post?</div>
|
||||
|
||||
<p class="d-none d-md-block">Your post will be removed everywhere on {{'SITE_NAME' | app_config}}.</p>
|
||||
<p class="d-none d-md-block">Your post will be removed everywhere on {{'SITE_NAME' | app_config}}. This action can be undone.</p>
|
||||
|
||||
<p class="text-muted d-md-none">Your post will be removed everywhere on {{'SITE_NAME' | app_config}}.</p>
|
||||
<p class="text-muted d-md-none">Your post will be removed everywhere on {{'SITE_NAME' | app_config}}. This action can be undone.</p>
|
||||
|
||||
<div class="d-md-none">
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue