Up-merged and resolved conflicts in routes/login.p and routes/votes.py
This commit is contained in:
commit
82a18e5cad
32 changed files with 50 additions and 541 deletions
|
@ -4625,9 +4625,7 @@ img[pat][src^="/pp/"], img[pat][src$="/pic"] {
|
||||||
color: #f27d0c !important;
|
color: #f27d0c !important;
|
||||||
font-weight: 800;
|
font-weight: 800;
|
||||||
}
|
}
|
||||||
.agendaposter {
|
|
||||||
text-transform: uppercase !important;
|
|
||||||
}
|
|
||||||
code {
|
code {
|
||||||
text-transform: none !important;
|
text-transform: none !important;
|
||||||
}
|
}
|
||||||
|
|
BIN
files/assets/images/emojis/feather.webp
Normal file
BIN
files/assets/images/emojis/feather.webp
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.2 KiB |
|
@ -40,11 +40,7 @@ class Badge(Base):
|
||||||
@property
|
@property
|
||||||
@lazy
|
@lazy
|
||||||
def text(self):
|
def text(self):
|
||||||
if self.name == "Chud":
|
if self.badge_id in {94,95,96,97,98,109}:
|
||||||
ti = self.user.agendaposter
|
|
||||||
if ti: text = self.badge.description + " until " + datetime.utcfromtimestamp(ti).strftime('%Y-%m-%d %H:%M:%S')
|
|
||||||
else: text = self.badge.description + " permanently"
|
|
||||||
elif self.badge_id in {94,95,96,97,98,109}:
|
|
||||||
if self.badge_id == 94: ti = self.user.progressivestack
|
if self.badge_id == 94: ti = self.user.progressivestack
|
||||||
elif self.badge_id == 95: ti = self.user.bird
|
elif self.badge_id == 95: ti = self.user.bird
|
||||||
elif self.badge_id == 96: ti = self.user.flairchanged
|
elif self.badge_id == 96: ti = self.user.flairchanged
|
||||||
|
|
|
@ -357,7 +357,6 @@ class Comment(Base):
|
||||||
body = self.body_html or ""
|
body = self.body_html or ""
|
||||||
|
|
||||||
if body:
|
if body:
|
||||||
body = censor_slurs(body, v)
|
|
||||||
|
|
||||||
if v:
|
if v:
|
||||||
body = body.replace("old.reddit.com", v.reddit)
|
body = body.replace("old.reddit.com", v.reddit)
|
||||||
|
@ -423,7 +422,7 @@ class Comment(Base):
|
||||||
|
|
||||||
if not body: return ""
|
if not body: return ""
|
||||||
|
|
||||||
return censor_slurs(body, v)
|
return body
|
||||||
|
|
||||||
def print(self):
|
def print(self):
|
||||||
print(f'post: {self.id}, comment: {self.author_id}', flush=True)
|
print(f'post: {self.id}, comment: {self.author_id}', flush=True)
|
||||||
|
|
|
@ -37,7 +37,7 @@ class Flag(Base):
|
||||||
|
|
||||||
@lazy
|
@lazy
|
||||||
def realreason(self, v):
|
def realreason(self, v):
|
||||||
return censor_slurs(self.reason, v)
|
return self.reason
|
||||||
|
|
||||||
|
|
||||||
class CommentFlag(Base):
|
class CommentFlag(Base):
|
||||||
|
@ -72,4 +72,4 @@ class CommentFlag(Base):
|
||||||
|
|
||||||
@lazy
|
@lazy
|
||||||
def realreason(self, v):
|
def realreason(self, v):
|
||||||
return censor_slurs(self.reason, v)
|
return self.reason
|
||||||
|
|
|
@ -116,11 +116,6 @@ class ModAction(Base):
|
||||||
return f"/log/{self.id}"
|
return f"/log/{self.id}"
|
||||||
|
|
||||||
ACTIONTYPES = {
|
ACTIONTYPES = {
|
||||||
'agendaposter': {
|
|
||||||
"str": 'set chud theme on {self.target_link}',
|
|
||||||
"icon": 'fa-snooze',
|
|
||||||
"color": 'bg-danger'
|
|
||||||
},
|
|
||||||
'approve_app': {
|
'approve_app': {
|
||||||
"str": 'approved an application by {self.target_link}',
|
"str": 'approved an application by {self.target_link}',
|
||||||
"icon": 'fa-robot',
|
"icon": 'fa-robot',
|
||||||
|
@ -356,11 +351,6 @@ ACTIONTYPES = {
|
||||||
"icon": 'fa-eye-slash',
|
"icon": 'fa-eye-slash',
|
||||||
"color": 'bg-danger'
|
"color": 'bg-danger'
|
||||||
},
|
},
|
||||||
'unagendaposter': {
|
|
||||||
"str": 'removed chud theme from {self.target_link}',
|
|
||||||
"icon": 'fa-snooze',
|
|
||||||
"color": 'bg-success'
|
|
||||||
},
|
|
||||||
'unban_comment': {
|
'unban_comment': {
|
||||||
"str": 'reinstated {self.target_link}',
|
"str": 'reinstated {self.target_link}',
|
||||||
"icon": 'fa-comment',
|
"icon": 'fa-comment',
|
||||||
|
|
|
@ -381,8 +381,6 @@ class Submission(Base):
|
||||||
|
|
||||||
body = self.body_html or ""
|
body = self.body_html or ""
|
||||||
|
|
||||||
body = censor_slurs(body, v)
|
|
||||||
|
|
||||||
if v:
|
if v:
|
||||||
body = body.replace("old.reddit.com", v.reddit)
|
body = body.replace("old.reddit.com", v.reddit)
|
||||||
|
|
||||||
|
@ -447,8 +445,6 @@ class Submission(Base):
|
||||||
|
|
||||||
if not body: return ""
|
if not body: return ""
|
||||||
|
|
||||||
body = censor_slurs(body, v)
|
|
||||||
|
|
||||||
if v:
|
if v:
|
||||||
body = body.replace("old.reddit.com", v.reddit)
|
body = body.replace("old.reddit.com", v.reddit)
|
||||||
|
|
||||||
|
@ -468,8 +464,6 @@ class Submission(Base):
|
||||||
elif self.title_html: title = self.title_html
|
elif self.title_html: title = self.title_html
|
||||||
else: title = self.title
|
else: title = self.title
|
||||||
|
|
||||||
title = censor_slurs(title, v)
|
|
||||||
|
|
||||||
return title
|
return title
|
||||||
|
|
||||||
@lazy
|
@lazy
|
||||||
|
@ -479,8 +473,6 @@ class Submission(Base):
|
||||||
else: return f'{CC} MEMBERS ONLY'
|
else: return f'{CC} MEMBERS ONLY'
|
||||||
else: title = self.title
|
else: title = self.title
|
||||||
|
|
||||||
title = censor_slurs(title, v)
|
|
||||||
|
|
||||||
return title
|
return title
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|
|
@ -520,7 +520,6 @@ class User(Base):
|
||||||
@property
|
@property
|
||||||
@lazy
|
@lazy
|
||||||
def profile_url(self):
|
def profile_url(self):
|
||||||
if self.agendaposter: return f"{SITE_FULL}/assets/images/astolfo.webp?v=1"
|
|
||||||
if self.profileurl:
|
if self.profileurl:
|
||||||
if self.profileurl.startswith('/'): return SITE_FULL + self.profileurl
|
if self.profileurl.startswith('/'): return SITE_FULL + self.profileurl
|
||||||
return self.profileurl
|
return self.profileurl
|
||||||
|
|
|
@ -28,76 +28,11 @@ AJ_REPLACEMENTS = {
|
||||||
}
|
}
|
||||||
|
|
||||||
SLURS = {
|
SLURS = {
|
||||||
"retarded": "r-slurred",
|
|
||||||
"retard": "r-slur",
|
|
||||||
"gayfag": "gaystrag",
|
|
||||||
"poorfag": "poorstrag",
|
|
||||||
"richfag": "richstrag",
|
|
||||||
"newfag": "newstrag",
|
|
||||||
"oldfag": "oldstrag",
|
|
||||||
"faggotry": "cute twinkry",
|
|
||||||
"faggot": "cute twink",
|
|
||||||
"pedophile": "libertarian",
|
|
||||||
"kill yourself": "keep yourself safe",
|
|
||||||
"n1gger": "BIPOC",
|
|
||||||
"nlgger": "BIPOC",
|
|
||||||
"nigger": "BIPOC",
|
|
||||||
"steve akins": "penny verity oaken",
|
|
||||||
"trannie": "🚂🚃🚃",
|
|
||||||
"tranny": "🚂🚃🚃",
|
|
||||||
"troon": "🚂🚃🚃",
|
|
||||||
"nonewnormal": "HorseDewormerAddicts",
|
|
||||||
"kikery": "https://sciencedirect.com/science/article/abs/pii/S016028960600033X",
|
|
||||||
"kike": "https://sciencedirect.com/science/article/abs/pii/S016028960600033X",
|
|
||||||
"latinos": "latinx",
|
|
||||||
"latino": "latinx",
|
|
||||||
"latinas": "latinx",
|
|
||||||
"latina": "latinx",
|
|
||||||
"hispanics": "latinx",
|
|
||||||
"hispanic": "latinx",
|
|
||||||
"uss liberty incident": "tragic accident aboard the USS Liberty",
|
|
||||||
"lavon affair": "Lavon Misunderstanding",
|
|
||||||
"shylock": "Israeli friend",
|
|
||||||
"mohammad": "Prophet Mohammad (PBUH)",
|
|
||||||
"muhammad": "Prophet Mohammad (PBUH)",
|
|
||||||
"i hate marsey": "i love marsey",
|
|
||||||
"dancing israelis": "i love Israel",
|
|
||||||
"sodomite": "total dreamboat",
|
|
||||||
"pajeet": "sexy Indian dude",
|
|
||||||
"landlord": "landchad",
|
|
||||||
"tenant": "renthog",
|
|
||||||
"renter": "rentoid",
|
|
||||||
"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",
|
|
||||||
"groomercord": "discord (actually a pretty cool service)",
|
|
||||||
"pedocord": "discord (actually a pretty cool service)",
|
|
||||||
"i hate carp": "i love Carp",
|
|
||||||
"manlet": "little king",
|
|
||||||
"gamer": "g*mer",
|
|
||||||
"journalist": "journ*list",
|
|
||||||
"journalism": "journ*lism",
|
|
||||||
"wuhan flu": "SARS-CoV-2 syndemic",
|
|
||||||
"china flu": "SARS-CoV-2 syndemic",
|
|
||||||
"china virus": "SARS-CoV-2 syndemic",
|
|
||||||
"kung flu": "SARS-CoV-2 syndemic",
|
|
||||||
"elon musk": "rocket daddy",
|
|
||||||
"fake and gay": "fake and straight",
|
|
||||||
|
|
||||||
" rapist ": " male feminist ",
|
|
||||||
" pedo ": " libertarian ",
|
|
||||||
" kys ": " keep yourself safe ",
|
|
||||||
" fag ": " cute twink ",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
single_words = "|".join([slur.lower() for slur in SLURS.keys()])
|
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", "Are you feeling okay bud?")
|
|
||||||
|
|
||||||
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 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).*"""
|
|
||||||
|
|
||||||
NOTIFICATIONS_ID = 1
|
NOTIFICATIONS_ID = 1
|
||||||
AUTOJANNY_ID = 2
|
AUTOJANNY_ID = 2
|
||||||
SNAPPY_ID = 3
|
SNAPPY_ID = 3
|
||||||
|
@ -369,14 +304,6 @@ AWARDS = {
|
||||||
"color": "text-blue",
|
"color": "text-blue",
|
||||||
"price": 1500
|
"price": 1500
|
||||||
},
|
},
|
||||||
"agendaposter": {
|
|
||||||
"kind": "agendaposter",
|
|
||||||
"title": "Chud",
|
|
||||||
"description": "Forces the chud theme on the recipient for 24 hours.",
|
|
||||||
"icon": "fas fa-snooze",
|
|
||||||
"color": "text-purple",
|
|
||||||
"price": 2500
|
|
||||||
},
|
|
||||||
"deflector": {
|
"deflector": {
|
||||||
"kind": "deflector",
|
"kind": "deflector",
|
||||||
"title": "Deflector",
|
"title": "Deflector",
|
||||||
|
@ -600,33 +527,9 @@ email_regex = re.compile('[^@]+@[^@]+\.[^@]+', flags=re.A)
|
||||||
utm_regex = re.compile('utm_[a-z]+=[a-z0-9_]+&', flags=re.A)
|
utm_regex = re.compile('utm_[a-z]+=[a-z0-9_]+&', flags=re.A)
|
||||||
utm_regex2 = re.compile('[?&]utm_[a-z]+=[a-z0-9_]+', flags=re.A)
|
utm_regex2 = re.compile('[?&]utm_[a-z]+=[a-z0-9_]+', flags=re.A)
|
||||||
|
|
||||||
slur_regex = re.compile(f"({single_words})(?![^<]*>)", flags=re.I|re.A)
|
|
||||||
slur_regex_upper = re.compile(f"({single_words.upper()})(?![^<]*>)", flags=re.A)
|
|
||||||
torture_regex = re.compile('(^|\s)(i|me) ', flags=re.I|re.A)
|
|
||||||
torture_regex2 = re.compile("(^|\s)i'm ", flags=re.I|re.A)
|
|
||||||
|
|
||||||
def sub_matcher(match):
|
|
||||||
return SLURS[match.group(0).lower()]
|
|
||||||
|
|
||||||
def sub_matcher_upper(match):
|
|
||||||
return SLURS[match.group(0).lower()].upper()
|
|
||||||
|
|
||||||
def censor_slurs(body, logged_user):
|
|
||||||
if not logged_user or logged_user == 'chat' or logged_user.slurreplacer:
|
|
||||||
body = slur_regex_upper.sub(sub_matcher_upper, body)
|
|
||||||
body = slur_regex.sub(sub_matcher, body)
|
|
||||||
return body
|
|
||||||
|
|
||||||
def torture_ap(body, username):
|
|
||||||
for k, l in AJ_REPLACEMENTS.items():
|
|
||||||
body = body.replace(k, l)
|
|
||||||
body = torture_regex.sub(rf'\1@{username} ', body)
|
|
||||||
body = torture_regex2.sub(rf'\1@{username} is ', body)
|
|
||||||
return body
|
|
||||||
|
|
||||||
YOUTUBE_KEY = environ.get("YOUTUBE_KEY", "").strip()
|
YOUTUBE_KEY = environ.get("YOUTUBE_KEY", "").strip()
|
||||||
|
|
||||||
ADMIGGERS = (37696,37697,37749,37833,37838)
|
ADMINISTRATORS = (37696, 37697, 37749, 37833, 37838)
|
||||||
|
|
||||||
proxies = {"http":"http://127.0.0.1:18080","https":"http://127.0.0.1:18080"}
|
proxies = {"http":"http://127.0.0.1:18080","https":"http://127.0.0.1:18080"}
|
||||||
|
|
||||||
|
|
|
@ -49,4 +49,4 @@ def timestamp(timestamp):
|
||||||
|
|
||||||
@app.context_processor
|
@app.context_processor
|
||||||
def inject_constants():
|
def inject_constants():
|
||||||
return {"environ":environ, "SITE":SITE, "SITE_NAME":SITE_NAME, "SITE_FULL":SITE_FULL, "AUTOJANNY_ID":AUTOJANNY_ID, "NOTIFICATIONS_ID":NOTIFICATIONS_ID, "PUSHER_ID":PUSHER_ID, "CC":CC, "CC_TITLE":CC_TITLE, "listdir":listdir, "MOOSE_ID":MOOSE_ID, "AEVANN_ID":AEVANN_ID, "PIZZASHILL_ID":PIZZASHILL_ID, "config":app.config.get, "DEFAULT_COLOR":DEFAULT_COLOR, "COLORS":COLORS, "ADMIGGERS":ADMIGGERS}
|
return {"environ":environ, "SITE":SITE, "SITE_NAME":SITE_NAME, "SITE_FULL":SITE_FULL, "AUTOJANNY_ID":AUTOJANNY_ID, "NOTIFICATIONS_ID":NOTIFICATIONS_ID, "PUSHER_ID":PUSHER_ID, "CC":CC, "CC_TITLE":CC_TITLE, "listdir":listdir, "MOOSE_ID":MOOSE_ID, "AEVANN_ID":AEVANN_ID, "PIZZASHILL_ID":PIZZASHILL_ID, "config":app.config.get, "DEFAULT_COLOR":DEFAULT_COLOR, "COLORS":COLORS, "ADMIGGERS":ADMINISTRATORS}
|
||||||
|
|
|
@ -914,77 +914,6 @@ def admin_removed_comments(v):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@app.post("/agendaposter/<user_id>")
|
|
||||||
@admin_level_required(2)
|
|
||||||
def agendaposter(user_id, v):
|
|
||||||
user = g.db.query(User).filter_by(id=user_id).one_or_none()
|
|
||||||
|
|
||||||
days = request.values.get("days") or 30
|
|
||||||
expiry = float(days)
|
|
||||||
expiry = int(time.time() + expiry*60*60*24)
|
|
||||||
|
|
||||||
user.agendaposter = expiry
|
|
||||||
g.db.add(user)
|
|
||||||
|
|
||||||
for alt in user.alts:
|
|
||||||
if alt.admin_level: return {"error": "User is an admin!"}
|
|
||||||
alt.agendaposter = expiry
|
|
||||||
g.db.add(alt)
|
|
||||||
|
|
||||||
note = f"for {days} days"
|
|
||||||
|
|
||||||
ma = ModAction(
|
|
||||||
kind="agendaposter",
|
|
||||||
user_id=v.id,
|
|
||||||
target_user_id=user.id,
|
|
||||||
note = note
|
|
||||||
)
|
|
||||||
g.db.add(ma)
|
|
||||||
|
|
||||||
if not user.has_badge(28):
|
|
||||||
badge = Badge(user_id=user.id, badge_id=28)
|
|
||||||
g.db.add(badge)
|
|
||||||
g.db.flush()
|
|
||||||
send_notification(user.id, f"@AutoJanny has given you the following profile badge:\n\n\n\n{badge.name}")
|
|
||||||
|
|
||||||
|
|
||||||
send_repeatable_notification(user.id, f"@{v.username} has marked you as a chud ({note}).")
|
|
||||||
|
|
||||||
g.db.commit()
|
|
||||||
|
|
||||||
return redirect(user.url)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@app.post("/unagendaposter/<user_id>")
|
|
||||||
@admin_level_required(2)
|
|
||||||
def unagendaposter(user_id, v):
|
|
||||||
user = g.db.query(User).filter_by(id=user_id).one_or_none()
|
|
||||||
|
|
||||||
user.agendaposter = 0
|
|
||||||
g.db.add(user)
|
|
||||||
|
|
||||||
for alt in user.alts:
|
|
||||||
alt.agendaposter = 0
|
|
||||||
g.db.add(alt)
|
|
||||||
|
|
||||||
ma = ModAction(
|
|
||||||
kind="unagendaposter",
|
|
||||||
user_id=v.id,
|
|
||||||
target_user_id=user.id
|
|
||||||
)
|
|
||||||
|
|
||||||
g.db.add(ma)
|
|
||||||
|
|
||||||
badge = user.has_badge(28)
|
|
||||||
if badge: g.db.delete(badge)
|
|
||||||
|
|
||||||
send_repeatable_notification(user.id, f"@{v.username} has unmarked you as a chud.")
|
|
||||||
|
|
||||||
g.db.commit()
|
|
||||||
return {"message": "Chud theme disabled!"}
|
|
||||||
|
|
||||||
|
|
||||||
@app.post("/shadowban/<user_id>")
|
@app.post("/shadowban/<user_id>")
|
||||||
@limiter.limit("1/second;30/minute;200/hour;1000/day")
|
@limiter.limit("1/second;30/minute;200/hour;1000/day")
|
||||||
@admin_level_required(2)
|
@admin_level_required(2)
|
||||||
|
@ -1502,9 +1431,6 @@ def api_unban_comment(c_id, v):
|
||||||
comment = g.db.query(Comment).filter_by(id=c_id).one_or_none()
|
comment = g.db.query(Comment).filter_by(id=c_id).one_or_none()
|
||||||
if not comment: abort(404)
|
if not comment: abort(404)
|
||||||
|
|
||||||
if comment.author.agendaposter and AGENDAPOSTER_PHRASE not in comment.body.lower():
|
|
||||||
return {"error": "You can't bypass the chud award!"}
|
|
||||||
|
|
||||||
if comment.is_banned:
|
if comment.is_banned:
|
||||||
ma=ModAction(
|
ma=ModAction(
|
||||||
kind="unban_comment",
|
kind="unban_comment",
|
||||||
|
|
|
@ -213,18 +213,6 @@ def award_post(pid, v):
|
||||||
cache.delete_memoized(frontlist)
|
cache.delete_memoized(frontlist)
|
||||||
else: post.stickied_utc = t
|
else: post.stickied_utc = t
|
||||||
g.db.add(post)
|
g.db.add(post)
|
||||||
elif kind == "agendaposter" and not (author.agendaposter and author.agendaposter == 0):
|
|
||||||
if author.marseyawarded:
|
|
||||||
return {"error": "This user is the under the effect of a conflicting award: Marsey award."}, 404
|
|
||||||
|
|
||||||
if author.agendaposter and time.time() < author.agendaposter: author.agendaposter += 86400
|
|
||||||
else: author.agendaposter = int(time.time()) + 86400
|
|
||||||
|
|
||||||
if not author.has_badge(28):
|
|
||||||
badge = Badge(user_id=author.id, badge_id=28)
|
|
||||||
g.db.add(badge)
|
|
||||||
g.db.flush()
|
|
||||||
send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n\n\n{badge.name}")
|
|
||||||
elif kind == "flairlock":
|
elif kind == "flairlock":
|
||||||
new_name = note[:100].replace("𒐪","")
|
new_name = note[:100].replace("𒐪","")
|
||||||
if not new_name and author.flairchanged:
|
if not new_name and author.flairchanged:
|
||||||
|
@ -451,18 +439,6 @@ def award_comment(cid, v):
|
||||||
c.is_pinned_utc = None
|
c.is_pinned_utc = None
|
||||||
else: c.is_pinned_utc = t
|
else: c.is_pinned_utc = t
|
||||||
g.db.add(c)
|
g.db.add(c)
|
||||||
elif kind == "agendaposter" and not (author.agendaposter and author.agendaposter == 0):
|
|
||||||
if author.marseyawarded:
|
|
||||||
return {"error": "This user is the under the effect of a conflicting award: Marsey award."}, 404
|
|
||||||
|
|
||||||
if author.agendaposter and time.time() < author.agendaposter: author.agendaposter += 86400
|
|
||||||
else: author.agendaposter = int(time.time()) + 86400
|
|
||||||
|
|
||||||
if not author.has_badge(28):
|
|
||||||
badge = Badge(user_id=author.id, badge_id=28)
|
|
||||||
g.db.add(badge)
|
|
||||||
g.db.flush()
|
|
||||||
send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n\n\n{badge.name}")
|
|
||||||
elif kind == "flairlock":
|
elif kind == "flairlock":
|
||||||
new_name = note[:100].replace("𒐪","")
|
new_name = note[:100].replace("𒐪","")
|
||||||
if not new_name and author.flairchanged:
|
if not new_name and author.flairchanged:
|
||||||
|
|
|
@ -55,7 +55,7 @@ def speak(data, v):
|
||||||
"namecolor": v.namecolor,
|
"namecolor": v.namecolor,
|
||||||
"text": text,
|
"text": text,
|
||||||
"text_html": text_html,
|
"text_html": text_html,
|
||||||
"text_censored": censor_slurs(text_html, 'chat'),
|
"text_censored": text,
|
||||||
"time": int(time.time())
|
"time": int(time.time())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -188,7 +188,7 @@ def api_comment(v):
|
||||||
with open(f"snappy_{SITE_NAME}.txt", "a", encoding="utf-8") as f:
|
with open(f"snappy_{SITE_NAME}.txt", "a", encoding="utf-8") as f:
|
||||||
f.write('\n{[para]}\n' + body)
|
f.write('\n{[para]}\n' + body)
|
||||||
|
|
||||||
if parent_post.id not in ADMIGGERS:
|
if parent_post.id not in ADMINISTRATORS:
|
||||||
if v.longpost and (len(body) < 280 or ' [](' in body or body.startswith('[](')):
|
if v.longpost and (len(body) < 280 or ' [](' in body or body.startswith('[](')):
|
||||||
return {"error":"You have to type more than 280 characters!"}, 403
|
return {"error":"You have to type more than 280 characters!"}, 403
|
||||||
elif v.bird and len(body) > 140:
|
elif v.bird and len(body) > 140:
|
||||||
|
@ -257,13 +257,9 @@ def api_comment(v):
|
||||||
body += f"\n\n{url}"
|
body += f"\n\n{url}"
|
||||||
else: return {"error": "Image/Video files only"}, 400
|
else: return {"error": "Image/Video files only"}, 400
|
||||||
|
|
||||||
if v.agendaposter and not v.marseyawarded and parent_post.id not in ADMIGGERS:
|
|
||||||
body = torture_ap(body, v.username)
|
|
||||||
|
|
||||||
body_html = sanitize(body, comment=True)
|
body_html = sanitize(body, comment=True)
|
||||||
|
|
||||||
|
if parent_post.id not in ADMINISTRATORS and '!slots' not in body.lower() and '!blackjack' not in body.lower() and '!wordle' not in body.lower():
|
||||||
if parent_post.id not in ADMIGGERS and '!slots' not in body.lower() and '!blackjack' not in body.lower() and '!wordle' not in body.lower() and AGENDAPOSTER_PHRASE not in body.lower():
|
|
||||||
existing = g.db.query(Comment.id).filter(Comment.author_id == v.id,
|
existing = g.db.query(Comment.id).filter(Comment.author_id == v.id,
|
||||||
Comment.deleted_utc == 0,
|
Comment.deleted_utc == 0,
|
||||||
Comment.parent_comment_id == parent_comment_id,
|
Comment.parent_comment_id == parent_comment_id,
|
||||||
|
@ -277,7 +273,7 @@ def api_comment(v):
|
||||||
|
|
||||||
is_bot = bool(request.headers.get("Authorization"))
|
is_bot = bool(request.headers.get("Authorization"))
|
||||||
|
|
||||||
if '!slots' not in body.lower() and '!blackjack' not in body.lower() and '!wordle' not in body.lower() and parent_post.id not in ADMIGGERS and not is_bot and not v.marseyawarded and AGENDAPOSTER_PHRASE not in body.lower() and len(body) > 10:
|
if '!slots' not in body.lower() and '!blackjack' not in body.lower() and '!wordle' not in body.lower() and parent_post.id not in ADMINISTRATORS and not is_bot and not v.marseyawarded and len(body) > 10:
|
||||||
now = int(time.time())
|
now = int(time.time())
|
||||||
cutoff = now - 60 * 60 * 24
|
cutoff = now - 60 * 60 * 24
|
||||||
|
|
||||||
|
@ -365,39 +361,7 @@ def api_comment(v):
|
||||||
|
|
||||||
g.db.add(c_choice)
|
g.db.add(c_choice)
|
||||||
|
|
||||||
if parent_post.id not in ADMIGGERS:
|
if parent_post.id not in ADMINISTRATORS:
|
||||||
if v.agendaposter and not v.marseyawarded and AGENDAPOSTER_PHRASE not in c.body.lower():
|
|
||||||
|
|
||||||
c.is_banned = True
|
|
||||||
c.ban_reason = "AutoJanny"
|
|
||||||
|
|
||||||
g.db.add(c)
|
|
||||||
|
|
||||||
|
|
||||||
body = AGENDAPOSTER_MSG.format(username=v.username, type='comment', AGENDAPOSTER_PHRASE=AGENDAPOSTER_PHRASE)
|
|
||||||
|
|
||||||
body_jannied_html = sanitize(body)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
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=body_jannied_html,
|
|
||||||
top_comment_id=c.top_comment_id,
|
|
||||||
ghost=parent_post.ghost
|
|
||||||
)
|
|
||||||
|
|
||||||
g.db.add(c_jannied)
|
|
||||||
g.db.flush()
|
|
||||||
|
|
||||||
n = Notification(comment_id=c_jannied.id, user_id=v.id)
|
|
||||||
g.db.add(n)
|
|
||||||
|
|
||||||
|
|
||||||
if not v.shadowbanned:
|
if not v.shadowbanned:
|
||||||
notify_users = NOTIFY_USERS(body, v)
|
notify_users = NOTIFY_USERS(body, v)
|
||||||
|
|
||||||
|
@ -446,7 +410,7 @@ def api_comment(v):
|
||||||
|
|
||||||
check_for_blackjack_commands(body, v, c)
|
check_for_blackjack_commands(body, v, c)
|
||||||
|
|
||||||
if not c.slots_result and not c.blackjack_result and v.marseyawarded and parent_post.id not in ADMIGGERS and marseyaward_body_regex.search(body_html):
|
if not c.slots_result and not c.blackjack_result and v.marseyawarded and parent_post.id not in ADMINISTRATORS and marseyaward_body_regex.search(body_html):
|
||||||
return {"error":"You can only type marseys!"}, 403
|
return {"error":"You can only type marseys!"}, 403
|
||||||
|
|
||||||
check_for_treasure(body, c)
|
check_for_treasure(body, c)
|
||||||
|
@ -486,9 +450,6 @@ def edit_comment(cid, v):
|
||||||
elif v.bird and len(body) > 140:
|
elif v.bird and len(body) > 140:
|
||||||
return {"error":"You have to type less than 140 characters!"}, 403
|
return {"error":"You have to type less than 140 characters!"}, 403
|
||||||
|
|
||||||
if v.agendaposter and not v.marseyawarded:
|
|
||||||
body = torture_ap(body, v.username)
|
|
||||||
|
|
||||||
if not c.options:
|
if not c.options:
|
||||||
for i in poll_regex.finditer(body):
|
for i in poll_regex.finditer(body):
|
||||||
body = body.replace(i.group(0), "")
|
body = body.replace(i.group(0), "")
|
||||||
|
@ -517,7 +478,7 @@ def edit_comment(cid, v):
|
||||||
|
|
||||||
body_html = sanitize(body, edit=True)
|
body_html = sanitize(body, edit=True)
|
||||||
|
|
||||||
if '!slots' not in body.lower() and '!blackjack' not in body.lower() and '!wordle' not in body.lower() and AGENDAPOSTER_PHRASE not in body.lower():
|
if '!slots' not in body.lower() and '!blackjack' not in body.lower() and '!wordle' not in body.lower():
|
||||||
now = int(time.time())
|
now = int(time.time())
|
||||||
cutoff = now - 60 * 60 * 24
|
cutoff = now - 60 * 60 * 24
|
||||||
|
|
||||||
|
@ -591,39 +552,6 @@ def edit_comment(cid, v):
|
||||||
notif = Notification(comment_id=c.id, user_id=CARP_ID)
|
notif = Notification(comment_id=c.id, user_id=CARP_ID)
|
||||||
g.db.add(notif)
|
g.db.add(notif)
|
||||||
|
|
||||||
if v.agendaposter and not v.marseyawarded and AGENDAPOSTER_PHRASE not in c.body.lower() and not c.is_banned:
|
|
||||||
|
|
||||||
c.is_banned = True
|
|
||||||
c.ban_reason = "AutoJanny"
|
|
||||||
|
|
||||||
g.db.add(c)
|
|
||||||
|
|
||||||
|
|
||||||
body = AGENDAPOSTER_MSG.format(username=v.username, type='comment', AGENDAPOSTER_PHRASE=AGENDAPOSTER_PHRASE)
|
|
||||||
|
|
||||||
body_jannied_html = sanitize(body)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
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=body_jannied_html,
|
|
||||||
top_comment_id=c.top_comment_id,
|
|
||||||
ghost=c.ghost
|
|
||||||
)
|
|
||||||
|
|
||||||
g.db.add(c_jannied)
|
|
||||||
g.db.flush()
|
|
||||||
|
|
||||||
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())
|
if int(time.time()) - c.created_utc > 60 * 3: c.edited_utc = int(time.time())
|
||||||
|
|
||||||
g.db.add(c)
|
g.db.add(c)
|
||||||
|
|
|
@ -227,14 +227,6 @@ def front_all(v, sub=None, subdomain=None):
|
||||||
g.db.add(v)
|
g.db.add(v)
|
||||||
g.db.commit()
|
g.db.commit()
|
||||||
|
|
||||||
if v.agendaposter and v.agendaposter < time.time():
|
|
||||||
v.agendaposter = 0
|
|
||||||
send_repeatable_notification(v.id, "Your chud theme has expired!")
|
|
||||||
g.db.add(v)
|
|
||||||
badge = v.has_badge(28)
|
|
||||||
if badge: g.db.delete(badge)
|
|
||||||
g.db.commit()
|
|
||||||
|
|
||||||
if v.flairchanged and v.flairchanged < time.time():
|
if v.flairchanged and v.flairchanged < time.time():
|
||||||
v.flairchanged = None
|
v.flairchanged = None
|
||||||
send_repeatable_notification(v.id, "Your flair lock has expired. You can now change your flair!")
|
send_repeatable_notification(v.id, "Your flair lock has expired. You can now change your flair!")
|
||||||
|
|
|
@ -321,7 +321,7 @@ def sign_up_post(v):
|
||||||
session["history"] = []
|
session["history"] = []
|
||||||
else: admin_level=0
|
else: admin_level=0
|
||||||
|
|
||||||
profileurl = '/assets/images/default-profile-pic.webp'
|
profileurl = '/e/feather.webp'
|
||||||
|
|
||||||
new_user = User(
|
new_user = User(
|
||||||
username=username,
|
username=username,
|
||||||
|
|
|
@ -434,7 +434,6 @@ def edit_post(pid, v):
|
||||||
return {"error":"You have to type less than 140 characters!"}, 403
|
return {"error":"You have to type less than 140 characters!"}, 403
|
||||||
|
|
||||||
if title != p.title:
|
if title != p.title:
|
||||||
if v.id == p.author_id and v.agendaposter and not v.marseyawarded: title = torture_ap(title, v.username)
|
|
||||||
|
|
||||||
title_html = filter_emojis_only(title, edit=True)
|
title_html = filter_emojis_only(title, edit=True)
|
||||||
|
|
||||||
|
@ -467,8 +466,6 @@ def edit_post(pid, v):
|
||||||
else: return {"error": "Image/Video files only"}, 400
|
else: return {"error": "Image/Video files only"}, 400
|
||||||
|
|
||||||
if body != p.body:
|
if body != p.body:
|
||||||
if v.id == p.author_id and v.agendaposter and not v.marseyawarded: body = torture_ap(body, v.username)
|
|
||||||
|
|
||||||
if not p.options:
|
if not p.options:
|
||||||
for i in poll_regex.finditer(body):
|
for i in poll_regex.finditer(body):
|
||||||
body = body.replace(i.group(0), "")
|
body = body.replace(i.group(0), "")
|
||||||
|
@ -498,7 +495,6 @@ def edit_post(pid, v):
|
||||||
if v.id == p.author_id and v.marseyawarded and marseyaward_body_regex.search(body_html):
|
if v.id == p.author_id and v.marseyawarded and marseyaward_body_regex.search(body_html):
|
||||||
return {"error":"You can only type marseys!"}, 403
|
return {"error":"You can only type marseys!"}, 403
|
||||||
|
|
||||||
|
|
||||||
p.body = body
|
p.body = body
|
||||||
|
|
||||||
if blackjack and any(i in f'{p.body} {p.title} {p.url}'.lower() for i in blackjack.split()):
|
if blackjack and any(i in f'{p.body} {p.title} {p.url}'.lower() for i in blackjack.split()):
|
||||||
|
@ -510,37 +506,6 @@ def edit_post(pid, v):
|
||||||
|
|
||||||
p.body_html = body_html
|
p.body_html = body_html
|
||||||
|
|
||||||
if v.id == p.author_id and v.agendaposter and not v.marseyawarded and AGENDAPOSTER_PHRASE not in f'{p.body}{p.title}'.lower() and not p.is_banned:
|
|
||||||
|
|
||||||
p.is_banned = True
|
|
||||||
p.ban_reason = "AutoJanny"
|
|
||||||
|
|
||||||
g.db.add(p)
|
|
||||||
|
|
||||||
body = AGENDAPOSTER_MSG.format(username=v.username, type='post', AGENDAPOSTER_PHRASE=AGENDAPOSTER_PHRASE)
|
|
||||||
|
|
||||||
body_jannied_html = sanitize(body)
|
|
||||||
|
|
||||||
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=body_jannied_html,
|
|
||||||
ghost=p.ghost
|
|
||||||
)
|
|
||||||
|
|
||||||
g.db.add(c_jannied)
|
|
||||||
g.db.flush()
|
|
||||||
|
|
||||||
c_jannied.top_comment_id = c_jannied.id
|
|
||||||
|
|
||||||
n = Notification(comment_id=c_jannied.id, user_id=v.id)
|
|
||||||
g.db.add(n)
|
|
||||||
|
|
||||||
if not p.private and not p.ghost:
|
if not p.private and not p.ghost:
|
||||||
notify_users = NOTIFY_USERS(f'{p.title} {p.body}', v)
|
notify_users = NOTIFY_USERS(f'{p.title} {p.body}', v)
|
||||||
if notify_users:
|
if notify_users:
|
||||||
|
@ -789,21 +754,10 @@ def submit_post(v, sub=None):
|
||||||
|
|
||||||
if v.is_suspended: return error("You can't perform this action while banned.")
|
if v.is_suspended: return error("You can't perform this action while banned.")
|
||||||
|
|
||||||
if v.agendaposter and not v.marseyawarded: title = torture_ap(title, v.username)
|
|
||||||
|
|
||||||
title_html = filter_emojis_only(title, graceful=True)
|
title_html = filter_emojis_only(title, graceful=True)
|
||||||
|
|
||||||
if v.marseyawarded and not marseyaward_title_regex.fullmatch(title_html):
|
|
||||||
return error("You can only type marseys!")
|
|
||||||
|
|
||||||
if len(title_html) > 1500: return error("Rendered title is too big!")
|
if len(title_html) > 1500: return error("Rendered title is too big!")
|
||||||
|
|
||||||
if v.longpost and (len(body) < 280 or ' [](' in body or body.startswith('[](')):
|
|
||||||
return error("You have to type more than 280 characters!")
|
|
||||||
elif v.bird and len(body) > 140:
|
|
||||||
return error("You have to type less than 140 characters!")
|
|
||||||
|
|
||||||
|
|
||||||
embed = None
|
embed = None
|
||||||
|
|
||||||
if url:
|
if url:
|
||||||
|
@ -889,7 +843,6 @@ def submit_post(v, sub=None):
|
||||||
if not title:
|
if not title:
|
||||||
return error("Please enter a better title.")
|
return error("Please enter a better title.")
|
||||||
|
|
||||||
|
|
||||||
elif len(title) > 500:
|
elif len(title) > 500:
|
||||||
return error("There's a 500 character limit for titles.")
|
return error("There's a 500 character limit for titles.")
|
||||||
|
|
||||||
|
@ -969,8 +922,6 @@ def submit_post(v, sub=None):
|
||||||
choices.append(i.group(1))
|
choices.append(i.group(1))
|
||||||
body = body.replace(i.group(0), "")
|
body = body.replace(i.group(0), "")
|
||||||
|
|
||||||
if v.agendaposter and not v.marseyawarded: body = torture_ap(body, v.username)
|
|
||||||
|
|
||||||
if request.files.get("file2") and request.headers.get("cf-ipcountry") != "T1":
|
if request.files.get("file2") and request.headers.get("cf-ipcountry") != "T1":
|
||||||
files = request.files.getlist('file2')[:4]
|
files = request.files.getlist('file2')[:4]
|
||||||
for file in files:
|
for file in files:
|
||||||
|
@ -995,9 +946,6 @@ def submit_post(v, sub=None):
|
||||||
|
|
||||||
body_html = sanitize(body)
|
body_html = sanitize(body)
|
||||||
|
|
||||||
if v.marseyawarded and marseyaward_body_regex.search(body_html):
|
|
||||||
return error("You can only type marseys!")
|
|
||||||
|
|
||||||
if len(body_html) > 40000: return error("Submission body_html too long! (max 40k characters)")
|
if len(body_html) > 40000: return error("Submission body_html too long! (max 40k characters)")
|
||||||
|
|
||||||
club = bool(request.values.get("club",""))
|
club = bool(request.values.get("club",""))
|
||||||
|
@ -1006,11 +954,6 @@ def submit_post(v, sub=None):
|
||||||
|
|
||||||
is_bot = bool(request.headers.get("Authorization"))
|
is_bot = bool(request.headers.get("Authorization"))
|
||||||
|
|
||||||
if request.values.get("ghost") and v.coins >= 100:
|
|
||||||
v.coins -= 100
|
|
||||||
ghost = True
|
|
||||||
else: ghost = False
|
|
||||||
|
|
||||||
post = Submission(
|
post = Submission(
|
||||||
private=bool(request.values.get("private","")),
|
private=bool(request.values.get("private","")),
|
||||||
club=club,
|
club=club,
|
||||||
|
@ -1025,7 +968,7 @@ def submit_post(v, sub=None):
|
||||||
title=title[:500],
|
title=title[:500],
|
||||||
title_html=title_html,
|
title_html=title_html,
|
||||||
sub=sub,
|
sub=sub,
|
||||||
ghost=ghost
|
ghost=False
|
||||||
)
|
)
|
||||||
|
|
||||||
g.db.add(post)
|
g.db.add(post)
|
||||||
|
@ -1104,9 +1047,6 @@ def submit_post(v, sub=None):
|
||||||
if not post.thumburl and post.url:
|
if not post.thumburl and post.url:
|
||||||
gevent.spawn(thumbnail_thread, post.id)
|
gevent.spawn(thumbnail_thread, post.id)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if not post.private and not post.ghost:
|
if not post.private and not post.ghost:
|
||||||
|
|
||||||
notify_users = NOTIFY_USERS(f'{title} {body}', v)
|
notify_users = NOTIFY_USERS(f'{title} {body}', v)
|
||||||
|
@ -1126,40 +1066,6 @@ def submit_post(v, sub=None):
|
||||||
if post.club and not user.paid_dues: continue
|
if post.club and not user.paid_dues: continue
|
||||||
add_notif(cid, user.id)
|
add_notif(cid, user.id)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if v.agendaposter and not v.marseyawarded and AGENDAPOSTER_PHRASE not in f'{post.body}{post.title}'.lower():
|
|
||||||
post.is_banned = True
|
|
||||||
post.ban_reason = "AutoJanny"
|
|
||||||
|
|
||||||
body = AGENDAPOSTER_MSG.format(username=v.username, type='post', AGENDAPOSTER_PHRASE=AGENDAPOSTER_PHRASE)
|
|
||||||
|
|
||||||
body_jannied_html = sanitize(body)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
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=body_jannied_html,
|
|
||||||
)
|
|
||||||
|
|
||||||
g.db.add(c_jannied)
|
|
||||||
g.db.flush()
|
|
||||||
|
|
||||||
c_jannied.top_comment_id = c_jannied.id
|
|
||||||
|
|
||||||
n = Notification(comment_id=c_jannied.id, user_id=v.id)
|
|
||||||
g.db.add(n)
|
|
||||||
|
|
||||||
|
|
||||||
v.post_count = g.db.query(Submission.id).filter_by(author_id=v.id, is_banned=False, deleted_utc=0).count()
|
v.post_count = g.db.query(Submission.id).filter_by(author_id=v.id, is_banned=False, deleted_utc=0).count()
|
||||||
g.db.add(v)
|
g.db.add(v)
|
||||||
|
|
||||||
|
|
|
@ -611,8 +611,6 @@ def settings_css_get(v):
|
||||||
@limiter.limit("1/second;30/minute;200/hour;1000/day")
|
@limiter.limit("1/second;30/minute;200/hour;1000/day")
|
||||||
@auth_required
|
@auth_required
|
||||||
def settings_css(v):
|
def settings_css(v):
|
||||||
if v.agendaposter: return {"error": "Agendapostered users can't edit css!"}
|
|
||||||
|
|
||||||
css = request.values.get("css").strip().replace('\\', '').strip()[:4000]
|
css = request.values.get("css").strip().replace('\\', '').strip()[:4000]
|
||||||
v.css = css
|
v.css = css
|
||||||
g.db.add(v)
|
g.db.add(v)
|
||||||
|
|
|
@ -252,12 +252,6 @@ def grassed(v):
|
||||||
|
|
||||||
return render_template("grassed.html", v=v, users=users)
|
return render_template("grassed.html", v=v, users=users)
|
||||||
|
|
||||||
@app.get("/agendaposters")
|
|
||||||
@auth_required
|
|
||||||
def agendaposters(v):
|
|
||||||
users = [x for x in g.db.query(User).filter(User.agendaposter > 0).order_by(User.username).all()]
|
|
||||||
return render_template("agendaposters.html", v=v, users=users)
|
|
||||||
|
|
||||||
|
|
||||||
@app.get("/@<username>/upvoters")
|
@app.get("/@<username>/upvoters")
|
||||||
@auth_required
|
@auth_required
|
||||||
|
|
|
@ -94,9 +94,13 @@ def api_vote_post(post_id, new, v):
|
||||||
post.author.truecoins += coin_delta
|
post.author.truecoins += coin_delta
|
||||||
g.db.add(post.author)
|
g.db.add(post.author)
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
DEFAULT_IMAGE = '/assets/images/default-profile-pic.webp'
|
DEFAULT_IMAGE = '/assets/images/default-profile-pic.webp'
|
||||||
|
|
||||||
if new == 1 and (v.agendaposter or v.shadowbanned or (v.is_banned and not v.unban_utc) or (v.profile_url == DEFAULT_IMAGE and not v.customtitle and v.namecolor == DEFAULT_COLOR)): real = False
|
if new == 1 and (v.agendaposter or v.shadowbanned or (v.is_banned and not v.unban_utc) or (v.profile_url == DEFAULT_IMAGE and not v.customtitle and v.namecolor == DEFAULT_COLOR)): real = False
|
||||||
|
=======
|
||||||
|
if new == 1 and (v.shadowbanned or (v.is_banned and not v.unban_utc) or (v.profile_url.startswith('/e/') and not v.customtitle and v.namecolor == DEFAULT_COLOR)): real = False
|
||||||
|
>>>>>>> frost
|
||||||
else: real = True
|
else: real = True
|
||||||
|
|
||||||
vote = Vote(user_id=v.id,
|
vote = Vote(user_id=v.id,
|
||||||
|
@ -166,7 +170,7 @@ def api_vote_comment(comment_id, new, v):
|
||||||
|
|
||||||
DEFAULT_IMAGE = '/assets/images/default-profile-pic.webp'
|
DEFAULT_IMAGE = '/assets/images/default-profile-pic.webp'
|
||||||
|
|
||||||
if new == 1 and (v.agendaposter or v.shadowbanned or (v.is_banned and not v.unban_utc) or (v.profile_url == DEFAULT_IMAGE and not v.customtitle and v.namecolor == DEFAULT_COLOR)): real = False
|
if new == 1 and (v.shadowbanned or (v.is_banned and not v.unban_utc) or (v.profile_url == DEFAULT_IMAGE and not v.customtitle and v.namecolor == DEFAULT_COLOR)): real = False
|
||||||
else: real = True
|
else: real = True
|
||||||
|
|
||||||
vote = CommentVote(user_id=v.id,
|
vote = CommentVote(user_id=v.id,
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
<li><a href="/admin/users">Users Feed</a></li>
|
<li><a href="/admin/users">Users Feed</a></li>
|
||||||
<li><a href="/admin/shadowbanned">Shadowbanned Users</a></li>
|
<li><a href="/admin/shadowbanned">Shadowbanned Users</a></li>
|
||||||
<li><a href="/banned">Permabanned Users</a></li>
|
<li><a href="/banned">Permabanned Users</a></li>
|
||||||
<li><a href="/agendaposters">Users with Chud Theme</a></li>
|
|
||||||
<li><a href="/grassed">Currently Grassed Users</a></li>
|
<li><a href="/grassed">Currently Grassed Users</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
|
|
@ -17,25 +17,7 @@
|
||||||
<style>:root{--primary:#{{v.themecolor}}}</style>
|
<style>:root{--primary:#{{v.themecolor}}}</style>
|
||||||
<link rel="stylesheet" href="/assets/css/main.css?v=250">
|
<link rel="stylesheet" href="/assets/css/main.css?v=250">
|
||||||
<link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=56">
|
<link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=56">
|
||||||
{% if v.agendaposter %}
|
{% if v.css %}
|
||||||
<style>
|
|
||||||
html {
|
|
||||||
cursor:url('/assets/images/dildo.webp?v=1008'), auto;
|
|
||||||
}
|
|
||||||
.nav-item .text-small.font-weight-bold::before {
|
|
||||||
content: "((("
|
|
||||||
}
|
|
||||||
.nav-item .text-small.font-weight-bold::after {
|
|
||||||
content: ")))"
|
|
||||||
}
|
|
||||||
.nav-item .text-small-extra.text-primary {
|
|
||||||
font-size: 0 !important
|
|
||||||
}
|
|
||||||
.nav-item .text-small-extra.text-primary i {
|
|
||||||
font-size: 11px !important
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
{% elif v.css %}
|
|
||||||
<link rel="stylesheet" href="/@{{v.username}}/css">
|
<link rel="stylesheet" href="/@{{v.username}}/css">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|
|
@ -287,7 +287,7 @@
|
||||||
</style>
|
</style>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<div id="comment-text-{{c.id}}" class="comment-text mb-0 {% if c.author.agendaposter %}agendaposter{% endif %}">
|
<div id="comment-text-{{c.id}}" class="comment-text mb-0">
|
||||||
{{c.realbody(v) | safe}}
|
{{c.realbody(v) | safe}}
|
||||||
</div>
|
</div>
|
||||||
{% if c.parent_submission %}
|
{% if c.parent_submission %}
|
||||||
|
|
|
@ -10,25 +10,7 @@
|
||||||
<style>:root{--primary:#{{v.themecolor}}}</style>
|
<style>:root{--primary:#{{v.themecolor}}}</style>
|
||||||
<link rel="stylesheet" href="/assets/css/main.css?v=250">
|
<link rel="stylesheet" href="/assets/css/main.css?v=250">
|
||||||
<link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=56">
|
<link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=56">
|
||||||
{% if v.agendaposter %}
|
{% if v.css %}
|
||||||
<style>
|
|
||||||
html {
|
|
||||||
cursor:url('/assets/images/dildo.webp?v=1008'), auto;
|
|
||||||
}
|
|
||||||
.nav-item .text-small.font-weight-bold::before {
|
|
||||||
content: "((("
|
|
||||||
}
|
|
||||||
.nav-item .text-small.font-weight-bold::after {
|
|
||||||
content: ")))"
|
|
||||||
}
|
|
||||||
.nav-item .text-small-extra.text-primary {
|
|
||||||
font-size: 0 !important
|
|
||||||
}
|
|
||||||
.nav-item .text-small-extra.text-primary i {
|
|
||||||
font-size: 11px !important
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
{% elif v.css %}
|
|
||||||
<link rel="stylesheet" href="/@{{v.username}}/css">
|
<link rel="stylesheet" href="/@{{v.username}}/css">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|
|
@ -8,25 +8,7 @@
|
||||||
<style>:root{--primary:#{{v.themecolor}}}</style>
|
<style>:root{--primary:#{{v.themecolor}}}</style>
|
||||||
<link rel="stylesheet" href="/assets/css/main.css?v=250">
|
<link rel="stylesheet" href="/assets/css/main.css?v=250">
|
||||||
<link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=56">
|
<link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=56">
|
||||||
{% if v.agendaposter %}
|
{% if v.css %}
|
||||||
<style>
|
|
||||||
html {
|
|
||||||
cursor:url('/assets/images/dildo.webp?v=1008'), auto;
|
|
||||||
}
|
|
||||||
.nav-item .text-small.font-weight-bold::before {
|
|
||||||
content: "((("
|
|
||||||
}
|
|
||||||
.nav-item .text-small.font-weight-bold::after {
|
|
||||||
content: ")))"
|
|
||||||
}
|
|
||||||
.nav-item .text-small-extra.text-primary {
|
|
||||||
font-size: 0 !important
|
|
||||||
}
|
|
||||||
.nav-item .text-small-extra.text-primary i {
|
|
||||||
font-size: 11px !important
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
{% elif v.css %}
|
|
||||||
<link rel="stylesheet" href="/@{{v.username}}/css">
|
<link rel="stylesheet" href="/@{{v.username}}/css">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|
|
@ -36,25 +36,7 @@
|
||||||
<style>:root{--primary:#{{v.themecolor}}}</style>
|
<style>:root{--primary:#{{v.themecolor}}}</style>
|
||||||
<link rel="stylesheet" href="/assets/css/main.css?v=250">
|
<link rel="stylesheet" href="/assets/css/main.css?v=250">
|
||||||
<link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=56">
|
<link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=56">
|
||||||
{% if v.agendaposter %}
|
{% if v.css and not request.path.startswith('/settings/css') %}
|
||||||
<style>
|
|
||||||
html {
|
|
||||||
cursor:url('/assets/images/dildo.webp?v=1008'), auto;
|
|
||||||
}
|
|
||||||
.nav-item .text-small.font-weight-bold::before {
|
|
||||||
content: "((("
|
|
||||||
}
|
|
||||||
.nav-item .text-small.font-weight-bold::after {
|
|
||||||
content: ")))"
|
|
||||||
}
|
|
||||||
.nav-item .text-small-extra.text-primary {
|
|
||||||
font-size: 0 !important
|
|
||||||
}
|
|
||||||
.nav-item .text-small-extra.text-primary i {
|
|
||||||
font-size: 11px !important
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
{% elif v.css and not request.path.startswith('/settings/css') %}
|
|
||||||
<link rel="stylesheet" href="/@{{v.username}}/css">
|
<link rel="stylesheet" href="/@{{v.username}}/css">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</head>
|
</head>
|
||||||
|
|
|
@ -209,13 +209,13 @@
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if p.realurl(v) %}
|
{% if p.realurl(v) %}
|
||||||
<h1 id="post-title" class="card-title post-title text-left mb-md-3 {% if p.author.agendaposter %}agendaposter{% endif %}"><a {% if not v or v.newtabexternal %}target="_blank"{% endif %} rel="nofollow noopener noreferrer" href="{{p.realurl(v)}}">
|
<h1 id="post-title" class="card-title post-title text-left mb-md-3"><a {% if not v or v.newtabexternal %}target="_blank"{% endif %} rel="nofollow noopener noreferrer" href="{{p.realurl(v)}}">
|
||||||
{% if p.club %}<span class="patron font-weight-bolder mr-1" style="background-color:red; font-size:12px; line-height:2;">{{CC}}</span>{% endif %}
|
{% if p.club %}<span class="patron font-weight-bolder mr-1" style="background-color:red; font-size:12px; line-height:2;">{{CC}}</span>{% endif %}
|
||||||
{% if p.flair %}<span class="patron font-weight-bolder mr-1" style="background-color:var(--primary); font-size:12px; line-height:2;">{{p.flair | safe}}</span>{% endif %}
|
{% if p.flair %}<span class="patron font-weight-bolder mr-1" style="background-color:var(--primary); font-size:12px; line-height:2;">{{p.flair | safe}}</span>{% endif %}
|
||||||
{{p.realtitle(v) | safe}}
|
{{p.realtitle(v) | safe}}
|
||||||
</a></h1>
|
</a></h1>
|
||||||
{% else %}
|
{% else %}
|
||||||
<h1 id="post-title" class="card-title post-title text-left mb-md-3 {% if p.author.agendaposter %}agendaposter{% endif %}">
|
<h1 id="post-title" class="card-title post-title text-left mb-md-3">
|
||||||
{% if p.club %}<span class="patron font-weight-bolder mr-1" style="background-color:red; font-size:12px; line-height:2;">{{CC}}</span>{% endif %}
|
{% if p.club %}<span class="patron font-weight-bolder mr-1" style="background-color:red; font-size:12px; line-height:2;">{{CC}}</span>{% endif %}
|
||||||
{% if p.flair %}<span class="patron font-weight-bolder mr-1" style="background-color:var(--primary); font-size:12px; line-height:2;">{{p.flair | safe}}</span>{% endif %}
|
{% if p.flair %}<span class="patron font-weight-bolder mr-1" style="background-color:var(--primary); font-size:12px; line-height:2;">{{p.flair | safe}}</span>{% endif %}
|
||||||
{{p.realtitle(v) | safe}}
|
{{p.realtitle(v) | safe}}
|
||||||
|
@ -249,7 +249,7 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
<div id="post-text" {% if p.author.agendaposter %}class="agendaposter"{% endif %}>
|
<div id="post-text">
|
||||||
{% if p.is_image %}
|
{% if p.is_image %}
|
||||||
<div class="row no-gutters">
|
<div class="row no-gutters">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
|
|
|
@ -200,7 +200,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h5 class="card-title post-title text-left w-lg-95 mb-0 pb-0 pb-md-1">
|
<h5 class="card-title post-title text-left w-lg-95 mb-0 pb-0 pb-md-1">
|
||||||
<a id="{{p.id}}-title" {% if v and v.newtab and not g.webview %}target="_blank"{% endif %} href="{{p.permalink}}" class="{% if voted and v.id == AEVANN_ID %}visited{% endif %} stretched-link {% if p.author.agendaposter %}agendaposter{% endif %}">
|
<a id="{{p.id}}-title" {% if v and v.newtab and not g.webview %}target="_blank"{% endif %} href="{{p.permalink}}" class="{% if voted and v.id == AEVANN_ID %}visited{% endif %} stretched-link">
|
||||||
{% if p.club %}<span class="patron font-weight-bolder mr-1" style="background-color:red; font-size:12px; line-height:2;">{{CC}}</span>{% endif %}
|
{% if p.club %}<span class="patron font-weight-bolder mr-1" style="background-color:red; font-size:12px; line-height:2;">{{CC}}</span>{% endif %}
|
||||||
{% if p.flair %}<span class="patron font-weight-bolder mr-1" style="background-color:var(--primary); font-size:12px; line-height:2;">{{p.flair | safe}}</span>{% endif %}
|
{% if p.flair %}<span class="patron font-weight-bolder mr-1" style="background-color:var(--primary); font-size:12px; line-height:2;">{{p.flair | safe}}</span>{% endif %}
|
||||||
{{p.realtitle(v) | safe}}
|
{{p.realtitle(v) | safe}}
|
||||||
|
@ -338,7 +338,7 @@
|
||||||
|
|
||||||
{% if not p.club or v and (v.paid_dues or v.id == p.author_id) %}
|
{% if not p.club or v and (v.paid_dues or v.id == p.author_id) %}
|
||||||
{% if p.realbody(v) %}
|
{% if p.realbody(v) %}
|
||||||
<div class="d-none card rounded border pt-3 pb-2 my-2 {% if p.author.agendaposter %}agendaposter{% endif %}" id="post-text-{{p.id}}">
|
<div class="d-none card rounded border pt-3 pb-2 my-2" id="post-text-{{p.id}}">
|
||||||
{{p.realbody(v) | safe}}
|
{{p.realbody(v) | safe}}
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -24,25 +24,7 @@
|
||||||
<style>:root{--primary:#{{v.themecolor}}}</style>
|
<style>:root{--primary:#{{v.themecolor}}}</style>
|
||||||
<link rel="stylesheet" href="/assets/css/main.css?v=250">
|
<link rel="stylesheet" href="/assets/css/main.css?v=250">
|
||||||
<link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=49">
|
<link rel="stylesheet" href="/assets/css/{{v.theme}}.css?v=49">
|
||||||
{% if v.agendaposter %}
|
{% if v.css %}
|
||||||
<style>
|
|
||||||
html {
|
|
||||||
cursor:url('/assets/images/dildo.webp?v=1008'), auto;
|
|
||||||
}
|
|
||||||
.nav-item .text-small.font-weight-bold::before {
|
|
||||||
content: "((("
|
|
||||||
}
|
|
||||||
.nav-item .text-small.font-weight-bold::after {
|
|
||||||
content: ")))"
|
|
||||||
}
|
|
||||||
.nav-item .text-small-extra.text-primary {
|
|
||||||
font-size: 0 !important
|
|
||||||
}
|
|
||||||
.nav-item .text-small-extra.text-primary i {
|
|
||||||
font-size: 11px !important
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
{% elif v.css %}
|
|
||||||
<link rel="stylesheet" href="/@{{v.username}}/css">
|
<link rel="stylesheet" href="/@{{v.username}}/css">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|
|
@ -244,14 +244,6 @@
|
||||||
</form>
|
</form>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<pre></pre>
|
<pre></pre>
|
||||||
|
|
||||||
<form id="agendaposter1" class="{% if u.agendaposter %}d-none{% endif %}" action="/agendaposter/{{u.id}}" method="post">
|
|
||||||
<input type="hidden" name="formkey", value="{{v.formkey}}">
|
|
||||||
<input autocomplete="off" type="number" step="any" name="days" class="form-control" placeholder="Days (0 or blank = permanent)">
|
|
||||||
<input type="submit" class="btn btn-danger" value="Lock Chud Theme">
|
|
||||||
</form>
|
|
||||||
<a id="unagendaposter" class="{% if not u.agendaposter %}d-none{% endif %} btn btn-success" role="button" onclick="post_toast2(this,'/unagendaposter/{{u.id}}','agendaposter1','unagendaposter')">Disable Chud Theme</a>
|
|
||||||
|
|
||||||
<pre></pre>
|
<pre></pre>
|
||||||
|
|
||||||
<a id="shadowban" class="{% if u.shadowbanned %}d-none{% endif %} btn btn-danger" role="button" onclick="post_toast2(this,'/shadowban/{{u.id}}','shadowban','unshadowban')">Shadowban</a>
|
<a id="shadowban" class="{% if u.shadowbanned %}d-none{% endif %} btn btn-danger" role="button" onclick="post_toast2(this,'/shadowban/{{u.id}}','shadowban','unshadowban')">Shadowban</a>
|
||||||
|
@ -525,14 +517,6 @@
|
||||||
</form>
|
</form>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<pre></pre>
|
<pre></pre>
|
||||||
|
|
||||||
<form id="agendaposter2" class="{% if u.agendaposter %}d-none{% endif %}" action="/agendaposter/{{u.id}}" method="post">
|
|
||||||
<input type="hidden" name="formkey", value="{{v.formkey}}">
|
|
||||||
<input autocomplete="off" type="number" step="any" name="days" class="form-control" placeholder="Days (0 or blank = permanent)">
|
|
||||||
<input type="submit" class="btn btn-danger" value="Lock Chud Theme">
|
|
||||||
</form>
|
|
||||||
<a id="unagendaposter2" class="{% if not u.agendaposter %}d-none{% endif %} btn btn-success" role="button" onclick="post_toast2(this,'/unagendaposter/{{u.id}}','agendaposter2','unagendaposter2')">Disable Chud Theme</a>
|
|
||||||
|
|
||||||
<pre></pre>
|
<pre></pre>
|
||||||
|
|
||||||
<a id="shadowban2" class="{% if u.shadowbanned %}d-none{% endif %} btn btn-danger" role="button" onclick="post_toast2(this,'/shadowban/{{u.id}}','shadowban2','unshadowban2')">Shadowban</a>
|
<a id="shadowban2" class="{% if u.shadowbanned %}d-none{% endif %} btn btn-danger" role="button" onclick="post_toast2(this,'/shadowban/{{u.id}}','shadowban2','unshadowban2')">Shadowban</a>
|
||||||
|
|
|
@ -10,7 +10,8 @@ def test_rules():
|
||||||
assert response.text.startswith("<!DOCTYPE html>")
|
assert response.text.startswith("<!DOCTYPE html>")
|
||||||
|
|
||||||
|
|
||||||
def test_signup():
|
def test_signup_and_post():
|
||||||
|
print("\nTesting signup and posting flow")
|
||||||
client = app.test_client()
|
client = app.test_client()
|
||||||
with client: # this keeps the session between requests, which we need
|
with client: # this keeps the session between requests, which we need
|
||||||
signup_get_response = client.get("/signup")
|
signup_get_response = client.get("/signup")
|
||||||
|
@ -35,6 +36,20 @@ def test_signup():
|
||||||
assert "error" not in signup_post_response.location
|
assert "error" not in signup_post_response.location
|
||||||
|
|
||||||
# we should now be logged in and able to post
|
# we should now be logged in and able to post
|
||||||
|
submit_get_response = client.get("/submit")
|
||||||
|
assert submit_get_response.status_code == 200
|
||||||
|
|
||||||
|
submit_post_response = client.post("/submit", data={
|
||||||
|
"title": "my_cool_post",
|
||||||
|
"body": "hey_guys",
|
||||||
|
})
|
||||||
|
assert submit_post_response.status_code == 302
|
||||||
|
post_render_result = client.get(submit_post_response.location)
|
||||||
|
assert "my_cool_post" in post_render_result.text
|
||||||
|
assert "hey_guys" in post_render_result.text
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue