remotes/1693045480750635534/spooky-22
Aevann1 2022-03-01 01:30:44 +02:00
parent fa641a50c1
commit 94f2a69167
10 changed files with 48 additions and 151 deletions

View File

@ -341,7 +341,11 @@ class Comment(Base):
if v.nitter and not '/i/' in body: body = body.replace("www.twitter.com", "nitter.net").replace("twitter.com", "nitter.net")
if v and v.controversial:
captured = []
for i in controversial_regex.finditer(body):
if i.group(0) in captured: continue
captured.append(i.group(0))
url = i.group(1)
p = urlparse(url).query
p = parse_qs(p)

View File

@ -128,7 +128,6 @@ class User(Base):
ban_evade = Column(Integer, default=0)
original_username = deferred(Column(String))
referred_by = Column(Integer, ForeignKey("users.id"))
nwordpass = Column(Boolean)
subs_created = Column(Integer, default=0)
badges = relationship("Badge", viewonly=True)
@ -474,7 +473,7 @@ class User(Base):
if self.profileurl:
if self.profileurl.startswith('/'): return SITE_FULL + self.profileurl
return self.profileurl
if SITE_NAME == 'Drama': return f"{SITE_FULL}/static/assets/images/defaultpictures/bhm/{random.randint(1, 25)}.webp?v=1008"
if SITE_NAME == 'Drama': return f"{SITE_FULL}/static/assets/images/defaultpictures/{random.randint(1, 150)}.webp?v=1008"
return f"{SITE_FULL}/static/assets/images/default-profile-pic.webp?v=1008"
@lazy

View File

@ -67,7 +67,11 @@ def NOTIFY_USERS(text, v):
if id == 0: continue
if word in text.lower() and id not in notify_users and v.id != id: notify_users.add(id)
captured = []
for i in mention_regex.finditer(text):
if i.group(0) in captured: continue
captured.append(i.group(0))
user = get_user(i.group(2), graceful=True)
if user and not v.any_block_exists(user): notify_users.add(user.id)

View File

