forked from MarseyWorld/MarseyWorld
sneed
parent
efa9bdd8ee
commit
9a45091f2a
File diff suppressed because it is too large
Load Diff
|
@ -35,6 +35,7 @@ class User(Base, Stndrd, Age_times):
|
|||
css = deferred(Column(String, default=None))
|
||||
profilecss = deferred(Column(String, default=None))
|
||||
passhash = deferred(Column(String, default=None))
|
||||
banawards = Column(Integer, default=0)
|
||||
created_utc = Column(Integer, default=0)
|
||||
admin_level = Column(Integer, default=0)
|
||||
resized = Column(Boolean, default=True)
|
||||
|
|
|
@ -421,7 +421,7 @@ def thumbs(new_post):
|
|||
for chunk in image_req.iter_content(1024):
|
||||
file.write(chunk)
|
||||
|
||||
post.thumburl = upload_from_file(name, tempname, resize=(50, 50))
|
||||
post.thumburl = upload_from_file(name, tempname, resize=(100, 100))
|
||||
if post.thumburl: post.has_thumb = True
|
||||
g.db.add(post)
|
||||
g.db.commit()
|
||||
|
@ -1062,7 +1062,7 @@ def delete_post_pid(pid, v):
|
|||
file.write(chunk)
|
||||
|
||||
u.profileurl = upload_from_file("resizing", "resizing", (50, 50))
|
||||
u.resized = true
|
||||
u.resized = True
|
||||
g.db.add(u)
|
||||
print(f"2 {u.profileurl}")
|
||||
|
||||
|
|
|
@ -17,6 +17,32 @@ beams_client = PushNotifications(
|
|||
secret_key=PUSHER_KEY,
|
||||
)
|
||||
|
||||
@app.route("/banaward/<user_id>", methods=["POST"])
|
||||
@auth_required
|
||||
def ban_user(user_id, v):
|
||||
|
||||
if v.banawards != 1 and v.banawards != 2: abort(403)
|
||||
user = g.db.query(User).filter_by(id=user_id).first()
|
||||
if not user: abort(400)
|
||||
if user.admin_level > 0: abort(403)
|
||||
|
||||
user.ban(admin=v, reason="1 day ban award", days=1)
|
||||
|
||||
send_notification(1046, user, f"Your Drama account has been suspended for 1 day for the following reason:\n\n> 1 day ban award")
|
||||
|
||||
ma=ModAction(
|
||||
kind="exile_user",
|
||||
user_id=v.id,
|
||||
target_user_id=user.id,
|
||||
board_id=1,
|
||||
note=f'reason: "1 day ban award", duration: 1 day'
|
||||
)
|
||||
g.db.add(ma)
|
||||
|
||||
user.banawards -= 1
|
||||
g.db.add(user)
|
||||
return "", 204
|
||||
|
||||
@app.route("/api/v1/user/<username>", methods=["GET"])
|
||||
@auth_desired
|
||||
@api("read")
|
||||
|
@ -40,7 +66,7 @@ def leaderboard(v):
|
|||
file.write(chunk)
|
||||
|
||||
u.profileurl = upload_from_file("resizing", "resizing", (50, 50))
|
||||
u.resized = true
|
||||
u.resized = True
|
||||
g.db.add(u)
|
||||
print(f"2 {u.profileurl}")
|
||||
|
||||
|
|
Loading…
Reference in New Issue