From 3b271cf1be5b4bdf602dbcc416b6885ca3648382 Mon Sep 17 00:00:00 2001 From: Chuck Sneed Date: Sun, 25 Jun 2023 14:33:26 -0500 Subject: [PATCH 1/6] more queenshit (I couldn't help myself) --- files/helpers/regex.py | 14 ++++++++++++++ files/helpers/sanitize.py | 8 ++++++++ 2 files changed, 22 insertions(+) diff --git a/files/helpers/regex.py b/files/helpers/regex.py index 878f53700..daa96b50f 100644 --- a/files/helpers/regex.py +++ b/files/helpers/regex.py @@ -82,6 +82,20 @@ like_before_regex = re.compile('(?<=^|(?<=\s))(?+)', flags=re.I|re.A) image_check_regex = re.compile(f'!\[\]\(((?!(https:\/\/({hosts})\/|\/)).*?)\)', flags=re.A) diff --git a/files/helpers/sanitize.py b/files/helpers/sanitize.py index 9aa958c47..0393506f3 100644 --- a/files/helpers/sanitize.py +++ b/files/helpers/sanitize.py @@ -701,6 +701,14 @@ def torture_queen(string, key): string = greeting_regex.sub(r"hiiiiiiiiii", string) string = like_after_regex.sub(r"\g<1> like", string) string = like_before_regex.sub(r"like \g<1>", string) + string = redpilled_regex.sub(r"goodpill\g<2>", string) + string = based_and_x_pilled_regex.sub(r"comfy \g<2> vibes", string) + string = based_regex.sub(r"comfy", string) + string = x_pilled_regex.sub(r"\g<2> vibes", string) + string = xmax_regex.sub(r"normalize good \g<2>s", string) + string = xmaxing_regex.sub(r"normalizing good \g<2>s", string) + string = xmaxed_regex.sub(r"normalized good \g<2>s", string) + string = normal_punctuation_regex.sub("", string) string = more_than_one_comma_regex.sub(",", string) if string[-5:] == ', and': -- 2.34.1 From 3813c0b4cfe483c778ff5e5cf23139695a00f0f2 Mon Sep 17 00:00:00 2001 From: Chuck Sneed Date: Sun, 25 Jun 2023 17:59:36 -0500 Subject: [PATCH 2/6] Add the sharpen award --- files/classes/user.py | 1 + files/helpers/config/awards.py | 13 ++++++++++- files/helpers/config/const.py | 1 + files/helpers/cron.py | 1 + files/helpers/regex.py | 7 ++++++ files/helpers/sharpen.py | 8 +++++++ files/routes/awards.py | 27 ++++++++++++++++++++++- files/routes/comments.py | 4 ++++ migrations/20230625-add-sharpen-award.sql | 1 + schema.sql | 7 ++++++ 10 files changed, 68 insertions(+), 2 deletions(-) create mode 100644 files/helpers/sharpen.py create mode 100644 migrations/20230625-add-sharpen-award.sql diff --git a/files/classes/user.py b/files/classes/user.py index af6bd95d4..b8d41608f 100644 --- a/files/classes/user.py +++ b/files/classes/user.py @@ -155,6 +155,7 @@ class User(Base): bite = Column(Integer, default=0) earlylife = Column(Integer, default=0) owoify = Column(Integer, default=0) + sharpen = Column(Integer, default=0) marsify = Column(Integer, default=0) rainbow = Column(Integer, default=0) spider = Column(Integer, default=0) diff --git a/files/helpers/config/awards.py b/files/helpers/config/awards.py index cb19a11b3..72a6523b9 100644 --- a/files/helpers/config/awards.py +++ b/files/helpers/config/awards.py @@ -494,7 +494,6 @@ AWARDS = { "ghost": False, "enabled": SITE_NAME != 'rDrama', }, - "rehab": { "kind": "rehab", "title": "Rehab", @@ -507,6 +506,18 @@ AWARDS = { "ghost": False, "enabled": True, }, + "sharpen": { + "kind": "sharpen", + "title": "Sharpen", + "description": "Adds a badass edge to all user's comments", + "icon": "fas fa-fire", + "color": "text-danger", + "price": 500, + "deflectable": True, + "cosmetic": False, + "ghost": False, + "enabled": True, + }, "flairlock": { "kind": "flairlock", "title": "1-Day Flairlock", diff --git a/files/helpers/config/const.py b/files/helpers/config/const.py index 4c6423b6d..ac6d60eb5 100644 --- a/files/helpers/config/const.py +++ b/files/helpers/config/const.py @@ -1112,6 +1112,7 @@ forced_hats = { "bite": ("Vampire Mask", "When other little girls wanted to be ballet dancers I kind of wanted to be a vampire."), "rainbow": ("Globohomo", "Homosexuality is no longer optional!"), "owoify": ("Cat Ears (wiggly)", "Nuzzles, pounces on you, UwU, you're so warm!.."), + "sharpen": ("Bane Mask", "No one understands..."), "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!"), diff --git a/files/helpers/cron.py b/files/helpers/cron.py index 3e39b02d4..a060800b5 100644 --- a/files/helpers/cron.py +++ b/files/helpers/cron.py @@ -202,6 +202,7 @@ def _award_timers_task(): _process_timer(User.marseyawarded, [98], "The marsey award you received has expired!") _process_timer(User.rehab, [109], "The rehab award you received has expired!") _process_timer(User.owoify, [167], "The OwOify award you received has expired!") + _process_timer(User.sharpen, [], "The Sharpen award you received has expired!") #TODO: badge _process_timer(User.bite, [168], "The bite award you received has expired! You're now back in your original house!", { User.house: User.old_house, User.old_house: '', diff --git a/files/helpers/regex.py b/files/helpers/regex.py index daa96b50f..452434f77 100644 --- a/files/helpers/regex.py +++ b/files/helpers/regex.py @@ -98,6 +98,13 @@ xmaxed_regex = re.compile('(?<=^|(?<=\s))(([a-zA-Z]+?)(s)?max*ed)(?=$|\n|\s|[.?! xmaxing_regex = re.compile('(?<=^|(?<=\s))(([a-zA-Z]+?)(s)?max*ing)(?=$|\n|\s|[.?!,])', flags=re.I|re.A) initial_part_regex = re.compile('(?<=^)(>+)', flags=re.I|re.A) +#matches "the" or is, but only if it is not followed by "fucking" +the_fucking_regex = re.compile('(?<=^|(?<=\s))(the|is)(?! fucking)(?=$|\n|\s|[.?!,])', flags=re.I|re.A) +#matches a single question mark but only if it isn't preceded by ", bitch" +bitch_question_mark_regex = re.compile('(? fucking", string) + string = bitch_question_mark_regex.sub(", bitch?", string) + string = exclamation_point_regex.sub(", motherfucker!", string) + return string diff --git a/files/routes/awards.py b/files/routes/awards.py index 9b58e0dcd..79f37b3f1 100644 --- a/files/routes/awards.py +++ b/files/routes/awards.py @@ -13,6 +13,7 @@ from files.helpers.config.awards import AWARDS_ENABLED, HOUSE_AWARDS, LOOTBOX_IT from files.helpers.get import * from files.helpers.marsify import marsify from files.helpers.owoify import owoify +from files.helpers.sharpen import sharpen from files.helpers.regex import * from files.helpers.sanitize import filter_emojis_only from files.helpers.useractions import * @@ -330,6 +331,9 @@ def award_thing(v, thing_type, id): if author.owoify: abort(409, f"{safe_username} is under the effect of a conflicting award: OwOify award!") + if author.sharpen: + abort(409, f"{safe_username} is under the effect of a conflicting award: Sharpen!") + if not author.queen: characters = list(filter(str.isalpha, author.username)) if characters: @@ -376,6 +380,9 @@ def award_thing(v, thing_type, id): if author.owoify: abort(409, f"{safe_username} is under the effect of a conflicting award: OwOify award!") + if author.sharpen: + abort(409, f"{safe_username} is under the effect of a conflicting award: Sharpen!") + if author.chud == 1: abort(409, f"{safe_username} is already chudded permanently!") @@ -495,7 +502,8 @@ def award_thing(v, thing_type, id): abort(409, f"{safe_username} is under the effect of a conflicting award: Chud award!") if author.queen: abort(409, f"{safe_username} is under the effect of a conflicting award: Queen award!") - + if author.sharpen: + abort(409, f"{safe_username} is under the effect of a conflicting award: Sharpen!") if not author.marsify or author.marsify != 1: if author.marsify: author.marsify += 86400 else: author.marsify = int(time.time()) + 86400 @@ -527,6 +535,8 @@ def award_thing(v, thing_type, id): abort(409, f"{safe_username} is under the effect of a conflicting award: Chud award!") if author.queen: abort(409, f"{safe_username} is under the effect of a conflicting award: Queen award!") + if author.sharpen: + abort(409, f"{safe_username} is under the effect of a conflicting award: Sharpen!") if author.owoify: author.owoify += 21600 else: author.owoify = int(time.time()) + 21600 @@ -538,6 +548,21 @@ def award_thing(v, thing_type, id): if author.marsify: body = marsify(body) thing.body_html = sanitize(body, limit_pings=5, showmore=True) g.db.add(thing) + elif kind == 'sharpen': + if author.chud: + abort(409, f"{safe_username} is under the effect of a conflicting award: Chud award!") + if author.queen: + abort(409, f"{safe_username} is under the effect of a conflicting award: Queen award!") + + if author.sharpen: author.sharpen += 21600 + else: author.sharpen = int(time.time()) + 21600 + # badge_grant(user=author, badge_id=167) #TODO: badge + + if thing_type == 'comment' and not thing.author.deflector: + body = thing.body + body = sharpen(body) + thing.body_html = sanitize(body, limit_pings=5, showmore=True) + g.db.add(thing) elif ("Femboy" in kind and kind == v.house) or kind == 'rainbow': if author.rainbow: author.rainbow += 86400 else: author.rainbow = int(time.time()) + 86400 diff --git a/files/routes/comments.py b/files/routes/comments.py index ee84d8b3b..96f531c7c 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -14,6 +14,7 @@ from files.helpers.get import * from files.helpers.marsify import marsify from files.helpers.media import * from files.helpers.owoify import owoify +from files.helpers.sharpen import sharpen from files.helpers.regex import * from files.helpers.slots import * from files.helpers.treasure import * @@ -239,6 +240,7 @@ def comment(v:User): body_for_sanitize = body if v.owoify: body_for_sanitize = owoify(body_for_sanitize) if v.marsify: body_for_sanitize = marsify(body_for_sanitize) + if v.sharpen: body_for_sanitize = sharpen(body_for_sanitize) body_html = sanitize(body_for_sanitize, limit_pings=5, showmore=True, count_emojis=not v.marsify) @@ -634,6 +636,8 @@ def edit_comment(cid, v): body_for_sanitize = owoify(body_for_sanitize) if v.marsify: body_for_sanitize = marsify(body_for_sanitize) + if v.sharpen: + body_for_sanitize = sharpen(body_for_sanitize) body_html = sanitize(body_for_sanitize, golden=False, limit_pings=5, showmore=True) diff --git a/migrations/20230625-add-sharpen-award.sql b/migrations/20230625-add-sharpen-award.sql new file mode 100644 index 000000000..5081da601 --- /dev/null +++ b/migrations/20230625-add-sharpen-award.sql @@ -0,0 +1 @@ +alter table users add column sharpen integer; \ No newline at end of file diff --git a/schema.sql b/schema.sql index 4603ca0e9..90a25b3d7 100644 --- a/schema.sql +++ b/schema.sql @@ -236,6 +236,7 @@ CREATE TABLE public.users ( bite integer, old_house character varying(16), owoify integer, + sharpen integer, marsify integer, is_muted boolean DEFAULT false NOT NULL, coins_spent_on_hats integer DEFAULT 0 NOT NULL, @@ -2280,6 +2281,12 @@ CREATE INDEX users_original_username_trgm_idx ON public.users USING gin (origina CREATE INDEX users_owoify_idx ON public.users USING btree (owoify); +-- +-- Name: users_edgified_idx; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX users_edgified_idx ON public.users USING btree (sharpen); + -- -- Name: users_patron_utc_idx; Type: INDEX; Schema: public; Owner: - -- 2.34.1 From 2f6763834673970ee2a6535138c89589994efe60 Mon Sep 17 00:00:00 2001 From: Chuck Sneed Date: Sun, 25 Jun 2023 22:09:31 -0500 Subject: [PATCH 3/6] regex is the fucking best its ever been --- files/helpers/regex.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/helpers/regex.py b/files/helpers/regex.py index 452434f77..a60e3fa45 100644 --- a/files/helpers/regex.py +++ b/files/helpers/regex.py @@ -99,7 +99,7 @@ xmaxing_regex = re.compile('(?<=^|(?<=\s))(([a-zA-Z]+?)(s)?max*ing)(?=$|\n|\s|[. initial_part_regex = re.compile('(?<=^)(>+)', flags=re.I|re.A) #matches "the" or is, but only if it is not followed by "fucking" -the_fucking_regex = re.compile('(?<=^|(?<=\s))(the|is)(?! fucking)(?=$|\n|\s|[.?!,])', flags=re.I|re.A) +the_fucking_regex = re.compile('(?<=^|(?<=\s))(the|(is (?:your|her|his|their|no|a|not|to|so|this|the|our|what)( (a|the))?)|is)(?=$|\n|\s)(?! fucking)', flags=re.I|re.A) #matches a single question mark but only if it isn't preceded by ", bitch" bitch_question_mark_regex = re.compile('(? Date: Sun, 25 Jun 2023 22:09:56 -0500 Subject: [PATCH 4/6] make comments bloody and cool and shit --- files/assets/css/main.css | 6 ++++++ files/templates/comments.html | 2 +- files/templates/post.html | 6 +++--- files/templates/post_listing.html | 2 +- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/files/assets/css/main.css b/files/assets/css/main.css index 4ea54e4c9..32d39f539 100644 --- a/files/assets/css/main.css +++ b/files/assets/css/main.css @@ -6676,6 +6676,12 @@ g { text-transform: lowercase !important; } +.sharpen:not(a) { + color: red !important; + font-weight: bold !important; + font-style: italic !important; +} + .rainbow-text:not(a) > p { color: transparent !important; } diff --git a/files/templates/comments.html b/files/templates/comments.html index 3fba23e36..809db9ebb 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -246,7 +246,7 @@ {% endif %} {% set realbody = c.realbody(v) %} -
+
{{realbody | safe}}
{% if c.parent_post or c.wall_user_id %} diff --git a/files/templates/post.html b/files/templates/post.html index 3ca79ad79..8ea6e3213 100644 --- a/files/templates/post.html +++ b/files/templates/post.html @@ -81,13 +81,13 @@ {% if p.realurl(v) and not v_forbid_deleted %}

