diff --git a/files/helpers/alerts.py b/files/helpers/alerts.py index 27d37fdf4..7948007a1 100755 --- a/files/helpers/alerts.py +++ b/files/helpers/alerts.py @@ -7,14 +7,17 @@ from .sanitize import * from .const import * -def send_notification(uid, text): +def send_notification(uid, text, autojanny=False): text = text.replace('r/', 'r\/').replace('u/', 'u\/') text_html = CustomRenderer().render(mistletoe.Document(text)) text_html = sanitize(text_html) - new_comment = Comment(author_id=NOTIFICATIONS_ACCOUNT, + if autojanny: author_id = AUTOJANNY_ACCOUNT + else: author_id = NOTIFICATIONS_ACCOUNT + + new_comment = Comment(author_id=author_id, parent_submission=None, distinguish_level=6, body=text, diff --git a/files/helpers/const.py b/files/helpers/const.py index 1907c63be..c2a6a85c3 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -95,7 +95,20 @@ Thank you.""" BASED_MSG = "@{username}'s Based Count has increased by 1. Their Based Count is now {basedcount}.\n\nPills: {pills}" -if SITE == "pcmemes.net": +if SITE == 'rdrama.net': + NOTIFICATIONS_ACCOUNT = 1046 + AUTOJANNY_ACCOUNT = 2360 + SNAPPY_ACCOUNT = 261 + LONGPOSTBOT_ACCOUNT = 1832 + ZOZBOT_ACCOUNT = 1833 + AUTOPOLLER_ACCOUNT = 6176 + TAX_RECEIVER_ID = 747 + TAX_RATE = 0.01 + PIZZA_SHILL_ID = 2424 + CARP_ID = 995 + LAWLZ_ID = 3833 + LLM_ID = 253 +elif SITE == "pcmemes.net": BASEDBOT_ACCOUNT = 800 NOTIFICATIONS_ACCOUNT = 1046 AUTOJANNY_ACCOUNT = 1050 @@ -103,13 +116,11 @@ if SITE == "pcmemes.net": LONGPOSTBOT_ACCOUNT = 1832 ZOZBOT_ACCOUNT = 1833 AUTOPOLLER_ACCOUNT = 3369 -elif SITE == 'rdrama.net': - NOTIFICATIONS_ACCOUNT = 1046 - AUTOJANNY_ACCOUNT = 2360 - SNAPPY_ACCOUNT = 261 - LONGPOSTBOT_ACCOUNT = 1832 - ZOZBOT_ACCOUNT = 1833 - AUTOPOLLER_ACCOUNT = 6176 + TAX_RECEIVER_ID = 1 + TAX_RATE = 0 + PIZZA_SHILL_ID = 0 + CARP_ID = 0 + LAWLZ_ID = 0 else: NOTIFICATIONS_ACCOUNT = 1 AUTOJANNY_ACCOUNT = 2 @@ -117,9 +128,11 @@ else: LONGPOSTBOT_ACCOUNT = 4 ZOZBOT_ACCOUNT = 5 AUTOPOLLER_ACCOUNT = 6 - -TAX_RECEIVER_ID = 747 -TAX_RATE = 0.01 + TAX_RECEIVER_ID = 7 + TAX_RATE = 0 + PIZZA_SHILL_ID = 0 + CARP_ID = 0 + LAWLZ_ID = 0 PUSHER_INSTANCE_ID = '02ddcc80-b8db-42be-9022-44c546b4dce6' PUSHER_KEY = environ.get("PUSHER_KEY", "").strip() diff --git a/files/helpers/discord.py b/files/helpers/discord.py index f572f3521..f4674ad76 100755 --- a/files/helpers/discord.py +++ b/files/helpers/discord.py @@ -9,7 +9,7 @@ BOT_TOKEN = environ.get("DISCORD_BOT_TOKEN",'').strip() AUTH = environ.get("DISCORD_AUTH",'').strip() ROLES={ - "shrigma": "864612849199480914", + "owner": "864612849199480914", "admin": "879459632656048180" if environ.get("DOMAIN") == "pcmemes.net" else "846509661288267776", "linked": "890342909390520382", "1": "868129042346414132", diff --git a/files/routes/admin.py b/files/routes/admin.py index 2566dfc24..62afda94d 100755 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -31,7 +31,7 @@ def truescore(v): @limiter.limit("1/second") @admin_level_required(6) def revert_actions(v, username): - if 'pcm' in request.host or (SITE_NAME == 'Drama' and v.id in [1,12,28,29,747,995,1480]) or ('rama' not in request.host and 'pcm' not in request.host): + if 'pcm' in request.host or (SITE_NAME == 'Drama' and v.id in [1,28,995]) or ('rama' not in request.host and 'pcm' not in request.host): user = get_user(username) if not user: abort(404) @@ -117,7 +117,7 @@ def club_ban(v, username): @limiter.limit("1/second") @admin_level_required(6) def make_admin(v, username): - if 'pcm' in request.host or (SITE_NAME == 'Drama' and v.id in [1,12,28,29,747,995,1480]) or ('rama' not in request.host and 'pcm' not in request.host): + if 'pcm' in request.host or (SITE_NAME == 'Drama' and v.id in [1,28,995]) or ('rama' not in request.host and 'pcm' not in request.host): user = get_user(username) if not user: abort(404) user.admin_level = 6 @@ -130,7 +130,7 @@ def make_admin(v, username): @limiter.limit("1/second") @admin_level_required(6) def remove_admin(v, username): - if 'pcm' in request.host or (SITE_NAME == 'Drama' and v.id in [1,12,28,29,747,995,1480]) or ('rama' not in request.host and 'pcm' not in request.host): + if 'pcm' in request.host or (SITE_NAME == 'Drama' and v.id in [1,28,995]) or ('rama' not in request.host and 'pcm' not in request.host): user = get_user(username) if not user: abort(404) user.admin_level = 0 @@ -143,7 +143,7 @@ def remove_admin(v, username): @limiter.limit("1/second") @admin_level_required(6) def make_fake_admin(v, username): - if 'pcm' in request.host or (SITE_NAME == 'Drama' and v.id in [1,12,28,29,747,995,1480]) or ('rama' not in request.host and 'pcm' not in request.host): + if 'pcm' in request.host or (SITE_NAME == 'Drama' and v.id in [1,28,995]) or ('rama' not in request.host and 'pcm' not in request.host): user = get_user(username) if not user: abort(404) user.admin_level = 1 @@ -156,7 +156,7 @@ def make_fake_admin(v, username): @limiter.limit("1/second") @admin_level_required(6) def remove_fake_admin(v, username): - if 'pcm' in request.host or (SITE_NAME == 'Drama' and v.id in [1,12,28,29,747,995,1480]) or ('rama' not in request.host and 'pcm' not in request.host): + if 'pcm' in request.host or (SITE_NAME == 'Drama' and v.id in [1,28,995]) or ('rama' not in request.host and 'pcm' not in request.host): user = get_user(username) if not user: abort(404) user.admin_level = 0 @@ -169,7 +169,7 @@ def remove_fake_admin(v, username): @limiter.limit("1/day") @admin_level_required(6) def monthly(v): - if 'pcm' in request.host or (SITE_NAME == 'Drama' and v.id in [1,995]) or ('rama' not in request.host and 'pcm' not in request.host): + if 'pcm' in request.host or (SITE_NAME == 'Drama' and v.id in [1,28,995]) or ('rama' not in request.host and 'pcm' not in request.host): thing = g.db.query(AwardRelationship).order_by(AwardRelationship.id.desc()).first().id for u in g.db.query(User).options(lazyload('*')).filter(User.patron > 0).all(): if u.patron == 1: procoins = 2000 diff --git a/files/routes/comments.py b/files/routes/comments.py index a1c37f66d..82108c1b7 100755 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -376,8 +376,8 @@ def api_comment(v): n = Notification(comment_id=c_jannied.id, user_id=v.id) g.db.add(n) - if v.id == 2424: - cratvote = CommentVote(user_id=747, comment_id=c.id, vote_type=1) + if v.id == PIZZA_SHILL_ID: + cratvote = CommentVote(user_id=TAX_RECEIVER_ID, comment_id=c.id, vote_type=1) g.db.add(cratvote) v.coins += 1 v.truecoins += 1 diff --git a/files/routes/discord.py b/files/routes/discord.py index 198752195..4f1c4a1da 100755 --- a/files/routes/discord.py +++ b/files/routes/discord.py @@ -116,7 +116,7 @@ def discord_redirect(v): if x.status_code in [201, 204]: - if v.id == 1: + if v.id in [1,7]: add_role(v, "shrigma") time.sleep(0.1) diff --git a/files/routes/posts.py b/files/routes/posts.py index 654d3390a..d1ea43416 100755 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -63,7 +63,7 @@ def publish(pid, v): for follow in v.followers: user = get_account(follow.user_id) - send_notification(user.id, f"@{v.username} has made a new post: [{post.title}](http://{site}{post.permalink})") + send_notification(user.id, f"@{v.username} has made a new post: [{post.title}](http://{site}{post.permalink})", True) g.db.commit() @@ -738,7 +738,7 @@ def submit_post(v): if not new_post.private: for follow in v.followers: user = get_account(follow.user_id) - send_notification(user.id, f"@{v.username} has made a new post: [{title}](http://{site}{new_post.permalink})") + send_notification(user.id, f"@{v.username} has made a new post: [{title}](http://{site}{new_post.permalink})", True) g.db.add(new_post) g.db.flush() @@ -819,10 +819,10 @@ def submit_post(v): g.db.add(new_post) if "rama" in request.host: - if v.id == 995: + if v.id == CARP_ID: if random.random() < 0.02: body = "i love you carp" else: body = "![](https://rdrama.net/assets/images/emojis/fuckoffcarp.webp)" - elif v.id == 3833: + elif v.id == LAWLZ_ID: if random.random() < 0.5: body = "wow, this lawlzpost sucks!" else: body = "wow, a good lawlzpost for once!" else: body = random.choice(snappyquotes) diff --git a/files/routes/users.py b/files/routes/users.py index bda6b923b..9e533668a 100755 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -117,7 +117,6 @@ def get_coins(v, username): @validate_formkey def transfer_coins(v, username): receiver = g.db.query(User).filter_by(username=username).first() - tax_receiver = g.db.query(User).filter_by(id=TAX_RECEIVER_ID).first() if receiver is None: return {"error": "That user doesn't exist."}, 404 @@ -129,22 +128,24 @@ def transfer_coins(v, username): if v.coins < amount: return {"error": f"You don't have enough {app.config['COINS_NAME']}"}, 400 if amount < 100: return {"error": f"You have to gift at least 100 {app.config['COINS_NAME']}."}, 400 - tax = math.ceil(amount*TAX_RATE) v.coins -= amount receiver.coins += amount-tax - tax_receiver.coins += tax - g.db.add(receiver) - g.db.add(tax_receiver) - g.db.add(v) transfer_message = f"🤑 [@{v.username}]({v.url}) has gifted you {amount} {app.config['COINS_NAME']}!" send_notification(receiver.id, transfer_message) - log_message = f"[@{v.username}]({v.url}) has transferred {amount} {app.config['COINS_NAME']} to [@{receiver.username}]({receiver.url})" - send_notification(TAX_RECEIVER_ID, log_message) + g.db.add(receiver) + g.db.add(v) + + if TAX_RATE and TAX_RECEIVER_ID: + tax = math.ceil(amount*TAX_RATE) + tax_receiver = g.db.query(User).filter_by(id=TAX_RECEIVER_ID).first() + tax_receiver.coins += tax + log_message = f"[@{v.username}]({v.url}) has transferred {amount} {app.config['COINS_NAME']} to [@{receiver.username}]({receiver.url})" + send_notification(TAX_RECEIVER_ID, log_message) + g.db.add(tax_receiver) g.db.commit() - return {"message": f"{amount-tax} {app.config['COINS_NAME']} transferred!"}, 200 return {"message": f"You can't transfer {app.config['COINS_NAME']} to yourself!"}, 400 @@ -423,7 +424,7 @@ def u_username(username, v=None): if u.is_private and (not v or (v.id != u.id and v.admin_level < 3)): - if v and u.id == 253: + if v and u.id == LLM_ID: if int(time.time()) - v.rent_utc > 600: if request.headers.get("Authorization"): return {"error": "That userpage is private"} else: return render_template("userpage_private.html", time=int(time.time()), u=u, v=v) @@ -516,7 +517,7 @@ def u_username_comments(username, v=None): if u.is_private and (not v or (v.id != u.id and v.admin_level < 3)): - if v and u.id == 253: + if v and u.id == LLM_ID: if int(time.time()) - v.rent_utc > 600: if request.headers.get("Authorization"): return {"error": "That userpage is private"} else: return render_template("userpage_private.html", time=int(time.time()), u=u, v=v) @@ -634,7 +635,7 @@ def unfollow_user(username, v): target = get_user(username) - if target.id == 995: abort(403) + if target.id == CARP_ID: abort(403) follow = g.db.query(Follow).options(lazyload('*')).filter_by(user_id=v.id, target_id=target.id).first() diff --git a/files/templates/admin/awards.html b/files/templates/admin/awards.html index 6466a0e4d..93a1b0f0c 100755 --- a/files/templates/admin/awards.html +++ b/files/templates/admin/awards.html @@ -65,7 +65,7 @@

-	{% if v.id in [1,995] %}
+	{% if 'rdrama.net' not in request.host or v.id in [1,995] %}
 		
Grant Monthly Marseybux
{% endif %} {% endblock %} \ No newline at end of file diff --git a/files/templates/comments.html b/files/templates/comments.html index 1a6777d93..01ec59fd5 100755 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -278,7 +278,7 @@ {% if c.is_blocking %}{% endif %} {% if c.is_blocked %}{% endif %} - {% if c.author.verified %} + {% if c.author.verified %} {% endif %} {{c.author.username}} @@ -734,7 +734,7 @@ } .popover { - max-width: 80%; + max-width: 100%; box-shadow: 0 1rem 3rem rgba(0, 0, 0, .175); border-color: #dadada; } diff --git a/files/templates/shop.html b/files/templates/shop.html index 105fc7edd..42edf4cbf 100644 --- a/files/templates/shop.html +++ b/files/templates/shop.html @@ -11,6 +11,7 @@

Stir drama. Earn coins.

Total sales: {{sales}} coins
+
Dramacoins spent by you: {{v.coins_spent}} coins
{% endblock %} diff --git a/files/templates/submission.html b/files/templates/submission.html index 502caa24d..aabe9ea9e 100755 --- a/files/templates/submission.html +++ b/files/templates/submission.html @@ -424,7 +424,7 @@ {% if p.over_18 %}+18{% endif %} {% if p.private %}Draft{% endif %} {% if p.active_flags %}{{p.active_flags}} Reports{% endif %} - {% if p.author.verified %} + {% if p.author.verified %} {% endif %} {{p.author.username}}{% if p.author.customtitle %}  {% if p.author.quadrant %}{% endif %}{{p.author.customtitle | safe}}{% endif %}  {{p.age_string}} diff --git a/files/templates/submission_listing.html b/files/templates/submission_listing.html index e2706bea6..8de3c966f 100755 --- a/files/templates/submission_listing.html +++ b/files/templates/submission_listing.html @@ -192,7 +192,7 @@ {% if p.is_blocked %}{% endif %} {% if p.private %}Draft{% endif %} {% if p.active_flags %}{{p.active_flags}} Reports{% endif %} - {% if p.author.verified %} + {% if p.author.verified %} {% endif %} {{p.author.username}}{% if p.author.customtitle %}  {% if p.author.quadrant %}{% endif %}{{p.author.customtitle | safe}}{% endif %}  {{p.age_string}} @@ -589,7 +589,7 @@