forked from rDrama/rDrama
1
0
Fork 0

fdMerge branch 'frost' of https://github.com/Aevann1/Drama into frost

master
Aevann1 2022-05-07 05:31:51 +00:00
commit 5284245cd5
14 changed files with 44 additions and 51 deletions

View File

@ -452,7 +452,7 @@ class Submission(Base):
def realtitle(self, v): def realtitle(self, v):
if self.club and not (v and (v.paid_dues or v.id == self.author_id)): if self.club and not (v and (v.paid_dues or v.id == self.author_id)):
if v: return random.choice(TROLLTITLES).format(username=v.username) if v: return random.choice(TROLLTITLES).format(username=v.username)
elif SITE == 'cringetopia.org': return f'Please make an account to see this post' elif dues == -2: return f'Please make an account to see this post'
else: return f'{CC} MEMBERS ONLY' else: return f'{CC} MEMBERS ONLY'
elif self.title_html: title = self.title_html elif self.title_html: title = self.title_html
else: title = self.title else: title = self.title

View File

@ -192,6 +192,7 @@ class User(Base):
if not self.has_badge(134): if not self.has_badge(134):
new_badge = Badge(badge_id=134, user_id=self.id) new_badge = Badge(badge_id=134, user_id=self.id)
g.db.add(new_badge) g.db.add(new_badge)
g.db.commit()
return True return True
return False return False

View File

@ -32,8 +32,8 @@ if SITE_NAME == 'Cringetopia':
SLURS = { SLURS = {
"retarded": "neurodivergent", "retarded": "neurodivergent",
"retard": "neurodivergent", "retard": "neurodivergent",
"faggotry": "cute twinkry",
"faggot": "cute twink", "faggot": "cute twink",
"fag": "cute twink",
"n1gger": "🏀", "n1gger": "🏀",
"nlgger": "🏀", "nlgger": "🏀",
"nigger": "🏀", "nigger": "🏀",
@ -43,11 +43,7 @@ if SITE_NAME == 'Cringetopia':
"autistic": "neurodivergent", "autistic": "neurodivergent",
"holohoax": "i tried to claim the Holocaust didn't happen because I am a pencil-dicked imbecile and the word filter caught me lol", "holohoax": "i tried to claim the Holocaust didn't happen because I am a pencil-dicked imbecile and the word filter caught me lol",
"i hate carp": "i love Carp", "i hate carp": "i love Carp",
"heil hitler": "hello kitty", "heil hitler": "hello kitty", }
" fag ": " cute twink ",
" fags ": " cute twinks ",
}
else: else:
SLURS = { SLURS = {
"california": "commiefornia", "california": "commiefornia",
@ -61,8 +57,8 @@ else:
"richfag": "richstrag", "richfag": "richstrag",
"newfag": "newstrag", "newfag": "newstrag",
"oldfag": "oldstrag", "oldfag": "oldstrag",
"faggotry": "cute twinkry",
"faggot": "cute twink", "faggot": "cute twink",
"fag": "cute twink",
"pedophile": "libertarian", "pedophile": "libertarian",
"kill yourself": "keep yourself safe", "kill yourself": "keep yourself safe",
"n1gger": "BIPOC", "n1gger": "BIPOC",
@ -114,8 +110,6 @@ else:
" kys ": " keep yourself safe ", " kys ": " keep yourself safe ",
" pedo ": " libertarian ", " pedo ": " libertarian ",
" pedos ": " libertarians ", " pedos ": " libertarians ",
" fag ": " cute twink ",
" fags ": " cute twinks ",
} }
single_words = "|".join([slur.lower() for slur in SLURS.keys()]) single_words = "|".join([slur.lower() for slur in SLURS.keys()])
@ -894,6 +888,8 @@ yt_id_regex = re.compile('[a-z0-9-_]{5,20}', flags=re.I|re.A)
image_regex = re.compile("(^|\s)(https:\/\/[\w\-.#&/=\?@%;+]{5,250}(\.png|\.jpg|\.jpeg|\.gif|\.webp|maxwidth=9999|fidelity=high))($|\s)", flags=re.I|re.A) image_regex = re.compile("(^|\s)(https:\/\/[\w\-.#&/=\?@%;+]{5,250}(\.png|\.jpg|\.jpeg|\.gif|\.webp|maxwidth=9999|fidelity=high))($|\s)", flags=re.I|re.A)
link_fix_regex = re.compile("(?!.*(http|\/))(.*\[[^\]]+\]\()([^)]+\))", flags=re.A)
css_regex = re.compile('''url\(['"]?(.*?)['"]?\)''', flags=re.I|re.A) css_regex = re.compile('''url\(['"]?(.*?)['"]?\)''', flags=re.I|re.A)
css_regex2 = re.compile('''['"](http.*?)['"]''', flags=re.I|re.A) css_regex2 = re.compile('''['"](http.*?)['"]''', flags=re.I|re.A)