- + {% if p.flair %}{{p.flair | safe}}{% endif %} {{p.realtitle(v) | safe}}

{% else %} -

+

{% if p.flair %}{{p.flair | safe}}{% endif %} {{p.realtitle(v) | safe}}

@@ -117,7 +117,7 @@ {% endif %} -
+
{% if p.is_image %}
diff --git a/files/templates/post_listing.html b/files/templates/post_listing.html index fcb33d38b..80214ee47 100644 --- a/files/templates/post_listing.html +++ b/files/templates/post_listing.html @@ -208,7 +208,7 @@ {% if not v_forbid_deleted %} {% if p.realbody(v, listing=True) %} -
+
{{p.realbody(v, listing=True) | safe}}
{% endif %} -- 2.34.1 From d5987ad70e71325d41a6a17450936543cdef987b Mon Sep 17 00:00:00 2001 From: Chuck Sneed Date: Mon, 26 Jun 2023 08:55:13 -0500 Subject: [PATCH 5/6] The fucking best regex ever --- files/helpers/regex.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/files/helpers/regex.py b/files/helpers/regex.py index a60e3fa45..dfc911e6d 100644 --- a/files/helpers/regex.py +++ b/files/helpers/regex.py @@ -98,8 +98,8 @@ xmaxed_regex = re.compile('(?<=^|(?<=\s))(([a-zA-Z]+?)(s)?max*ed)(?=$|\n|\s|[.?! xmaxing_regex = re.compile('(?<=^|(?<=\s))(([a-zA-Z]+?)(s)?max*ing)(?=$|\n|\s|[.?!,])', flags=re.I|re.A) initial_part_regex = re.compile('(?<=^)(>+)', flags=re.I|re.A) -#matches "the" or is, but only if it is not followed by "fucking" -the_fucking_regex = re.compile('(?<=^|(?<=\s))(the|(is (?:your|her|his|their|no|a|not|to|so|this|the|our|what)( (a|the))?)|is)(?=$|\n|\s)(?! fucking)', flags=re.I|re.A) +#matches "the" or is, but only if it is not followed by "fucking". https://regex101.com/r/yxuYsQ/2 +the_fucking_regex = re.compile('(?<=^|(?<=\s))((?:the|a)( (?:only))?|((that )?(?:is|are|was|were|will be|would be)( (?:your|her|his|their|no|a|not|to|too|so|this|the|our|what))?( (a|the))?)|is)(?=\s)(?! fucking)', flags=re.I|re.A) #matches a single question mark but only if it isn't preceded by ", bitch" bitch_question_mark_regex = re.compile('(? Date: Mon, 26 Jun 2023 09:00:01 -0500 Subject: [PATCH 6/6] Add the badge --- files/helpers/cron.py | 2 +- files/routes/awards.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/files/helpers/cron.py b/files/helpers/cron.py index a060800b5..2705fcec4 100644 --- a/files/helpers/cron.py +++ b/files/helpers/cron.py @@ -202,7 +202,7 @@ def _award_timers_task(): _process_timer(User.marseyawarded, [98], "The marsey award you received has expired!") _process_timer(User.rehab, [109], "The rehab award you received has expired!") _process_timer(User.owoify, [167], "The OwOify award you received has expired!") - _process_timer(User.sharpen, [], "The Sharpen award you received has expired!") #TODO: badge + _process_timer(User.sharpen, [289], "The Sharpen award you received has expired!") _process_timer(User.bite, [168], "The bite award you received has expired! You're now back in your original house!", { User.house: User.old_house, User.old_house: '', diff --git a/files/routes/awards.py b/files/routes/awards.py index 79f37b3f1..75bad66e5 100644 --- a/files/routes/awards.py +++ b/files/routes/awards.py @@ -556,7 +556,7 @@ def award_thing(v, thing_type, id): if author.sharpen: author.sharpen += 21600 else: author.sharpen = int(time.time()) + 21600 - # badge_grant(user=author, badge_id=167) #TODO: badge + badge_grant(user=author, badge_id=289) if thing_type == 'comment' and not thing.author.deflector: body = thing.body -- 2.34.1