make marsify not count towards /marseys

master
Aevann1 2022-09-05 10:49:34 +02:00
parent e2c7e2939f
commit 959e08bb83
3 changed files with 6 additions and 6 deletions

View File

@ -193,7 +193,7 @@ def with_sigalrm_timeout(timeout: int):
@with_sigalrm_timeout(2) @with_sigalrm_timeout(2)
def sanitize(sanitized, edit=False, limit_pings=0, showmore=True): def sanitize(sanitized, edit=False, limit_pings=0, showmore=True, marsified=False):
sanitized = sanitized.strip() sanitized = sanitized.strip()
sanitized = normalize_url(sanitized) sanitized = normalize_url(sanitized)
@ -322,7 +322,7 @@ def sanitize(sanitized, edit=False, limit_pings=0, showmore=True):
sanitized = video_sub_regex.sub(r'\1<video controls preload="metadata"><source src="\2"></video>', sanitized) sanitized = video_sub_regex.sub(r'\1<video controls preload="metadata"><source src="\2"></video>', sanitized)
sanitized = audio_sub_regex.sub(r'\1<audio controls preload="metadata" src="\2"></audio>', sanitized) sanitized = audio_sub_regex.sub(r'\1<audio controls preload="metadata" src="\2"></audio>', sanitized)
if not edit: if not edit and not marsified:
for marsey in g.db.query(Marsey).filter(Marsey.name.in_(marseys_used)).all(): for marsey in g.db.query(Marsey).filter(Marsey.name.in_(marseys_used)).all():
marsey.count += 1 marsey.count += 1
g.db.add(marsey) g.db.add(marsey)

View File

@ -360,7 +360,7 @@ def award_thing(v, thing_type, id):
body = thing.body body = thing.body
body = owoify(body) body = owoify(body)
if author.marsify: body = marsify(body) if author.marsify: body = marsify(body)
thing.body_html = sanitize(body, limit_pings=5) thing.body_html = sanitize(body, limit_pings=5, marsified=True)
g.db.add(thing) g.db.add(thing)
elif ("Femboy" in kind and kind == v.house) or kind == 'marsify': elif ("Femboy" in kind and kind == v.house) or kind == 'marsify':
if author.marsify: author.marsify += 21600 if author.marsify: author.marsify += 21600
@ -370,7 +370,7 @@ def award_thing(v, thing_type, id):
body = thing.body body = thing.body
if author.owoify: body = owoify(body) if author.owoify: body = owoify(body)
body = marsify(body) body = marsify(body)
thing.body_html = sanitize(body, limit_pings=5) thing.body_html = sanitize(body, limit_pings=5, marsified=True)
g.db.add(thing) g.db.add(thing)
if author.received_award_count: author.received_award_count += 1 if author.received_award_count: author.received_award_count += 1

View File

@ -341,7 +341,7 @@ def comment(v):
if v.marsify: if v.marsify:
body_for_sanitize = marsify(body_for_sanitize) body_for_sanitize = marsify(body_for_sanitize)
body_html = sanitize(body_for_sanitize, limit_pings=5) body_html = sanitize(body_for_sanitize, limit_pings=5, marsified=True)
if parent_post.id not in ADMIGGERS and '!wordle' not in body.lower() and AGENDAPOSTER_PHRASE not in body.lower(): if parent_post.id not in ADMIGGERS and '!wordle' not in body.lower() and AGENDAPOSTER_PHRASE not in body.lower():
@ -772,7 +772,7 @@ def edit_comment(cid, v):
if v.marsify: if v.marsify:
body_for_sanitize = marsify(body_for_sanitize) body_for_sanitize = marsify(body_for_sanitize)
body_html = sanitize(body_for_sanitize, edit=True, limit_pings=5) body_html = sanitize(body_for_sanitize, edit=True, limit_pings=5, marsified=True)
if len(body_html) > 20000: abort(400) if len(body_html) > 20000: abort(400)