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