fd
BIN
files/assets/images/emojis/0.webp
Normal file
After Width: | Height: | Size: 5.9 KiB |
BIN
files/assets/images/emojis/1.webp
Normal file
After Width: | Height: | Size: 3.9 KiB |
BIN
files/assets/images/emojis/2.webp
Normal file
After Width: | Height: | Size: 6.4 KiB |
BIN
files/assets/images/emojis/3.webp
Normal file
After Width: | Height: | Size: 5.5 KiB |
BIN
files/assets/images/emojis/4.webp
Normal file
After Width: | Height: | Size: 4.2 KiB |
BIN
files/assets/images/emojis/5.webp
Normal file
After Width: | Height: | Size: 4.6 KiB |
BIN
files/assets/images/emojis/6.webp
Normal file
After Width: | Height: | Size: 6.3 KiB |
BIN
files/assets/images/emojis/7.webp
Normal file
After Width: | Height: | Size: 4.6 KiB |
BIN
files/assets/images/emojis/8.webp
Normal file
After Width: | Height: | Size: 6 KiB |
BIN
files/assets/images/emojis/9.webp
Normal file
After Width: | Height: | Size: 5.5 KiB |
BIN
files/assets/images/emojis/a.webp
Normal file
After Width: | Height: | Size: 6.8 KiB |
BIN
files/assets/images/emojis/b.webp
Normal file
After Width: | Height: | Size: 4.4 KiB |
BIN
files/assets/images/emojis/c.webp
Normal file
After Width: | Height: | Size: 4.1 KiB |
Before Width: | Height: | Size: 516 B After Width: | Height: | Size: 5.1 KiB |
BIN
files/assets/images/emojis/e.webp
Normal file
After Width: | Height: | Size: 5.2 KiB |
BIN
files/assets/images/emojis/exclamationpoint.webp
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
files/assets/images/emojis/f.webp
Normal file
After Width: | Height: | Size: 4.5 KiB |
BIN
files/assets/images/emojis/g.webp
Normal file
After Width: | Height: | Size: 5.1 KiB |
BIN
files/assets/images/emojis/h.webp
Normal file
After Width: | Height: | Size: 5 KiB |
BIN
files/assets/images/emojis/i.webp
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
files/assets/images/emojis/j.webp
Normal file
After Width: | Height: | Size: 4.3 KiB |
BIN
files/assets/images/emojis/k.webp
Normal file
After Width: | Height: | Size: 5.6 KiB |
BIN
files/assets/images/emojis/l.webp
Normal file
After Width: | Height: | Size: 3.5 KiB |
BIN
files/assets/images/emojis/m.webp
Normal file
After Width: | Height: | Size: 6 KiB |
Before Width: | Height: | Size: 8.6 KiB After Width: | Height: | Size: 94 KiB |
BIN
files/assets/images/emojis/n.webp
Normal file
After Width: | Height: | Size: 7.4 KiB |
BIN
files/assets/images/emojis/o.webp
Normal file
After Width: | Height: | Size: 6 KiB |
Before Width: | Height: | Size: 368 B After Width: | Height: | Size: 4.2 KiB |
BIN
files/assets/images/emojis/period.webp
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
files/assets/images/emojis/q.webp
Normal file
After Width: | Height: | Size: 5.2 KiB |
BIN
files/assets/images/emojis/questionmark.webp
Normal file
After Width: | Height: | Size: 4.6 KiB |
BIN
files/assets/images/emojis/r.webp
Normal file
After Width: | Height: | Size: 5 KiB |
BIN
files/assets/images/emojis/s.webp
Normal file
After Width: | Height: | Size: 4.8 KiB |
BIN
files/assets/images/emojis/t.webp
Normal file
After Width: | Height: | Size: 3.9 KiB |
BIN
files/assets/images/emojis/u.webp
Normal file
After Width: | Height: | Size: 4.9 KiB |
BIN
files/assets/images/emojis/v.webp
Normal file
After Width: | Height: | Size: 4 KiB |
BIN
files/assets/images/emojis/w.webp
Normal file
After Width: | Height: | Size: 4.6 KiB |
BIN
files/assets/images/emojis/x.webp
Normal file
After Width: | Height: | Size: 5.3 KiB |
BIN
files/assets/images/emojis/y.webp
Normal file
After Width: | Height: | Size: 3.8 KiB |
BIN
files/assets/images/emojis/z.webp
Normal file
After Width: | Height: | Size: 4.4 KiB |
|
@ -15,7 +15,7 @@ function loadEmojis(form) {
|
|||
emojis = {
|
||||
'marsey': JSON.parse(xhr.response),
|
||||
|
||||
'marseyalphabet': ['marseya','marseyb','marseyc','marseyd','marseye','marseyf','marseyg','marseyh','marseyi','marseyj','marseyk','marseyl','marseym','marseyn','marseyo','marseyp','marseyq','marseyr','marseys','marseyt','marseyu','marseyv','marseyw','marseyx','marseyy','marseyz','marsey0','marsey1','marsey2','marsey3','marsey4','marsey5','marsey6','marsey7','marsey8','marsey9','marseyexclamationpoint','marseyperiod','marseyquestionmark'],
|
||||
'marseyalphabet': ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','0','1','2','3','4','5','6','7','8','9','exclamationpoint','period','questionmark'],
|
||||
|
||||
'platy': ['platytrans','platyfuckyou','plarsy','platyabused','platyblizzard','platyboxer','platydevil','platyfear','platygirlmagic','platygolong','platyhaes','platyking','platylove','platyneet','platyold','platypatience','platypopcorn','platyrich','platysarcasm','platysilly','platysleeping','platythink','platytired','platytuxedomask','platyblush','platybruh','platycaveman','platycheer','platydown','platyeyes','platyheart','platylol','platymicdrop','platynooo','platysalute','platyseethe','platythumbsup','platywave'],
|
||||
|
||||
|
|
|
@ -85,12 +85,12 @@ class Comment(Base):
|
|||
@property
|
||||
@lazy
|
||||
def options(self):
|
||||
return tuple(x for x in self.child_comments if x.author_id == AUTOPOLLER_ID)
|
||||
return [x for x in self.child_comments if x.author_id == AUTOPOLLER_ID]
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def choices(self):
|
||||
return tuple(x for x in self.child_comments if x.author_id == AUTOCHOICE_ID)
|
||||
return [x for x in self.child_comments if x.author_id == AUTOCHOICE_ID]
|
||||
|
||||
def total_poll_voted(self, v):
|
||||
if v:
|
||||
|
@ -100,7 +100,7 @@ class Comment(Base):
|
|||
|
||||
def total_choice_voted(self, v):
|
||||
if v:
|
||||
return g.db.query(CommentVote).filter(CommentVote.user_id == v.id, CommentVote.comment_id.in_(tuple(x.id for x in self.choices))).all()
|
||||
return g.db.query(CommentVote).filter(CommentVote.user_id == v.id, CommentVote.comment_id.in_([x.id for x in self.choices])).all()
|
||||
return False
|
||||
|
||||
@property
|
||||
|
|
|
@ -107,7 +107,7 @@ class Submission(Base):
|
|||
|
||||
def total_choice_voted(self, v):
|
||||
if v and self.choices:
|
||||
return g.db.query(CommentVote).filter(CommentVote.user_id == v.id, CommentVote.comment_id.in_(tuple(x.id for x in self.choices))).all()
|
||||
return g.db.query(CommentVote).filter(CommentVote.user_id == v.id, CommentVote.comment_id.in_([x.id for x in self.choices])).all()
|
||||
return False
|
||||
|
||||
def total_bet_voted(self, v):
|
||||
|
@ -221,8 +221,8 @@ class Submission(Base):
|
|||
if self.club: return link
|
||||
|
||||
output = self.title.lower()
|
||||
output = re.sub('&\w{2,3};', '', output, re.A)
|
||||
output = [re.sub('\W', '', word, re.A) for word in output.split()]
|
||||
output = re.sub('&\w{2,3};', '', output, flags=re.A)
|
||||
output = [re.sub('\W', '', word, flags=re.A) for word in output.split()]
|
||||
output = [x for x in output if x][:6]
|
||||
output = '-'.join(output)
|
||||
if not output: output = '-'
|
||||
|
|
|
@ -163,7 +163,7 @@ class User(Base):
|
|||
@property
|
||||
@lazy
|
||||
def all_blocks(self):
|
||||
return tuple(x[0] for x in g.db.query(SubBlock.sub).filter_by(user_id=self.id).all())
|
||||
return [x[0] for x in g.db.query(SubBlock.sub).filter_by(user_id=self.id).all()]
|
||||
|
||||
@lazy
|
||||
def blocks(self, sub):
|
||||
|
@ -214,7 +214,7 @@ class User(Base):
|
|||
@property
|
||||
@lazy
|
||||
def paid_dues(self):
|
||||
return self.admin_level or self.club_allowed or self.patron > 1 or (self.patron == 1 and self.truecoins > dues/10) or (self.club_allowed != False and self.truecoins > dues)
|
||||
return self.admin_level or self.club_allowed or self.patron > 1 or (self.patron == 1 and self.truecoins > dues/5) or (self.club_allowed != False and self.truecoins > dues)
|
||||
|
||||
@lazy
|
||||
def any_block_exists(self, other):
|
||||
|
|
|
@ -67,7 +67,7 @@ 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)
|
||||
|
||||
soup = BeautifulSoup(text, 'html.parser')
|
||||
soup = BeautifulSoup(text, 'lxml')
|
||||
for mention in soup.find_all("a", href=re.compile("^\/id\/([0-9]+)")):
|
||||
id = int(mention["href"].split("/id/")[1])
|
||||
if id != v.id:
|
||||
|
@ -82,7 +82,7 @@ def NOTIFY_USERS2(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)
|
||||
|
||||
for i in re.finditer("(^|\s|\n)@((\w|-){1,25})", text, re.A):
|
||||
for i in re.finditer("(^|\s|\n)@((\w|-){1,25})", text, flags=re.A):
|
||||
user = get_user(i.group(2), graceful=True)
|
||||
if user and not v.any_block_exists(user): notify_users.add(user.id)
|
||||
|
||||
|
|
|
@ -106,8 +106,8 @@ SLURS = {
|
|||
|
||||
single_words = "|".join([slur.lower() for slur in SLURS.keys()])
|
||||
|
||||
SLUR_REGEX = re.compile(rf"((?<=\s|>)|^)({single_words})((?=[\s<,.$]|s[\s<,.$]))", re.I|re.A)
|
||||
SLUR_REGEX_UPPER = re.compile(rf"((?<=\s|>)|^)({single_words.upper()})((?=[\s<,.$]|S[\s<,.$]))", 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)
|
||||
|
||||
def sub_matcher(match):
|
||||
return SLURS[match.group(0).lower()]
|
||||
|
@ -125,8 +125,8 @@ def torture_ap(body, username):
|
|||
body = SLUR_REGEX_UPPER.sub(sub_matcher_upper, body)
|
||||
body = SLUR_REGEX.sub(sub_matcher, body)
|
||||
for k, l in AJ_REPLACEMENTS.items(): body = body.replace(k, l)
|
||||
body = re.sub('(^|\s|\n)(i|me) ', rf'\1@{username} ', body, re.I|re.A)
|
||||
body = re.sub("(^|\s|\n)i'm ", rf'\1@{username} is ', body, re.I|re.A)
|
||||
body = re.sub('(^|\s|\n)(i|me) ', rf'\1@{username} ', body, flags=re.I|re.A)
|
||||
body = re.sub("(^|\s|\n)i'm ", rf'\1@{username} is ', body, flags=re.I|re.A)
|
||||
return body
|
||||
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ from files.classes import BannedDomain
|
|||
|
||||
def filter_comment_html(html_text):
|
||||
|
||||
soup = BeautifulSoup(html_text, 'html.parser')
|
||||
soup = BeautifulSoup(html_text, 'lxml')
|
||||
|
||||
links = soup.find_all("a")
|
||||
|
||||
|
@ -28,7 +28,7 @@ def filter_comment_html(html_text):
|
|||
new_domain += "." + parts[j]
|
||||
domain_list.add(new_domain)
|
||||
|
||||
bans = tuple(x for x in g.db.query(BannedDomain).filter(BannedDomain.domain.in_(list(domain_list))).all())
|
||||
bans = [x for x in g.db.query(BannedDomain).filter(BannedDomain.domain.in_(list(domain_list))).all()]
|
||||
|
||||
if bans: return bans
|
||||
else: return []
|
||||
|
|
|
@ -140,8 +140,6 @@ def get_posts(pids, v=None):
|
|||
if not pids:
|
||||
return []
|
||||
|
||||
pids=tuple(pids)
|
||||
|
||||
if v:
|
||||
vt = g.db.query(Vote).filter(
|
||||
Vote.submission_id.in_(pids),
|
||||
|
@ -218,8 +216,6 @@ def get_comments(cids, v=None, load_parent=False):
|
|||
|
||||
if not cids: return []
|
||||
|
||||
cids=tuple(cids)
|
||||
|
||||
if v:
|
||||
votes = g.db.query(CommentVote).filter_by(user_id=v.id).subquery()
|
||||
|
||||
|
@ -282,8 +278,6 @@ def get_domain(s):
|
|||
|
||||
domain_list.add(new_domain)
|
||||
|
||||
domain_list = tuple(list(domain_list))
|
||||
|
||||
doms = [x for x in g.db.query(BannedDomain).filter(BannedDomain.domain.in_(domain_list)).all()]
|
||||
|
||||
if not doms:
|
||||
|
|
|
@ -12,7 +12,7 @@ import signal
|
|||
import time
|
||||
|
||||
db = db_session()
|
||||
marseys = tuple(x[0] for x in db.query(Marsey.name).all())
|
||||
marseys = [x[0] for x in db.query(Marsey.name).all()] + ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','0','1','2','3','4','5','6','7','8','9','exclamationpoint','period','questionmark']
|
||||
db.close()
|
||||
|
||||
allowed_tags = tags = ['b',
|
||||
|
@ -120,16 +120,16 @@ def sanitize(sanitized, noimages=False, alert=False, comment=False, edit=False):
|
|||
sanitized = sanitized.replace("\ufeff", "").replace("𒐪","").replace("<script","").replace('','')
|
||||
|
||||
if alert:
|
||||
for i in re.finditer("<p>@((\w|-){1,25})", sanitized, re.A):
|
||||
for i in re.finditer("<p>@((\w|-){1,25})", sanitized, flags=re.A):
|
||||
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)
|
||||
else:
|
||||
sanitized = re.sub('(^|\s|\n|<p>)\/?((r|u)\/(\w|-){3,25})', r'\1<a href="https://old.reddit.com/\2" rel="nofollow noopener noreferrer">/\2</a>', sanitized, re.A)
|
||||
sanitized = re.sub('(^|\s|\n|<p>)\/?((r|u)\/(\w|-){3,25})', r'\1<a href="https://old.reddit.com/\2" rel="nofollow noopener noreferrer">/\2</a>', sanitized, flags=re.A)
|
||||
|
||||
sanitized = re.sub('(^|\s|\n|<p>)\/?(s\/(\w|-){3,25})', r'\1<a href="/\2" rel="nofollow noopener noreferrer">/\2</a>', sanitized, re.A)
|
||||
sanitized = re.sub('(^|\s|\n|<p>)\/?(s\/(\w|-){3,25})', r'\1<a href="/\2" rel="nofollow noopener noreferrer">/\2</a>', sanitized, flags=re.A)
|
||||
|
||||
for i in re.finditer('(^|\s|\n|<p>)@((\w|-){1,25})', sanitized, re.A):
|
||||
for i in re.finditer('(^|\s|\n|<p>)@((\w|-){1,25})', sanitized, flags=re.A):
|
||||
u = get_user(i.group(2), graceful=True)
|
||||
|
||||
if u and (not g.v.any_block_exists(u) or g.v.admin_level > 1):
|
||||
|
@ -165,7 +165,7 @@ def sanitize(sanitized, noimages=False, alert=False, comment=False, edit=False):
|
|||
]
|
||||
).clean(sanitized)
|
||||
|
||||
soup = BeautifulSoup(sanitized, 'html.parser')
|
||||
soup = BeautifulSoup(sanitized, 'lxml')
|
||||
|
||||
for tag in soup.find_all("img"):
|
||||
if tag.get("src") and tag.get("class") != ['pp20']:
|
||||
|
@ -184,7 +184,7 @@ def sanitize(sanitized, noimages=False, alert=False, comment=False, edit=False):
|
|||
tag["target"] = "_blank"
|
||||
tag["rel"] = "nofollow noopener noreferrer"
|
||||
|
||||
if re.match("https?://\S+", str(tag.string), re.A):
|
||||
if re.match("https?://\S+", str(tag.string), flags=re.A):
|
||||
try: tag.string = tag["href"]
|
||||
except: tag.string = ""
|
||||
|
||||
|
@ -195,9 +195,14 @@ 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, re.A))
|
||||
emojis = list(re.finditer("[^a]>\s*(:[!#]{0,2}\w+:\s*)+<\/", sanitized, flags=re.A))
|
||||
if len(emojis) > 20: edit = True
|
||||
|
||||
captured = []
|
||||
for i in emojis:
|
||||
if i.group(0) in captured: continue
|
||||
captured.append(i.group(0))
|
||||
|
||||
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()
|
||||
|
@ -221,14 +226,19 @@ def sanitize(sanitized, noimages=False, alert=False, comment=False, edit=False):
|
|||
if remoji == 'marseyrandom': remoji = choice(marseys)
|
||||
|
||||
if path.isfile(f'files/assets/images/emojis/{remoji}.webp'):
|
||||
new = re.sub(f'(?<!"):{emoji}:', f'<img loading="lazy" data-bs-toggle="tooltip" alt=":{emoji}:" title=":{emoji}:" delay="0" class="{classes}" src="/static/assets/images/emojis/{remoji}.webp" >', new, re.I)
|
||||
new = re.sub(f'(?<!"):{emoji}:', f'<img loading="lazy" data-bs-toggle="tooltip" alt=":{emoji}:" title=":{emoji}:" delay="0" class="{classes}" src="/static/assets/images/emojis/{remoji}.webp" >', new, flags=re.I)
|
||||
if comment: marseys_used.add(emoji)
|
||||
|
||||
sanitized = sanitized.replace(old, new)
|
||||
|
||||
emojis = list(re.finditer('(?<!#"):([!#A-Za-z0-9]{1,30}?):', sanitized))
|
||||
if len(emojis) > 20: edit = True
|
||||
|
||||
captured = []
|
||||
for i in emojis:
|
||||
if i.group(0) in captured: continue
|
||||
captured.append(i.group(0))
|
||||
|
||||
emoji = i.group(1).lower().replace('#','')
|
||||
if emoji.startswith("!"):
|
||||
emoji = emoji[1:]
|
||||
|
@ -240,7 +250,7 @@ def sanitize(sanitized, noimages=False, alert=False, comment=False, edit=False):
|
|||
else: emoji = old
|
||||
|
||||
if path.isfile(f'files/assets/images/emojis/{emoji}.webp'):
|
||||
sanitized = re.sub(f'(?<!"):!{i.group(1).lower()[1:]}:', f'<img loading="lazy" data-bs-toggle="tooltip" alt=":!{old}:" title=":!{old}:" delay="0" class="{classes}" src="/static/assets/images/emojis/{emoji}.webp">', sanitized, re.I)
|
||||
sanitized = re.sub(f'(?<!"):{i.group(1).lower()}:', f'<img loading="lazy" data-bs-toggle="tooltip" alt=":!{old}:" title=":!{old}:" delay="0" class="{classes}" src="/static/assets/images/emojis/{emoji}.webp">', sanitized, flags=re.I)
|
||||
if comment: marseys_used.add(emoji)
|
||||
else:
|
||||
classes = 'emoji'
|
||||
|
@ -251,7 +261,7 @@ def sanitize(sanitized, noimages=False, alert=False, comment=False, edit=False):
|
|||
else: emoji = old
|
||||
|
||||
if path.isfile(f'files/assets/images/emojis/{emoji}.webp'):
|
||||
sanitized = re.sub(f'(?<!"):{i.group(1).lower()}:', f'<img loading="lazy" data-bs-toggle="tooltip" alt=":{old}:" title=":{old}:" delay="0" class="{classes}" src="/static/assets/images/emojis/{emoji}.webp">', sanitized, re.I)
|
||||
sanitized = re.sub(f'(?<!"):{i.group(1).lower()}:', f'<img loading="lazy" data-bs-toggle="tooltip" alt=":{old}:" title=":{old}:" delay="0" class="{classes}" src="/static/assets/images/emojis/{emoji}.webp">', sanitized, flags=re.I)
|
||||
if comment: marseys_used.add(emoji)
|
||||
|
||||
sanitized = sanitized.replace("https://youtu.be/", "https://youtube.com/watch?v=").replace("https://music.youtube.com/watch?v=", "https://youtube.com/watch?v=").replace("https://streamable.com/", "https://streamable.com/e/").replace("https://youtube.com/shorts/", "https://youtube.com/watch?v=").replace("https://mobile.twitter", "https://twitter").replace("https://m.facebook", "https://facebook").replace("m.wikipedia.org", "wikipedia.org").replace("https://m.youtube", "https://youtube").replace("https://www.youtube", "https://youtube")
|
||||
|
@ -310,7 +320,12 @@ def filter_emojis_only(title, edit=False, graceful=False):
|
|||
|
||||
emojis = list(re.finditer('(?<!"):([!A-Za-z0-9]{1,30}?):', title))
|
||||
if len(emojis) > 20: edit = True
|
||||
|
||||
captured = []
|
||||
for i in emojis:
|
||||
if i.group(0) in captured: continue
|
||||
captured.append(i.group(0))
|
||||
|
||||
emoji = i.group(1).lower()
|
||||
|
||||
if emoji.startswith("!"):
|
||||
|
@ -323,7 +338,7 @@ def filter_emojis_only(title, edit=False, graceful=False):
|
|||
else: emoji = old
|
||||
|
||||
if path.isfile(f'files/assets/images/emojis/{emoji}.webp'):
|
||||
title = re.sub(f'(?<!"):!{old}:', f'<img loading="lazy" data-bs-toggle="tooltip" alt=":!{old}:" title=":!{old}:" delay="0" src="/static/assets/images/emojis/{emoji}.webp" class="{classes}">', title, re.I)
|
||||
title = re.sub(f'(?<!"):!{old}:', f'<img loading="lazy" data-bs-toggle="tooltip" alt=":!{old}:" title=":!{old}:" delay="0" src="/static/assets/images/emojis/{emoji}.webp" class="{classes}">', title, flags=re.I)
|
||||
|
||||
else:
|
||||
classes = 'emoji'
|
||||
|
@ -334,7 +349,7 @@ def filter_emojis_only(title, edit=False, graceful=False):
|
|||
else: emoji = old
|
||||
|
||||
if path.isfile(f'files/assets/images/emojis/{emoji}.webp'):
|
||||
title = re.sub(f'(?<!"):{old}:', f'<img loading="lazy" data-bs-toggle="tooltip" alt=":{old}:" title=":{old}:" delay="0" class="{classes}" src="/static/assets/images/emojis/{emoji}.webp">', title, re.I)
|
||||
title = re.sub(f'(?<!"):{old}:', f'<img loading="lazy" data-bs-toggle="tooltip" alt=":{old}:" title=":{old}:" delay="0" class="{classes}" src="/static/assets/images/emojis/{emoji}.webp">', title, flags=re.I)
|
||||
|
||||
title = re.sub('~~(.*?)~~', r'<del>\1</del>', title)
|
||||
|
||||
|
|
|
@ -40,8 +40,6 @@ WORDLE_COLOR_MAPPINGS = {-1: "🟥", 0: "🟨", 1: "🟩"}
|
|||
def post_pid_comment_cid(cid, pid=None, anything=None, v=None, sub=None):
|
||||
|
||||
if not v and not request.path.startswith('/logged_out'): return redirect(f"{SITE_FULL}/logged_out{request.full_path}")
|
||||
|
||||
if v and request.path.startswith('/logged_out'): return redirect(SITE_FULL + request.full_path.replace('/logged_out',''))
|
||||
|
||||
try: cid = int(cid)
|
||||
except: abort(404)
|
||||
|
@ -145,7 +143,7 @@ def post_pid_comment_cid(cid, pid=None, anything=None, v=None, sub=None):
|
|||
def api_comment(v):
|
||||
if v.is_suspended: return {"error": "You can't perform this action while banned."}, 403
|
||||
|
||||
if v.admin_level < 2:
|
||||
if v.admin_level < 3:
|
||||
if v and v.patron:
|
||||
if request.content_length > 8 * 1024 * 1024: return {"error":"Max file size is 4 MB (8 MB for paypigs)."}, 413
|
||||
elif request.content_length > 4 * 1024 * 1024: return {"error":"Max file size is 4 MB (8 MB for paypigs)."}, 413
|
||||
|
@ -181,7 +179,7 @@ def api_comment(v):
|
|||
f.write('\n{[para]}\n' + body)
|
||||
|
||||
if v.marseyawarded and parent_post.id not in (37696,37697,37749,37833,37838):
|
||||
marregex = list(re.finditer("^(:[!#]{0,2}m\w+:\s*)+$", body, re.A))
|
||||
marregex = list(re.finditer("^(:[!#]{0,2}m\w+:\s*)+$", body, flags=re.A))
|
||||
if len(marregex) == 0: return {"error":"You can only type marseys!"}, 403
|
||||
|
||||
if v.longpost and len(body) < 280 or ' [](' in body or body.startswith('[]('): return {"error":"You have to type more than 280 characters!"}, 403
|
||||
|
@ -190,16 +188,16 @@ def api_comment(v):
|
|||
|
||||
if not body and not request.files.get('file'): return {"error":"You need to actually write something!"}, 400
|
||||
|
||||
for i in re.finditer('^(https:\/\/.*\.(png|jpg|jpeg|gif|webp|PNG|JPG|JPEG|GIF|WEBP|9999)($|\s|\n))', body, re.M|re.A):
|
||||
for i in re.finditer('^(https:\/\/.*\.(png|jpg|jpeg|gif|webp|PNG|JPG|JPEG|GIF|WEBP|9999)($|\s|\n))', body, flags=re.M|re.A):
|
||||
if "wikipedia" not in i.group(1): body = body.replace(i.group(1), f'})')
|
||||
|
||||
options = []
|
||||
for i in re.finditer('\s*\$\$([^\$\n]+)\$\$\s*', body, re.A):
|
||||
for i in re.finditer('\s*\$\$([^\$\n]+)\$\$\s*', body, flags=re.A):
|
||||
options.append(i.group(1))
|
||||
body = body.replace(i.group(0), "")
|
||||
|
||||
choices = []
|
||||
for i in re.finditer('\s*&&([^\$\n]+)&&\s*', body, re.A):
|
||||
for i in re.finditer('\s*&&([^\$\n]+)&&\s*', body, flags=re.A):
|
||||
choices.append(i.group(1))
|
||||
body = body.replace(i.group(0), "")
|
||||
|
||||
|
@ -275,7 +273,7 @@ def api_comment(v):
|
|||
|
||||
body_html = sanitize(body, comment=True)
|
||||
|
||||
if v.marseyawarded and len(list(re.finditer('>[^<\s+]|[^>\s+]<', body_html, re.A))): return {"error":"You can only type marseys!"}, 403
|
||||
if v.marseyawarded and len(list(re.finditer('>[^<\s+]|[^>\s+]<', body_html, flags=re.A))): return {"error":"You can only type marseys!"}, 403
|
||||
|
||||
if parent_post.id not in (37696,37697,37749,37833,37838):
|
||||
if v.longpost:
|
||||
|
@ -388,7 +386,7 @@ def api_comment(v):
|
|||
g.db.add(c_choice)
|
||||
|
||||
if request.host == 'pcmemes.net' and c.body.lower().startswith("based"):
|
||||
pill = re.match("based and (.{1,20}?)(-| )pilled", body, re.IGNORECASE)
|
||||
pill = re.match("based and (.{1,20}?)(-| )pilled", body, flags=re.IGNORECASE)
|
||||
|
||||
if level == 1: basedguy = get_account(parent_post.author_id)
|
||||
else: basedguy = get_account(c.parent_comment.author_id)
|
||||
|
@ -695,7 +693,7 @@ def api_comment(v):
|
|||
@auth_required
|
||||
def edit_comment(cid, v):
|
||||
|
||||
if v.admin_level < 2:
|
||||
if v.admin_level < 3:
|
||||
if v and v.patron:
|
||||
if request.content_length > 8 * 1024 * 1024: return {"error":"Max file size is 4 MB (8 MB for paypigs)."}, 413
|
||||
elif request.content_length > 4 * 1024 * 1024: return {"error":"Max file size is 4 MB (8 MB for paypigs)."}, 413
|
||||
|
@ -711,20 +709,20 @@ def edit_comment(cid, v):
|
|||
|
||||
if body != c.body or request.files.get("file") and request.headers.get("cf-ipcountry") != "T1":
|
||||
if v.marseyawarded:
|
||||
marregex = list(re.finditer("^(:[!#]{0,2}m\w+:\s*)+$", body, re.A))
|
||||
marregex = list(re.finditer("^(:[!#]{0,2}m\w+:\s*)+$", body, flags=re.A))
|
||||
if len(marregex) == 0: return {"error":"You can only type marseys!"}, 403
|
||||
|
||||
if v.longpost and len(body) < 280 or ' [](' in body or body.startswith('[]('): return {"error":"You have to type more than 280 characters!"}, 403
|
||||
elif v.bird and len(body) > 140: return {"error":"You have to type less than 140 characters!"}, 403
|
||||
|
||||
for i in re.finditer('^(https:\/\/.*\.(png|jpg|jpeg|gif|webp|PNG|JPG|JPEG|GIF|WEBP|9999)($|\s|\n))', body, re.M|re.A):
|
||||
for i in re.finditer('^(https:\/\/.*\.(png|jpg|jpeg|gif|webp|PNG|JPG|JPEG|GIF|WEBP|9999)($|\s|\n))', body, flags=re.M|re.A):
|
||||
if "wikipedia" not in i.group(1): body = body.replace(i.group(1), f'})')
|
||||
|
||||
if v.agendaposter and not v.marseyawarded:
|
||||
body = torture_ap(body, v.username)
|
||||
|
||||
if not c.options:
|
||||
for i in re.finditer('\s*\$\$([^\$\n]+)\$\$\s*', body, re.A):
|
||||
for i in re.finditer('\s*\$\$([^\$\n]+)\$\$\s*', body, flags=re.A):
|
||||
body = body.replace(i.group(0), "")
|
||||
c_option = Comment(author_id=AUTOPOLLER_ID,
|
||||
parent_submission=c.parent_submission,
|
||||
|
@ -737,7 +735,7 @@ def edit_comment(cid, v):
|
|||
g.db.add(c_option)
|
||||
|
||||
if not c.choices:
|
||||
for i in re.finditer('\s*&&([^\$\n]+)&&\s*', body, re.A):
|
||||
for i in re.finditer('\s*&&([^\$\n]+)&&\s*', body, flags=re.A):
|
||||
body = body.replace(i.group(0), "")
|
||||
c_choice = Comment(author_id=AUTOCHOICE_ID,
|
||||
parent_submission=c.parent_submission,
|
||||
|
@ -751,7 +749,7 @@ def edit_comment(cid, v):
|
|||
|
||||
body_html = sanitize(body, edit=True)
|
||||
|
||||
if v.marseyawarded and len(list(re.finditer('>[^<\s+]|[^>\s+]<', body_html, re.A))): return {"error":"You can only type marseys!"}, 403
|
||||
if v.marseyawarded and len(list(re.finditer('>[^<\s+]|[^>\s+]<', body_html, flags=re.A))): return {"error":"You can only type marseys!"}, 403
|
||||
|
||||
if v.longpost:
|
||||
if len(body) < 280 or ' [](' in body or body.startswith('[]('): return {"error":"You have to type more than 280 characters!"}, 403
|
||||
|
|
|
@ -145,8 +145,6 @@ def front_all(v, sub=None):
|
|||
if not v and request.path == "/" and not request.headers.get("Authorization"):
|
||||
return redirect(f"{SITE_FULL}/logged_out{request.full_path}")
|
||||
|
||||
if v and request.path.startswith('/logged_out'): return redirect(SITE_FULL + request.full_path.replace('/logged_out',''))
|
||||
|
||||
try: page = max(int(request.values.get("page", 1)), 1)
|
||||
except: abort(400)
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ def login_get(v):
|
|||
|
||||
|
||||
def check_for_alts(current_id):
|
||||
ids = tuple(x[0] for x in g.db.query(User.id).all())
|
||||
ids = [x[0] for x in g.db.query(User.id).all()]
|
||||
past_accs = set(session.get("history", []))
|
||||
|
||||
for past_id in list(past_accs):
|
||||
|
@ -338,7 +338,7 @@ def sign_up_post(v):
|
|||
password=request.values.get("password"),
|
||||
email=email,
|
||||
referred_by=ref_id or None,
|
||||
ban_evade = int(any((x.is_banned or x.shadowbanned) and not x.unban_utc for x in g.db.query(User).filter(User.id.in_(tuple(session.get("history", [])))).all() if x))
|
||||
ban_evade = int(any((x.is_banned or x.shadowbanned) and not x.unban_utc for x in g.db.query(User).filter(User.id.in_(session.get("history", []))).all() if x))
|
||||
)
|
||||
|
||||
g.db.add(new_user)
|
||||
|
|
|
@ -21,13 +21,13 @@ from shutil import copyfile
|
|||
from sys import stdout
|
||||
|
||||
db = db_session()
|
||||
marseys = tuple(f':#{x[0]}:' for x in db.query(Marsey.name).all())
|
||||
marseys = [f':#{x[0]}:' for x in db.query(Marsey.name).all()]
|
||||
db.close()
|
||||
|
||||
if path.exists(f'snappy_{SITE_NAME}.txt'):
|
||||
with open(f'snappy_{SITE_NAME}.txt', "r", encoding="utf-8") as f:
|
||||
if SITE == 'pcmemes.net': snappyquotes = tuple(f.read().split("{[para]}"))
|
||||
else: snappyquotes = tuple(f.read().split("\n{[para]}\n")) + marseys
|
||||
if SITE == 'pcmemes.net': snappyquotes = f.read().split("{[para]}")
|
||||
else: snappyquotes = [f.read().split("\n{[para]}\n")] + marseys
|
||||
else: snappyquotes = marseys
|
||||
|
||||
IMGUR_KEY = environ.get("IMGUR_KEY").strip()
|
||||
|
@ -129,7 +129,7 @@ def submit_get(v, sub=None):
|
|||
|
||||
if request.path.startswith('/s/') and not sub: abort(404)
|
||||
|
||||
SUBS = () if SITE_NAME == 'Drama' and not sub else tuple(x[0] for x in g.db.query(Sub.name).order_by(Sub.name).all())
|
||||
SUBS = () if SITE_NAME == 'Drama' and not sub else [[0] for x in g.db.query(Sub.name).order_by(Sub.name).all()]
|
||||
|
||||
return render_template("submit.html", SUBS=SUBS, v=v, sub=sub, ghost=submit_ghost(v,g.db))
|
||||
|
||||
|
@ -146,9 +146,6 @@ def post_id(pid, anything=None, v=None, sub=None):
|
|||
if not v and not request.path.startswith('/logged_out') and not request.headers.get("Authorization"):
|
||||
return redirect(f"{SITE_FULL}/logged_out{request.full_path}")
|
||||
|
||||
if v and request.path.startswith('/logged_out'): return redirect(SITE_FULL + request.full_path.replace('/logged_out',''))
|
||||
|
||||
|
||||
try: pid = int(pid)
|
||||
except Exception as e: pass
|
||||
|
||||
|
@ -444,7 +441,7 @@ def morecomments(v, cid):
|
|||
@limiter.limit("1/second;30/minute;200/hour;1000/day")
|
||||
@auth_required
|
||||
def edit_post(pid, v):
|
||||
if v.admin_level < 2:
|
||||
if v.admin_level < 3:
|
||||
if v and v.patron:
|
||||
if request.content_length > 8 * 1024 * 1024: return {"error":"Max file size is 4 MB (8 MB for paypigs)."}, 413
|
||||
elif request.content_length > 4 * 1024 * 1024: return {"error":"Max file size is 4 MB (8 MB for paypigs)."}, 413
|
||||
|
@ -460,10 +457,10 @@ def edit_post(pid, v):
|
|||
if len(body) > 20000: return {"error":"Character limit is 20000!"}, 403
|
||||
|
||||
if v.marseyawarded:
|
||||
marregex = list(re.finditer("^(:[!#]{0,2}m\w+:\s*)+$", title, re.A))
|
||||
marregex = list(re.finditer("^(:[!#]{0,2}m\w+:\s*)+$", title, flags=re.A))
|
||||
if len(marregex) == 0: return {"error":"You can only type marseys!"}, 403
|
||||
if body:
|
||||
marregex = list(re.finditer("^(:[!#]{0,2}m\w+:\s*)+$", body, re.A))
|
||||
marregex = list(re.finditer("^(:[!#]{0,2}m\w+:\s*)+$", body, flags=re.A))
|
||||
if len(marregex) == 0: return {"error":"You can only type marseys!"}, 403
|
||||
|
||||
if v.longpost and len(body) < 280 or ' [](' in body or body.startswith('[]('): return {"error":"You have to type more than 280 characters!"}, 403
|
||||
|
@ -473,7 +470,7 @@ def edit_post(pid, v):
|
|||
if v.agendaposter and not v.marseyawarded: title = torture_ap(title, v.username)
|
||||
|
||||
title_html = filter_emojis_only(title, edit=True)
|
||||
if v.marseyawarded and len(list(re.finditer('>[^<\s+]|[^>\s+]<', title_html, re.A))): return {"error":"You can only type marseys!"}, 403
|
||||
if v.marseyawarded and len(list(re.finditer('>[^<\s+]|[^>\s+]<', title_html, flags=re.A))): return {"error":"You can only type marseys!"}, 403
|
||||
p.title = title[:500]
|
||||
p.title_html = title_html
|
||||
|
||||
|
@ -494,13 +491,13 @@ def edit_post(pid, v):
|
|||
else: return {"error": "Image/Video files only"}, 400
|
||||
|
||||
if body != p.body:
|
||||
for i in re.finditer('^(https:\/\/.*\.(png|jpg|jpeg|gif|webp|PNG|JPG|JPEG|GIF|WEBP|9999)($|\s|\n))', body, re.M|re.A):
|
||||
for i in re.finditer('^(https:\/\/.*\.(png|jpg|jpeg|gif|webp|PNG|JPG|JPEG|GIF|WEBP|9999)($|\s|\n))', body, flags=re.M|re.A):
|
||||
if "wikipedia" not in i.group(1): body = body.replace(i.group(1), f'})')
|
||||
|
||||
if v.agendaposter and not v.marseyawarded: body = torture_ap(body, v.username)
|
||||
|
||||
if not p.options.count():
|
||||
for i in re.finditer('\s*\$\$([^\$\n]+)\$\$\s*', body, re.A):
|
||||
for i in re.finditer('\s*\$\$([^\$\n]+)\$\$\s*', body, flags=re.A):
|
||||
body = body.replace(i.group(0), "")
|
||||
c = Comment(author_id=AUTOPOLLER_ID,
|
||||
parent_submission=p.id,
|
||||
|
@ -512,7 +509,7 @@ def edit_post(pid, v):
|
|||
g.db.add(c)
|
||||
|
||||
if not p.choices.count():
|
||||
for i in re.finditer('\s*&&([^\$\n]+)&&\s*', body, re.A):
|
||||
for i in re.finditer('\s*&&([^\$\n]+)&&\s*', body, flags=re.A):
|
||||
body = body.replace(i.group(0), "")
|
||||
c = Comment(author_id=AUTOCHOICE_ID,
|
||||
parent_submission=p.id,
|
||||
|
@ -535,7 +532,7 @@ def edit_post(pid, v):
|
|||
return {"error": reason}, 403
|
||||
|
||||
p.body = body
|
||||
if v.marseyawarded and len(list(re.finditer('>[^<\s+]|[^>\s+]<', body_html, re.A))): return {"error":"You can only type marseys!"}, 40
|
||||
if v.marseyawarded and len(list(re.finditer('>[^<\s+]|[^>\s+]<', body_html, flags=re.A))): return {"error":"You can only type marseys!"}, 40
|
||||
|
||||
if v.longpost:
|
||||
if len(body) < 280 or ' [](' in body or body.startswith('[]('): return {"error":"You have to type more than 280 characters!"}, 403
|
||||
|
@ -671,7 +668,7 @@ def thumbnail_thread(pid):
|
|||
|
||||
|
||||
if x.headers.get("Content-Type","").startswith("text/html"):
|
||||
soup=BeautifulSoup(x.content, 'html.parser')
|
||||
soup=BeautifulSoup(x.content, 'lxml')
|
||||
|
||||
thumb_candidate_urls=[]
|
||||
|
||||
|
@ -788,7 +785,7 @@ def thumbnail_thread(pid):
|
|||
notif = Notification(comment_id=new_comment.id, user_id=admin.id)
|
||||
db.add(notif)
|
||||
|
||||
k,val = random.choice(tuple(REDDIT_NOTIFS.items()))
|
||||
k,val = random.choice(REDDIT_NOTIFS.items())
|
||||
for i in requests.get(f'https://api.pushshift.io/reddit/{t}/search?html_decode=true&q={k}&size=1').json()["data"]:
|
||||
try: body_html = sanitize(f'New mention of you: https://old.reddit.com{i["permalink"]}?context=89', noimages=True)
|
||||
except: continue
|
||||
|
@ -859,7 +856,7 @@ def submit_post(v, sub=None):
|
|||
def error(error):
|
||||
if request.headers.get("Authorization") or request.headers.get("xhr"): return {"error": error}, 403
|
||||
|
||||
SUBS = () if SITE_NAME == 'Drama' and not sub else tuple(x[0] for x in g.db.query(Sub.name).order_by(Sub.name).all())
|
||||
SUBS = () if SITE_NAME == 'Drama' and not sub else [x[0] for x in g.db.query(Sub.name).order_by(Sub.name).all()]
|
||||
return render_template("submit.html", SUBS=SUBS, v=v, error=error, title=title, url=url, body=body, ghost=submit_ghost(v,g.db)), 400
|
||||
|
||||
|
||||
|
@ -876,7 +873,7 @@ def submit_post(v, sub=None):
|
|||
|
||||
if v.is_suspended: return error("You can't perform this action while banned.")
|
||||
|
||||
if v.admin_level < 2:
|
||||
if v.admin_level < 3:
|
||||
if v and v.patron:
|
||||
if request.content_length > 8 * 1024 * 1024: return error( "Max file size is 4 MB (8 MB for paypigs).")
|
||||
elif request.content_length > 4 * 1024 * 1024: return error( "Max file size is 4 MB (8 MB for paypigs).")
|
||||
|
@ -886,7 +883,7 @@ def submit_post(v, sub=None):
|
|||
title_html = filter_emojis_only(title, graceful=True)
|
||||
if len(title_html) > 1500: return error("Rendered title is too big!")
|
||||
|
||||
if v.marseyawarded and len(list(re.finditer('>[^<\s+]|[^>\s+]<', title_html, re.A))): return error("You can only type marseys!")
|
||||
if v.marseyawarded and len(list(re.finditer('>[^<\s+]|[^>\s+]<', title_html, flags=re.A))): return error("You can only type marseys!")
|
||||
|
||||
if v.longpost:
|
||||
if len(body) < 280 or ' [](' in body or body.startswith('[]('): return error("You have to type more than 280 characters!")
|
||||
|
@ -898,10 +895,10 @@ def submit_post(v, sub=None):
|
|||
elif "/media.giphy.com/" in url or "/c.tenor.com/" in url: url = url.replace(".gif", ".webp")
|
||||
elif "/i.ibb.com/" in url: url = url.replace(".png", ".webp").replace(".jpg", ".webp").replace(".jpeg", ".webp").replace(".gif", ".webp")
|
||||
|
||||
for rd in ["://reddit.com", "://new.reddit.com", "://www.reddit.com", "://redd.it", "://libredd.it"]:
|
||||
for rd in ("://reddit.com", "://new.reddit.com", "://www.reddit.com", "://redd.it", "://libredd.it", "://teddit.net"):
|
||||
url = url.replace(rd, "://old.reddit.com")
|
||||
|
||||
url = url.replace("old.reddit.com/gallery", "new.reddit.com/gallery").replace("https://youtu.be/", "https://youtube.com/watch?v=").replace("https://music.youtube.com/watch?v=", "https://youtube.com/watch?v=").replace("https://streamable.com/", "https://streamable.com/e/").replace("https://youtube.com/shorts/", "https://youtube.com/watch?v=").replace("https://mobile.twitter", "https://twitter").replace("https://m.facebook", "https://facebook").replace("m.wikipedia.org", "wikipedia.org").replace("https://m.youtube", "https://youtube").replace("https://www.youtube", "https://youtube")
|
||||
url = url.replace("nitter.net", "twitter.com").replace("old.reddit.com/gallery", "new.reddit.com/gallery").replace("https://youtu.be/", "https://youtube.com/watch?v=").replace("https://music.youtube.com/watch?v=", "https://youtube.com/watch?v=").replace("https://streamable.com/", "https://streamable.com/e/").replace("https://youtube.com/shorts/", "https://youtube.com/watch?v=").replace("https://mobile.twitter", "https://twitter").replace("https://m.facebook", "https://facebook").replace("m.wikipedia.org", "wikipedia.org").replace("https://m.youtube", "https://youtube").replace("https://www.youtube", "https://youtube")
|
||||
|
||||
if url.startswith("https://streamable.com/") and not url.startswith("https://streamable.com/e/"): url = url.replace("https://streamable.com/", "https://streamable.com/e/")
|
||||
|
||||
|
@ -972,10 +969,10 @@ def submit_post(v, sub=None):
|
|||
return error("There's a 500 character limit for titles.")
|
||||
|
||||
if v.marseyawarded:
|
||||
marregex = list(re.finditer("^(:[!#]{0,2}m\w+:\s*)+$", title, re.A))
|
||||
marregex = list(re.finditer("^(:[!#]{0,2}m\w+:\s*)+$", title, flags=re.A))
|
||||
if len(marregex) == 0: return error("You can only type marseys!")
|
||||
if body:
|
||||
marregex = list(re.finditer("^(:[!#]{0,2}m\w+:\s*)+$", body, re.A))
|
||||
marregex = list(re.finditer("^(:[!#]{0,2}m\w+:\s*)+$", body, flags=re.A))
|
||||
if len(marregex) == 0: return error("You can only type marseys!")
|
||||
|
||||
if v.longpost and len(body) < 280 or ' [](' in body or body.startswith('[]('): return error("You have to type more than 280 characters!")
|
||||
|
@ -1041,22 +1038,22 @@ def submit_post(v, sub=None):
|
|||
if len(url) > 2048:
|
||||
return error("There's a 2048 character limit for URLs.")
|
||||
|
||||
for i in re.finditer('^(https:\/\/.*\.(png|jpg|jpeg|gif|webp|PNG|JPG|JPEG|GIF|WEBP|9999)($|\s|\n))', body, re.M|re.A):
|
||||
for i in re.finditer('^(https:\/\/.*\.(png|jpg|jpeg|gif|webp|PNG|JPG|JPEG|GIF|WEBP|9999)($|\s|\n))', body, flags=re.M|re.A):
|
||||
if "wikipedia" not in i.group(1): body = body.replace(i.group(1), f'})')
|
||||
|
||||
if v and v.admin_level > 2:
|
||||
bet_options = []
|
||||
for i in re.finditer('\s*\$\$\$([^\$\n]+)\$\$\$\s*', body, re.A):
|
||||
for i in re.finditer('\s*\$\$\$([^\$\n]+)\$\$\$\s*', body, flags=re.A):
|
||||
bet_options.append(i.group(1))
|
||||
body = body.replace(i.group(0), "")
|
||||
|
||||
options = []
|
||||
for i in re.finditer('\s*\$\$([^\$\n]+)\$\$\s*', body, re.A):
|
||||
for i in re.finditer('\s*\$\$([^\$\n]+)\$\$\s*', body, flags=re.A):
|
||||
options.append(i.group(1))
|
||||
body = body.replace(i.group(0), "")
|
||||
|
||||
choices = []
|
||||
for i in re.finditer('\s*&&([^\$\n]+)&&\s*', body, re.A):
|
||||
for i in re.finditer('\s*&&([^\$\n]+)&&\s*', body, flags=re.A):
|
||||
choices.append(i.group(1))
|
||||
body = body.replace(i.group(0), "")
|
||||
|
||||
|
@ -1084,7 +1081,7 @@ def submit_post(v, sub=None):
|
|||
|
||||
body_html = sanitize(body)
|
||||
|
||||
if v.marseyawarded and len(list(re.finditer('>[^<\s+]|[^>\s+]<', body_html, re.A))): return error("You can only type marseys!")
|
||||
if v.marseyawarded and len(list(re.finditer('>[^<\s+]|[^>\s+]<', body_html, flags=re.A))): return error("You can only type marseys!")
|
||||
|
||||
if v.longpost:
|
||||
if len(body) < 280 or ' [](' in body or body.startswith('[]('): return error("You have to type more than 280 characters!")
|
||||
|
|
|
@ -5,7 +5,7 @@ from flask import *
|
|||
from files.__main__ import app
|
||||
|
||||
|
||||
query_regex=re.compile("(\w+):(\S+)", re.A)
|
||||
query_regex=re.compile("(\w+):(\S+)", flags=re.A)
|
||||
valid_params=[
|
||||
'author',
|
||||
'domain',
|
||||
|
@ -88,7 +88,6 @@ def searchposts(v):
|
|||
if 'q' in criteria:
|
||||
words=criteria['q'].split()
|
||||
words=[Submission.title.ilike('%'+x+'%') for x in words]
|
||||
words=tuple(words)
|
||||
posts=posts.filter(*words)
|
||||
|
||||
if 'over18' in criteria: posts = posts.filter(Submission.over_18==True)
|
||||
|
@ -225,7 +224,6 @@ def searchcomments(v):
|
|||
if 'q' in criteria:
|
||||
words = criteria['q'].split()
|
||||
words = [Comment.body.ilike('%'+x+'%') for x in words]
|
||||
words = tuple(words)
|
||||
comments = comments.filter(*words)
|
||||
|
||||
if 'over18' in criteria: comments = comments.filter(Comment.over_18 == True)
|
||||
|
|
|
@ -46,8 +46,8 @@ def removebackground(v):
|
|||
@auth_required
|
||||
def settings_profile_post(v):
|
||||
if v and v.patron:
|
||||
if request.content_length > 8 * 1024 * 1024: return {"error":"Max file size is 8 MB."}, 413
|
||||
elif request.content_length > 4 * 1024 * 1024: return {"error":"Max file size is 4 MB."}, 413
|
||||
if request.content_length > 8 * 1024 * 1024: return {"error":"Max file size is 4 MB (8 MB for paypigs)."}, 413
|
||||
elif request.content_length > 4 * 1024 * 1024: return {"error":"Max file size is 4 MB (8 MB for paypigs)."}, 413
|
||||
|
||||
|
||||
updated = False
|
||||
|
@ -143,7 +143,7 @@ def settings_profile_post(v):
|
|||
elif (v.patron or v.id == MOOSE_ID) and request.values.get("sig"):
|
||||
sig = request.values.get("sig")[:200]
|
||||
|
||||
for i in re.finditer('^(https:\/\/.*\.(png|jpg|jpeg|gif|webp|PNG|JPG|JPEG|GIF|WEBP|9999)($|\s|\n))', sig, re.M|re.A):
|
||||
for i in re.finditer('^(https:\/\/.*\.(png|jpg|jpeg|gif|webp|PNG|JPG|JPEG|GIF|WEBP|9999)($|\s|\n))', sig, flags=re.M|re.A):
|
||||
if "wikipedia" not in i.group(1): sig = sig.replace(i.group(1), f'})')
|
||||
|
||||
sig_html = sanitize(sig)
|
||||
|
@ -177,7 +177,7 @@ def settings_profile_post(v):
|
|||
elif request.values.get("friends"):
|
||||
friends = request.values.get("friends")[:500]
|
||||
|
||||
for i in re.finditer('^(https:\/\/.*\.(png|jpg|jpeg|gif|webp|PNG|JPG|JPEG|GIF|WEBP|9999)($|\s|\n))', friends, re.M|re.A):
|
||||
for i in re.finditer('^(https:\/\/.*\.(png|jpg|jpeg|gif|webp|PNG|JPG|JPEG|GIF|WEBP|9999)($|\s|\n))', friends, flags=re.M|re.A):
|
||||
if "wikipedia" not in i.group(1): friends = friends.replace(i.group(1), f'})')
|
||||
|
||||
friends_html = sanitize(friends)
|
||||
|
@ -214,7 +214,7 @@ def settings_profile_post(v):
|
|||
elif request.values.get("enemies"):
|
||||
enemies = request.values.get("enemies")[:500]
|
||||
|
||||
for i in re.finditer('^(https:\/\/.*\.(png|jpg|jpeg|gif|webp|PNG|JPG|JPEG|GIF|WEBP|9999)($|\s|\n))', enemies, re.M|re.A):
|
||||
for i in re.finditer('^(https:\/\/.*\.(png|jpg|jpeg|gif|webp|PNG|JPG|JPEG|GIF|WEBP|9999)($|\s|\n))', enemies, flags=re.M|re.A):
|
||||
if "wikipedia" not in i.group(1): enemies = enemies.replace(i.group(1), f'})')
|
||||
|
||||
enemies_html = sanitize(enemies)
|
||||
|
@ -251,7 +251,7 @@ def settings_profile_post(v):
|
|||
elif request.values.get("bio") or request.files.get('file') and request.headers.get("cf-ipcountry") != "T1":
|
||||
bio = request.values.get("bio")[:1500]
|
||||
|
||||
for i in re.finditer('^(https:\/\/.*\.(png|jpg|jpeg|gif|webp|PNG|JPG|JPEG|GIF|WEBP|9999)($|\s|\n))', bio, re.M|re.A):
|
||||
for i in re.finditer('^(https:\/\/.*\.(png|jpg|jpeg|gif|webp|PNG|JPG|JPEG|GIF|WEBP|9999)($|\s|\n))', bio, flags=re.M|re.A):
|
||||
if "wikipedia" not in i.group(1): bio = bio.replace(i.group(1), f'})')
|
||||
|
||||
if request.files.get('file'):
|
||||
|
@ -631,8 +631,8 @@ def settings_log_out_others(v):
|
|||
@auth_required
|
||||
def settings_images_profile(v):
|
||||
if v and v.patron:
|
||||
if request.content_length > 8 * 1024 * 1024: return {"error":"Max file size is 8 MB."}, 413
|
||||
elif request.content_length > 4 * 1024 * 1024: return {"error":"Max file size is 4 MB."}, 413
|
||||
if request.content_length > 8 * 1024 * 1024: return {"error":"Max file size is 4 MB (8 MB for paypigs)."}, 413
|
||||
elif request.content_length > 4 * 1024 * 1024: return {"error":"Max file size is 4 MB (8 MB for paypigs)."}, 413
|
||||
|
||||
if request.headers.get("cf-ipcountry") == "T1": return {"error":"Image uploads are not allowed through TOR."}, 403
|
||||
|
||||
|
@ -670,8 +670,8 @@ def settings_images_profile(v):
|
|||
@auth_required
|
||||
def settings_images_banner(v):
|
||||
if v and v.patron:
|
||||
if request.content_length > 8 * 1024 * 1024: return {"error":"Max file size is 8 MB."}, 413
|
||||
elif request.content_length > 4 * 1024 * 1024: return {"error":"Max file size is 4 MB."}, 413
|
||||
if request.content_length > 8 * 1024 * 1024: return {"error":"Max file size is 4 MB (8 MB for paypigs)."}, 413
|
||||
elif request.content_length > 4 * 1024 * 1024: return {"error":"Max file size is 4 MB (8 MB for paypigs)."}, 413
|
||||
|
||||
if request.headers.get("cf-ipcountry") == "T1": return {"error":"Image uploads are not allowed through TOR."}, 403
|
||||
|
||||
|
|
|
@ -39,7 +39,6 @@ def marsey_list():
|
|||
@auth_desired
|
||||
def terms(v):
|
||||
if not v and not request.path.startswith('/logged_out'): return redirect(f"{SITE_FULL}/logged_out{request.full_path}")
|
||||
if v and request.path.startswith('/logged_out'): return redirect(SITE_FULL + request.full_path.replace('/logged_out',''))
|
||||
|
||||
return render_template("terms.html", v=v)
|
||||
|
||||
|
@ -48,7 +47,6 @@ def terms(v):
|
|||
@auth_desired
|
||||
def sidebar(v):
|
||||
if not v and not request.path.startswith('/logged_out'): return redirect(f"{SITE_FULL}/logged_out{request.full_path}")
|
||||
if v and request.path.startswith('/logged_out'): return redirect(SITE_FULL + request.full_path.replace('/logged_out',''))
|
||||
|
||||
return render_template('sidebar.html', v=v)
|
||||
|
||||
|
@ -65,7 +63,6 @@ def stats():
|
|||
day = int(time.time()) - 86400
|
||||
|
||||
week = int(time.time()) - 604800
|
||||
active_users = set()
|
||||
posters = g.db.query(Submission.author_id).distinct(Submission.author_id).filter(Submission.created_utc > week).all()
|
||||
commenters = g.db.query(Comment.author_id).distinct(Comment.author_id).filter(Comment.created_utc > week).all()
|
||||
voters = g.db.query(Vote.user_id).distinct(Vote.user_id).filter(Vote.created_utc > week).all()
|
||||
|
|
|
@ -371,8 +371,8 @@ def get_sub_css(sub):
|
|||
@is_not_permabanned
|
||||
def sub_banner(v, sub):
|
||||
if v and v.patron:
|
||||
if request.content_length > 8 * 1024 * 1024: return {"error":"Max file size is 8 MB."}, 413
|
||||
elif request.content_length > 4 * 1024 * 1024: return {"error":"Max file size is 4 MB."}, 413
|
||||
if request.content_length > 8 * 1024 * 1024: return {"error":"Max file size is 4 MB (8 MB for paypigs)."}, 413
|
||||
elif request.content_length > 4 * 1024 * 1024: return {"error":"Max file size is 4 MB (8 MB for paypigs)."}, 413
|
||||
|
||||
if request.headers.get("cf-ipcountry") == "T1": return {"error":"Image uploads are not allowed through TOR."}, 403
|
||||
|
||||
|
@ -402,8 +402,8 @@ def sub_banner(v, sub):
|
|||
@is_not_permabanned
|
||||
def sub_sidebar(v, sub):
|
||||
if v and v.patron:
|
||||
if request.content_length > 8 * 1024 * 1024: return {"error":"Max file size is 8 MB."}, 413
|
||||
elif request.content_length > 4 * 1024 * 1024: return {"error":"Max file size is 4 MB."}, 413
|
||||
if request.content_length > 8 * 1024 * 1024: return {"error":"Max file size is 4 MB (8 MB for paypigs)."}, 413
|
||||
elif request.content_length > 4 * 1024 * 1024: return {"error":"Max file size is 4 MB (8 MB for paypigs)."}, 413
|
||||
|
||||
if request.headers.get("cf-ipcountry") == "T1": return {"error":"Image uploads are not allowed through TOR."}, 403
|
||||
|
||||
|
|
|
@ -685,8 +685,6 @@ def u_username(username, v=None):
|
|||
|
||||
if not v and not request.path.startswith('/logged_out'): return redirect(f"{SITE_FULL}/logged_out{request.full_path}")
|
||||
|
||||
if v and request.path.startswith('/logged_out'): return redirect(SITE_FULL + request.full_path.replace('/logged_out',''))
|
||||
|
||||
|
||||
|
||||
u = get_user(username, v=v)
|
||||
|
@ -784,8 +782,6 @@ def u_username_comments(username, v=None):
|
|||
|
||||
if not v and not request.path.startswith('/logged_out'): return redirect(f"{SITE_FULL}/logged_out{request.full_path}")
|
||||
|
||||
if v and request.path.startswith('/logged_out'): return redirect(SITE_FULL + request.full_path.replace('/logged_out',''))
|
||||
|
||||
user = get_user(username, v=v)
|
||||
|
||||
if username != user.username: return redirect(f'{SITE_FULL}/@{user.username}/comments')
|
||||
|
@ -970,7 +966,6 @@ def remove_follow(username, v):
|
|||
@auth_desired
|
||||
def user_profile_uid(v, id):
|
||||
if not v and not request.path.startswith('/logged_out'): return redirect(f"{SITE_FULL}/logged_out{request.full_path}")
|
||||
if v and request.path.startswith('/logged_out'): return redirect(SITE_FULL + request.full_path.replace('/logged_out',''))
|
||||
|
||||
try: id = int(id)
|
||||
except: abort(404)
|
||||
|
|
|
@ -106,4 +106,4 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<script data-cfasync="false" src="/static/assets/js/emoji_modal.js?a=247"></script>
|
||||
<script data-cfasync="false" src="/static/assets/js/emoji_modal.js?a=249"></script>
|
|
@ -20,7 +20,7 @@
|
|||
<tr>
|
||||
<td style="font-weight: bold">{{loop.index}}</td>
|
||||
<td style="font-weight: bold">{{marsey.name}}</td>
|
||||
<td><img class="marsey" loading="lazy" data-bs-toggle="tooltip" alt=":{{marsey.name}}:" title=":{{marsey.name}}:" data-bs-original-title=":{{marsey.name}}:" delay="0" src="/static/assets/images/emojis/{{marsey.name}}.webp?a=1009" ></td>
|
||||
<td><img class="marsey" loading="lazy" data-bs-toggle="tooltip" alt=":{{marsey.name}}:" title=":{{marsey.name}}:" data-bs-original-title=":{{marsey.name}}:" delay="0" src="/static/assets/images/emojis/{{marsey.name}}.webp?a=1010" ></td>
|
||||
<td style="font-weight: bold">{{marsey.count}}</td>
|
||||
<td><a style="color:#{{author.namecolor}};font-weight:bold" href="/@{{author.username}}"><img loading="lazy" src="{{author.profile_url}}" class="pp20"><span {% if author.patron %}class="patron" style="background-color:#{{author.namecolor}}"{% endif %}>{{author.username}}</span></a></td>
|
||||
</tr>
|
||||
|
@ -30,7 +30,7 @@
|
|||
<tr>
|
||||
<td style="font-weight: bold">{{loop.index}}</td>
|
||||
<td style="font-weight: bold">{{marsey.name}}</td>
|
||||
<td><img class="marsey" loading="lazy" data-bs-toggle="tooltip" alt=":{{marsey.name}}:" title=":{{marsey.name}}:" data-bs-original-title=":{{marsey.name}}:" delay="0" src="/static/assets/images/emojis/{{marsey.name}}.webp?a=1009" ></td>
|
||||
<td><img class="marsey" loading="lazy" data-bs-toggle="tooltip" alt=":{{marsey.name}}:" title=":{{marsey.name}}:" data-bs-original-title=":{{marsey.name}}:" delay="0" src="/static/assets/images/emojis/{{marsey.name}}.webp?a=1010" ></td>
|
||||
<td style="font-weight: bold">{{marsey.count}}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
history.pushState(null, null, '{{p.permalink}}');
|
||||
localStorage.setItem("post_title", "")
|
||||
localStorage.setItem("post_text", "")
|
||||
localStorage.setItem("post_url", "")
|
||||
localStorage.setItem("sub", "")
|
||||
</script>
|
||||
{% endif %}
|
||||
|
||||
|
|