diff --git a/files/__main__.py b/files/__main__.py index 03ec28833e..298625f508 100644 --- a/files/__main__.py +++ b/files/__main__.py @@ -21,6 +21,7 @@ app = Flask(__name__, template_folder='templates') app.url_map.strict_slashes = False app.jinja_env.cache = {} app.jinja_env.auto_reload = True +app.jinja_env.add_extension('jinja2.ext.do') faulthandler.enable() app.config['SECRET_KEY'] = environ.get('MASTER_KEY') diff --git a/files/helpers/actions.py b/files/helpers/actions.py index fc33347ba2..f22c513ceb 100644 --- a/files/helpers/actions.py +++ b/files/helpers/actions.py @@ -7,13 +7,6 @@ from files.helpers.sanitize import * import random from urllib.parse import quote -if SITE_NAME == 'PCM': snappyquotes = [] -else: snappyquotes = [f':#{x}:' for x in marseys_const2] - -if path.exists(f'snappy_{SITE_NAME}.txt'): - with open(f'snappy_{SITE_NAME}.txt', "r", encoding="utf-8") as f: - snappyquotes += f.read().split("\n{[para]}\n") - def badge_grant(user, badge_id, description=None, url=None): assert user != None if user.has_badge(badge_id): @@ -49,8 +42,10 @@ def execute_snappy(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!" + elif len(SNAPPY_QUOTES) == 0: + body = "" else: - body = random.choice(snappyquotes).strip() + body = random.choice(SNAPPY_QUOTES).strip() if body.startswith('▼'): body = body[1:] vote = Vote(user_id=SNAPPY_ID, @@ -122,9 +117,11 @@ def execute_snappy(post, v): gevent.spawn(archiveorg, href) body = body.strip() - body_html = sanitize(body) + if len(body_html) == 0: + return + if len(body_html) < 40000: c = Comment(author_id=SNAPPY_ID, distinguish_level=6, @@ -156,4 +153,4 @@ def execute_snappy(post, v): c.top_comment_id = c.id post.comment_count += 1 - post.replies = [c] \ No newline at end of file + post.replies = [c] diff --git a/files/helpers/const.py b/files/helpers/const.py index 2ee72c36a1..b22e1556ba 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -139,12 +139,6 @@ AGENDAPOSTER_MSG_HTML = """

Hi diff --git a/files/templates/sidebar_LGBDropTheT.html b/files/templates/sidebar_LGBDropTheT.html index ac939592d4..d32c12d1de 100644 --- a/files/templates/sidebar_LGBDropTheT.html +++ b/files/templates/sidebar_LGBDropTheT.html @@ -29,6 +29,10 @@ {% endif %} {{HOLE_NAME|upper}} MODS {% endif %} + + DIRECTORY + Resources | Site Help | Megathreads +