forked from MarseyWorld/MarseyWorld
fdfd
parent
0bb69d079e
commit
5f97e8b3a9
|
@ -17,7 +17,7 @@ from drama.classes.domains import reasons as REASONS
|
|||
from flask import *
|
||||
import matplotlib.pyplot as plt
|
||||
from drama.__main__ import app, cache
|
||||
|
||||
from .front import frontlist
|
||||
|
||||
@app.get("/admin/shadowbanned")
|
||||
@auth_required
|
||||
|
@ -588,6 +588,8 @@ def shadowban(user_id, v):
|
|||
)
|
||||
g.db.add(ma)
|
||||
|
||||
cache.delete_memoized(frontlist)
|
||||
|
||||
return "", 204
|
||||
|
||||
|
||||
|
@ -610,6 +612,8 @@ def unshadowban(user_id, v):
|
|||
)
|
||||
g.db.add(ma)
|
||||
|
||||
cache.delete_memoized(frontlist)
|
||||
|
||||
return "", 204
|
||||
|
||||
|
||||
|
@ -730,7 +734,7 @@ def unban_user(user_id, v):
|
|||
)
|
||||
g.db.add(ma)
|
||||
g.db.commit()
|
||||
|
||||
|
||||
if request.args.get("notoast"): return (redirect(user.url), user)
|
||||
return jsonify({"message": f"@{user.username} was unbanned"})
|
||||
|
||||
|
@ -767,6 +771,9 @@ def ban_post(post_id, v):
|
|||
target_submission_id=post.id,
|
||||
)
|
||||
g.db.add(ma)
|
||||
|
||||
cache.delete_memoized(frontlist)
|
||||
|
||||
return "", 204
|
||||
|
||||
|
||||
|
@ -793,7 +800,7 @@ def unban_post(post_id, v):
|
|||
|
||||
g.db.add(post)
|
||||
|
||||
|
||||
cache.delete_memoized(frontlist)
|
||||
|
||||
return "", 204
|
||||
|
||||
|
@ -831,6 +838,7 @@ def api_sticky_post(post_id, v):
|
|||
g.db.add(post)
|
||||
g.db.commit()
|
||||
|
||||
cache.delete_memoized(frontlist)
|
||||
|
||||
return "", 204
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ from flask import *
|
|||
from io import BytesIO
|
||||
from drama.__main__ import app, limiter, cache
|
||||
from PIL import Image as PILimage
|
||||
from .front import frontlist
|
||||
|
||||
with open("snappy.txt", "r") as f:
|
||||
snappyquotes = f.read().split("{[para]}")
|
||||
|
@ -60,7 +61,8 @@ def publish(pid, v):
|
|||
post.private = False
|
||||
g.db.add(post)
|
||||
|
||||
g.db.commit()
|
||||
cache.delete_memoized(frontlist)
|
||||
|
||||
return "", 204
|
||||
|
||||
@app.get("/submit")
|
||||
|
@ -1029,6 +1031,9 @@ def submit_post(v):
|
|||
|
||||
v.post_count = v.submissions.filter_by(is_banned=False, deleted_utc=0).count()
|
||||
g.db.add(v)
|
||||
|
||||
cache.delete_memoized(frontlist)
|
||||
|
||||
return {"html": lambda: redirect(new_post.permalink),
|
||||
"api": lambda: jsonify(new_post.json)
|
||||
}
|
||||
|
@ -1051,7 +1056,7 @@ def delete_post_pid(pid, v):
|
|||
|
||||
g.db.add(post)
|
||||
|
||||
|
||||
cache.delete_memoized(frontlist)
|
||||
|
||||
return "", 204
|
||||
|
||||
|
@ -1065,7 +1070,9 @@ def undelete_post_pid(pid, v):
|
|||
if not post.author_id == v.id: abort(403)
|
||||
post.deleted_utc =0
|
||||
g.db.add(post)
|
||||
|
||||
|
||||
cache.delete_memoized(frontlist)
|
||||
|
||||
return "", 204
|
||||
|
||||
@app.get("/embed/post/<pid>")
|
||||
|
|
|
@ -7,6 +7,7 @@ from drama.helpers.discord import remove_user, set_nick
|
|||
from drama.mail import *
|
||||
from drama.__main__ import app, cache
|
||||
import youtube_dl
|
||||
from .front import frontlist
|
||||
|
||||
valid_username_regex = re.compile("^[a-zA-Z0-9_\-]{3,25}$")
|
||||
valid_title_regex = re.compile("^((?!<).){3,100}$")
|
||||
|
@ -158,7 +159,9 @@ def settings_profile_post(v):
|
|||
def changelogsub(v):
|
||||
v.changelogsub = not v.changelogsub
|
||||
g.db.add(v)
|
||||
|
||||
|
||||
cache.delete_memoized(frontlist)
|
||||
|
||||
return "", 204
|
||||
|
||||
@app.post("/settings/namecolor")
|
||||
|
@ -470,6 +473,8 @@ def settings_block_user(v):
|
|||
|
||||
if v.admin_level == 1: return jsonify({"message": f"@{user.username} banned!"})
|
||||
|
||||
cache.delete_memoized(frontlist)
|
||||
|
||||
return jsonify({"message": f"@{user.username} blocked."})
|
||||
|
||||
|
||||
|
@ -495,6 +500,8 @@ def settings_unblock_user(v):
|
|||
|
||||
if v.admin_level == 1: return jsonify({"message": f"@{user.username} unbanned!"})
|
||||
|
||||
cache.delete_memoized(frontlist)
|
||||
|
||||
return jsonify({"message": f"@{user.username} unblocked."})
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue