From 26f55c806b71d87f3f54574d65d04651b8ee5402 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sun, 16 Jan 2022 10:08:55 +0200 Subject: [PATCH 01/24] bb --- files/templates/comments.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/files/templates/comments.html b/files/templates/comments.html index 07af7358df..caa188b0e3 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -149,8 +149,8 @@ {% if c.post and c.post.over_18 %}+18{% endif %} {% if c.post %} - {% if c.author_id==v.id and c.child_comments and is_notification_page%} - Comment {{'Replies' if (c.child_comments | length)>1 else 'Reply'}}: {{c.post.realtitle(v) | safe}} + {% if c.author_id==v.id and replies and is_notification_page%} + Comment {{'Replies' if (replies | length)>1 else 'Reply'}}: {{c.post.realtitle(v) | safe}} {% elif c.post.author_id==v.id and c.level == 1 and is_notification_page%} Post Reply: {{c.post.realtitle(v) | safe}} {% elif is_notification_page and c.parent_submission in v.subscribed_idlist() %} From b617163a1c15b0d5575b34a720e772c3b69caeec Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Mon, 17 Jan 2022 13:06:12 +0200 Subject: [PATCH 02/24] vvv --- files/routes/admin.py | 5 +---- files/routes/awards.py | 6 ++++-- files/routes/comments.py | 3 ++- files/routes/errors.py | 15 ++++++++------- files/routes/front.py | 10 +++------- files/routes/login.py | 20 ++++++++++++-------- files/routes/posts.py | 11 ++++++----- files/routes/search.py | 2 +- files/routes/users.py | 12 +++++++----- 9 files changed, 44 insertions(+), 40 deletions(-) diff --git a/files/routes/admin.py b/files/routes/admin.py index e0b2ef440b..65f8167ccb 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -500,14 +500,11 @@ def users_list(v): @admin_level_required(2) def alt_votes_get(v): - if not request.values.get("u1") or not request.values.get("u2"): - return render_template("admin/alt_votes.html", v=v) - u1 = request.values.get("u1") u2 = request.values.get("u2") if not u1 or not u2: - return redirect("/admin/alt_votes") + return render_template("admin/alt_votes.html", v=v) u1 = get_user(u1) u2 = get_user(u2) diff --git a/files/routes/awards.py b/files/routes/awards.py index 5abef536b2..f99c9a3417 100644 --- a/files/routes/awards.py +++ b/files/routes/awards.py @@ -356,7 +356,8 @@ def award_post(pid, v): g.db.add(post.author) g.db.commit() - if request.referrer and len(request.referrer) > 1: return redirect(request.referrer) + if request.referrer and len(request.referrer) > 1 and (request.referrer.startswith('/') or request.referrer.startswith(request.host_url)): + return redirect(request.referrer) else: return redirect("/") @@ -540,7 +541,8 @@ def award_comment(cid, v): g.db.add(c.author) g.db.commit() - if request.referrer and len(request.referrer) > 1: return redirect(request.referrer) + if request.referrer and len(request.referrer) > 1 and (request.referrer.startswith('/') or request.referrer.startswith(request.host_url)): + return redirect(request.referrer) else: return redirect("/") @app.get("/admin/awards") diff --git a/files/routes/comments.py b/files/routes/comments.py index 166c4ef3d0..e4bbbf80b1 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -467,7 +467,8 @@ def api_comment(v): if parent.author.id != v.id: if len(c.body) > 500: notifbody = c.body[:500] + '...' - else: notifbody = c.body + elif c.body: notifbody = c.body + else: notifbody = '' beams_client.publish_to_interests( interests=[f'{request.host}{parent.author.id}'], diff --git a/files/routes/errors.py b/files/routes/errors.py index 31a33760f2..9c36a9a404 100644 --- a/files/routes/errors.py +++ b/files/routes/errors.py @@ -13,13 +13,12 @@ def error_400(e): @app.errorhandler(401) def error_401(e): - path = request.path - qs = urlencode(dict(request.values)) - argval = quote(f"{path}?{qs}", safe='') - output = f"/login?redirect={argval}" - if request.headers.get("Authorization") or request.headers.get("xhr"): return {"error": "401 Not Authorized"}, 401 - else: return redirect(output) + else: + path = request.path + qs = urlencode(dict(request.values)) + argval = quote(f"{path}?{qs}", safe='') + return redirect(f"/login?redirect={argval}") @app.errorhandler(403) @@ -61,4 +60,6 @@ def error_500(e): @app.post("/allow_nsfw") def allow_nsfw(): session["over_18"] = int(time.time()) + 3600 - return redirect(request.values.get("redir", "/")) \ No newline at end of file + redir = request.values.get("redir") + if redir and redir.startswith(request.host_url) or redir.startswith('/'): return redirect(redir) + return redirect('/') \ No newline at end of file diff --git a/files/routes/front.py b/files/routes/front.py index de7a471beb..a8f3cc0355 100644 --- a/files/routes/front.py +++ b/files/routes/front.py @@ -6,11 +6,6 @@ from files.classes.submission import Submission defaulttimefilter = environ.get("DEFAULT_TIME_FILTER", "all").strip() SITE_NAME = environ.get("SITE_NAME", "").strip() -@app.get("/post/") -@auth_required -def slash_post(v): - return redirect("/") - @app.post("/clear") @auth_required def clear(v): @@ -123,7 +118,8 @@ def notifications(v): @auth_desired def front_all(v): - if not v and request.path == "/" and not request.headers.get("Authorization"): return redirect(f"/logged_out{request.full_path}") + if not v and request.path == "/" and not request.headers.get("Authorization"): + return redirect(f"/logged_out{request.full_path}") if v and request.path.startswith('/logged_out'): v = None @@ -436,7 +432,7 @@ def comment_idlist(page=1, v=None, nsfw=False, sort="new", t="all"): elif sort == "controversial": comments = comments.order_by(-1 * Comment.upvotes * Comment.downvotes * Comment.downvotes) elif sort == "top": - comments = comments.order_by(Comment.realupvotes.desc()) + comments = comments.order_by(Comment.downvotes - Comment.upvotes) elif sort == "bottom": comments = comments.order_by(Comment.upvotes - Comment.downvotes) diff --git a/files/routes/login.py b/files/routes/login.py index 0a44b9c615..bdeb5b44e0 100644 --- a/files/routes/login.py +++ b/files/routes/login.py @@ -12,13 +12,14 @@ valid_password_regex = re.compile("^.{8,100}$") @auth_desired def login_get(v): - redir = request.values.get("redirect", "/").replace("/logged_out", "").strip() - if v: - return redirect(redir) + redir = request.values.get("redirect") + if redir: + redir = replace("/logged_out", "").strip() + if not redir.startswith(request.host_url) and not redir.startswith('/'): redir = None - return render_template("login.html", - failed=False, - redirect=redir) + if v and redir: return redirect(redir) + + return render_template("login.html", failed=False, redirect=redir) def check_for_alts(current_id): @@ -137,10 +138,13 @@ def login_post(): if account.id != PW_ID: check_for_alts(account.id) - redir = request.values.get("redirect", "/").replace("/logged_out", "").strip() - g.db.commit() + redir = request.values.get("redirect") + if redir: + redir = replace("/logged_out", "").strip() + if not redir.startswith(request.host_url) and not redir.startswith('/'): redir = '/' + return redirect(redir) diff --git a/files/routes/posts.py b/files/routes/posts.py index 3618feda77..8f42777819 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -96,7 +96,8 @@ def submit_get(v): @app.get("/logged_out/post//") @auth_desired def post_id(pid, anything=None, v=None): - if not v and not request.path.startswith('/logged_out') and not request.headers.get("Authorization"): return redirect(f"/logged_out{request.full_path}") + if not v and not request.path.startswith('/logged_out') and not request.headers.get("Authorization"): + return redirect(f"/logged_out{request.full_path}") if v and request.path.startswith('/logged_out'): v = None @@ -169,7 +170,7 @@ def post_id(pid, anything=None, v=None): elif sort == "controversial": comments = comments.order_by(-1 * Comment.upvotes * Comment.downvotes * Comment.downvotes) elif sort == "top": - comments = comments.order_by(-Comment.upvotes - Comment.downvotes) + comments = comments.order_by(Comment.realupvotes.desc()) elif sort == "bottom": comments = comments.order_by(Comment.upvotes - Comment.downvotes) @@ -186,7 +187,7 @@ def post_id(pid, anything=None, v=None): elif sort == "controversial": comments = comments.order_by(-1 * Comment.upvotes * Comment.downvotes * Comment.downvotes) elif sort == "top": - comments = comments.order_by(-Comment.upvotes - Comment.downvotes) + comments = comments.order_by(Comment.realupvotes.desc()) elif sort == "bottom": comments = comments.order_by(Comment.upvotes - Comment.downvotes) @@ -288,7 +289,7 @@ def viewmore(v, pid, sort, offset): elif sort == "controversial": comments = comments.order_by(-1 * Comment.upvotes * Comment.downvotes * Comment.downvotes) elif sort == "top": - comments = comments.order_by(-Comment.upvotes - Comment.downvotes) + comments = comments.order_by(Comment.realupvotes.desc()) elif sort == "bottom": comments = comments.order_by(Comment.upvotes - Comment.downvotes) @@ -305,7 +306,7 @@ def viewmore(v, pid, sort, offset): elif sort == "controversial": comments = comments.order_by(-1 * Comment.upvotes * Comment.downvotes * Comment.downvotes) elif sort == "top": - comments = comments.order_by(-Comment.upvotes - Comment.downvotes) + comments = comments.order_by(Comment.realupvotes.desc()) elif sort == "bottom": comments = comments.order_by(Comment.upvotes - Comment.downvotes) diff --git a/files/routes/search.py b/files/routes/search.py index cc80f82f0f..f23843f74b 100644 --- a/files/routes/search.py +++ b/files/routes/search.py @@ -255,7 +255,7 @@ def searchcomments(v): elif sort == "controversial": comments = comments.order_by(-1 * Comment.upvotes * Comment.downvotes * Comment.downvotes) elif sort == "top": - comments = comments.order_by(Comment.realupvotes.desc()) + comments = comments.order_by(Comment.downvotes - Comment.upvotes) elif sort == "bottom": comments = comments.order_by(Comment.upvotes - Comment.downvotes) diff --git a/files/routes/users.py b/files/routes/users.py index cb423d2fa6..b5f3895862 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -435,8 +435,9 @@ def message2(v, username): g.db.add(notif) if len(message) > 500: notifbody = message[:500] + '...' - else: notifbody = message - + elif message: notifbody = message + else: notifbody = '' + beams_client.publish_to_interests( interests=[f'{request.host}{user.id}'], publish_body={ @@ -502,7 +503,8 @@ def messagereply(v): g.db.add(notif) if len(message) > 500: notifbody = message[:500] + '...' - else: notifbody = message + elif message: notifbody = message + else: notifbody = '' beams_client.publish_to_interests( interests=[f'{request.host}{user_id}'], @@ -628,7 +630,7 @@ def u_username(username, v=None): if username != u.username: - return redirect(request.path.replace(username, u.username)) + return redirect(request.full_path.replace(username, u.username)) if u.reserved: if request.headers.get("Authorization") or request.headers.get("xhr"): return {"error": f"That username is reserved for: {u.reserved}"} @@ -796,7 +798,7 @@ def u_username_comments(username, v=None): elif sort == "controversial": comments = comments.order_by(-1 * Comment.upvotes * Comment.downvotes * Comment.downvotes) elif sort == "top": - comments = comments.order_by(Comment.realupvotes.desc()) + comments = comments.order_by(Comment.downvotes - Comment.upvotes) elif sort == "bottom": comments = comments.order_by(Comment.upvotes - Comment.downvotes) From 7a9a78c027ee53ff0d1c89f45c9c081c92d377e6 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Mon, 17 Jan 2022 13:47:30 +0200 Subject: [PATCH 03/24] bbb --- files/classes/submission.py | 2 +- files/helpers/const.py | 9 ++++++--- files/helpers/sanitize.py | 6 +++--- files/routes/admin.py | 10 +++++----- files/routes/comments.py | 10 +++++++++- files/routes/posts.py | 3 ++- files/templates/submission_listing.html | 8 +++----- 7 files changed, 29 insertions(+), 19 deletions(-) diff --git a/files/classes/submission.py b/files/classes/submission.py index 4b5a1e8d3d..4326a55e11 100644 --- a/files/classes/submission.py +++ b/files/classes/submission.py @@ -68,7 +68,7 @@ class Submission(Base): @property @lazy def comments(self): - return g.db.query(Comment.author_id, Comment.created_utc, Comment.id).filter_by(parent_submission=self.id) + return g.db.query(Comment.author_id, Comment.created_utc, Comment.id).filter(Submission.parent_submission == self.id, Submission.author_id.notin_((AUTOPOLLER_ID,AUTOBETTER_ID))) @property @lazy diff --git a/files/helpers/const.py b/files/helpers/const.py index 5976f5e6f7..1d7d67e8c1 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -141,7 +141,8 @@ if SITE == 'rdrama.net': AUTOPOLLER_ID = 6176 AUTOBETTER_ID = 7668 TAX_RECEIVER_ID = 995 - AUTO_UPVOTE_IDS = (2424,4245) + PIZZASHILL_ID = 2424 + HIL_ID = 4245 CRAT_ID = 747 IDIO_ID = 30 CARP_ID = 995 @@ -167,7 +168,8 @@ elif SITE == "pcmemes.net": AUTOPOLLER_ID = 3369 AUTOBETTER_ID = 1867 TAX_RECEIVER_ID = 1592 - AUTO_UPVOTE_IDS = () + PIZZASHILL_ID = 0 + HIL_ID = 0 CRAT_ID = 0 IDIO_ID = 0 CARP_ID = 0 @@ -193,7 +195,8 @@ else: AUTOPOLLER_ID = 6 AUTOBETTER_ID = 7 TAX_RECEIVER_ID = 8 - AUTO_UPVOTE_IDS = () + PIZZASHILL_ID = 0 + HIL_ID = 0 CRAT_ID = 0 IDIO_ID = 0 CARP_ID = 0 diff --git a/files/helpers/sanitize.py b/files/helpers/sanitize.py index 62bf6c4ff3..bb01f318eb 100644 --- a/files/helpers/sanitize.py +++ b/files/helpers/sanitize.py @@ -113,14 +113,14 @@ def sanitize(sanitized, noimages=False, alert=False, comment=False): else: sanitized = re.sub('(^|\s|\n|

)\/?((r|u)\/\w{3,25})', r'\1\2', sanitized) - for i in re.finditer('(^|\s|\n|

)@((\w|-){1,25})', sanitized): + for i in re.finditer('(^|\s|\n|

)@((\w|-){1,25})($|\s|\n|<\p>)', sanitized): u = get_user(i.group(2), graceful=True) if u and (not g.v.any_block_exists(u) or g.v.admin_level > 1): if noimages: - sanitized = sanitized.replace(i.group(0), f'{i.group(1)}@{u.username}') + sanitized = sanitized.replace(i.group(0), f'{i.group(1)}@{u.username}{i.group(4)}') else: - sanitized = sanitized.replace(i.group(0), f'''{i.group(1)}@{u.username}'s profile picture@{u.username}''') + sanitized = sanitized.replace(i.group(0), f'''{i.group(1)}@{u.username}'s profile picture@{u.username}{i.group(4)}''') for i in re.finditer('https://i\.imgur\.com/(([^_]*?)\.(jpg|png|jpeg))', sanitized): diff --git a/files/routes/admin.py b/files/routes/admin.py index 65f8167ccb..a35f71f978 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -67,6 +67,11 @@ def distribute(v, comment): for option in post.bet_options: pool += option.upvotes pool *= 200 + autobetter = g.db.query(User).filter_by(id=AUTOBETTER_ID).one_or_none() + autobetter.coins -= pool + if autobetter.coins < 0: autobetter.coins = 0 + g.db.add(autobetter) + votes = g.db.query(CommentVote).filter_by(comment_id=comment) coinsperperson = int(pool / votes.count()) @@ -76,11 +81,6 @@ def distribute(v, comment): u.coins += coinsperperson add_notif(cid, u.id) - autobetter = g.db.query(User).filter_by(id=AUTOBETTER_ID).one_or_none() - autobetter.coins -= pool - if autobetter.coins < 0: return {"error": "Not enough coins in bool"}, 400 - g.db.add(autobetter) - cid = notif_comment(f"You lost the 200 coins you bet on [{post.permalink}]({post.permalink}) :marseylaugh:") cids = [x.id for x in post.bet_options] cids.remove(comment) diff --git a/files/routes/comments.py b/files/routes/comments.py index e4bbbf80b1..5c05d86ac0 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -513,7 +513,7 @@ def api_comment(v): c.voted = 1 - if v.id in AUTO_UPVOTE_IDS: + if v.id == PIZZASHILL_ID: autovote = CommentVote(user_id=CARP_ID, comment_id=c.id, vote_type=1) g.db.add(autovote) autovote = CommentVote(user_id=AEVANN_ID, comment_id=c.id, vote_type=1) @@ -525,6 +525,14 @@ def api_comment(v): g.db.add(v) c.upvotes += 3 g.db.add(c) + elif v.id == HIL_ID: + autovote = CommentVote(user_id=CARP_ID, comment_id=c.id, vote_type=1) + g.db.add(autovote) + v.coins += 1 + v.truecoins += 1 + g.db.add(v) + c.upvotes += 1 + g.db.add(c) g.db.commit() diff --git a/files/routes/posts.py b/files/routes/posts.py index 8f42777819..28b6700d81 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -1065,6 +1065,7 @@ def submit_post(v): title = url_match.group(5) if "Snapshots:\n\n" not in body: body += "Snapshots:\n\n" + if f'**[{title}]({href})**:\n\n' in body: continue body += f'**[{title}]({href})**:\n\n' if href.startswith('https://old.reddit.com/'): body += f'* [unddit.com](https://unddit.com/{href.replace("https://old.reddit.com/", "")})\n' @@ -1107,7 +1108,7 @@ def submit_post(v): send_discord_message(f"https://{site}{new_post.permalink}") cache.delete_memoized(changeloglist) - if v.id in AUTO_UPVOTE_IDS: + if v.id in (PIZZASHILL_ID, HIL_ID): autovote = Vote(user_id=CARP_ID, submission_id=new_post.id, vote_type=1) g.db.add(autovote) autovote = Vote(user_id=AEVANN_ID, submission_id=new_post.id, vote_type=1) diff --git a/files/templates/submission_listing.html b/files/templates/submission_listing.html index 0734877a34..b92c476c9e 100644 --- a/files/templates/submission_listing.html +++ b/files/templates/submission_listing.html @@ -63,11 +63,9 @@ {% for p in listing %} {% set ups=p.upvotes %} From f20c8ae2a4bde4fe3959d931370691574e0a0d4a Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Mon, 17 Jan 2022 13:50:03 +0200 Subject: [PATCH 04/24] bbb --- files/helpers/sanitize.py | 2 +- files/routes/login.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/files/helpers/sanitize.py b/files/helpers/sanitize.py index bb01f318eb..6cc40ea5d8 100644 --- a/files/helpers/sanitize.py +++ b/files/helpers/sanitize.py @@ -113,7 +113,7 @@ def sanitize(sanitized, noimages=False, alert=False, comment=False): else: sanitized = re.sub('(^|\s|\n|

)\/?((r|u)\/\w{3,25})', r'\1\2', sanitized) - for i in re.finditer('(^|\s|\n|

)@((\w|-){1,25})($|\s|\n|<\p>)', sanitized): + for i in re.finditer('(^|\s|\n|

)@((\w|-){1,25})($|\s|\n|<\\p>)', sanitized): u = get_user(i.group(2), graceful=True) if u and (not g.v.any_block_exists(u) or g.v.admin_level > 1): diff --git a/files/routes/login.py b/files/routes/login.py index bdeb5b44e0..ff479a9ec0 100644 --- a/files/routes/login.py +++ b/files/routes/login.py @@ -14,7 +14,7 @@ def login_get(v): redir = request.values.get("redirect") if redir: - redir = replace("/logged_out", "").strip() + redir = redir.replace("/logged_out", "").strip() if not redir.startswith(request.host_url) and not redir.startswith('/'): redir = None if v and redir: return redirect(redir) @@ -142,7 +142,7 @@ def login_post(): redir = request.values.get("redirect") if redir: - redir = replace("/logged_out", "").strip() + redir = redir.replace("/logged_out", "").strip() if not redir.startswith(request.host_url) and not redir.startswith('/'): redir = '/' return redirect(redir) From b95b401d7e0dc5bb8114fe84bbb630b02ea2db98 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Mon, 17 Jan 2022 13:51:03 +0200 Subject: [PATCH 05/24] bbb --- files/helpers/sanitize.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/helpers/sanitize.py b/files/helpers/sanitize.py index 6cc40ea5d8..ae260232f9 100644 --- a/files/helpers/sanitize.py +++ b/files/helpers/sanitize.py @@ -113,7 +113,7 @@ def sanitize(sanitized, noimages=False, alert=False, comment=False): else: sanitized = re.sub('(^|\s|\n|

)\/?((r|u)\/\w{3,25})', r'\1\2', sanitized) - for i in re.finditer('(^|\s|\n|

)@((\w|-){1,25})($|\s|\n|<\\p>)', sanitized): + for i in re.finditer('(^|\s|\n|

)@((\w|-){1,25})($|\s|\n|

)', sanitized): u = get_user(i.group(2), graceful=True) if u and (not g.v.any_block_exists(u) or g.v.admin_level > 1): From 8f6c0bf457f96fe25e825d0a68e8d0fc88fba1cf Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Mon, 17 Jan 2022 14:06:26 +0200 Subject: [PATCH 06/24] fdf --- files/routes/front.py | 16 +++++- files/routes/users.py | 6 ++- files/templates/home_comments.html | 82 +++++++++++++++--------------- 3 files changed, 60 insertions(+), 44 deletions(-) diff --git a/files/routes/front.py b/files/routes/front.py index a8f3cc0355..f7a87f0294 100644 --- a/files/routes/front.py +++ b/files/routes/front.py @@ -462,4 +462,18 @@ def all_comments(v): idlist = idlist[:25] if request.headers.get("Authorization"): return {"data": [x.json for x in comments]} - return render_template("home_comments.html", v=v, sort=sort, t=t, page=page, comments=comments, standalone=True, next_exists=next_exists) \ No newline at end of file + return render_template("home_comments.html", v=v, sort=sort, t=t, page=page, comments=comments, standalone=True, next_exists=next_exists) + + +@app.get("/transfers") +@auth_required +def transfers(v): + + page = int(request.values.get("page", 1)) + + comments = g.db.query(Comment).filter(Comment.author_id == NOTIFICATIONS_ID, Comment.parent_submission == None, Comment.distinguish_level == 6, Comment.body_html.like("% has transferred %"), Comment.created_utc == 0).offset(25 * (page - 1)).limit(26).all() + + next_exists = len(comments) > 25 + comments = comments[:25] + + return render_template("home_comments.html", v=v, page=page, comments=comments, standalone=True, next_exists=next_exists) \ No newline at end of file diff --git a/files/routes/users.py b/files/routes/users.py index b5f3895862..142ba995b2 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -244,11 +244,13 @@ def transfer_coins(v, username): tax = math.ceil(amount*0.03) tax_receiver = g.db.query(User).filter_by(id=TAX_RECEIVER_ID).one_or_none() tax_receiver.coins += tax - log_message = f"[@{v.username}](/id/{v.id}) has transferred {amount} {app.config['COINS_NAME']} to [@{receiver.username}]({receiver.id})" - send_repeatable_notification(TAX_RECEIVER_ID, log_message) g.db.add(tax_receiver) else: tax = 0 + if TAX_RECEIVED_ID: + log_message = f"[@{v.username}](/id/{v.id}) has transferred {amount} {app.config['COINS_NAME']} to [@{receiver.username}]({receiver.id})" + send_repeatable_notification(TAX_RECEIVER_ID, log_message) + receiver.coins += amount-tax v.coins -= amount send_repeatable_notification(receiver.id, f"🤑 [@{v.username}](/id/{v.id}) has gifted you {amount-tax} {app.config['COINS_NAME']}!") diff --git a/files/templates/home_comments.html b/files/templates/home_comments.html index ceb3bc2084..018d90e2f6 100644 --- a/files/templates/home_comments.html +++ b/files/templates/home_comments.html @@ -4,54 +4,54 @@ {% block sortnav %}{% endblock %} {% block content %} -

-	
+ {% if request.path != '/transfers' %} +
-
-
‎
-