' in body:
- return body
-
- if not logged_user or logged_user == 'chat' or logged_user.slurreplacer:
- body = replace_re(body, slur_regex, slur_regex_title, slur_regex_upper, sub_matcher_slurs, sub_matcher_slurs_title, sub_matcher_slurs_upper)
-
- if SITE_NAME == 'rDrama':
- if not logged_user or logged_user == 'chat' or logged_user.profanityreplacer:
- body = replace_re(body, profanity_regex, profanity_regex_title, profanity_regex_upper, sub_matcher_profanities, sub_matcher_profanities_title, sub_matcher_profanities_upper)
-
- return body
-
commands = {
"fortune": FORTUNE_REPLIES,
"factcheck": FACTCHECK_REPLIES,
@@ -279,6 +188,8 @@ reddit_s_url_regex = re.compile("https:\/\/reddit.com\/[ru]\/\w{2,25}\/s\/\w{10}
#run-time
reddit_to_vreddit_regex = re.compile('(^|>|")https:\/\/old.reddit.com\/(r|user)\/', flags=re.A)
+#post search
+subreddit_name_regex = re.compile('\w{2,25}', flags=re.A)
###YOUTUBE
diff --git a/files/helpers/sanitize.py b/files/helpers/sanitize.py
index f5ecc46fc..454ab915b 100644
--- a/files/helpers/sanitize.py
+++ b/files/helpers/sanitize.py
@@ -260,6 +260,15 @@ def find_all_emote_endings(word):
is_non_ending_found = True
+ if word.endswith('random'):
+ kind = word.split('random')[0].title()
+ if kind == 'Donkeykong': kind = 'Donkey Kong'
+ elif kind == 'Marseyflag': kind = 'Marsey Flags'
+ elif kind == 'Marseyalphabet': kind = 'Marsey Alphabet'
+
+ if kind in EMOJI_KINDS:
+ word = g.db.query(Emoji.name).filter_by(kind=kind).order_by(func.random()).first()[0]
+
return endings, word
@@ -282,16 +291,6 @@ def render_emoji(html, regexp, golden, emojis_used, b=False, is_title=False):
old = emoji
emoji = emoji.replace('!','').replace('#','')
- if emoji.endswith('random'):
- kind = emoji.split('random')[0].title()
- if kind == 'Donkeykong': kind = 'Donkey Kong'
- elif kind == 'Marseyflag': kind = 'Marsey Flags'
- elif kind == 'Marseyalphabet': kind = 'Marsey Alphabet'
-
- if kind in EMOJI_KINDS:
- emoji = g.db.query(Emoji.name).filter_by(kind=kind).order_by(func.random()).first()[0]
-
-
emoji_partial_pat = ''
emoji_partial = ''
emoji_html = None
@@ -449,7 +448,7 @@ def sanitize(sanitized, golden=True, limit_pings=0, showmore=False, count_emojis
sanitized = sanitized.replace('/\1', sanitized)
- sanitized = sub_regex.sub(r'/\1', sanitized)
+ sanitized = hole_mention_regex.sub(r'/\1', sanitized)
v = getattr(g, 'v', None)
@@ -582,6 +581,8 @@ def sanitize(sanitized, golden=True, limit_pings=0, showmore=False, count_emojis
#doing this here cuz of the linkifyfilter right above it (therefore unifying all link processing logic)
soup = BeautifulSoup(sanitized, 'lxml')
+ has_transform = bool(soup.select('[style*=transform]'))
+
links = soup.find_all("a")
if g.v and g.v.admin_level >= PERMS["IGNORE_DOMAIN_BAN"]:
@@ -645,6 +646,9 @@ def sanitize(sanitized, golden=True, limit_pings=0, showmore=False, count_emojis
link["target"] = "_blank"
link["rel"] = "nofollow noopener"
+ if has_transform:
+ del link["href"]
+
sanitized = str(soup).replace('','').replace('','').replace('/>','>')
captured = []
diff --git a/files/helpers/sharpen.py b/files/helpers/sharpen.py
index 6f52dfeb8..04903ec53 100644
--- a/files/helpers/sharpen.py
+++ b/files/helpers/sharpen.py
@@ -1,4 +1,3 @@
-import re
from files.helpers.regex import *
def sharpen(string):
diff --git a/files/helpers/slurs_and_profanities.py b/files/helpers/slurs_and_profanities.py
new file mode 100644
index 000000000..3422502ae
--- /dev/null
+++ b/files/helpers/slurs_and_profanities.py
@@ -0,0 +1,167 @@
+import re
+from .config.const import *
+
+tranny = f''
+trannie = f''
+troon = f''
+
+def replace_train_html(body):
+ body = body.replace(tranny, ':marseytrain:')
+ body = body.replace(trannie, ':!marseytrain:')
+ body = body.replace(troon, ':marseytrain2:')
+ return body
+
+SLURS = {
+ "tranny": tranny,
+ "trannie": trannie,
+ "troon": troon,
+ "(?]*>|{slur_single_words}", flags=re.I|re.A)
+profanity_regex = re.compile(f"<[^>]*>|{profanity_single_words}", flags=re.I|re.A)
+
+SLURS_FOR_REPLACING = {}
+for k, val in SLURS.items():
+ newkey = k.split('(?!')[0]
+ if ')' in newkey:
+ newkey = newkey.split(')')[1]
+ SLURS_FOR_REPLACING[newkey] = val
+
+PROFANITIES_FOR_REPLACING = {}
+for k, val in PROFANITIES.items():
+ newkey = k.split('(?!')[0]
+ if ')' in newkey:
+ newkey = newkey.split(')')[1]
+ PROFANITIES_FOR_REPLACING[newkey] = val
+
+
+
+def sub_matcher(match, X_FOR_REPLACING):
+ group_num = 0
+ match_str = match.group(group_num)
+ if match_str.startswith('<'):
+ return match_str
+ else:
+ repl = X_FOR_REPLACING[match_str.lower()]
+ if match_str.isupper():
+ return repl.upper()
+ if match_str.istitle():
+ return repl.title()
+ return repl
+
+def sub_matcher_slurs(match):
+ return sub_matcher(match, SLURS_FOR_REPLACING)
+
+def sub_matcher_profanities(match):
+ return sub_matcher(match, PROFANITIES_FOR_REPLACING)
+
+
+
+def censor_slurs_profanities(body, logged_user):
+ if not body: return ""
+
+ if '' in body or '' in body:
+ return body
+
+ if not logged_user or logged_user == 'chat' or logged_user.slurreplacer:
+ body = slur_regex.sub(sub_matcher_slurs, body)
+
+ if SITE_NAME == 'rDrama':
+ if not logged_user or logged_user == 'chat' or logged_user.profanityreplacer:
+ body = profanity_regex.sub(sub_matcher_profanities, body)
+
+ return body
diff --git a/files/helpers/twentyone.py b/files/helpers/twentyone.py
index bcfd6d9f0..e294d2c94 100644
--- a/files/helpers/twentyone.py
+++ b/files/helpers/twentyone.py
@@ -269,7 +269,7 @@ def can_double_down(state):
player = state['player']
player_hand_value = get_value_of_hand(player)
player_never_hit = len(player) == 2
- return not state['has_player_split'] and player_hand_value in (10, 11) and player_never_hit
+ return not state['has_player_split'] and player_hand_value in (9, 10, 11) and player_never_hit
def can_split(state):
player = state['player']
diff --git a/files/routes/__init__.py b/files/routes/__init__.py
index 3510dfad4..c718c313f 100644
--- a/files/routes/__init__.py
+++ b/files/routes/__init__.py
@@ -56,4 +56,4 @@ if IS_LOCALHOST:
if "cron" not in argv and "load_chat" not in argv:
from files.helpers.cron import cron_fn
print('Starting cron tasks!', flush=True)
- gevent.spawn(cron_fn, True, False, False, False, False, False, False, False, False, False)
+ gevent.spawn(cron_fn, True, False, False, False, False, False, False, False, False, False, False)
diff --git a/files/routes/admin.py b/files/routes/admin.py
index 8cb2e3a60..abeed62c9 100644
--- a/files/routes/admin.py
+++ b/files/routes/admin.py
@@ -11,6 +11,7 @@ from files.helpers.actions import *
from files.helpers.alerts import *
from files.helpers.cloudflare import *
from files.helpers.config.const import *
+from files.helpers.slurs_and_profanities import censor_slurs_profanities
from files.helpers.get import *
from files.helpers.media import *
from files.helpers.sanitize import *
@@ -909,7 +910,7 @@ def admin_title_change(user_id, v):
user.customtitleplain = new_name
new_name = filter_emojis_only(new_name)
- new_name = censor_slurs(new_name, None)
+ new_name = censor_slurs_profanities(new_name, None)
user = get_account(user.id)
user.customtitle=new_name
diff --git a/files/routes/awards.py b/files/routes/awards.py
index d0037ecaa..8e6500d07 100644
--- a/files/routes/awards.py
+++ b/files/routes/awards.py
@@ -9,6 +9,7 @@ from files.classes.userblock import UserBlock
from files.helpers.actions import *
from files.helpers.alerts import *
from files.helpers.config.const import *
+from files.helpers.slurs_and_profanities import censor_slurs_profanities
from files.helpers.config.awards import AWARDS_ENABLED, HOUSE_AWARDS, LOOTBOX_ITEM_COUNT, LOOTBOX_CONTENTS
from files.helpers.get import *
from files.helpers.marsify import marsify
@@ -48,7 +49,7 @@ def shop(v):
val["baseprice"] = int(val["price"])
if val["kind"].endswith('Founder'):
val["baseprice"] = int(val["baseprice"] / 0.75)
- val["price"] = int(val["price"] * v.discount)
+ val["price"] = int(val["price"] * v.award_discount)
sales = g.db.query(func.sum(User.coins_spent)).scalar()
return render_template("shop.html", awards=list(AWARDS.values()), v=v, sales=sales)
@@ -73,7 +74,7 @@ def buy(v, award):
og_price = AWARDS[award]["price"]
award_title = AWARDS[award]['title']
- price = int(og_price * v.discount)
+ price = int(og_price * v.award_discount)
if award == "grass":
@@ -394,7 +395,7 @@ def award_thing(v, thing_type, id):
else:
author.customtitleplain = new_name
new_name = filter_emojis_only(new_name)
- new_name = censor_slurs(new_name, None)
+ new_name = censor_slurs_profanities(new_name, None)
if len(new_name) > 1000: abort(403)
author.customtitle = new_name
author.flairchanged = int(time.time()) + 86400
@@ -461,7 +462,7 @@ def award_thing(v, thing_type, id):
author.patron = 1
if author.patron_utc: author.patron_utc += 2629746
else: author.patron_utc = int(time.time()) + 2629746
- author.pay_account('marseybux', 2500)
+ author.pay_account('marseybux', 2000)
badge_grant(user=v, badge_id=103)
elif kind == "rehab":
if author.rehab: author.rehab += 86400
diff --git a/files/routes/chat.py b/files/routes/chat.py
index 5ab422259..d76466069 100644
--- a/files/routes/chat.py
+++ b/files/routes/chat.py
@@ -9,6 +9,7 @@ from flask import request
from files.helpers.actions import *
from files.helpers.alerts import *
from files.helpers.config.const import *
+from files.helpers.slurs_and_profanities import censor_slurs_profanities
from files.helpers.regex import *
from files.helpers.media import *
from files.helpers.sanitize import *
@@ -167,9 +168,9 @@ def speak(data, v):
"namecolor": v.name_color,
"patron": v.patron,
"text": text,
- "text_censored": censor_slurs(text, 'chat'),
+ "text_censored": censor_slurs_profanities(text, 'chat'),
"text_html": text_html,
- "text_html_censored": censor_slurs(text_html, 'chat'),
+ "text_html_censored": censor_slurs_profanities(text_html, 'chat'),
"time": int(time.time()),
}
diff --git a/files/routes/comments.py b/files/routes/comments.py
index d102de9d5..2f0d8f765 100644
--- a/files/routes/comments.py
+++ b/files/routes/comments.py
@@ -663,12 +663,10 @@ def edit_comment(cid, v):
abort(400, "You have to actually type something!")
if body != c.body or request.files.get("file") and not g.is_tor:
-
- if v.id == c.author_id:
- if v.longpost and (len(body) < 280 or ' [](' in body or body.startswith('[](')):
- abort(403, "You have to type more than 280 characters!")
- elif v.bird and len(body) > 140:
- abort(403, "You have to type less than 140 characters!")
+ if c.author.longpost and (len(body) < 280 or ' [](' in body or body.startswith('[](')):
+ abort(403, "You have to type more than 280 characters!")
+ elif c.author.bird and len(body) > 140:
+ abort(403, "You have to type less than 140 characters!")
execute_antispam_comment_check(body, v)
@@ -677,11 +675,10 @@ def edit_comment(cid, v):
body_for_sanitize = body
- if v.id == c.author_id:
- if v.owoify:
- body_for_sanitize = owoify(body_for_sanitize)
- if v.marsify and not v.chud:
- body_for_sanitize = marsify(body_for_sanitize)
+ if c.author.owoify:
+ body_for_sanitize = owoify(body_for_sanitize)
+ if c.author.marsify and not c.author.chud:
+ body_for_sanitize = marsify(body_for_sanitize)
if c.sharpened:
body_for_sanitize = sharpen(body_for_sanitize)
@@ -690,7 +687,7 @@ def edit_comment(cid, v):
if len(body_html) > COMMENT_BODY_HTML_LENGTH_LIMIT: abort(400)
- if v.id == c.author_id and v.marseyawarded and marseyaward_body_regex.search(body_html):
+ if c.author.marseyawarded and marseyaward_body_regex.search(body_html):
abort(403, "You can only type marseys!")
oldtext = c.body
@@ -702,7 +699,7 @@ def edit_comment(cid, v):
execute_blackjack(v, c, c.body, "comment")
if not complies_with_chud(c):
- abort(403, f'You have to include "{v.chud_phrase}" in your comment!')
+ abort(403, f'You have to include "{c.author.chud_phrase}" in your comment!')
process_poll_options(v, c)
diff --git a/files/routes/posts.py b/files/routes/posts.py
index 696c95539..697f55913 100644
--- a/files/routes/posts.py
+++ b/files/routes/posts.py
@@ -995,11 +995,10 @@ def edit_post(pid, v):
body = request.values.get("body", "")
body = body[:POST_BODY_LENGTH_LIMIT(g.v)].strip()
- if v.id == p.author_id:
- if v.longpost and (len(body) < 280 or ' [](' in body or body.startswith('[](')):
- abort(403, "You have to type more than 280 characters!")
- elif v.bird and len(body) > 140:
- abort(403, "You have to type less than 140 characters!")
+ if p.author.longpost and (len(body) < 280 or ' [](' in body or body.startswith('[](')):
+ abort(403, "You have to type more than 280 characters!")
+ elif p.author.bird and len(body) > 140:
+ abort(403, "You have to type less than 140 characters!")
if not title:
abort(400, "Please enter a better title!")
@@ -1019,7 +1018,7 @@ def edit_post(pid, v):
if title != p.title:
title_html = filter_emojis_only(title, golden=False)
- if v.id == p.author_id and v.marseyawarded and not marseyaward_title_regex.fullmatch(title_html):
+ if p.author.marseyawarded and not marseyaward_title_regex.fullmatch(title_html):
abort(403, "You can only type marseys!")
if 'megathread' in title.lower() and 'megathread' not in p.title.lower():
@@ -1037,7 +1036,7 @@ def edit_post(pid, v):
body_html = sanitize(body_for_sanitize, golden=False, limit_pings=100)
- if v.id == p.author_id and v.marseyawarded and marseyaward_body_regex.search(body_html):
+ if p.author.marseyawarded and marseyaward_body_regex.search(body_html):
abort(403, "You can only type marseys!")
@@ -1057,7 +1056,7 @@ def edit_post(pid, v):
if not complies_with_chud(p):
- abort(403, f'You have to include "{v.chud_phrase}" in your post!')
+ abort(403, f'You have to include "{p.author.chud_phrase}" in your post!')
if v.id == p.author_id:
diff --git a/files/routes/search.py b/files/routes/search.py
index fb77214bf..3dd4dd115 100644
--- a/files/routes/search.py
+++ b/files/routes/search.py
@@ -22,6 +22,7 @@ valid_params = [
'title',
'sentto',
search_operator_hole,
+ 'subreddit',
]
def searchparse(text):
@@ -114,27 +115,30 @@ def searchposts(v):
if 'over18' in criteria: posts = posts.filter(Post.over_18==True)
if 'domain' in criteria:
- domain=criteria['domain']
+ domain = criteria['domain']
domain = domain.replace('\\', '').replace('_', '\_').replace('%', '').strip()
- posts=posts.filter(
+ posts = posts.filter(
or_(
Post.url.ilike("https://"+domain+'/%'),
- Post.url.ilike("https://"+domain+'/%'),
- Post.url.ilike("https://"+domain),
Post.url.ilike("https://"+domain),
Post.url.ilike("https://www."+domain+'/%'),
- Post.url.ilike("https://www."+domain+'/%'),
- Post.url.ilike("https://www."+domain),
Post.url.ilike("https://www."+domain),
Post.url.ilike("https://old." + domain + '/%'),
- Post.url.ilike("https://old." + domain + '/%'),
- Post.url.ilike("https://old." + domain),
Post.url.ilike("https://old." + domain)
)
)
+ if 'subreddit' in criteria:
+ subreddit = criteria['subreddit']
+
+ if not subreddit_name_regex.fullmatch(subreddit):
+ abort(400, "Invalid subreddit name.")
+
+ posts = posts.filter(Post.url.ilike(f"https://old.reddit.com/r/{subreddit}/%"))
+
+
if search_operator_hole in criteria:
posts = posts.filter(Post.sub == criteria[search_operator_hole])
diff --git a/files/routes/settings.py b/files/routes/settings.py
index fcd27ba7d..c0140aca9 100644
--- a/files/routes/settings.py
+++ b/files/routes/settings.py
@@ -12,6 +12,7 @@ from sqlalchemy.orm import load_only
from files.helpers.actions import *
from files.helpers.alerts import *
from files.helpers.config.const import *
+from files.helpers.slurs_and_profanities import censor_slurs_profanities
from files.helpers.get import *
from files.helpers.mail import *
from files.helpers.media import *
@@ -908,7 +909,7 @@ def settings_title_change(v):
if customtitleplain:
customtitle = filter_emojis_only(customtitleplain)
- customtitle = censor_slurs(customtitle, None)
+ customtitle = censor_slurs_profanities(customtitle, None)
if len(customtitle) > 1000:
abort(400, "Flair too long!")
diff --git a/files/templates/casino/blackjack_screen.html b/files/templates/casino/blackjack_screen.html
index fc1a20d5b..6c11c00bb 100644
--- a/files/templates/casino/blackjack_screen.html
+++ b/files/templates/casino/blackjack_screen.html
@@ -15,17 +15,16 @@
-
+
-
@@ -171,7 +171,7 @@
diff --git a/files/templates/shop.html b/files/templates/shop.html
index e25ee2c11..6f29ae598 100644
--- a/files/templates/shop.html
+++ b/files/templates/shop.html
@@ -29,7 +29,7 @@
{% if FEATURES['MARSEYBUX'] %}
Your current marseybux: {{"{:,}".format(v.marseybux)}}
{% endif %}
- Your total award discount: {{v.formatted_discount}}
+ Your total award discount: {{v.formatted_award_discount}}
{% endblock %}
diff --git a/files/templates/sub/settings.html b/files/templates/sub/settings.html
index 492fefe42..cfaaba06c 100644
--- a/files/templates/sub/settings.html
+++ b/files/templates/sub/settings.html
@@ -22,7 +22,7 @@
@@ -36,7 +36,7 @@
diff --git a/files/templates/userpage/banner.html b/files/templates/userpage/banner.html
index 869a72cd9..79904a39d 100644
--- a/files/templates/userpage/banner.html
+++ b/files/templates/userpage/banner.html
@@ -245,7 +245,7 @@
Lifetime donated: ${{u.lifetimedonated}} (shown to you only)
{% endif %}
- Total award discount: {{u.formatted_discount}}
+ Total award discount: {{u.formatted_award_discount}}
{% if u.is_private %}
User has private mode enabled
@@ -394,7 +394,7 @@
{% if FEATURES['USERS_PROFILE_BODYTEXT'] -%}
{% if u.bio_html and u.can_see_my_shit %}
- {{u.bio_html | safe}}
+ {{u.bio_html | safe}}
{% endif %}
{% if u.friends_html and u.can_see_my_shit %}
@@ -533,7 +533,7 @@
Lifetime donated: ${{u.lifetimedonated}} (shown to you only)
{% endif %}
- Total award discount: {{u.formatted_discount}}
+ Total award discount: {{u.formatted_award_discount}}
{% if u.is_private %}
User has private mode enabled
diff --git a/snappy_WPD.txt b/snappy_WPD.txt
index 1f27c3525..6911e2bf2 100644
--- a/snappy_WPD.txt
+++ b/snappy_WPD.txt
@@ -3327,3 +3327,55 @@ How’s that job going? Still working at the gay retard factory?
Instead of saying “speaking as a woman”, just make your point without the preamble. People will know that you’re a woman by noticing that what you’re saying is wrong.
{[para]}
https://i.watchpeopledie.tv/images/16950118870526097.webp
+{[para]}
+Pisses me right off!..
+
+Especially when a guy
+
+(who used to basically be my step dad.... not joking.)
+
+GOT 40 YEARS!!!!!!!!!! 😡
+
+What?
+
+What did he do you ask?...
+
+He drove...
+
+(under the threat of his girlfriend..
+
+[being my mum..at the time]
+
+and his family..
+
+[being me and his own mum]
+
+being shot)
+
+a close friend of his around a bit........
+
+Who critically injured his ex partner with a sawed off shotgun,
+
+Then shot her new boyfriend..who later died,
+
+Then went on to shoot a police officer in the face through the officers side window.. resulting in the officer being permanently blinded in both eyes.
+
+My (basically) step-dad didn't pull a trigger at all............
+
+BUT AGAIN!.... HE GOT F-O-R-T-Y YEARSSS!!!!!!!! 😤
+
+So if what you're saying about this bitch is true.......
+
+Only getting......
+
+8 years..........
+
+In a place where the death penalty is. 😐😕 Wow!
+
+(The crime I'm referring to happened in United Kingdom)
+
+Sorry about the rant. You're comment about 8 years got me riled up about the justice system.
+
+P.S...... Yes i like putting lots of full stops and starting new lines 😂.
+{[para]}
+get off this site retard
diff --git a/snappy_rDrama.txt b/snappy_rDrama.txt
index e8948e088..23e02176a 100644
--- a/snappy_rDrama.txt
+++ b/snappy_rDrama.txt
@@ -4484,3 +4484,13 @@ mom said its my turn to post this
:stabl#er:
{[para]}
https://i.rdrama.net/images/16952178175040581.webp
+{[para]}
+Are the Redditors biting son?
+{[para]}
+"But lo, the butt was flat. And so Abraham wept unto the sky, "O Lord, why hast thou forced a pancake butt upon my household?" - Bimothy 14:88
+{[para]}
+Ezekiel 23:20
+{[para]}
+https://i.rdrama.net/images/16953344801317484.webp
+{[para]}
+https://i.rdrama.net/images/16954095136634.webp