diff --git a/files/routes/comments.py b/files/routes/comments.py index 028d66e50c..5de8f09623 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -154,6 +154,10 @@ def api_comment(v): body = request.values.get("body", "").strip()[:10000] + if v.admin_level == 3 and parent_post.id == 37749: + with open(f"snappy_{SITE_NAME}.txt", "a") as f: + f.write('\n{[para]}\n' + body) + if v.marseyawarded: marregex = list(re.finditer("^(:[!#]{0,2}m\w+:\s*)+$", body)) if len(marregex) == 0: return {"error":"You can only type marseys!"}, 403 diff --git a/files/routes/posts.py b/files/routes/posts.py index 6ebf90a5b2..964c3c0389 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -23,11 +23,6 @@ CF_KEY = environ.get("CF_KEY", "").strip() CF_ZONE = environ.get("CF_ZONE", "").strip() CF_HEADERS = {"Authorization": f"Bearer {CF_KEY}", "Content-Type": "application/json"} -if path.exists(f'snappy_{SITE_NAME}.txt'): - with open(f'snappy_{SITE_NAME}.txt', "r") as f: - if SITE == 'pcmemes.net': snappyquotes = f.read().split("{[para]}") - else: snappyquotes = f.read().split("{[para]}") + [f':#{x}:' for x in marseys] - @app.post("/toggle_club/") @auth_required def toggle_club(pid, v): @@ -658,7 +653,6 @@ def submit_post(v): if request.content_length > 8 * 1024 * 1024: return {"error": "Max file size is 8 MB."}, 413 elif request.content_length > 4 * 1024 * 1024: return {"error": "Max file size is 4 MB."}, 413 - title = request.values.get("title", "").strip()[:500].replace('‎','') url = request.values.get("url", "").strip() @@ -1002,7 +996,11 @@ def submit_post(v): elif v.id == LAWLZ_ID: if random.random() < 0.5: body = "wow, this lawlzpost sucks!" else: body = "wow, a good lawlzpost for once!" - else: body = random.choice(snappyquotes) + elif path.exists(f'snappy_{SITE_NAME}.txt'): + with open(f'snappy_{SITE_NAME}.txt', "r") as f: + if request.host == 'pcmemes.net': snappyquotes = f.read().split("{[para]}") + else: snappyquotes = f.read().split("{[para]}") + [f':#{x}:' for x in marseys] + body = random.choice(snappyquotes) body += "\n\n" if new_post.url: