diff --git a/files/classes/comment.py b/files/classes/comment.py index 1a285b789..c29933214 100644 --- a/files/classes/comment.py +++ b/files/classes/comment.py @@ -330,7 +330,7 @@ class Comment(Base): body = body.replace(url, f"{url_noquery}?{urlencode(p, True)}") if v and v.shadowbanned and v.id == self.author_id and 86400 > time.time() - self.created_utc > 60: - ti = int(time.time() - self.created_utc)/60 + ti = int((time.time() - self.created_utc)/60) maxupvotes = min(ti, 31) rand = randint(1, maxupvotes) if self.upvotes < rand: diff --git a/files/classes/submission.py b/files/classes/submission.py index 2fb2efced..3c9ae0a1b 100644 --- a/files/classes/submission.py +++ b/files/classes/submission.py @@ -334,7 +334,7 @@ class Submission(Base): if v.nitter: body = body.replace("www.twitter.com", "nitter.net").replace("twitter.com", "nitter.net") if v and v.shadowbanned and v.id == self.author_id and 86400 > time.time() - self.created_utc > 20: - ti = int(time.time() - self.created_utc)/60 + ti = int((time.time() - self.created_utc)/60) maxupvotes = min(ti, 27) rand = random.randint(1, maxupvotes) if self.upvotes < rand: diff --git a/files/routes/static.py b/files/routes/static.py index 3ee79c3f1..8b69a887d 100644 --- a/files/routes/static.py +++ b/files/routes/static.py @@ -7,6 +7,7 @@ from sqlalchemy import func from os import path import calendar import matplotlib.pyplot as plt +from files.classes.mod_logs import ACTIONTYPES site = environ.get("DOMAIN").strip() site_name = environ.get("SITE_NAME").strip() @@ -177,7 +178,8 @@ def log(v): page = int(request.args.get("page",1)) admin = request.args.get("admin") - if admin: admin = get_id(admin) + if admin: admin_id = get_id(admin) + else: admin_id = 0 kind = request.args.get("kind") @@ -185,14 +187,16 @@ def log(v): if not (v and v.admin_level > 1): actions = actions.filter(ModAction.kind!="shadowban", ModAction.kind!="unshadowban", ModAction.kind!="club", ModAction.kind!="unclub", ModAction.kind!="check") - if admin: actions = actions.filter_by(user_id=admin) + if admin_id: actions = actions.filter_by(user_id=admin_id) if kind: actions = actions.filter_by(kind=kind) actions = actions.order_by(ModAction.id.desc()).offset(25*(page-1)).limit(26).all() next_exists=len(actions)>25 actions=actions[:25] - return render_template("log.html", v=v, actions=actions, next_exists=next_exists, page=page) + admins = [x[0] for x in g.db.query(User.username).filter(User.admin_level > 1).all()] + + return render_template("log.html", v=v, admins=admins, types=ACTIONTYPES, admin=admin, type=kind, actions=actions, next_exists=next_exists, page=page) @app.get("/log/") @auth_desired diff --git a/files/routes/users.py b/files/routes/users.py index b28aa5d97..5815d18be 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -782,6 +782,11 @@ def user_profile_uid(id): x=get_account(id) return redirect(x.profile_url) +@app.get("/@/pic") +@limiter.exempt +def user_profile_name(username): + x = get_user(username) + return redirect(x.profile_url) @app.get("/@/saved/posts") @auth_required diff --git a/files/templates/log.html b/files/templates/log.html index 3dea5eec6..f04da52bf 100644 --- a/files/templates/log.html +++ b/files/templates/log.html @@ -36,6 +36,48 @@ +
+
+
+ + {% block navbar %} +
+ +
+
+ + +
+ +
+ {% endblock %} +
+
+
+ +
{% for ma in actions %} diff --git a/files/templates/shadowbanned.html b/files/templates/shadowbanned.html new file mode 100644 index 000000000..94cb47ec3 --- /dev/null +++ b/files/templates/shadowbanned.html @@ -0,0 +1,23 @@ +{% extends "settings2.html" %} + +{% block content %} + + + + + + + + + +{% for user in users %} + + + + + + +{% endfor %} +
#NameBan reasonBanned by
{{users.index(user)+1}}{{user.username}}{% if user.ban_reason %}{{user.ban_reason}}{% endif %}{{user.banned_by.username}}
+ +{% endblock %}