Merge branch 'frost' into remove-more-dramaisms

This commit is contained in:
Ben Rog-Wilhelm 2022-11-09 20:45:31 -06:00 committed by GitHub
commit 7c72815dcc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
30 changed files with 142 additions and 845 deletions

2
.github/FUNDING.yml vendored
View file

@ -1,2 +0,0 @@
github: Aevann1
custom: ["https://marsey1.gumroad.com/l/tfcvri"]

View file

@ -21,14 +21,9 @@ function pick(kind, canbuy1, canbuy2) {
document.getElementById('kind').value=kind;
try {document.getElementsByClassName('picked')[0].classList.toggle('picked');} catch(e) {console.log(e)}
document.getElementById(kind).classList.toggle('picked')
if (kind == "flairlock") {
document.getElementById('notelabel').innerHTML = "New flair:";
document.getElementById('note').placeholder = "Insert new flair here, or leave empty to add 1 day to the duration of the current flair";
}
else {
document.getElementById('notelabel').innerHTML = "Note (optional):";
document.getElementById('note').placeholder = "Note to include in award notification";
}
document.getElementById('notelabel').innerHTML = "Note (optional):";
document.getElementById('note').placeholder = "Note to include in award notification";
}
function buy(mb) {

View file

@ -41,15 +41,7 @@ class Badge(Base):
@property
@lazy
def text(self):
if self.badge_id in {94,95,96,97,98,109}:
if self.badge_id == 94: ti = self.user.progressivestack
elif self.badge_id == 95: ti = self.user.bird
elif self.badge_id == 96: ti = self.user.flairchanged
elif self.badge_id == 97: ti = self.user.longpost
elif self.badge_id == 98: ti = self.user.marseyawarded
elif self.badge_id == 109: ti = self.user.rehab
text = self.badge.description + " until " + datetime.utcfromtimestamp(ti).strftime('%Y-%m-%d %H:%M:%S')
elif self.description: text = self.description
if self.description: text = self.description
elif self.badge.description: text = self.badge.description
else: return self.name
return f'{self.name} - {text}'

View file

@ -375,9 +375,6 @@ class Comment(Base):
g.db.add(self)
g.db.commit()
if self.author.sig_html and (self.author_id == MOOSE_ID or (not self.ghost and not (v and v.sigs_disabled))):
body += f"<hr>{self.author.sig_html}"
return body
def plainbody(self, v):

View file

@ -377,9 +377,6 @@ class Submission(Base):
g.db.add(self)
g.db.commit()
if self.author.sig_html and (self.author_id == MOOSE_ID or (not self.ghost and not (v and v.sigs_disabled))):
body += f"<hr>{self.author.sig_html}"
return body
def plainbody(self, v):

View file

@ -57,12 +57,7 @@ class User(Base):
patron_utc = Column(Integer, default=0, nullable=False)
verified = Column(String)
verifiedcolor = Column(String)
marseyawarded = Column(Integer)
rehab = Column(Integer)
longpost = Column(Integer)
winnings = Column(Integer, default=0, nullable=False)
unblockable = Column(Boolean)
bird = Column(Integer)
email = deferred(Column(String))
css = deferred(Column(String))
profilecss = deferred(Column(String))
@ -87,21 +82,11 @@ class User(Base):
newtabexternal = Column(Boolean, default=True, nullable=False)
reddit = Column(String, default='old.reddit.com', nullable=False)
nitter = Column(Boolean)
mute = Column(Boolean)
unmutable = Column(Boolean)
eye = Column(Boolean)
alt = Column(Boolean)
frontsize = Column(Integer, default=25, nullable=False)
controversial = Column(Boolean, default=False, nullable=False)
bio = deferred(Column(String))
bio_html = Column(String)
sig = deferred(Column(String))
sig_html = Column(String)
fp = Column(String)
sigs_disabled = Column(Boolean)
fish = Column(Boolean)
progressivestack = Column(Integer)
deflector = Column(Integer)
friends = deferred(Column(String))
friends_html = deferred(Column(String))
enemies = deferred(Column(String))
@ -205,7 +190,7 @@ class User(Base):
@lazy
def mod_date(self, sub):
if self.id == AEVANN_ID: return 1
if self.id == OWNER_ID: return 1
mod = g.db.query(Mod).filter_by(user_id=self.id, sub=sub).one_or_none()
if not mod: return None
return mod.created_utc

View file

@ -27,24 +27,8 @@ AUTOBETTER_ID = 7
AUTOCHOICE_ID = 8
BASEDBOT_ID = 0
A_ID = 0
KIPPY_ID = 0
GIFT_NOTIF_ID = 9
PIZZASHILL_ID = 0
PIZZA_VOTERS = ()
IDIO_ID = 0
CARP_ID = 0
JOAN_ID = 0
MOOSE_ID = 0
AEVANN_ID = 9
HOMO_ID = 0
SOREN_ID = 0
Q_ID = 0
LAWLZ_ID = 0
LLM_ID = 0
DAD_ID = 0
MOM_ID = 0
DONGER_ID = 0
OWNER_ID = 9
BUG_THREAD = 0
WELCOME_MSG = f"Welcome to {SITE_TITLE}! Please read [the rules](/rules) first. Then [read some of our current conversations](/) and feel free to comment or post!\n\nWe encourage people to comment even if they aren't sure they fit in; as long as your comment follows [community rules](/rules), we are happy to have posters from all backgrounds, education levels, and specialties."
ROLES={}
@ -58,110 +42,6 @@ COLORS = {'ff66ac','805ad5','62ca56','38a169','80ffff','2a96f3','eb4963','ff0000
LOGGEDIN_ACTIVE_TIME = 15 * 60
AWARDS = {
"ghost": {
"kind": "ghost",
"title": "Ghost",
"description": "???",
"icon": "fas fa-ghost",
"color": "text-white",
"price": 3000
},
"nword": {
"kind": "nword",
"title": "Nword Pass",
"description": "???",
"icon": "fas fa-edit",
"color": "text-success",
"price": 10000
},
"snow": {
"kind": "snow",
"title": "Snow",
"description": "???",
"icon": "fas fa-snowflake",
"color": "text-blue-200",
"price": 300
},
"gingerbread": {
"kind": "gingerbread",
"title": "Gingerbread",
"description": "???",
"icon": "fas fa-gingerbread-man",
"color": "",
"price": 300
},
"lights": {
"kind": "lights",
"title": "Lights",
"description": "???",
"icon": "fas fa-lights-holiday",
"color": "",
"price": 300
},
"candycane": {
"kind": "candycane",
"title": "Candy Cane",
"description": "???",
"icon": "fas fa-candy-cane",
"color": "",
"price": 400
},
"fireplace": {
"kind": "fireplace",
"title": "Fireplace",
"description": "???",
"icon": "fas fa-fireplace",
"color": "",
"price": 600
},
"grinch": {
"kind": "grinch",
"title": "Grinch",
"description": "???",
"icon": "fas fa-angry",
"color": "text-green-500",
"price": 1000
},
"haunt": {
"kind": "haunt",
"title": "Haunt",
"description": "???",
"icon": "fas fa-book-dead",
"color": "text-warning",
"price": 500
},
"upsidedown": {
"kind": "upsidedown",
"title": "The Upside Down",
"description": "???",
"icon": "fas fa-lights-holiday",
"color": "",
"price": 400
},
"stab": {
"kind": "stab",
"title": "Stab",
"description": "???",
"icon": "fas fa-knife-kitchen",
"color": "text-danger",
"price": 300
},
"spiders": {
"kind": "spiders",
"title": "Spiders",
"description": "???",
"icon": "fas fa-spider",
"color": "text-black",
"price": 200
},
"fog": {
"kind": "fog",
"title": "Fog",
"description": "???",
"icon": "fas fa-smoke",
"color": "text-gray",
"price": 200
},
"lootbox": {
"kind": "lootbox",
"title": "Lootstocking",
@ -226,22 +106,6 @@ AWARDS = {
"color": "text-green",
"price": 300
},
"rehab": {
"kind": "rehab",
"title": "Rehab",
"description": "Prevents the user from gambling for 24 hours in a last ditch effort to save them from themself.",
"icon": "fas fa-dice-six",
"color": "text-black",
"price": 777
},
"progressivestack": {
"kind": "progressivestack",
"title": "Progressive Stack",
"description": "Makes votes on the recipient's posts and comments weigh double in the ranking algorithm for 6 hours.",
"icon": "fas fa-bullhorn",
"color": "text-danger",
"price": 1000
},
"pin": {
"kind": "pin",
"title": "1-Hour Pin",
@ -258,46 +122,6 @@ AWARDS = {
"color": "text-black",
"price": 1000
},
"flairlock": {
"kind": "flairlock",
"title": "1-Day Flairlock",
"description": "Sets a flair for the recipient and locks it for 24 hours.",
"icon": "fas fa-lock",
"color": "text-black",
"price": 1250
},
"pizzashill": {
"kind": "pizzashill",
"title": "Pizzashill",
"description": "Forces the recipient to make all posts/comments > 280 characters for 24 hours.",
"icon": "fas fa-pizza-slice",
"color": "text-orange",
"price": 1500
},
"bird": {
"kind": "bird",
"title": "Bird Site",
"description": "Forces the recipient to make all posts/comments < 140 characters for 24 hours.",
"icon": "fab fa-twitter",
"color": "text-blue",
"price": 1500
},
"deflector": {
"kind": "deflector",
"title": "Deflector",
"description": "Causes most awards received for the next 10 hours to be deflected back at their giver.",
"icon": "fas fa-shield",
"color": "text-pink",
"price": 2750
},
"marsey": {
"kind": "marsey",
"title": "Marsey",
"description": "Makes the recipient unable to post/comment anything but marsey emojis for 24 hours.",
"icon": "fas fa-cat",
"color": "text-orange",
"price": 3000
},
"ban": {
"kind": "ban",
"title": "1-Day Ban",
@ -330,54 +154,6 @@ AWARDS = {
"color": "text-success",
"price": 10000
},
"eye": {
"kind": "eye",
"title": "All-Seeing Eye",
"description": "Gives the recipient the ability to view private profiles.",
"icon": "fas fa-eye",
"color": "text-silver",
"price": 10000
},
"unblockable": {
"kind": "unblockable",
"title": "Unblockable",
"description": "Makes the recipient unblockable and removes all blocks on them.",
"icon": "far fa-laugh-squint",
"color": "text-lightgreen",
"price": 10000
},
"fish": {
"kind": "fish",
"title": "Fish",
"description": "This user cannot be unfollowed",
"icon": "fas fa-fish",
"color": "text-lightblue",
"price": 20000
},
"pause": {
"kind": "pause",
"title": "Pause",
"description": "Gives the recipient the ability to pause profile anthems.",
"icon": "fas fa-volume-mute",
"color": "text-danger",
"price": 20000
},
"unpausable": {
"kind": "unpausable",
"title": "Unpausable",
"description": "Makes the profile anthem of the recipient unpausable.",
"icon": "fas fa-volume",
"color": "text-success",
"price": 40000
},
"alt": {
"kind": "alt",
"title": "Alt-Seeing Eye",
"description": "Gives the recipient the ability to view alts.",
"icon": "fas fa-eye",
"color": "text-gold",
"price": 50000
},
}
AWARDS2 = deepcopy(AWARDS)
@ -390,34 +166,11 @@ for k, val in AWARDS2.items():
if val['price'] == 300: AWARDS3[k] = val
NOTIFIED_USERS = {
'aevan': AEVANN_ID,
'avean': AEVANN_ID,
'joan': JOAN_ID,
'pewkie': JOAN_ID,
'carp': CARP_ID,
'idio3': IDIO_ID,
'idio ': IDIO_ID,
'landlord_messiah': LLM_ID,
'landlordmessiah': LLM_ID,
' llm ': LLM_ID,
'landlet': LLM_ID,
'dong': DONGER_ID,
'kippy': KIPPY_ID,
'the_homocracy': HOMO_ID,
'soren': SOREN_ID,
# format: 'substring' ↦ User ID to notify
}
patron = 'Patron'
REDDIT_NOTIFS = {
'idio3': IDIO_ID,
'aevann': AEVANN_ID,
'carpflo': CARP_ID,
'carpathianflorist': CARP_ID,
'carpathian florist': CARP_ID,
'the_homocracy': HOMO_ID
}
discounts = {
69: 0.02,
70: 0.04,
@ -446,10 +199,6 @@ mention_regex2 = re.compile('<p>@(([a-zA-Z0-9_\\-]){1,25})', flags=re.A)
valid_password_regex = re.compile("^.{8,100}$", flags=re.A)
marseyaward_body_regex = re.compile(">[^<\\s+]|[^>\\s+]<", flags=re.A)
marseyaward_title_regex = re.compile("( *<img[^>]+>)+", flags=re.A)
marsey_regex = re.compile("[a-z0-9]{1,30}", flags=re.A)
tags_regex = re.compile("[a-z0-9: ]{1,200}", flags=re.A)
@ -498,8 +247,6 @@ utm_regex2 = re.compile('[?&]utm_[a-z]+=[a-z0-9_]+', flags=re.A)
YOUTUBE_KEY = environ.get("YOUTUBE_KEY", "").strip()
ADMINISTRATORS = (37696, 37697, 37749, 37833, 37838)
proxies = {"http":"http://127.0.0.1:18080","https":"http://127.0.0.1:18080"}
approved_embed_hosts = [

View file

@ -113,6 +113,10 @@ def get_account(id, v=None):
def get_post(i, v=None, graceful=False):
try: i = int(i)
except:
if graceful: return None
else: abort(404)
if v:
vt = g.db.query(Vote).filter_by(
@ -201,6 +205,10 @@ def get_posts(pids, v=None):
return sorted(output, key=lambda x: pids.index(x.id))
def get_comment(i, v=None, graceful=False):
try: i = int(i)
except:
if graceful: return None
abort(404)
if v:

View file

@ -7,10 +7,6 @@ from files.helpers.assetcache import assetcache_path
@app.template_filter("post_embed")
def post_embed(id, v):
try: id = int(id)
except: return None
p = get_post(id, v, graceful=True)
if p: return render_template("submission_listing.html", listing=[p], v=v)
@ -65,11 +61,7 @@ def inject_constants():
"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,
"ADMINISTRATORS":ADMINISTRATORS
}

View file

@ -26,7 +26,7 @@ month = datetime.now().strftime('%B')
@limiter.exempt
@admin_level_required(3)
def merge(v, id1, id2):
if v.id != AEVANN_ID: abort(403)
if v.id != OWNER_ID: abort(403)
if time.time() - session.get('verified', 0) > 3:
session.pop("session_id", None)
@ -87,7 +87,7 @@ def merge(v, id1, id2):
@limiter.exempt
@admin_level_required(3)
def merge_all(v, id):
if v.id != AEVANN_ID: abort(403)
if v.id != OWNER_ID: abort(403)
if time.time() - session.get('verified', 0) > 3:
session.pop("session_id", None)
@ -609,7 +609,7 @@ def badge_grant_post(v):
try: badge_id = int(request.values.get("badge_id"))
except: abort(400)
if badge_id in {16,17,94,95,96,97,98,109} and v.id != AEVANN_ID:
if badge_id in {16,17,94,95,96,97,98,109} and v.id != OWNER_ID:
abort(403)
if user.has_badge(badge_id):
@ -1043,11 +1043,9 @@ def admin_title_change(user_id, v):
user=g.db.query(User).filter_by(id=user.id).one_or_none()
user.customtitle=new_name
if request.values.get("locked"): user.flairchanged = int(time.time()) + 2629746
else:
user.flairchanged = None
badge = user.has_badge(96)
if badge: g.db.delete(badge)
user.flairchanged = None
if request.values.get("locked"):
user.flairchanged = (2 << 30) - 1
g.db.add(user)

View file

@ -115,10 +115,6 @@ def buy(v, award):
g.db.add(award_object)
g.db.add(v)
if CARP_ID and v.id != CARP_ID and og_price >= 10000:
send_repeatable_notification(CARP_ID, f"@{v.username} has bought a `{award}` award!")
g.db.commit()
return {"message": "Award bought!"}
@ -158,23 +154,13 @@ def award_post(pid, v):
author = post.author
if author.id in (PIZZASHILL_ID, DAD_ID) and v.id not in (PIZZASHILL_ID, DAD_ID):
return {"error": "This user is immune to awards."}, 403
if kind == "benefactor" and author.id == v.id:
return {"error": "You can't use this award on yourself."}, 400
if v.id != author.id:
if author.deflector and AWARDS[kind]['price'] > 300 and kind not in ('pin','unpin','benefactor'):
msg = f"@{v.username} has tried to give your [post]({post.shortlink}) the {AWARDS[kind]['title']} Award but it was deflected and applied to them :marseytroll:"
send_repeatable_notification(author.id, msg)
msg = f"@{author.username} is under the effect of a deflector award; your {AWARDS[kind]['title']} Award has been deflected back to you :marseytroll:"
send_repeatable_notification(v.id, msg)
author = v
else:
msg = f"@{v.username} has given your [post]({post.shortlink}) the {AWARDS[kind]['title']} Award!"
if note: msg += f"\n\n> {note}"
send_repeatable_notification(author.id, msg)
msg = f"@{v.username} has given your [post]({post.shortlink}) the {AWARDS[kind]['title']} Award!"
if note: msg += f"\n\n> {note}"
send_repeatable_notification(author.id, msg)
if kind == "ban":
link = f"[this post]({post.shortlink})"
@ -219,99 +205,6 @@ def award_post(pid, v):
cache.delete_memoized(frontlist)
else: post.stickied_utc = t
g.db.add(post)
elif kind == "flairlock":
new_name = note[:100].replace("𒐪","")
if not new_name and author.flairchanged:
author.flairchanged += 86400
else:
author.customtitleplain = new_name
author.customtitle = filter_emojis_only(new_name)
if len(author.customtitle) > 1000: abort(403)
author.flairchanged = int(time.time()) + 86400
if not author.has_badge(96):
badge = Badge(user_id=author.id, badge_id=96)
g.db.add(badge)
g.db.flush()
send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({badge.path})\n\n{badge.name}")
elif kind == "pause":
author.mute = True
if not author.has_badge(68):
new_badge = Badge(badge_id=68, user_id=author.id)
g.db.add(new_badge)
g.db.flush()
send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({new_badge.path})\n\n{new_badge.name}")
elif kind == "unpausable":
author.unmutable = True
if not author.has_badge(67):
new_badge = Badge(badge_id=67, user_id=author.id)
g.db.add(new_badge)
g.db.flush()
send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({new_badge.path})\n\n{new_badge.name}")
elif kind == "marsey":
if author.marseyawarded: author.marseyawarded += 86400
else: author.marseyawarded = int(time.time()) + 86400
if not author.has_badge(98):
badge = Badge(user_id=author.id, badge_id=98)
g.db.add(badge)
g.db.flush()
send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({badge.path})\n\n{badge.name}")
elif kind == "pizzashill":
if author.bird:
return {"error": "This user is the under the effect of a conflicting award: Bird Site award."}, 404
if author.longpost: author.longpost += 86400
else: author.longpost = int(time.time()) + 86400
if not author.has_badge(97):
badge = Badge(user_id=author.id, badge_id=97)
g.db.add(badge)
g.db.flush()
send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({badge.path})\n\n{badge.name}")
elif kind == "bird":
if author.longpost:
return {"error": "This user is the under the effect of a conflicting award: Pizzashill award."}, 404
if author.bird: author.bird += 86400
else: author.bird = int(time.time()) + 86400
if not author.has_badge(95):
badge = Badge(user_id=author.id, badge_id=95)
g.db.add(badge)
g.db.flush()
send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({badge.path})\n\n{badge.name}")
elif kind == "eye":
author.eye = True
if not author.has_badge(83):
new_badge = Badge(badge_id=83, user_id=author.id)
g.db.add(new_badge)
g.db.flush()
send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({new_badge.path})\n\n{new_badge.name}")
elif kind == "alt":
author.alt = True
if not author.has_badge(84):
new_badge = Badge(badge_id=84, user_id=author.id)
g.db.add(new_badge)
g.db.flush()
send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({new_badge.path})\n\n{new_badge.name}")
elif kind == "unblockable":
author.unblockable = True
if not author.has_badge(87):
new_badge = Badge(badge_id=87, user_id=author.id)
g.db.add(new_badge)
g.db.flush()
send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({new_badge.path})\n\n{new_badge.name}")
for block in g.db.query(UserBlock).filter_by(target_id=author.id).all(): g.db.delete(block)
elif kind == "fish":
author.fish = True
if not author.has_badge(90):
new_badge = Badge(badge_id=90, user_id=author.id)
g.db.add(new_badge)
g.db.flush()
send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({new_badge.path})\n\n{new_badge.name}")
elif kind == "progressivestack":
if author.progressivestack: author.progressivestack += 21600
else: author.progressivestack = int(time.time()) + 21600
if not author.has_badge(94):
badge = Badge(user_id=author.id, badge_id=94)
g.db.add(badge)
g.db.flush()
send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({badge.path})\n\n{badge.name}")
elif kind == "benefactor":
author.patron = 1
if author.patron_utc: author.patron_utc += 2629746
@ -323,17 +216,6 @@ def award_post(pid, v):
g.db.add(badge)
g.db.flush()
send_notification(v.id, f"@AutoJanny has given you the following profile badge:\n\n![]({badge.path})\n\n{badge.name}")
elif kind == "rehab":
if author.rehab: author.rehab += 86400
else: author.rehab = int(time.time()) + 86400
if not author.has_badge(109):
badge = Badge(user_id=author.id, badge_id=109)
g.db.add(badge)
g.db.flush()
send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({badge.path})\n\n{badge.name}")
elif kind == "deflector":
if author.deflector: author.deflector += 36000
else: author.deflector = int(time.time()) + 36000
if author.received_award_count: author.received_award_count += 1
else: author.received_award_count = 1
@ -381,26 +263,14 @@ def award_comment(cid, v):
author = c.author
if author.id in (PIZZASHILL_ID, DAD_ID) and v.id not in (PIZZASHILL_ID, DAD_ID):
return {"error": "This user is immune to awards."}, 403
if v.id != author.id:
if author.deflector and AWARDS[kind]['price'] > 300 and kind not in ('pin','unpin','benefactor'):
msg = f"@{v.username} has tried to give your [comment]({c.shortlink}) the {AWARDS[kind]['title']} Award but it was deflected and applied to them :marseytroll:"
send_repeatable_notification(author.id, msg)
msg = f"@{author.username} is under the effect of a deflector award; your {AWARDS[kind]['title']} Award has been deflected back to you :marseytroll:"
send_repeatable_notification(v.id, msg)
author = v
else:
msg = f"@{v.username} has given your [comment]({c.shortlink}) the {AWARDS[kind]['title']} Award!"
if note: msg += f"\n\n> {note}"
send_repeatable_notification(author.id, msg)
msg = f"@{v.username} has given your [comment]({c.shortlink}) the {AWARDS[kind]['title']} Award!"
if note: msg += f"\n\n> {note}"
send_repeatable_notification(author.id, msg)
if kind == "benefactor" and author.id == v.id:
return {"error": "You can't use this award on yourself."}, 400
if author.deflector: author = v
if kind == "ban":
link = f"[this comment]({c.shortlink})"
@ -441,99 +311,6 @@ def award_comment(cid, v):
c.is_pinned_utc = None
else: c.is_pinned_utc = t
g.db.add(c)
elif kind == "flairlock":
new_name = note[:100].replace("𒐪","")
if not new_name and author.flairchanged:
author.flairchanged += 86400
else:
author.customtitleplain = new_name
author.customtitle = filter_emojis_only(new_name)
if len(author.customtitle) > 1000: abort(403)
author.flairchanged = int(time.time()) + 86400
if not author.has_badge(96):
badge = Badge(user_id=author.id, badge_id=96)
g.db.add(badge)
g.db.flush()
send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({badge.path})\n\n{badge.name}")
elif kind == "pause":
author.mute = True
if not author.has_badge(68):
new_badge = Badge(badge_id=68, user_id=author.id)
g.db.add(new_badge)
g.db.flush()
send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({new_badge.path})\n\n{new_badge.name}")
elif kind == "unpausable":
author.unmutable = True
if not author.has_badge(67):
new_badge = Badge(badge_id=67, user_id=author.id)
g.db.add(new_badge)
g.db.flush()
send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({new_badge.path})\n\n{new_badge.name}")
elif kind == "marsey":
if author.marseyawarded: author.marseyawarded += 86400
else: author.marseyawarded = int(time.time()) + 86400
if not author.has_badge(98):
badge = Badge(user_id=author.id, badge_id=98)
g.db.add(badge)
g.db.flush()
send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({badge.path})\n\n{badge.name}")
elif kind == "pizzashill":
if author.bird:
return {"error": "This user is the under the effect of a conflicting award: Bird Site award."}, 404
if author.longpost: author.longpost += 86400
else: author.longpost = int(time.time()) + 86400
if not author.has_badge(97):
badge = Badge(user_id=author.id, badge_id=97)
g.db.add(badge)
g.db.flush()
send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({badge.path})\n\n{badge.name}")
elif kind == "bird":
if author.longpost:
return {"error": "This user is the under the effect of a conflicting award: Pizzashill award."}, 404
if author.bird: author.bird += 86400
else: author.bird = int(time.time()) + 86400
if not author.has_badge(95):
badge = Badge(user_id=author.id, badge_id=95)
g.db.add(badge)
g.db.flush()
send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({badge.path})\n\n{badge.name}")
elif kind == "eye":
author.eye = True
if not author.has_badge(83):
new_badge = Badge(badge_id=83, user_id=author.id)
g.db.add(new_badge)
g.db.flush()
send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({new_badge.path})\n\n{new_badge.name}")
elif kind == "alt":
author.alt = True
if not author.has_badge(84):
new_badge = Badge(badge_id=84, user_id=author.id)
g.db.add(new_badge)
g.db.flush()
send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({new_badge.path})\n\n{new_badge.name}")
elif kind == "unblockable":
author.unblockable = True
if not author.has_badge(87):
new_badge = Badge(badge_id=87, user_id=author.id)
g.db.add(new_badge)
g.db.flush()
send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({new_badge.path})\n\n{new_badge.name}")
for block in g.db.query(UserBlock).filter_by(target_id=author.id).all(): g.db.delete(block)
elif kind == "fish":
author.fish = True
if not author.has_badge(90):
new_badge = Badge(badge_id=90, user_id=author.id)
g.db.add(new_badge)
g.db.flush()
send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({new_badge.path})\n\n{new_badge.name}")
elif kind == "progressivestack":
if author.progressivestack: author.progressivestack += 21600
else: author.progressivestack = int(time.time()) + 21600
if not author.has_badge(94):
badge = Badge(user_id=author.id, badge_id=94)
g.db.add(badge)
g.db.flush()
send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({badge.path})\n\n{badge.name}")
elif kind == "benefactor":
author.patron = 1
if author.patron_utc: author.patron_utc += 2629746
@ -545,17 +322,6 @@ def award_comment(cid, v):
g.db.add(badge)
g.db.flush()
send_notification(v.id, f"@AutoJanny has given you the following profile badge:\n\n![]({badge.path})\n\n{badge.name}")
elif kind == "rehab":
if author.rehab: author.rehab += 86400
else: author.rehab = int(time.time()) + 86400
if not author.has_badge(109):
badge = Badge(user_id=author.id, badge_id=109)
g.db.add(badge)
g.db.flush()
send_notification(author.id, f"@AutoJanny has given you the following profile badge:\n\n![]({badge.path})\n\n{badge.name}")
elif kind == "deflector":
if author.deflector: author.deflector += 36000
else: author.deflector = int(time.time()) + 36000
if author.received_award_count: author.received_award_count += 1
else: author.received_award_count = 1

View file

@ -52,10 +52,6 @@ def pusher_thread(interests, c, username):
# @app.get("/h/<sub>/post/<pid>/<anything>/<cid>")
@auth_desired
def post_pid_comment_cid(cid, pid=None, anything=None, v=None, sub=None):
try: cid = int(cid)
except: abort(404)
comment = get_comment(cid, v=v)
if v and request.values.get("read"):
@ -75,9 +71,6 @@ def post_pid_comment_cid(cid, pid=None, anything=None, v=None, sub=None):
if comment.parent_submission: pid = comment.parent_submission
else: pid = 1
try: pid = int(pid)
except: abort(404)
post = get_post(pid, v=v)
if post.over_18 and not (v and v.over_18) and not session.get('over_18', 0) >= int(time.time()):
@ -177,12 +170,6 @@ def api_comment(v):
body = request.values.get("body", "").strip()[:10000]
if parent_post.id not in ADMINISTRATORS:
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
if not body and not request.files.get('file'): return {"error":"You need to actually write something!"}, 400
if request.files.get("file") and request.headers.get("cf-ipcountry") != "T1":
@ -192,35 +179,9 @@ def api_comment(v):
oldname = f'/images/{time.time()}'.replace('.','') + '.webp'
file.save(oldname)
image = process_image(oldname)
if image == "": return {"error":"Image upload failed"}
if v.admin_level > 2 and level == 1:
if parent_post.id == 37696:
pass
# filename = 'files/assets/images/rDrama/sidebar/' + str(len(listdir('files/assets/images/rDrama/sidebar'))+1) + '.webp'
# copyfile(oldname, filename)
# process_image(filename, 400)
elif parent_post.id == 37697:
pass
# filename = 'files/assets/images/rDrama/banners/' + str(len(listdir('files/assets/images/rDrama/banners'))+1) + '.webp'
# copyfile(oldname, filename)
# process_image(filename)
elif parent_post.id == 37833:
try:
badge_def = loads(body)
name = badge_def["name"]
if image == "":
return {"error":"Image upload failed"}
existing = g.db.query(BadgeDef).filter_by(name=name).one_or_none()
if existing: return {"error": "A badge with this name already exists!"}, 403
badge = BadgeDef(name=name, description=badge_def["description"])
g.db.add(badge)
g.db.flush()
filename = f'files/assets/images/badges/{badge.id}.webp'
copyfile(oldname, filename)
process_image(filename, 200)
requests.post(f'https://api.cloudflare.com/client/v4/zones/{CF_ZONE}/purge_cache', headers=CF_HEADERS, data={'files': [f"https://{request.host}/assets/images/badges/{badge.id}.webp"]}, timeout=5)
except Exception as e:
return {"error": str(e)}, 400
if app.config['MULTIMEDIA_EMBEDDING_ENABLED']:
body += f"\n\n![]({image})"
else:
@ -244,21 +205,23 @@ def api_comment(v):
body_html = sanitize(body, comment=True)
if parent_post.id not in ADMINISTRATORS:
existing = g.db.query(Comment.id).filter(Comment.author_id == v.id,
Comment.deleted_utc == 0,
Comment.parent_comment_id == parent_comment_id,
Comment.parent_submission == parent_post.id,
Comment.body_html == body_html
).one_or_none()
if existing: return {"error": f"You already made that comment: /comment/{existing.id}"}, 409
existing = g.db.query(Comment.id).filter(
Comment.author_id == v.id,
Comment.deleted_utc == 0,
Comment.parent_comment_id == parent_comment_id,
Comment.parent_submission == parent_post.id,
Comment.body_html == body_html
).one_or_none()
if existing:
return {"error": f"You already made that comment: /comment/{existing.id}"}, 409
if parent.author.any_block_exists(v) and v.admin_level < 2:
return {"error": "You can't reply to users who have blocked you, or users you have blocked."}, 403
is_bot = bool(request.headers.get("Authorization"))
if parent_post.id not in ADMINISTRATORS and not is_bot and not v.marseyawarded and len(body) > 10:
if not is_bot and len(body) > 10:
now = int(time.time())
cutoff = now - 60 * 60 * 24
@ -331,19 +294,6 @@ def api_comment(v):
c.voted = 1
if v.id == PIZZASHILL_ID:
for uid in PIZZA_VOTERS:
autovote = CommentVote(user_id=uid, comment_id=c.id, vote_type=1)
g.db.add(autovote)
v.coins += 3
v.truecoins += 3
g.db.add(v)
c.upvotes += 3
g.db.add(c)
if v.marseyawarded and parent_post.id not in ADMINISTRATORS and marseyaward_body_regex.search(body_html):
return {"error":"You can only type marseys!"}, 403
g.db.commit()
if request.headers.get("Authorization"): return c.json
@ -422,11 +372,6 @@ def edit_comment(cid, v):
return {"error":"You have to actually type something!"}, 400
if body != c.body or request.files.get("file") and request.headers.get("cf-ipcountry") != "T1":
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
body_html = sanitize(body, edit=True)
# Spam Checking
@ -490,9 +435,6 @@ def edit_comment(cid, v):
if len(body_html) > 20000: abort(400)
if v.marseyawarded and marseyaward_body_regex.search(body_html):
return {"error":"You can only type marseys!"}, 403
c.body = body[:10000]
c.body_html = body_html

View file

@ -210,7 +210,6 @@ def front_all(v, sub=None, subdomain=None):
if v:
if v.hidevotedon: posts = [x for x in posts if not hasattr(x, 'voted') or not x.voted]
if v.patron_utc and v.patron_utc < time.time():
v.patron = 0
v.patron_utc = 0
@ -218,7 +217,6 @@ def front_all(v, sub=None, subdomain=None):
if v.discord_id: remove_role(v, "1")
g.db.add(v)
g.db.commit()
if v.unban_utc and v.unban_utc < time.time():
v.is_banned = 0
v.unban_utc = 0
@ -227,60 +225,6 @@ def front_all(v, sub=None, subdomain=None):
g.db.add(v)
g.db.commit()
if v.flairchanged and v.flairchanged < time.time():
v.flairchanged = None
send_repeatable_notification(v.id, "Your flair lock has expired. You can now change your flair!")
g.db.add(v)
badge = v.has_badge(96)
if badge: g.db.delete(badge)
g.db.commit()
if v.marseyawarded and v.marseyawarded < time.time():
v.marseyawarded = None
send_repeatable_notification(v.id, "Your marsey award has expired!")
g.db.add(v)
badge = v.has_badge(98)
if badge: g.db.delete(badge)
g.db.commit()
if v.longpost and v.longpost < time.time():
v.longpost = None
send_repeatable_notification(v.id, "Your pizzashill award has expired!")
g.db.add(v)
badge = v.has_badge(97)
if badge: g.db.delete(badge)
g.db.commit()
if v.bird and v.bird < time.time():
v.bird = None
send_repeatable_notification(v.id, "Your bird site award has expired!")
g.db.add(v)
badge = v.has_badge(95)
if badge: g.db.delete(badge)
g.db.commit()
if v.progressivestack and v.progressivestack < time.time():
v.progressivestack = None
send_repeatable_notification(v.id, "Your progressive stack has expired!")
g.db.add(v)
badge = v.has_badge(94)
if badge: g.db.delete(badge)
g.db.commit()
if v.rehab and v.rehab < time.time():
v.rehab = None
send_repeatable_notification(v.id, "Your rehab has finished!")
g.db.add(v)
badge = v.has_badge(109)
if badge: g.db.delete(badge)
g.db.commit()
if v.deflector and v.deflector < time.time():
v.deflector = None
send_repeatable_notification(v.id, "Your deflector has expired!")
g.db.add(v)
g.db.commit()
if request.headers.get("Authorization"): return {"data": [x.json for x in posts], "next_exists": next_exists}
return render_template("home.html", v=v, listing=posts, next_exists=next_exists, sort=sort, t=t, page=page, ccmode=ccmode, sub=sub, home=True)

View file

@ -31,7 +31,6 @@ def check_for_alts(current_id):
past_accs.remove(past_id)
continue
if past_id == MOM_ID or current_id == MOM_ID: break
if past_id == current_id: continue
li = [past_id, current_id]
@ -144,7 +143,8 @@ def login_post():
session["session_id"] = token_hex(49)
session["lo_user"] = account.id
session["login_nonce"] = account.login_nonce
if account.id == AEVANN_ID: session["verified"] = time.time()
if account.id == OWNER_ID:
session["verified"] = time.time()
check_for_alts(account.id)

View file

@ -129,14 +129,6 @@ def submit_get(v, sub=None):
# @app.get("/h/<sub>/post/<pid>/<anything>")
@auth_desired
def post_id(pid, anything=None, v=None, sub=None):
try: pid = int(pid)
except Exception as e: pass
try: pid = int(pid)
except: abort(404)
post = get_post(pid, v=v)
if post.over_18 and not (v and v.over_18) and session.get('over_18', 0) < int(time.time()):
@ -276,8 +268,6 @@ def post_id(pid, anything=None, v=None, sub=None):
@limiter.limit("1/second;30/minute;200/hour;1000/day")
@auth_desired
def viewmore(v, pid, sort, offset):
try: pid = int(pid)
except: abort(400)
post = get_post(pid, v=v)
if post.club and not (v and (v.paid_dues or v.id == post.author_id)): abort(403)
@ -459,12 +449,6 @@ def edit_post(pid, v):
body, err = guarded_value("body", 0, MAX_BODY_LENGTH)
if err: return err
if v.id == p.author_id:
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
if title != p.title:
p.title = title
title_html = filter_emojis_only(title, edit=True)
@ -1017,17 +1001,6 @@ def submit_post(v, sub=None):
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)
if v.id == PIZZASHILL_ID:
for uid in PIZZA_VOTERS:
autovote = Vote(user_id=uid, submission_id=post.id, vote_type=1)
g.db.add(autovote)
v.coins += 3
v.truecoins += 3
g.db.add(v)
post.upvotes += 3
g.db.add(post)
g.db.commit()
cache.delete_memoized(frontlist)

View file

@ -70,7 +70,7 @@ def searchposts(v):
posts = posts.filter(Submission.ghost == False)
author = get_user(criteria['author'])
if not author: return {"error": "User not found"}
if author.is_private and (not v or (author.id != v.id and v.admin_level < 2 and not v.eye)):
if author.is_private and (not v or (author.id != v.id and v.admin_level < 2)):
if request.headers.get("Authorization"):
return {"error": f"@{author.username}'s profile is private; You can't use the 'author' syntax on them"}
return render_template("search.html",
@ -196,7 +196,7 @@ def searchcomments(v):
comments = comments.filter(Comment.ghost == False)
author = get_user(criteria['author'])
if not author: return {"error": "User not found"}
if author.is_private and (not v or (author.id != v.id and v.admin_level < 2 and not v.eye)):
if author.is_private and (not v or (author.id != v.id and v.admin_level < 2)):
if request.headers.get("Authorization"):
return {"error": f"@{author.username}'s profile is private; You can't use the 'author' syntax on them"}

View file

@ -78,10 +78,6 @@ def settings_profile_post(v):
updated = True
v.controversial = request.values.get("controversial") == 'true'
elif request.values.get("sigs_disabled", v.sigs_disabled) != v.sigs_disabled:
updated = True
v.sigs_disabled = request.values.get("sigs_disabled") == 'true'
elif request.values.get("over18", v.over_18) != v.over_18:
updated = True
v.over_18 = request.values.get("over18") == 'true'
@ -101,13 +97,6 @@ def settings_profile_post(v):
g.db.commit()
return render_template("settings_profile.html", v=v, msg="Your bio has been updated.")
elif request.values.get("sig") == "":
v.sig = None
v.sig_html = None
g.db.add(v)
g.db.commit()
return render_template("settings_profile.html", v=v, msg="Your sig has been updated.")
elif request.values.get("friends") == "":
v.friends = None
v.friends_html = None
@ -122,27 +111,6 @@ def settings_profile_post(v):
g.db.commit()
return render_template("settings_profile.html", v=v, msg="Your enemies list has been updated.")
elif (v.patron or v.id == MOOSE_ID) and request.values.get("sig"):
sig = request.values.get("sig")[:200]
sig_html = sanitize(sig)
if len(sig_html) > 1000:
return render_template("settings_profile.html",
v=v,
error="Your sig is too long")
v.sig = sig[:200]
v.sig_html=sig_html
g.db.add(v)
g.db.commit()
return render_template("settings_profile.html",
v=v,
msg="Your sig has been updated.")
elif request.values.get("friends"):
friends = request.values.get("friends")[:500]
@ -293,10 +261,6 @@ def settings_profile_post(v):
if house == "None": house = None
v.house = house
if v.house == "Vampire":
send_repeatable_notification(DAD_ID, f"@{v.username} has joined House Vampire!")
updated = True
if updated:
@ -594,11 +558,6 @@ def settings_block_user(v):
if not user: return {"error": "That user doesn't exist."}, 404
if user.unblockable:
send_notification(user.id, f"@{v.username} has tried to block you and failed because of your unblockable status!")
g.db.commit()
return {"error": "This user is unblockable."}, 403
if user.id == v.id:
return {"error": "You can't block yourself."}, 409

View file

@ -9,9 +9,6 @@ from .front import frontlist
@app.post("/exile/post/<pid>")
@is_not_permabanned
def exile_post(v, pid):
try: pid = int(pid)
except: abort(400)
p = get_post(pid)
sub = p.sub
if not sub: abort(400)
@ -37,9 +34,6 @@ def exile_post(v, pid):
@app.post("/exile/comment/<cid>")
@is_not_permabanned
def exile_comment(v, cid):
try: cid = int(cid)
except: abort(400)
c = get_comment(cid)
sub = c.post.sub
if not sub: abort(400)
@ -268,9 +262,6 @@ def create_sub2(v):
@app.post("/kick/<pid>")
@is_not_permabanned
def kick(v, pid):
try: pid = int(pid)
except: abort(400)
post = get_post(pid)
if not post.sub: abort(403)

View file

@ -799,7 +799,7 @@ def u_username(username, v=None):
if request.headers.get("Authorization") or request.headers.get("xhr"): return {"error": f"That username is reserved for: {u.reserved}"}
return render_template("userpage_reserved.html", u=u, v=v)
if v and v.id not in (u.id,DAD_ID) and (u.patron or u.admin_level > 1):
if v and v.id != u.id and (u.patron or u.admin_level > 1):
view = g.db.query(ViewerRelationship).filter_by(viewer_id=v.id, user_id=u.id).one_or_none()
if view: view.last_view_utc = int(time.time())
@ -809,7 +809,7 @@ def u_username(username, v=None):
g.db.commit()
if u.is_private and (not v or (v.id != u.id and v.admin_level < 2 and not v.eye)):
if u.is_private and (not v or (v.id != u.id and v.admin_level < 2)):
if request.headers.get("Authorization") or request.headers.get("xhr"): return {"error": "That userpage is private"}
return render_template("userpage_private.html", u=u, v=v)
@ -887,7 +887,7 @@ def u_username_comments(username, v=None):
v=v)
if u.is_private and (not v or (v.id != u.id and v.admin_level < 2 and not v.eye)):
if u.is_private and (not v or (v.id != u.id and v.admin_level < 2)):
if request.headers.get("Authorization") or request.headers.get("xhr"): return {"error": "That userpage is private"}
return render_template("userpage_private.html", u=u, v=v)
@ -1011,14 +1011,8 @@ def follow_user(username, v):
@limiter.limit("1/second;30/minute;200/hour;1000/day")
@auth_required
def unfollow_user(username, v):
target = get_user(username)
if target.fish:
send_notification(target.id, f"@{v.username} has tried to unfollow you and failed because of your fish award!")
g.db.commit()
return {"error": "You can't unfollow this user!"}
follow = g.db.query(Follow).filter_by(user_id=v.id, target_id=target.id).one_or_none()
if follow:

View file

@ -19,7 +19,7 @@ def admin_vote_info_get(v):
else: abort(400)
except: abort(400)
if thing.ghost and v.id != AEVANN_ID: abort(403)
if thing.ghost and v.id != OWNER_ID: abort(403)
if not thing.author:
print(thing.id, flush=True)
@ -65,8 +65,6 @@ def api_vote_post(post_id, new, v):
new = int(new)
# get the post
try: post_id = int(post_id)
except: abort(404)
post = get_post(post_id)
# get the old vote, if we have one
@ -135,8 +133,6 @@ def api_vote_comment(comment_id, new, v):
new = int(new)
# get the comment
try: comment_id = int(comment_id)
except: abort(404)
comment = get_comment(comment_id)
# get the old vote, if we have one

View file

@ -289,7 +289,7 @@
<div id="comment-edit-{{c.id}}" class="d-none comment-write collapsed child">
<form id="comment-edit-form-{{c.id}}" action="/edit_comment/{{c.id}}" method="post" enctype="multipart/form-data">
<input type="hidden" name="formkey" value="{{v.formkey}}">
<textarea autocomplete="off" {% if v.longpost %}minlength="280"{% endif %} maxlength="{% if v.bird %}140{% else %}10000{% endif %}" oninput="markdown('comment-edit-body-{{c.id}}', 'preview-edit-{{c.id}}');charLimit('comment-edit-body-{{c.id}}','charcount-edit-{{c.id}}')" id="comment-edit-body-{{c.id}}" data-id="{{c.id}}" name="body" form="comment-edit-form-{{c.id}}" class="comment-box form-control rounded" aria-label="With textarea" placeholder="Add your comment..." rows="3">{{c.body}}</textarea>
<textarea autocomplete="off" maxlength="10000" oninput="markdown('comment-edit-body-{{c.id}}', 'preview-edit-{{c.id}}');charLimit('comment-edit-body-{{c.id}}','charcount-edit-{{c.id}}')" id="comment-edit-body-{{c.id}}" data-id="{{c.id}}" name="body" form="comment-edit-form-{{c.id}}" class="comment-box form-control rounded" aria-label="With textarea" placeholder="Add your comment..." rows="3">{{c.body}}</textarea>
<div class="text-small font-weight-bold mt-1" id="charcount-edit-{{c.id}}" style="right: 1rem; bottom: 0.5rem; z-index: 3;"></div>
@ -538,7 +538,7 @@
<input type="hidden" name="formkey" value="{{v.formkey}}">
<input type="hidden" name="parent_fullname" value="{{c.fullname}}">
<input autocomplete="off" id="reply-form-submission-{{c.fullname}}" type="hidden" name="submission" value="{{c.post.id}}">
<textarea required autocomplete="off" {% if v.longpost %}minlength="280"{% else %}minlength="1"{% endif %} maxlength="{% if v.bird %}140{% else %}10000{% endif %}" oninput="markdown('reply-form-body-{{c.fullname}}', 'reply-edit-{{c.id}}');charLimit('reply-form-body-{{c.fullname}}','charcount-{{c.id}}')" id="reply-form-body-{{c.fullname}}" data-fullname="{{c.fullname}}" name="body" form="reply-to-t3_{{c.id}}" class="comment-box form-control rounded" aria-label="With textarea" placeholder="Add your comment..." rows="3"></textarea>
<textarea required autocomplete="off" minlength="1" maxlength="10000" oninput="markdown('reply-form-body-{{c.fullname}}', 'reply-edit-{{c.id}}');charLimit('reply-form-body-{{c.fullname}}','charcount-{{c.id}}')" id="reply-form-body-{{c.fullname}}" data-fullname="{{c.fullname}}" name="body" form="reply-to-t3_{{c.id}}" class="comment-box form-control rounded" aria-label="With textarea" placeholder="Add your comment..." rows="3"></textarea>
<div class="text-small font-weight-bold mt-1" id="charcount-{{c.id}}" style="right: 1rem; bottom: 0.5rem; z-index: 3;"></div>

View file

@ -2,14 +2,6 @@
{% block desktopBanner %}
{% if v and v.id == AEVANN_ID %}
<style>
#frontpage .post-title a:not(.visited):visited {
color: var(--black) !important;
}
</style>
{% endif %}
{% if v and environ.get("FP") %}
{% if not v.fp %}
<script>

View file

@ -219,28 +219,6 @@
<div class="settings-section rounded">
<div class="d-lg-flex border-bottom">
<div class="title w-lg-25">
<label for="sigs_disabled">Disable signatures</label>
</div>
<div class="body w-lg-100">
<div class="custom-control custom-switch">
<input autocomplete="off" type="checkbox" class="custom-control-input" id="sigs_disabled" name="sigs_disabled"{% if v.sigs_disabled %} checked{% endif %} onchange="post_toast(this,'/settings/profile?sigs_disabled='+document.getElementById('sigs_disabled').checked);">
<label class="custom-control-label" for="sigs_disabled"></label>
</div>
<span class="text-small-extra text-muted">Hide user signatures.</span>
</div>
</div>
<div class="d-lg-flex border-bottom">
<div class="title w-lg-25">

View file

@ -421,35 +421,6 @@
</div>
{% if v.patron or v.id == MOOSE_ID %}
<div class="body d-lg-flex border-bottom">
<label class="text-black w-lg-25">Signature</label>
<div class="w-lg-100">
<form id="profile-sig" action="/settings/profile" method="post" enctype="multipart/form-data">
<input type="hidden" name="formkey" value="{{v.formkey}}">
<div class="input-group mb-2">
<textarea autocomplete="off" id="sig-text" class="form-control rounded" aria-label="With textarea" placeholder="Enter a signature..." rows="3" name="sig" form="profile-sig" maxlength="200">{% if v.sig %}{{v.sig}}{% endif %}</textarea>
</div>
<div class="d-flex">
<pre style="padding-top:0.7rem" class="btn btn-secondary format d-inline-block m-0 fas fa-bold" aria-hidden="true" onclick="makeBold('sig-text')" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Bold"></pre>
&nbsp;
<pre style="padding-top:0.7rem" class="btn btn-secondary format d-inline-block m-0 fas fa-italic" aria-hidden="true" onclick="makeItalics('sig-text')" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Italicize"></pre>
&nbsp;
<pre style="padding-top:0.7rem" class="btn btn-secondary format d-inline-block m-0 fas fa-quote-right" aria-hidden="true" onclick="makeQuote('sig-text')" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Quote"></pre>
&nbsp;
<pre style="padding-top:0.7rem;line-height:1" class="btn btn-secondary format d-inline-block m-0 font-weight-bolder text-uppercase" onclick="commentForm('sig-text');getGif()" aria-hidden="true" data-bs-toggle="modal" data-bs-target="#gifModal" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Add GIF">GIF</pre>
</div>
<pre></pre>
<div class="d-flex">
<small>Limit of 200 characters</small>
<input autocomplete="off" class="btn btn-primary ml-auto" id="sigSave" type="submit" value="Save Changes">
</div>
</form>
</div>
</div>
{% endif %}
<div class="d-lg-flex border-bottom">

View file

@ -292,7 +292,7 @@
<input type="hidden" name="formkey" value="{{v.formkey}}">
<input type="hidden" name="current_page" value="{{request.path}}">
<input type="text" autocomplete="off" maxlength="500" name="title" class="comment-box form-control rounded" required placeholder="title" value="{{p.title}}"\>
<textarea autocomplete="off" name="body" {% if v.longpost %}minlength="280"{% endif %} maxlength="{% if v.bird %}140{% else %}20000{% endif %}" oninput="markdown('post-edit-box-{{p.id}}', 'post-edit-{{p.id}}');charLimit('post-edit-box-{{p.id}}','charcount-post-edit')" id="post-edit-box-{{p.id}}" form="post-edit-form-{{p.id}}" class="comment-box form-control rounded" aria-label="With textarea" placeholder="Add text to your post..." rows="10" data-id="{{p.id}}">{{p.body}}</textarea>
<textarea autocomplete="off" name="body" maxlength="20000" oninput="markdown('post-edit-box-{{p.id}}', 'post-edit-{{p.id}}');charLimit('post-edit-box-{{p.id}}','charcount-post-edit')" id="post-edit-box-{{p.id}}" form="post-edit-form-{{p.id}}" class="comment-box form-control rounded" aria-label="With textarea" placeholder="Add text to your post..." rows="10" data-id="{{p.id}}">{{p.body}}</textarea>
<div class="text-small font-weight-bold mt-1" id="charcount-post-edit" style="right: 1rem; bottom: 0.5rem; z-index: 3;"></div>
@ -482,7 +482,7 @@
<input type="hidden" name="formkey" value="{{v.formkey}}">
<input type="hidden" name="parent_fullname" value="t2_{{p.id}}">
<input autocomplete="off" id="reply-form-submission-{{p.fullname}}" type="hidden" name="submission" value="{{p.id}}">
<textarea required autocomplete="off" {% if not (p and p.id in ADMINISTRATORS) %}{% if v.longpost %}minlength="280"{% elif v.bird %}maxlength="140"{% endif %}{% endif %} minlength="1" maxlength="10000" oninput="markdown('reply-form-body-{{p.fullname}}', 'form-preview-{{p.id}}');charLimit('reply-form-body-{{p.fullname}}','charcount-reply')" id="reply-form-body-{{p.fullname}}" data-fullname="{{p.fullname}}" class="comment-box form-control rounded" id="comment-form" name="body" form="reply-to-{{p.fullname}}" aria-label="With textarea" placeholder="Add your comment..." rows="3"></textarea>
<textarea required autocomplete="off" minlength="1" maxlength="10000" oninput="markdown('reply-form-body-{{p.fullname}}', 'form-preview-{{p.id}}');charLimit('reply-form-body-{{p.fullname}}','charcount-reply')" id="reply-form-body-{{p.fullname}}" data-fullname="{{p.fullname}}" class="comment-box form-control rounded" id="comment-form" name="body" form="reply-to-{{p.fullname}}" aria-label="With textarea" placeholder="Add your comment..." rows="3"></textarea>
<div class="text-small font-weight-bold mt-1" id="charcount-reply" style="right: 1rem; bottom: 0.5rem; z-index: 3;"></div>

View file

@ -147,7 +147,7 @@
<div class="post-meta text-left mb-md-2">
<h5 class="card-title post-title text-left 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 %}">
<a id="{{p.id}}-title" {% if v and v.newtab and not g.webview %}target="_blank"{% endif %} href="{{p.permalink}}">
{% 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 %}
{{p.realtitle(v) | safe}}

View file

@ -82,7 +82,7 @@
<label for="body" class="mt-3">Text<i class="fas fa-info-circle text-gray-400 ml-1" data-bs-toggle="tooltip" data-bs-placement="top" title="Uses markdown. Limited to 20000 characters."></i></label>
<div>
<textarea form="submitform" id="post-text" class="form-control rounded" aria-label="With textarea" placeholder="Optional if you have a link or an image." rows="7" name="body" oninput="markdown('post-text','preview');charLimit('post-text','character-count-submit-text-form');checkForRequired();savetext()" {% if v.longpost %}minlength="280"{% endif %} maxlength="{% if v.bird %}140{% else %}20000{% endif %}" required></textarea>
<textarea form="submitform" id="post-text" class="form-control rounded" aria-label="With textarea" placeholder="Optional if you have a link or an image." rows="7" name="body" oninput="markdown('post-text','preview');charLimit('post-text','character-count-submit-text-form');checkForRequired();savetext()" maxlength="20000" required></textarea>
<div class="btn btn-secondary fl-r mt-3" onclick="document.getElementById('preview').classList.toggle('d-none');">
Toggle preview

View file

@ -190,7 +190,7 @@
<a href="/views" class="btn btn-secondary">Profile views</a>
{% endif %}
{% if u.song and v and (v.id == u.id or v.mute and not u.unmutable) %}
{% if u.song and v and (v.id == u.id) %}
<a class="btn btn-secondary" role="button" onclick="toggle()">Toggle anthem</a>
{% endif %}
@ -271,7 +271,7 @@
{% if u.is_private %}
<p>User has private mode enabled.</p>
{% endif %}
{% if v and (v.admin_level > 1 or v.alt) %}
{% if v and v.admin_level >= 2 %}
<span>Alts:</span>
<ul>
{% for account in u.alts_unique %}
@ -416,7 +416,7 @@
<a href="/views" class="btn btn-secondary">Profile views</a>
{% endif %}
{% if u.song and v and (v.id == u.id or v.mute and not u.unmutable) %}
{% if u.song and v and (v.id == u.id) %}
<a class="btn btn-secondary" role="button" onclick="toggle()">Toggle anthem</a>
{% endif %}
@ -532,7 +532,7 @@
{% if u.is_private %}
<p>User has private mode enabled.</p>
{% endif %}
{% if v and (v.admin_level > 1 or v.alt) %}
{% if v and v.admin_level >= 2 %}
<span>Alts:</span>
<ul>
{% for account in u.alts_unique %}

View file

@ -0,0 +1,32 @@
"""remove signatures feature
Revision ID: 61c6f838c5c6
Revises: 44a40481ca2b
Create Date: 2022-11-06 22:06:07.735203+00:00
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '61c6f838c5c6'
down_revision = '44a40481ca2b'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('users', 'sigs_disabled')
op.drop_column('users', 'sig_html')
op.drop_column('users', 'sig')
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('users', sa.Column('sig', sa.VARCHAR(length=200), autoincrement=False, nullable=True))
op.add_column('users', sa.Column('sig_html', sa.VARCHAR(length=1000), autoincrement=False, nullable=True))
op.add_column('users', sa.Column('sigs_disabled', sa.BOOLEAN(), autoincrement=False, nullable=True))
# ### end Alembic commands ###

View file

@ -0,0 +1,50 @@
"""remove many user award tracking columns
Revision ID: 0d4c7cf3da6d
Revises: 61c6f838c5c6
Create Date: 2022-11-07 08:04:52.285019+00:00
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '0d4c7cf3da6d'
down_revision = '61c6f838c5c6'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('users', 'alt')
op.drop_column('users', 'unblockable')
op.drop_column('users', 'deflector')
op.drop_column('users', 'bird')
op.drop_column('users', 'rehab')
op.drop_column('users', 'fish')
op.drop_column('users', 'mute')
op.drop_column('users', 'eye')
op.drop_column('users', 'longpost')
op.drop_column('users', 'marseyawarded')
op.drop_column('users', 'progressivestack')
op.drop_column('users', 'unmutable')
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('users', sa.Column('unmutable', sa.BOOLEAN(), autoincrement=False, nullable=True))
op.add_column('users', sa.Column('progressivestack', sa.INTEGER(), autoincrement=False, nullable=True))
op.add_column('users', sa.Column('marseyawarded', sa.INTEGER(), autoincrement=False, nullable=True))
op.add_column('users', sa.Column('longpost', sa.INTEGER(), autoincrement=False, nullable=True))
op.add_column('users', sa.Column('eye', sa.BOOLEAN(), autoincrement=False, nullable=True))
op.add_column('users', sa.Column('mute', sa.BOOLEAN(), autoincrement=False, nullable=True))
op.add_column('users', sa.Column('fish', sa.BOOLEAN(), autoincrement=False, nullable=True))
op.add_column('users', sa.Column('rehab', sa.INTEGER(), autoincrement=False, nullable=True))
op.add_column('users', sa.Column('bird', sa.INTEGER(), autoincrement=False, nullable=True))
op.add_column('users', sa.Column('deflector', sa.INTEGER(), autoincrement=False, nullable=True))
op.add_column('users', sa.Column('unblockable', sa.BOOLEAN(), autoincrement=False, nullable=True))
op.add_column('users', sa.Column('alt', sa.BOOLEAN(), autoincrement=False, nullable=True))
# ### end Alembic commands ###