forked from rDrama/rDrama
cut down on chud award evasion
parent
d36a930328
commit
50680e0fa8
|
@ -454,3 +454,8 @@ class Comment(Base):
|
||||||
|
|
||||||
body += '</span>'
|
body += '</span>'
|
||||||
return body
|
return body
|
||||||
|
|
||||||
|
@property
|
||||||
|
@lazy
|
||||||
|
def complies_with_chud(self):
|
||||||
|
return re.search(self.author.phrase_regex_pattern, self.body_html.lower())
|
||||||
|
|
|
@ -359,3 +359,8 @@ class Submission(Base):
|
||||||
@lazy
|
@lazy
|
||||||
def active_flags(self, v):
|
def active_flags(self, v):
|
||||||
return len(self.filtered_flags(v))
|
return len(self.filtered_flags(v))
|
||||||
|
|
||||||
|
@property
|
||||||
|
@lazy
|
||||||
|
def complies_with_chud(self):
|
||||||
|
return re.search(self.author.phrase_regex_pattern, self.body_html.lower())
|
||||||
|
|
|
@ -1210,3 +1210,8 @@ class User(Base):
|
||||||
def can_see_my_shit(self):
|
def can_see_my_shit(self):
|
||||||
v = g.v
|
v = g.v
|
||||||
return not self.shadowbanned or (v and (v.id == self.id or v.can_see_shadowbanned))
|
return not self.shadowbanned or (v and (v.id == self.id or v.can_see_shadowbanned))
|
||||||
|
|
||||||
|
@property
|
||||||
|
@lazy
|
||||||
|
def phrase_regex_pattern(self):
|
||||||
|
return f"<p>[^<>]*{self.agendaposter_phrase}[^<>]*<\/p>"
|
||||||
|
|
|
@ -327,6 +327,8 @@ def handle_youtube_links(url):
|
||||||
def sanitize(sanitized, golden=True, limit_pings=0, showmore=True, count_emojis=False, torture=False, snappy=False, chat=False, blackjack=None):
|
def sanitize(sanitized, golden=True, limit_pings=0, showmore=True, count_emojis=False, torture=False, snappy=False, chat=False, blackjack=None):
|
||||||
sanitized = sanitized.strip()
|
sanitized = sanitized.strip()
|
||||||
|
|
||||||
|
sanitized = sanitized.replace("<p>", "").replace("</p>", "")
|
||||||
|
|
||||||
if blackjack and execute_blackjack(g.v, None, sanitized, blackjack):
|
if blackjack and execute_blackjack(g.v, None, sanitized, blackjack):
|
||||||
sanitized = 'g'
|
sanitized = 'g'
|
||||||
|
|
||||||
|
|
|
@ -1306,7 +1306,7 @@ def remove_post(post_id, v):
|
||||||
def approve_post(post_id, v):
|
def approve_post(post_id, v):
|
||||||
post = get_post(post_id)
|
post = get_post(post_id)
|
||||||
|
|
||||||
if post.author.id == v.id and post.author.agendaposter and post.author.agendaposter_phrase not in post.body.lower() and post.sub != 'chudrama':
|
if post.author.id == v.id and post.author.agendaposter and post.sub != 'chudrama' and not post.complies_with_chud:
|
||||||
abort(400, "You can't bypass the chud award!")
|
abort(400, "You can't bypass the chud award!")
|
||||||
|
|
||||||
if post.is_banned:
|
if post.is_banned:
|
||||||
|
@ -1540,7 +1540,7 @@ def remove_comment(c_id, v):
|
||||||
def approve_comment(c_id, v):
|
def approve_comment(c_id, v):
|
||||||
comment = get_comment(c_id)
|
comment = get_comment(c_id)
|
||||||
|
|
||||||
if comment.author.id == v.id and comment.author.agendaposter and comment.author.agendaposter_phrase not in comment.body.lower() and not (comment.parent_submission and comment.post.sub == 'chudrama'):
|
if comment.author.id == v.id and comment.author.agendaposter and not (comment.parent_submission and comment.post.sub == 'chudrama') and not comment.complies_with_chud:
|
||||||
abort(400, "You can't bypass the chud award!")
|
abort(400, "You can't bypass the chud award!")
|
||||||
|
|
||||||
if comment.is_banned:
|
if comment.is_banned:
|
||||||
|
|
|
@ -299,6 +299,9 @@ def award_thing(v, thing_type, id):
|
||||||
if author.marseyawarded:
|
if author.marseyawarded:
|
||||||
abort(409, f"{safe_username} is under the effect of a conflicting award: Marsey award!")
|
abort(409, f"{safe_username} is under the effect of a conflicting award: Marsey award!")
|
||||||
|
|
||||||
|
if author.marsify:
|
||||||
|
abort(409, f"{safe_username} is under the effect of a conflicting award: Marsify award!")
|
||||||
|
|
||||||
if author.agendaposter == 1:
|
if author.agendaposter == 1:
|
||||||
abort(409, f"{safe_username} is already chudded permanently!")
|
abort(409, f"{safe_username} is already chudded permanently!")
|
||||||
|
|
||||||
|
@ -330,6 +333,9 @@ def award_thing(v, thing_type, id):
|
||||||
elif kind == "unpausable":
|
elif kind == "unpausable":
|
||||||
badge_grant(badge_id=67, user=author)
|
badge_grant(badge_id=67, user=author)
|
||||||
elif kind == "marsey":
|
elif kind == "marsey":
|
||||||
|
if author.agendaposter:
|
||||||
|
abort(409, f"{safe_username} is under the effect of a conflicting award: Chud award!")
|
||||||
|
|
||||||
if author.marseyawarded: author.marseyawarded += 86400
|
if author.marseyawarded: author.marseyawarded += 86400
|
||||||
else: author.marseyawarded = int(time.time()) + 86400
|
else: author.marseyawarded = int(time.time()) + 86400
|
||||||
badge_grant(user=author, badge_id=98)
|
badge_grant(user=author, badge_id=98)
|
||||||
|
@ -383,6 +389,9 @@ def award_thing(v, thing_type, id):
|
||||||
author.verified = "Verified"
|
author.verified = "Verified"
|
||||||
badge_grant(user=author, badge_id=150)
|
badge_grant(user=author, badge_id=150)
|
||||||
elif kind == 'marsify':
|
elif kind == 'marsify':
|
||||||
|
if author.agendaposter:
|
||||||
|
abort(409, f"{safe_username} is under the effect of a conflicting award: Chud award!")
|
||||||
|
|
||||||
if not author.marsify or author.marsify != 1:
|
if not author.marsify or author.marsify != 1:
|
||||||
if author.marsify: author.marsify += 86400
|
if author.marsify: author.marsify += 86400
|
||||||
else: author.marsify = int(time.time()) + 86400
|
else: author.marsify = int(time.time()) + 86400
|
||||||
|
|
|
@ -279,7 +279,7 @@ def comment(v:User):
|
||||||
if c.level == 1: c.top_comment_id = c.id
|
if c.level == 1: c.top_comment_id = c.id
|
||||||
else: c.top_comment_id = parent.top_comment_id
|
else: c.top_comment_id = parent.top_comment_id
|
||||||
|
|
||||||
if post_target.id not in ADMIGGER_THREADS and v.agendaposter and not v.marseyawarded and v.agendaposter_phrase not in c.body.lower() and not (posting_to_submission and post_target.sub == 'chudrama'):
|
if post_target.id not in ADMIGGER_THREADS and v.agendaposter and not v.marseyawarded and not (posting_to_submission and post_target.sub == 'chudrama') and not c.complies_with_chud:
|
||||||
c.is_banned = True
|
c.is_banned = True
|
||||||
c.ban_reason = "AutoJanny"
|
c.ban_reason = "AutoJanny"
|
||||||
g.db.add(c)
|
g.db.add(c)
|
||||||
|
@ -674,7 +674,7 @@ def edit_comment(cid, v):
|
||||||
execute_blackjack(v, c, c.body, "comment")
|
execute_blackjack(v, c, c.body, "comment")
|
||||||
execute_under_siege(v, c, c.body, "comment")
|
execute_under_siege(v, c, c.body, "comment")
|
||||||
|
|
||||||
if not (c.parent_submission and c.post.id in ADMIGGER_THREADS) and v.agendaposter and not v.marseyawarded and v.agendaposter_phrase not in c.body.lower() and not (c.parent_submission and c.post.sub == 'chudrama'):
|
if not (c.parent_submission and c.post.id in ADMIGGER_THREADS) and v.agendaposter and not v.marseyawarded and not (c.parent_submission and c.post.sub == 'chudrama') and not c.complies_with_chud:
|
||||||
abort(403, f'You have to include "{v.agendaposter_phrase}" in your comment!')
|
abort(403, f'You have to include "{v.agendaposter_phrase}" in your comment!')
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -656,7 +656,7 @@ def submit_post(v:User, sub=None):
|
||||||
for x in notify_users:
|
for x in notify_users:
|
||||||
add_notif(cid, x, text, pushnotif_url=p.permalink)
|
add_notif(cid, x, text, pushnotif_url=p.permalink)
|
||||||
|
|
||||||
if v.agendaposter and not v.marseyawarded and v.agendaposter_phrase not in f'{p.body}{p.title}'.lower() and sub != 'chudrama':
|
if v.agendaposter and not v.marseyawarded and sub != 'chudrama' and not p.complies_with_chud:
|
||||||
p.is_banned = True
|
p.is_banned = True
|
||||||
p.ban_reason = "AutoJanny"
|
p.ban_reason = "AutoJanny"
|
||||||
|
|
||||||
|
@ -1041,7 +1041,7 @@ def edit_post(pid, v):
|
||||||
|
|
||||||
p.body_html = body_html
|
p.body_html = body_html
|
||||||
|
|
||||||
if v.id == p.author_id and v.agendaposter and not v.marseyawarded and v.agendaposter_phrase not in f'{p.body}{p.title}'.lower() and p.sub != 'chudrama':
|
if v.id == p.author_id and v.agendaposter and not v.marseyawarded and p.sub != 'chudrama' and not p.complies_with_chud:
|
||||||
abort(403, f'You have to include "{v.agendaposter_phrase}" in your post!')
|
abort(403, f'You have to include "{v.agendaposter_phrase}" in your post!')
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue