diff --git a/files/classes/submission.py b/files/classes/submission.py index ed9e0e860..34484ab15 100644 --- a/files/classes/submission.py +++ b/files/classes/submission.py @@ -452,7 +452,7 @@ class Submission(Base): def realtitle(self, v): 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) - 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' elif self.title_html: title = self.title_html else: title = self.title diff --git a/files/classes/user.py b/files/classes/user.py index 7769880eb..e940e6656 100644 --- a/files/classes/user.py +++ b/files/classes/user.py @@ -192,6 +192,7 @@ class User(Base): if not self.has_badge(134): new_badge = Badge(badge_id=134, user_id=self.id) g.db.add(new_badge) + g.db.commit() return True return False diff --git a/files/helpers/const.py b/files/helpers/const.py index 24b2064cc..2d6a43bc2 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -32,8 +32,8 @@ if SITE_NAME == 'Cringetopia': SLURS = { "retarded": "neurodivergent", "retard": "neurodivergent", - "faggotry": "cute twinkry", "faggot": "cute twink", + "fag": "cute twink", "n1gger": "๐Ÿ€", "nlgger": "๐Ÿ€", "nigger": "๐Ÿ€", @@ -43,11 +43,7 @@ if SITE_NAME == 'Cringetopia': "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", "i hate carp": "i love Carp", - "heil hitler": "hello kitty", - - " fag ": " cute twink ", - " fags ": " cute twinks ", - } + "heil hitler": "hello kitty", } else: SLURS = { "california": "commiefornia", @@ -61,8 +57,8 @@ else: "richfag": "richstrag", "newfag": "newstrag", "oldfag": "oldstrag", - "faggotry": "cute twinkry", "faggot": "cute twink", + "fag": "cute twink", "pedophile": "libertarian", "kill yourself": "keep yourself safe", "n1gger": "BIPOC", @@ -114,8 +110,6 @@ else: " kys ": " keep yourself safe ", " pedo ": " libertarian ", " pedos ": " libertarians ", - " fag ": " cute twink ", - " fags ": " cute twinks ", } 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) +link_fix_regex = re.compile("(?!.*(http|\/))(.*\[[^\]]+\]\()([^)]+\))", flags=re.A) + css_regex = re.compile('''url\(['"]?(.*?)['"]?\)''', flags=re.I|re.A) css_regex2 = re.compile('''['"](http.*?)['"]''', flags=re.I|re.A) diff --git a/files/helpers/discord.py b/files/helpers/discord.py index c5bc3f168..e8ac3df00 100644 --- a/files/helpers/discord.py +++ b/files/helpers/discord.py @@ -57,10 +57,4 @@ def send_discord_message(message): headers = {"Authorization": f"Bot {BOT_TOKEN}"} 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/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) \ No newline at end of file + requests.post("https://discordapp.com/api/channels/924486091795484732/messages", headers=headers, data=data, timeout=5) \ No newline at end of file diff --git a/files/helpers/sanitize.py b/files/helpers/sanitize.py index b999c301b..91c7982f9 100644 --- a/files/helpers/sanitize.py +++ b/files/helpers/sanitize.py @@ -137,6 +137,8 @@ def sanitize(sanitized, alert=False, comment=False, edit=False): sanitized = image_check_regex.sub(r'\1', sanitized) + sanitized = link_fix_regex.sub(r'\2https://\3', sanitized) + sanitized = markdown(sanitized) sanitized = strikethrough_regex.sub(r'\1', sanitized) diff --git a/files/routes/front.py b/files/routes/front.py index 373095941..82967c68d 100644 --- a/files/routes/front.py +++ b/files/routes/front.py @@ -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) if request.host == 'rdrama.net': num = 5 - else: num = 1 + else: num = 0.5 if sort == "hot": ti = int(time.time()) + 3600 diff --git a/files/routes/posts.py b/files/routes/posts.py index 778224b90..fc37e8721 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -4,7 +4,7 @@ import requests from files.helpers.wrappers import * from files.helpers.sanitize 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.slots import * from files.classes import * @@ -90,9 +90,7 @@ def publish(pid, v): cache.delete_memoized(frontlist) cache.delete_memoized(User.userpagelisting) - if SITE == 'cringetopia.org': - send_cringetopia_message(post.permalink) - elif v.admin_level > 0 and ("[changelog]" in post.title.lower() or "(changelog)" in post.title.lower()): + if v.admin_level > 0 and ("[changelog]" in post.title.lower() or "(changelog)" in post.title.lower()): send_discord_message(post.permalink) 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' gevent.spawn(archiveorg, href) + if body == '!slots': + body = f'!slots{snappy.coins}' + body_html = sanitize(body) if len(body_html) < 40000: @@ -1364,7 +1365,7 @@ def submit_post(v, sub=None): snappy.coins += 1 g.db.add(snappy) - if body.startswith('!slots1000'): + if body.startswith('!slots'): check_for_slots_command(body, snappy, c) g.db.flush() @@ -1392,9 +1393,7 @@ def submit_post(v, sub=None): cache.delete_memoized(frontlist) cache.delete_memoized(User.userpagelisting) - if SITE == 'cringetopia.org': - 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: + if 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) cache.delete_memoized(changeloglist) diff --git a/files/routes/static.py b/files/routes/static.py index c7cedb4b1..25f00d418 100644 --- a/files/routes/static.py +++ b/files/routes/static.py @@ -34,13 +34,13 @@ def marseys(v): def marsey_list(): # From database emojis = [{ - "name": emoij.name, + "name": emoji.name, "author": author if SITE_NAME == 'rDrama' else "rDrama's chads", # 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 []), - "count": emoij.count, + "tags": emoji.tags.split(" ") + [emoji.name[len("marsey"):] if emoji.name.startswith("marsey") else emoji.name] + ([author] if SITE_NAME == 'rDrama' else []), + "count": emoji.count, "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 shit = open("files/assets/shit emojis.json", "r", encoding="utf-8") diff --git a/files/routes/users.py b/files/routes/users.py index eeb28936d..d3763c7dd 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -776,7 +776,8 @@ def messagereply(v): g.db.add(notif) 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: g.db.delete(n) diff --git a/files/templates/default.html b/files/templates/default.html index 1d47c7513..1da90f0ec 100644 --- a/files/templates/default.html +++ b/files/templates/default.html @@ -247,7 +247,7 @@ /h/{{sub.name}} banner {% elif SITE_NAME == 'rDrama' %} {% 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' %} {% if v and (v.is_banned or v.agendaposter) %} diff --git a/files/templates/emoji_modal.html b/files/templates/emoji_modal.html index 581eefba7..be3edcbba 100644 --- a/files/templates/emoji_modal.html +++ b/files/templates/emoji_modal.html @@ -29,19 +29,19 @@