View File

@ -57,10 +57,4 @@ def send_discord_message(message):
headers = {"Authorization": f"Bot {BOT_TOKEN}"} headers = {"Authorization": f"Bot {BOT_TOKEN}"}
data={"content": message} data={"content": message}
requests.post("https://discordapp.com/api/channels/924485611715452940/messages", headers=headers, data=data, timeout=5) requests.post("https://discordapp.com/api/channels/924485611715452940/messages", headers=headers, data=data, timeout=5)
requests.post("https://discordapp.com/api/channels/924486091795484732/messages", headers=headers, data=data, timeout=5) requests.post("https://discordapp.com/api/channels/924486091795484732/messages", headers=headers, data=data, timeout=5)
def send_cringetopia_message(message):
headers = {"Authorization": f"Bot {BOT_TOKEN}"}
data={"content": message}
requests.post("https://discordapp.com/api/channels/965264044531527740/messages", headers=headers, data=data, timeout=5)

View File

@ -137,6 +137,8 @@ def sanitize(sanitized, alert=False, comment=False, edit=False):
sanitized = image_check_regex.sub(r'\1', sanitized) sanitized = image_check_regex.sub(r'\1', sanitized)
sanitized = link_fix_regex.sub(r'\2https://\3', sanitized)
sanitized = markdown(sanitized) sanitized = markdown(sanitized)
sanitized = strikethrough_regex.sub(r'<del>\1</del>', sanitized) sanitized = strikethrough_regex.sub(r'<del>\1</del>', sanitized)

View File

@ -353,7 +353,7 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, ccmode="false"
posts = posts.join(User, User.id == Submission.author_id).filter(User.shadowbanned == None) posts = posts.join(User, User.id == Submission.author_id).filter(User.shadowbanned == None)
if request.host == 'rdrama.net': num = 5 if request.host == 'rdrama.net': num = 5
else: num = 1 else: num = 0.5
if sort == "hot": if sort == "hot":
ti = int(time.time()) + 3600 ti = int(time.time()) + 3600

View File

@ -4,7 +4,7 @@ import requests
from files.helpers.wrappers import * from files.helpers.wrappers import *
from files.helpers.sanitize import * from files.helpers.sanitize import *
from files.helpers.alerts import * from files.helpers.alerts import *
from files.helpers.discord import send_discord_message, send_cringetopia_message from files.helpers.discord import send_discord_message
from files.helpers.const import * from files.helpers.const import *
from files.helpers.slots import * from files.helpers.slots import *
from files.classes import * from files.classes import *
@ -90,9 +90,7 @@ def publish(pid, v):
cache.delete_memoized(frontlist) cache.delete_memoized(frontlist)
cache.delete_memoized(User.userpagelisting) cache.delete_memoized(User.userpagelisting)
if SITE == 'cringetopia.org': if v.admin_level > 0 and ("[changelog]" in post.title.lower() or "(changelog)" in post.title.lower()):
send_cringetopia_message(post.permalink)
elif v.admin_level > 0 and ("[changelog]" in post.title.lower() or "(changelog)" in post.title.lower()):
send_discord_message(post.permalink) send_discord_message(post.permalink)
cache.delete_memoized(changeloglist) cache.delete_memoized(changeloglist)
@ -1344,6 +1342,9 @@ def submit_post(v, sub=None):
body += f'* [ghostarchive.org](https://ghostarchive.org/search?term={quote(href)}) (click to archive)\n\n' body += f'* [ghostarchive.org](https://ghostarchive.org/search?term={quote(href)}) (click to archive)\n\n'
gevent.spawn(archiveorg, href) gevent.spawn(archiveorg, href)
if body == '!slots':
body = f'!slots{snappy.coins}'
body_html = sanitize(body) body_html = sanitize(body)
if len(body_html) < 40000: if len(body_html) < 40000:
@ -1364,7 +1365,7 @@ def submit_post(v, sub=None):
snappy.coins += 1 snappy.coins += 1
g.db.add(snappy) g.db.add(snappy)
if body.startswith('!slots1000'): if body.startswith('!slots'):
check_for_slots_command(body, snappy, c) check_for_slots_command(body, snappy, c)
g.db.flush() g.db.flush()
@ -1392,9 +1393,7 @@ def submit_post(v, sub=None):
cache.delete_memoized(frontlist) cache.delete_memoized(frontlist)
cache.delete_memoized(User.userpagelisting) cache.delete_memoized(User.userpagelisting)
if SITE == 'cringetopia.org': if v.admin_level > 0 and ("[changelog]" in post.title.lower() or "(changelog)" in post.title.lower()) and not post.private:
send_cringetopia_message(post.permalink)
elif v.admin_level > 0 and ("[changelog]" in post.title.lower() or "(changelog)" in post.title.lower()) and not post.private:
send_discord_message(post.permalink) send_discord_message(post.permalink)
cache.delete_memoized(changeloglist) cache.delete_memoized(changeloglist)

View File

@ -34,13 +34,13 @@ def marseys(v):
def marsey_list(): def marsey_list():
# From database # From database
emojis = [{ emojis = [{
"name": emoij.name, "name": emoji.name,
"author": author if SITE_NAME == 'rDrama' else "rDrama's chads", "author": author if SITE_NAME == 'rDrama' else "rDrama's chads",
# yikes, I don't really like this DB schema. Next time be better # yikes, I don't really like this DB schema. Next time be better
"tags": emoij.tags.split(" ") + [emoij.name[len("marsey"):] if emoij.name.startswith("marsey") else emoij.name] + ([author] if SITE_NAME == 'rDrama' else []), "tags": emoji.tags.split(" ") + [emoji.name[len("marsey"):] if emoji.name.startswith("marsey") else emoji.name] + ([author] if SITE_NAME == 'rDrama' else []),
"count": emoij.count, "count": emoji.count,
"class": "Marsey" "class": "Marsey"
} for emoij, author in g.db.query(Marsey, User.username).join(User, User.id==Marsey.author_id).order_by(Marsey.count.desc())] } for emoji, author in g.db.query(Marsey, User.username).join(User, User.id==Marsey.author_id).order_by(Marsey.count.desc())]
# Stastic shit # Stastic shit
shit = open("files/assets/shit emojis.json", "r", encoding="utf-8") shit = open("files/assets/shit emojis.json", "r", encoding="utf-8")

View File

@ -776,7 +776,8 @@ def messagereply(v):
g.db.add(notif) g.db.add(notif)
ids = [c.top_comment.id] + [x.id for x in c.top_comment.replies] ids = [c.top_comment.id] + [x.id for x in c.top_comment.replies]
notifications = g.db.query(Notification).filter(Notification.comment_id.in_(ids)) uids = [x.id for x in admins]
notifications = g.db.query(Notification).filter(Notification.comment_id.in_(ids), Notification.user_id.in_(uids))
for n in notifications: for n in notifications:
g.db.delete(n) g.db.delete(n)

View File

@ -247,7 +247,7 @@
<img alt="/h/{{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"> <img alt="/h/{{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 == 'rDrama' %} {% elif SITE_NAME == 'rDrama' %}
{% set path = "assets/images/" + SITE_NAME + "/banners" %} {% set path = "assets/images/" + SITE_NAME + "/banners" %}
{% set image = "/" + path + "/" + listdir('files/' + path)|random() + '?v=25' %} {% set image = "/" + path + "/" + listdir('files/' + path)|random() + '?v=26' %}
<a href="https://secure.transequality.org/site/Donation2?df_id=1480"> <a href="https://secure.transequality.org/site/Donation2?df_id=1480">
{% if v and (v.is_banned or v.agendaposter) %} {% if v and (v.is_banned or v.agendaposter) %}

View File