@ -110,14 +110,9 @@ single_words = "|".join([slur.lower() for slur in SLURS.keys()])
LONGPOST_REPLIES = ('Wow, you must be a JP fan.', 'This is one of the worst posts I have EVER seen. Delete it.', "No, don't reply like this, please do another wall of unhinged rant please.", '# 😴😴😴', "Ma'am we've been over this before. You need to stop.", "I've known more coherent downies.", "Your pulitzer's in the mail", "That's great and all, but I asked for my burger without cheese.", 'That degree finally paying off', "That's nice sweaty. Why don't you have a seat in the time out corner with Pizzashill until you calm down, then you can have your Capri Sun.", "All them words won't bring your pa back.", "You had a chance to not be completely worthless, but it looks like you threw it away. At least you're consistent.", 'Some people are able to display their intelligence by going on at length on a subject and never actually saying anything. This ability is most common in trades such as politics, public relations, and law. You have impressed me by being able to best them all, while still coming off as an absolute idiot.', "You can type 10,000 characters and you decided that these were the one's that you wanted.", 'Have you owned the libs yet?', "I don't know what you said, because I've seen another human naked.", 'Impressive. Normally people with such severe developmental disabilities struggle to write much more than a sentence or two. He really has exceded our expectations for the writing portion. Sadly the coherency of his writing, along with his abilities in the social skills and reading portions, are far behind his peers with similar disabilities.', "This is a really long way of saying you don't fuck.", "Sorry ma'am, looks like his delusions have gotten worse. We'll have to admit him.", ':#marseywoah:', 'If only you could put that energy into your relationships', 'Posts like this is why I do Heroine.', 'still unemployed then?', 'K', 'look im gunna have 2 ask u 2 keep ur giant dumps in the toilet not in my replys 😷😷😷', "Mommy is soooo proud of you, sweaty. Let's put this sperg out up on the fridge with all your other failures.", "Good job bobby, here's a star", "That was a mistake. You're about to find out the hard way why.", f'You sat down and wrote all this shit. You could have done so many other things with your life. What happened to your life that made you decide writing novels of bullshit on {SITE} was the best option?', "I don't have enough spoons to read this shit", "All those words won't bring daddy back.", 'OUT!', "Damn, you're really mad over this, but thanks for the effort you put into typing that all out! Sadly I won't read it all.", "Jesse what the fuck are you talking about??", "▼you're fucking bananas if you think I'm reading all that, take my downvote and shut up idiot")
AGENDAPOSTER_PHRASE = 'black lives matter'
AGENDAPOSTER_PHRASE = 'trans lives matter'
AGENDAPOSTER_MSG = """Hi @{username},\n\nYour {type} has been automatically removed because you forgot
to include `{AGENDAPOSTER_PHRASE}`.\n\nDon't worry, we're here to help! We
won't let you post or comment anything that doesn't express your love and acceptance towards
the black community. Feel free to resubmit your {type} with `{AGENDAPOSTER_PHRASE}`
included. \n\n*This is an automated message; if you need help,
you can message us [here](/contact).*"""
AGENDAPOSTER_MSG = """Hi @{username},\n\nYour {type} has been automatically removed because you forgot to include `{AGENDAPOSTER_PHRASE}`.\n\nDon't worry, we're here to help! We won't let you post or comment anything that doesn't express your love and acceptance towards the trans community. Feel free to resubmit your {type} with `{AGENDAPOSTER_PHRASE}` included. \n\n*This is an automated message; if you need help, you can message us [here](/contact).*"""
if SITE in {'rdrama.net','devrama.xyz'}:
NOTIFICATIONS_ID = 1046
@ -497,14 +492,6 @@ AWARDS = {
"color": "text-lightgreen",
"price": 10000
},
"nword": {
"kind": "nword",
"title": "Nword Pass",
"description": "Gives the recipient the ability to speak that which must not be spoken",
"icon": "fas fa-edit",
"color": "text-success",
"price": 10000
},
"fish": {
"kind": "fish",
"title": "Fish",
@ -601,8 +588,6 @@ NOTIFIED_USERS = {
FORTUNE_REPLIES = ('<b style="color:#6023f8">Your fortune: Allah Wills It</b>','<b style="color:#d302a7">Your fortune: Inshallah, Only Good Things Shall Come To Pass</b>','<b style="color:#e7890c">Your fortune: Allah Smiles At You This Day</b>','<b style="color:#7fec11">Your fortune: Your Bussy Is In For A Blasting</b>','<b style="color:#43fd3b">Your fortune: You Will Be Propositioned By A High-Tier Twink</b>','<b style="color:#9d05da">Your fortune: Repent, You Have Displeased Allah And His Vengeance Is Nigh</b>','<b style="color:#f51c6a">Your fortune: Reply Hazy, Try Again</b>','<b style="color:#00cbb0">Your fortune: lmao you just lost 100 coins</b>','<b style="color:#2a56fb">Your fortune: Yikes 😬</b>','<b style="color:#0893e1">Your fortune: You Will Be Blessed With Many Black Bulls</b>','<b style="color:#16f174">Your fortune: NEETmax, The Day Is Lost If You Venture Outside</b>','<b style="color:#fd4d32">Your fortune: A Taste Of Jannah Awaits You Today</b>','<b style="color:#bac200">Your fortune: Watch Your Back</b>','<b style="color:#6023f8">Your fortune: Outlook good</b>','<b style="color:#d302a7">Your fortune: Godly Luck</b>','<b style="color:#e7890c">Your fortune: Good Luck</b>','<b style="color:#7fec11">Your fortune: Bad Luck</b>','<b style="color:#43fd3b">Your fortune: Good news will come to you by mail</b>','<b style="color:#9d05da">Your fortune: Very Bad Luck</b>','<b style="color:#00cbb0">Your fortune: キタ━━━━━━(゚∀゚)━━━━━━ !!!!</b>','<b style="color:#2a56fb">Your fortune: Better not tell you now</b>','<b style="color:#0893e1">Your fortune: You will meet a dark handsome stranger</b>','<b style="color:#16f174">Your fortune:  ´_ゝ`)フーン</b>','<b style="color:#fd4d32">Your fortune: Excellent Luck</b>','<b style="color:#bac200">Your fortune: Average Luck</b>')
no_pass_phrase = """<p>Sorry whiteboy, we're gonna need to see some ID before you start throwin that word around like it's nothing.\n\nTake a 10 minute time-out and come back when you've learned your lesson and/or paid reparations (by purchasing a BIPOC Approved™ rDrama NWord Pass© from the <a href="/shop">shop</a>) \n\n<em>This is an automated message; if you need help, you can message us <a href="/contact">here</a>.</em></p>"""
ROLES={
"owner": "864612849199480914",
"admin": "879459632656048180" if environ.get("DOMAIN") == "pcmemes.net" else "846509661288267776",
@ -690,6 +675,13 @@ sub_regex = re.compile('(^|\s|<p>)\/?(s\/(\w|-){3,25})', flags=re.A)
youtube_regex = re.compile('" target="_blank">(https://youtube\.com/watch\?v\=(.*?))</a>(?!</code>)', flags=re.A)
strikethrough_regex = re.compile('~~(.*?)~~', flags=re.A)
emoji_regex = re.compile("[^a]>\s*(:[!#]{0,2}\w+:\s*)+<\/", flags=re.A)
emoji_regex2 = re.compile('(?<!"):([!#A-Za-z0-9]{1,30}?):', flags=re.A)
emoji_regex3 = re.compile('(?<!#"):([!#A-Za-z0-9]{1,30}?):', flags=re.A)
emoji_regex4 = re.compile('(?<!"):([!A-Za-z0-9]{1,30}?):', flags=re.A)
snappy_url_regex = re.compile('<a href=\"(https?:\/\/[a-z]{1,20}\.[^\"]+)\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">(.*?)<\/a>', flags=re.A)
slur_regex = re.compile(rf"((?<=\s|>)|^)({single_words})((?=[\s<,.$]|s[\s<,.$]))", flags=re.I|re.A)
slur_regex_upper = re.compile(rf"((?<=\s|>)|^)({single_words.upper()})((?=[\s<,.$]|S[\s<,.$]))", flags=re.A)
torture_regex = re.compile('(^|\s)(i|me) ', flags=re.I|re.A)

View File

@ -116,7 +116,11 @@ def sanitize(sanitized, noimages=False, alert=False, comment=False, edit=False):
sanitized = sanitized.replace("\ufeff", "").replace("𒐪","").replace("<script","").replace("script>","").replace('','')
if alert:
captured = []
for i in mention_regex2.finditer(sanitized):
if i.group(0) in captured: continue
captured.append(i.group(0))
u = get_user(i.group(1), graceful=True)
if u:
sanitized = sanitized.replace(i.group(0), f'''<p><a href="/id/{u.id}"><img loading="lazy" src="/uid/{u.id}/pic" class="pp20">@{u.username}</a>''', 1)
@ -125,7 +129,11 @@ def sanitize(sanitized, noimages=False, alert=False, comment=False, edit=False):
sanitized = sub_regex.sub(r'\1<a href="/\2" rel="nofollow noopener noreferrer">/\2</a>', sanitized)
captured = []
for i in mention_regex.finditer(sanitized):
if i.group(0) in captured: continue
captured.append(i.group(0))
u = get_user(i.group(2), graceful=True)
if u and (not g.v.any_block_exists(u) or g.v.admin_level > 1):
@ -186,7 +194,7 @@ def sanitize(sanitized, noimages=False, alert=False, comment=False, edit=False):
if comment: marseys_used = set()
emojis = list(re.finditer("[^a]>\s*(:[!#]{0,2}\w+:\s*)+<\/", sanitized, flags=re.A))
emojis = list(emoji_regex.finditer(sanitized))
if len(emojis) > 20: edit = True
captured = []
@ -197,7 +205,12 @@ def sanitize(sanitized, noimages=False, alert=False, comment=False, edit=False):
old = i.group(0)
if 'marseylong1' in old or 'marseylong2' in old or 'marseyllama1' in old or 'marseyllama2' in old: new = old.lower().replace(">", " class='mb-0'>")
else: new = old.lower()
for i in re.finditer('(?<!"):([!#A-Za-z0-9]{1,30}?):', new, flags=re.A):
captured2 = []
for i in emoji_regex2.finditer(new):
if i.group(0) in captured2: continue
captured2.append(i.group(0))
emoji = i.group(1).lower()
if emoji.startswith("#!") or emoji.startswith("!#"):
classes = 'emoji-lg mirrored'
@ -222,7 +235,7 @@ def sanitize(sanitized, noimages=False, alert=False, comment=False, edit=False):
sanitized = sanitized.replace(old, new)
emojis = list(re.finditer('(?<!#"):([!#A-Za-z0-9]{1,30}?):', sanitized, flags=re.A))
emojis = list(emoji_regex3.finditer(sanitized))
if len(emojis) > 20: edit = True
captured = []
@ -259,7 +272,11 @@ def sanitize(sanitized, noimages=False, alert=False, comment=False, edit=False):
if "https://youtube.com/watch?v=" in sanitized: sanitized = sanitized.replace("?t=", "&t=")
captured = []
for i in youtube_regex.finditer(sanitized):
if i.group(0) in captured: continue
captured.append(i.group(0))
url = i.group(1)
yt_id = i.group(2).split('&')[0].split('%')[0]
replacing = f'<a href="{url}" rel="nofollow noopener noreferrer" target="_blank">{url}</a>'
@ -307,7 +324,7 @@ def filter_emojis_only(title, edit=False, graceful=False):
title = bleach.clean(title, tags=[])
emojis = list(re.finditer('(?<!"):([!A-Za-z0-9]{1,30}?):', title, flags=re.A))
emojis = list(emoji_regex4.finditer(title))
if len(emojis) > 20: edit = True
captured = []

View File

@ -398,13 +398,6 @@ def award_post(pid, v):
for c in post.comments:
c.ghost = True
g.db.add(c)
elif kind == "nword":
author.nwordpass = True
if not author.has_badge(108):
new_badge = Badge(badge_id=108, user_id=author.id)
g.db.add(new_badge)
g.db.flush()
send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({new_badge.path})\n\n{new_badge.name}")
elif kind == "rehab":
if author.rehab: author.rehab += 86400
else: author.rehab = int(time.time()) + 86400
@ -625,13 +618,6 @@ def award_comment(cid, v):
elif kind == "ghost":
c.ghost = True
g.db.add(c)
elif kind == "nword":
author.nwordpass = True
if not author.has_badge(108):
new_badge = Badge(badge_id=108, user_id=author.id)
g.db.add(new_badge)
g.db.flush()
send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({new_badge.path})\n\n{new_badge.name}")
elif kind == "rehab":
if author.rehab: author.rehab += 86400
else: author.rehab = int(time.time()) + 86400

View File

@ -243,7 +243,7 @@ def api_comment(v):
copyfile(oldname, filename)
process_image(filename, 400)
elif parent_post.id == 37697:
filename = 'files/assets/images/Drama/banners_bhm/' + str(len(listdir('files/assets/images/Drama/banners_bhm'))+1) + '.webp'
filename = 'files/assets/images/Drama/banners/' + str(len(listdir('files/assets/images/Drama/banners'))+1) + '.webp'
copyfile(oldname, filename)
process_image(filename)
elif parent_post.id == 37833:
@ -480,35 +480,8 @@ def api_comment(v):
n = Notification(comment_id=c_jannied.id, user_id=v.id)
g.db.add(n)
elif SITE_NAME == 'Drama' and 'nigg' in c.body.lower() and not v.nwordpass:
c.is_banned = True
c.ban_reason = "AutoJanny"
g.db.add(c)
c_jannied = Comment(author_id=NOTIFICATIONS_ID,
parent_submission=parent_submission,
distinguish_level=6,
parent_comment_id=c.id,
level=level+1,
is_bot=True,
body_html=no_pass_phrase,
top_comment_id=c.top_comment_id,
ghost=parent_post.ghost
)
g.db.add(c_jannied)
g.db.flush()
v.ban(reason="White people nonsense.", days=0.007)
text = "Your account has been banned for **10 minutes** for the following reason:\n\n> Unsanctioned NWord"
send_repeatable_notification(v.id, text)
n = Notification(comment_id=c_jannied.id, user_id=v.id)
g.db.add(n)
if SITE_NAME == 'Drama' and len(c.body) >= 1000 and "<" not in body and "</blockquote>" not in body_html:
body = random.choice(LONGPOST_REPLIES)
@ -859,33 +832,6 @@ def edit_comment(cid, v):
n = Notification(comment_id=c_jannied.id, user_id=v.id)
g.db.add(n)
elif SITE_NAME == 'Drama' and 'nigg' in c.body.lower() and not v.nwordpass:
c.is_banned = True
c.ban_reason = "AutoJanny"
g.db.add(c)
c_jannied = Comment(author_id=NOTIFICATIONS_ID,
parent_submission=c.parent_submission,
distinguish_level=6,
parent_comment_id=c.id,
level=c.level+1,
is_bot=True,
body_html=no_pass_phrase,
top_comment_id=c.top_comment_id,
ghost=c.ghost
)
g.db.add(c_jannied)
g.db.flush()
v.ban(reason="White people nonsense.", days=0.007)
text = "Your account has been banned for **10 minutes** for the following reason:\n\n> Unsanctioned NWord"
send_repeatable_notification(v.id, text)
n = Notification(comment_id=c_jannied.id, user_id=v.id)
g.db.add(n)
if int(time.time()) - c.created_utc > 60 * 3: c.edited_utc = int(time.time())

View File

@ -570,34 +570,6 @@ def edit_post(pid, v):
n = Notification(comment_id=c_jannied.id, user_id=v.id)
g.db.add(n)
elif SITE_NAME == 'Drama' and 'nigg' in f'{p.body}{p.title}'.lower() and not v.nwordpass:
p.is_banned = True
p.ban_reason = "AutoJanny"
g.db.add(p)
c_jannied = Comment(author_id=NOTIFICATIONS_ID,
parent_submission=p.id,
level=1,
over_18=False,
is_bot=True,
app_id=None,
is_pinned='AutoJanny',
distinguish_level=6,
body_html=no_pass_phrase,
ghost=p.ghost
)
g.db.add(c_jannied)
g.db.flush()
v.ban(reason="White people nonsense.", days=0.007)
text = "Your account has been banned for **10 minutes** for the following reason:\n\n> Unsanctioned NWord"
send_repeatable_notification(v.id, text)
n = Notification(comment_id=c_jannied.id, user_id=v.id)
g.db.add(n)
if not p.private and not p.ghost:
@ -1248,32 +1220,7 @@ def submit_post(v, sub=None):
n = Notification(comment_id=c_jannied.id, user_id=v.id)
g.db.add(n)
elif SITE_NAME == 'Drama' and 'nigg' in f'{post.body}{post.title}'.lower() and not v.nwordpass:
post.is_banned = True
post.ban_reason = "AutoJanny"
c_jannied = Comment(author_id=NOTIFICATIONS_ID,
parent_submission=post.id,
level=1,
over_18=False,
is_bot=True,
app_id=None,
is_pinned='AutoJanny',
distinguish_level=6,
body_html=no_pass_phrase,
)
g.db.add(c_jannied)
g.db.flush()
v.ban(reason="White people nonsense.", days=0.007)
text = "Your account has been banned for **10 minutes** for the following reason:\n\n> Unsanctioned NWord"
send_repeatable_notification(v.id, text)
n = Notification(comment_id=c_jannied.id, user_id=v.id)
g.db.add(n)
if not (post.sub and g.db.query(Exile.user_id).filter_by(user_id=SNAPPY_ID, sub=post.sub).one_or_none()):
if post.sub == 'dankchristianmemes':
@ -1321,12 +1268,15 @@ def submit_post(v, sub=None):
body += f"Snapshots:\n\n{rev}* [archive.org](https://web.archive.org/{newposturl})\n* [archive.ph](https://archive.ph/?url={quote(newposturl)}&run=1) (click to archive)\n\n"
gevent.spawn(archiveorg, newposturl)
url_regex = '<a href=\"(https?:\/\/[a-z]{1,20}\.[^\"]+)\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">(.*?)<\/a>'
for url_match in list(re.finditer(url_regex, post.body_html, flags=re.A))[:20]:
href = url_match.group(1)
captured = []
for i in list(snappy_url_regex.finditer(post.body_html))[:20]:
if i.group(0) in captured: continue
captured.append(i.group(0))
href = i.group(1)
if not href: continue
title = url_match.group(2)
title = i.group(2)
if "Snapshots:\n\n" not in body: body += "Snapshots:\n\n"
if f'**[{title}]({href})**:\n\n' not in body:

View File

@ -231,7 +231,7 @@
{% if sub %}
<img alt="/s/{{sub.name}} banner" role="button" data-bs-toggle="modal" data-bs-target="#expandImageModal" onclick="expandDesktopImage('{{sub.banner_url}}')" loading="lazy" src="{{sub.banner_url}}" width=100% style="object-fit:cover;max-height:25vw">
{% elif SITE_NAME == 'Drama' %}
{% set path = "assets/images/" + SITE_NAME + "/banners_bhm" %}
{% set path = "assets/images/" + SITE_NAME + "/banners" %}
{% set image = "/static/" + path + "/" + listdir('files/' + path)|random() + '?v=21' %}
<a href="https://naacp.org/donate">

View File

@ -618,7 +618,6 @@ CREATE TABLE public.users (
winnings integer DEFAULT 0 NOT NULL,
patron_utc integer DEFAULT 0 NOT NULL,
rehab integer,
nwordpass boolean,
house character varying(16),
subs_created integer DEFAULT 0 NOT NULL
);