pull/154/head
Chuck Sneed 2023-06-17 15:54:48 -05:00
parent 6fa9caac27
commit 74d50be3a5
14 changed files with 134 additions and 32 deletions

View File

@ -6669,6 +6669,11 @@ g {
font-weight: 700 !important;
}
.misogynist:not(a) {
color: hotpink !important;
font-weight: 700 !important;
}
.rainbow-text:not(a) > p {
color: transparent !important;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

View File

@ -96,6 +96,7 @@ class User(Base):
coins_spent_on_hats = Column(Integer, default=0)
lootboxes_bought = Column(Integer, default=0)
agendaposter = Column(Integer, default=0)
misogynist = Column(Integer, default=0)
agendaposter_phrase = Column(String)
is_activated = Column(Boolean, default=False)
shadowbanned = Column(Integer, ForeignKey("users.id"))
@ -816,6 +817,10 @@ class User(Base):
return f"{SITE_FULL}/e/chudsey.webp"
if self.rainbow:
return f"{SITE_FULL}/e/marseysalutepride.webp"
if self.misogynist:
number_of_girl_pfps = 2
pic_num = (self.id % number_of_girl_pfps) + 1
return f"{SITE_FULL}/i/pfps/girls/{pic_num}.webp"
if self.profileurl and self.can_see_my_shit:
if self.profileurl.startswith('/'): return SITE_FULL + self.profileurl
return self.profileurl

View File

@ -531,6 +531,18 @@ AWARDS = {
"ghost": False,
"enabled": True,
},
"misogynist": {
"kind": "misogynist",
"title": "Misogynist",
"description": "Gets the recipient in touch with their feminine side for 24 hours.",
"icon": "fas fa-snooze",
"color": "text-purple",
"price": 1,
"deflectable": True,
"cosmetic": False,
"ghost": False,
"enabled": True,
},
"offsitementions": {
"kind": "offsitementions",
"title": "Y'all Seein' Eye",

View File

@ -101,6 +101,21 @@ AJ_REPLACEMENTS = {
'EVERYBODY': 'EVERYPONY',
}
GIRL_PHRASES = [
"ok so $",
"literally, $",
"i feel like $",
"my heart is telling me $",
"its almost as if $",
"omg! $",
"im literally screaming, $",
"$ and thats the tea, sis",
"$ but go off i guess",
"$ but go off",
"$, karen",
"$ but its whatever"
]
SLURS = {
"(?<!\\bs)nigger": "BIPOC",
"negroid": "BIPOC",
@ -1084,6 +1099,7 @@ forced_hats = {
"earlylife": ("The Merchant", "SHUT IT DOWN, the goys know!"),
"marsify": ("Marsified", "I can't pick my own Marseys, help!"),
"is_suspended": ("Behind Bars", "This user is banned and needs to do better!"),
"misogynist": ("Emoji Crown (hearts and shooting stars)", "This user is getting in touch with her feminine side 🥰"),
"agendaposter": (("Egg_irl", "This user is getting in touch with xir identity!"),
("Trans Flag", "Just in case you forgot, trans lives matter."),
("Trans Flag II", "Your egg is cracked; wear it with pride!"),

View File

@ -209,6 +209,7 @@ def _award_timers_task():
_process_timer(User.earlylife, [169], "The earlylife award you received has expired!")
_process_timer(User.marsify, [170], "The marsify award you received has expired!")
_process_timer(User.rainbow, [171], "The rainbow award you received has expired!")
_process_timer(User.misogynist, [], "The misogynist award you received has expired!")
_process_timer(User.spider, [179], "The spider award you received has expired!")
_process_timer(User.namechanged, [281], "The namelock award you received has expired. You're now back to your old username!", {
User.username: User.prelock_username,

View File

@ -69,6 +69,10 @@ torture_regex = re.compile('(^|\s)(i|me)($|\s)', flags=re.I|re.A)
torture_regex2 = re.compile("(^|\s)(i'm)($|\s)", flags=re.I|re.A)
torture_regex3 = re.compile("(^|\s)(my|mine)($|\s)", flags=re.I|re.A)
sentence_ending_regex = re.compile('(\.|\?|\!)', flags=re.I|re.A)
normal_punctuation_regex = re.compile('(\"|\')', flags=re.I|re.A)
more_than_one_comma_regex = re.compile('\,\,+', flags=re.I|re.A)
image_check_regex = re.compile(f'!\[\]\(((?!(https:\/\/({hosts})\/|\/)).*?)\)', flags=re.A)
video_regex_extensions = '|'.join(VIDEO_FORMATS)

View File

@ -677,8 +677,6 @@ def validate_css(css):
return True, ""
def torture_ap(string, username):
if not string: return string
for k, l in AJ_REPLACEMENTS.items():
@ -688,9 +686,37 @@ def torture_ap(string, username):
string = torture_regex3.sub(rf"\1@{username}'s\3", string)
return string
def torture_misogynist(string, key):
if not string: return string
string = string.lower()
string = sentence_ending_regex.sub(",", string)
string = normal_punctuation_regex.sub("", string)
string = more_than_one_comma_regex.sub(",", string)
if string[-1] == ',':
string = string[0:-1]
girl_phrase = GIRL_PHRASES[key%len(GIRL_PHRASES)]
string = girl_phrase.replace("$", string)
return string
def torture_object(obj, torture_method):
#torture body_html
if obj.body_html and '<p>&amp;&amp;' not in obj.body_html and '<p>$$' not in obj.body_html and '<p>##' not in obj.body_html:
soup = BeautifulSoup(obj.body_html, 'lxml')
tags = soup.html.body.find_all(lambda tag: tag.name not in {'blockquote','codeblock','pre'} and tag.string, recursive=False)
i = 0
for tag in tags:
i+=1
key = obj.id*i
tag.string.replace_with(torture_method(tag.string, key))
obj.body_html = str(soup).replace('<html><body>','').replace('</body></html>','')
#torture title_html and check for agendaposter_phrase in plain title and leave if it's there
if isinstance(obj, Post):
obj.title_html = torture_method(obj.title_html)
def complies_with_chud(obj):
#check for cases where u should leave
if not obj.author.agendaposter: return True
if not (obj.author.agendaposter or obj.author.misogynist): return True
if obj.author.marseyawarded: return True
if isinstance(obj, Post):
if obj.id in ADMIGGER_THREADS: return True
@ -699,31 +725,36 @@ def complies_with_chud(obj):
if obj.parent_submission in ADMIGGER_THREADS: return True
if obj.post.sub == "chudrama": return True
#perserve old body_html to be used in checking for chud phrase
old_body_html = obj.body_html
if obj.author.agendaposter:
#perserve old body_html to be used in checking for chud phrase
old_body_html = obj.body_html
#torture body_html
if obj.body_html and '<p>&amp;&amp;' not in obj.body_html and '<p>$$' not in obj.body_html and '<p>##' not in obj.body_html:
soup = BeautifulSoup(obj.body_html, 'lxml')
tags = soup.html.body.find_all(lambda tag: tag.name not in {'blockquote','codeblock','pre'} and tag.string, recursive=False)
for tag in tags:
tag.string.replace_with(torture_ap(tag.string, obj.author.username))
obj.body_html = str(soup).replace('<html><body>','').replace('</body></html>','')
# TODO: Replace this code to make it more generic
#torture body_html
if obj.body_html and '<p>&amp;&amp;' not in obj.body_html and '<p>$$' not in obj.body_html and '<p>##' not in obj.body_html:
soup = BeautifulSoup(obj.body_html, 'lxml')
tags = soup.html.body.find_all(lambda tag: tag.name not in {'blockquote','codeblock','pre'} and tag.string, recursive=False)
for tag in tags:
tag.string.replace_with(torture_ap(tag.string, obj.author.username))
obj.body_html = str(soup).replace('<html><body>','').replace('</body></html>','')
#torture title_html and check for agendaposter_phrase in plain title and leave if it's there
if isinstance(obj, Post):
obj.title_html = torture_ap(obj.title_html, obj.author.username)
if obj.author.agendaposter_phrase in obj.title.lower():
return True
#torture title_html and check for agendaposter_phrase in plain title and leave if it's there
if isinstance(obj, Post):
obj.title_html = torture_ap(obj.title_html, obj.author.username)
if obj.author.agendaposter_phrase in obj.title.lower():
return True
#check for agendaposter_phrase in body_html
if old_body_html:
excluded_tags = {'del','sub','sup','marquee','spoiler','lite-youtube','video','audio'}
soup = BeautifulSoup(old_body_html, 'lxml')
tags = soup.html.body.find_all(lambda tag: tag.name not in excluded_tags and not tag.attrs, recursive=False)
for tag in tags:
for text in tag.find_all(text=True, recursive=False):
if obj.author.agendaposter_phrase in text.lower():
return True
#check for agendaposter_phrase in body_html
if old_body_html:
excluded_tags = {'del','sub','sup','marquee','spoiler','lite-youtube','video','audio'}
soup = BeautifulSoup(old_body_html, 'lxml')
tags = soup.html.body.find_all(lambda tag: tag.name not in excluded_tags and not tag.attrs, recursive=False)
for tag in tags:
for text in tag.find_all(text=True, recursive=False):
if obj.author.agendaposter_phrase in text.lower():
return True
return False
return False
elif obj.author.misogynist:
torture_object(obj, torture_misogynist)
return True

View File

@ -312,11 +312,32 @@ def award_thing(v, thing_type, id):
cache.delete_memoized(frontlist)
else: thing.stickied_utc = t
g.db.add(thing)
elif kind == "misogynist":
if author.agendaposter:
abort(409, f"{safe_username} is under the effect of a conflicting award: Chud award!")
if author.marseyawarded:
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.owoify:
abort(409, f"{safe_username} is under the effect of a conflicting award: OwOify award!")
if author.misogynist and time.time() < author.misogynist: author.misogynist += 86400
else: author.misogynist = int(time.time()) + 86400
# badge_grant(user=author, badge_id=58)
elif kind == "agendaposter":
if thing_type == 'post' and thing.sub == 'chudrama' \
or thing_type == 'comment' and thing.post and thing.post.sub == 'chudrama':
abort(403, "You can't give the chud award in /h/chudrama")
if author.misogynist:
abort(409, f"{safe_username} is under the effect of a conflicting award: Misogynist award!")
if author.marseyawarded:
abort(409, f"{safe_username} is under the effect of a conflicting award: Marsey award!")
@ -377,6 +398,8 @@ def award_thing(v, thing_type, id):
elif kind == "marsey":
if author.agendaposter:
abort(409, f"{safe_username} is under the effect of a conflicting award: Chud award!")
if author.misogynist:
abort(409, f"{safe_username} is under the effect of a conflicting award: Misogynist award!")
if author.marseyawarded: author.marseyawarded += 86400
else: author.marseyawarded = int(time.time()) + 86400
@ -433,6 +456,8 @@ def award_thing(v, thing_type, id):
elif kind == 'marsify':
if author.agendaposter:
abort(409, f"{safe_username} is under the effect of a conflicting award: Chud award!")
if author.misogynist:
abort(409, f"{safe_username} is under the effect of a conflicting award: Misogynist award!")
if not author.marsify or author.marsify != 1:
if author.marsify: author.marsify += 86400
@ -463,6 +488,8 @@ def award_thing(v, thing_type, id):
elif ("Furry" in kind and kind == v.house) or kind == 'owoify':
if author.agendaposter:
abort(409, f"{safe_username} is under the effect of a conflicting award: Chud award!")
if author.misogynist:
abort(409, f"{safe_username} is under the effect of a conflicting award: Misogynist award!")
if author.owoify: author.owoify += 21600
else: author.owoify = int(time.time()) + 21600

View File

@ -242,7 +242,7 @@
{% endif %}
{% set realbody = c.realbody(v) %}
<div id="comment-text-{{c.id}}" class="comment-text mb-0 {% if c.author.agendaposter and not (c.parent_submission and c.post.sub == 'chudrama') %}text-uppercase agendaposter-img agendaposter-{{c.id_last_num}}{% endif %} {% if c.author.rainbow %}rainbow-text{% endif %}">
<div id="comment-text-{{c.id}}" class="comment-text mb-0 {% if c.author.agendaposter and not (c.parent_submission and c.post.sub == 'chudrama') %}text-uppercase agendaposter-img agendaposter-{{c.id_last_num}}{% endif %} {% if c.author.rainbow %}rainbow-text{% endif %} {%if c.author.misogynist%}misogynist{%endif%}">
{{realbody | safe}}
</div>
{% if c.parent_submission or c.wall_user_id %}

View File

@ -81,13 +81,13 @@
{% if p.realurl(v) and not v_forbid_deleted %}
<h1 id="post-title" class="card-title post-title text-left mb-md-3 {% if p.author.agendaposter and p.sub != 'chudrama' %}text-uppercase{% endif %}">
<a {% if p.author.rainbow %}class="rainbow-text"{% endif %} {% if not v or v.newtabexternal %}target="_blank"{% endif %} rel="nofollow noopener" href="{{p.realurl(v)}}">
<a {% if p.author.rainbow %}class="rainbow-text"{% endif %} {%if p.author.misogynist%}misogynist{%endif%} {% if not v or v.newtabexternal %}target="_blank"{% endif %} rel="nofollow noopener" href="{{p.realurl(v)}}">
{% if p.flair %}<span class="patron font-weight-bolder mr-1" style="background-color:var(--primary); font-size:12px; line-height:2;">{{p.flair | safe}}</span>{% endif %}
{{p.realtitle(v) | safe}}
</a>
</h1>
{% else %}
<h1 id="post-title" class="card-title post-title text-left mb-md-3 {% if p.author.agendaposter and p.sub != 'chudrama' %}text-uppercase{% endif %} {% if p.author.rainbow %}rainbow-text{% endif %}">
<h1 id="post-title" class="card-title post-title text-left mb-md-3 {% if p.author.agendaposter and p.sub != 'chudrama' %}text-uppercase{% endif %} {% if p.author.rainbow %}rainbow-text{% endif %} {%if p.author.misogynist%}misogynist{%endif%}">
{% if p.flair %}<span class="patron font-weight-bolder mr-1" style="background-color:var(--primary); font-size:12px; line-height:2;">{{p.flair | safe}}</span>{% endif %}
{{p.realtitle(v) | safe}}
</h1>
@ -117,7 +117,7 @@
{% endif %}
<div id="post-text" class="{% if p.author.agendaposter and p.sub != 'chudrama' %}text-uppercase agendaposter-img agendaposter-{{p.id_last_num}}{% endif %} {% if p.author.rainbow %}rainbow-text{% endif %}">
<div id="post-text" class="{% if p.author.agendaposter and p.sub != 'chudrama' %}text-uppercase agendaposter-img agendaposter-{{p.id_last_num}}{% endif %} {% if p.author.rainbow %}rainbow-text{% endif %} {%if p.author.misogynist%}misogynist{%endif%}">
{% if p.is_image %}
<div class="row no-gutters mb-4">
<div class="col">

View File

@ -208,7 +208,7 @@
{% if not v_forbid_deleted %}
{% if p.realbody(v, listing=True) %}
<div class="d-none card rounded border {% if p.author.agendaposter and p.sub != 'chudrama' %}text-uppercase agendaposter-img agendaposter-{{p.id_last_num}}{% endif %} {% if p.author.rainbow %}rainbow-text{% endif %} post-preview" id="post-text-{{p.id}}">
<div class="d-none card rounded border {% if p.author.agendaposter and p.sub != 'chudrama' %}text-uppercase agendaposter-img agendaposter-{{p.id_last_num}}{% endif %} {% if p.author.rainbow %}rainbow-text{% endif %} {%if p.author.misogynist%}misogynist{%endif%} post-preview" id="post-text-{{p.id}}">
{{p.realbody(v, listing=True) | safe}}
</div>
{% endif %}

View File

@ -0,0 +1 @@
alter table users add column misogynist integer;