@ -29,19 +29,19 @@
<fieldset class="p-2"> <fieldset class="p-2">
<label style="display: inline">Options:</legend> <label style="display: inline">Options:</legend>
<div style="display: inline" title="Makes the emoji larger"> <div style="display: inline" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Makes the emoji larger">
<input type="checkbox" id="emoij-sel-0" value="#" class="emoij-suffix"> <input type="checkbox" id="emoji-sel-0" value="#" class="emoji-suffix">
<label for="emoij-sel-0">Large</label> <label for="emoji-sel-0">Large</label>
</div> </div>
<div style="display: inline" title="Mirror the emoji along the Y axis"> <div style="display: inline" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Mirror the emoji along the Y axis">
<input type="checkbox" id="emoij-sel-1" value="!" class="emoij-suffix"> <input type="checkbox" id="emoji-sel-1" value="!" class="emoji-suffix">
<label for="emoij-sel-1">Mirror</label> <label for="emoji-sel-1">Mirror</label>
</div> </div>
<div style="display: inline" title="Adds a hand that pats the emoji.&#10;Does not work with animated emoji"> <div style="display: inline" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Adds a hand that pats the emoji">
<input type="checkbox" id="emoij-sel-2" value="pat" class="emoij-postfix"> <input type="checkbox" id="emoji-sel-2" value="pat" class="emoji-postfix">
<label for="emoij-sel-2">Pat</label> <label for="emoji-sel-2">Pat</label>
</div> </div>
</fieldset> </fieldset>
<!-- <!--
@ -70,7 +70,7 @@
border: none border: none
} }
</style> </style>
<template id="emoij-button-template"> <template id="emoji-button-template">
<button class="btn m-1 px-0 emoji2" data-bs-toggle="tooltip" delay:="0"> <button class="btn m-1 px-0 emoji2" data-bs-toggle="tooltip" delay:="0">
<img loading="lazy" width=50> <img loading="lazy" width=50>
</button> </button>
@ -83,4 +83,4 @@
</div> </div>
</div> </div>
<script src="/assets/js/emoji_modal.js?v=274"></script> <script src="/assets/js/emoji_modal.js?v=275"></script>

View File

@ -1,27 +1,27 @@
INSERT INTO public.users (username, passhash, created_utc, admin_level, over_18, is_activated, bio, bio_html, login_nonce, is_private, INSERT INTO public.users (username, passhash, created_utc, admin_level, over_18, is_activated, bio, bio_html, login_nonce, is_private,
unban_utc, original_username, customtitle, defaultsorting, defaultsortingcomments, defaulttime, namecolor, titlecolor, unban_utc, original_username, customtitle, defaultsorting, defaultsortingcomments, defaulttime, namecolor, titlecolor,
customtitleplain, theme, themecolor, changelogsub, reddit, css, profilecss, coins, agendaposter, customtitleplain, theme, themecolor, changelogsub, reddit, css, profilecss, coins, agendaposter,
post_count, comment_count, background, verified, truecoins, cardview post_count, comment_count, background, verified, truecoins, cardview, profileurl, highres
) VALUES ('System', '', extract(epoch from now()), 0, true, true, '', '', 0, false, ) VALUES ('System', '', extract(epoch from now()), 0, true, true, '', '', 0, false,
0, 'System', '', 'hot', 'top', 'day', 'ff66ac', 'ff66ac', 0, 'System', '', 'hot', 'top', 'day', 'ff66ac', 'ff66ac',
'', 'dark', 'ff66ac', false, 'old.reddit.com', '', '', 0, 0, '', 'dark', 'ff66ac', false, 'old.reddit.com', '', '', 0, 0,
0, 0, '', 'Verified', 0, false), 0, 0, '', 'Verified', 0, false, '/assets/images/pfps/2.webp', '/assets/images/pfps/2.webp'),
('AutoJanny', '', extract(epoch from now()), 0, true, true, '', '', 0, false, ('AutoJanny', '', extract(epoch from now()), 0, true, true, '', '', 0, false,
0, 'AutoJanny', '', 'hot', 'top', 'day', 'ff66ac', 'ff66ac', 0, 'AutoJanny', '', 'hot', 'top', 'day', 'ff66ac', 'ff66ac',
'', 'dark', 'ff66ac', false, 'old.reddit.com', '', '', 0, 0, '', 'dark', 'ff66ac', false, 'old.reddit.com', '', '', 0, 0,
0, 0, '', 'Verified', 0, false), 0, 0, '', 'Verified', 0, false, '/assets/images/pfps/2.webp', '/assets/images/pfps/2.webp'),
('Snappy', '', extract(epoch from now()), 0, true, true, '', '', 0, false, ('Snappy', '', extract(epoch from now()), 0, true, true, '', '', 0, false,
0, 'Snappy', '', 'hot', 'top', 'day', '62ca56', 'e4432d', 0, 'Snappy', '', 'hot', 'top', 'day', '62ca56', 'e4432d',
'', 'dark', '30409f', false, 'old.reddit.com', '', '', 0, 0, '', 'dark', '30409f', false, 'old.reddit.com', '', '', 0, 0,
0, 0, '', 'Verified', 0, false), 0, 0, '', 'Verified', 0, false, '/assets/images/pfps/3.webp', '/assets/images/pfps/3.webp'),
('longpostbot', '', extract(epoch from now()), 0, true, true, '', '', 0, false, ('longpostbot', '', extract(epoch from now()), 0, true, true, '', '', 0, false,
0, 'longpostbot', '', 'hot', 'top', 'day', '62ca56', 'e4432d', 0, 'longpostbot', '', 'hot', 'top', 'day', '62ca56', 'e4432d',
'', 'dark', '30409f', false, 'old.reddit.com', '', '', 0, 0, '', 'dark', '30409f', false, 'old.reddit.com', '', '', 0, 0,
0, 0, '', 'Verified', 0, false), 0, 0, '', 'Verified', 0, false, '/assets/images/pfps/4.webp', '/assets/images/pfps/4.webp'),
('zozbot', '', extract(epoch from now()), 0, true, true, '', '', 0, false, ('zozbot', '', extract(epoch from now()), 0, true, true, '', '', 0, false,
0, 'zozbot', '', 'hot', 'top', 'day', '62ca56', 'e4432d', 0, 'zozbot', '', 'hot', 'top', 'day', '62ca56', 'e4432d',
'', 'dark', '30409f', false, 'old.reddit.com', '', '', 0, 0, '', 'dark', '30409f', false, 'old.reddit.com', '', '', 0, 0,
0, 0, '', 'Verified', 0, false), 0, 0, '', 'Verified', 0, false, '/assets/images/pfps/5.webp', '/assets/images/pfps/5.webp'),
('AutoPoller', '', extract(epoch from now()), 0, true, true, '', '', 0, false, ('AutoPoller', '', extract(epoch from now()), 0, true, true, '', '', 0, false,
0, 'AutoPoller', '', 'hot', 'top', 'day', '62ca56', 'e4432d', 0, 'AutoPoller', '', 'hot', 'top', 'day', '62ca56', 'e4432d',
'', 'dark', '30409f', false, 'old.reddit.com', '', '', 0, 0, '', 'dark', '30409f', false, 'old.reddit.com', '', '', 0, 0,

View File

@ -598,7 +598,7 @@ Ayoo, youre fat as fuck!
{[para]} {[para]}
AVOCADO NIGGER! AVOCADO NIGGER!
{[para]} {[para]}
!slots1000 !slots
Youre poor, figure it out. Imagine being at the super market looking at the cost of nectors and shit. Fuck you, dude. Youre poor, figure it out. Imagine being at the super market looking at the cost of nectors and shit. Fuck you, dude.
{[para]} {[para]}
Want to go rape some fire hydrants? Want to go rape some fire hydrants?

View File

@ -3261,7 +3261,7 @@ That I am trapped in this particular irrelevancy is never more apparent to me th
{[para]} {[para]}
https://youtube.com/watch?v=5I884gOUONg https://youtube.com/watch?v=5I884gOUONg
{[para]} {[para]}
!slots1000 !slots
{[para]} {[para]}
Fuck you. Dog walkings great. Excellent way to make side cash and get exercise, and being able to immediately make any dog fall in love with you is a skill I use on a monthly basis. Fuck you. Dog walkings great. Excellent way to make side cash and get exercise, and being able to immediately make any dog fall in love with you is a skill I use on a monthly basis.