From c2748736fe29a6b406b8e5e3a31343af39962128 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sat, 5 Feb 2022 20:47:21 +0200 Subject: [PATCH] fsd --- docker-compose.yml | 2 +- files/helpers/const.py | 2 +- files/helpers/jinja2.py | 2 +- files/helpers/sanitize.py | 2 ++ files/routes/front.py | 2 -- files/routes/posts.py | 2 ++ files/templates/header.html | 15 +++++++++++++-- files/templates/sidebar_2Much4You.html | 0 files/templates/submission.html | 3 +++ files/templates/submission_listing.html | 3 +++ files/templates/submit.html | 18 +++++++++++++++++- 11 files changed, 43 insertions(+), 8 deletions(-) create mode 100644 files/templates/sidebar_2Much4You.html diff --git a/docker-compose.yml b/docker-compose.yml index 7cab26997..c7eafd145 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -11,7 +11,7 @@ services: - MASTER_KEY=3435tdfsdudebussylmaoxxt43 - REDIS_URL=redis://redis - DOMAIN=localhost - - SITE_NAME=Drama + - SITE_NAME=2Much4You - GIPHY_KEY=3435tdfsdudebussylmaoxxt43 - DISCORD_SERVER_ID=3435tdfsdudebussylmaoxxt43 - DISCORD_CLIENT_ID=3435tdfsdudebussylmaoxxt43 diff --git a/files/helpers/const.py b/files/helpers/const.py index 6b4577a36..46ac335aa 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -566,5 +566,5 @@ FORTUNE_REPLIES = ('Your fortune: Allah Wills It',' no_pass_phrase = """

Sorry whiteboy, we're gonna need to see some ID before you start throwin that word around like it's nothing.\n\nTake a 10 minute time-out and come back when you've learned your lesson and/or paid reparations (by purchasing a BIPOC Approved™ Rdrama NWord Pass© from the shop) \n\nThis is an automated message; if you need help, you can message us here.

""" -if SITE == '2much4u.net': subs = ('2balkan4you','2middleeast4you') +if True: subs = ('2balkan4you','2middleeast4you','2asia4you','2visegrad4you') else: subs = () \ No newline at end of file diff --git a/files/helpers/jinja2.py b/files/helpers/jinja2.py index 7b4e1409f..140c71f0a 100644 --- a/files/helpers/jinja2.py +++ b/files/helpers/jinja2.py @@ -16,4 +16,4 @@ def post_embed(id, v): @app.context_processor def inject_constants(): - return {"environ":environ, "SITE_NAME":SITE_NAME, "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, "config":app.config.get, "DEFAULT_COLOR":DEFAULT_COLOR, "COLORS":COLORS} + return {"environ":environ, "SITE_NAME":SITE_NAME, "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, "config":app.config.get, "DEFAULT_COLOR":DEFAULT_COLOR, "COLORS":COLORS, "subs":subs} diff --git a/files/helpers/sanitize.py b/files/helpers/sanitize.py index 550ccb063..700bd720b 100644 --- a/files/helpers/sanitize.py +++ b/files/helpers/sanitize.py @@ -112,6 +112,8 @@ def sanitize(sanitized, noimages=False, alert=False, comment=False, edit=False): else: sanitized = re.sub('(^|\s|\n|

)\/?((r|u)\/(\w|-){3,25})', r'\1\2', sanitized, re.A) + sanitized = re.sub('(^|\s|\n|

)\/?(s\/(\w|-){3,25})', r'\1\2', sanitized, re.A) + for i in re.finditer('(^|\s|\n|

)@((\w|-){1,25})', sanitized, re.A): u = get_user(i.group(2), graceful=True) diff --git a/files/routes/front.py b/files/routes/front.py index e774df199..f11447f15 100644 --- a/files/routes/front.py +++ b/files/routes/front.py @@ -257,7 +257,6 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, ccmode="false" posts = g.db.query(Submission) if sub: posts = posts.filter_by(sub=sub) - else: posts = posts.filter_by(sub=None) if t == 'all': cutoff = 0 else: @@ -328,7 +327,6 @@ def frontlist(v=None, sort="hot", page=1, t="all", ids_only=True, ccmode="false" if (sort == "hot" or (v and v.id == Q_ID)) and page == 1 and ccmode == "false": pins = g.db.query(Submission).filter(Submission.stickied != None, Submission.is_banned == False) if sub: pins = pins.filter_by(sub=sub) - else: pins = pins.filter_by(sub=None) if v and v.admin_level == 0: blocking = [x[0] for x in g.db.query(UserBlock.target_id).filter_by(user_id=v.id).all()] blocked = [x[0] for x in g.db.query(UserBlock.user_id).filter_by(target_id=v.id).all()] diff --git a/files/routes/posts.py b/files/routes/posts.py index 685ed2e88..fac90656f 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -760,7 +760,9 @@ def thumbnail_thread(pid): @limiter.limit("1/second;6/minute;200/hour;1000/day") @auth_required def submit_post(v, sub=None): + if not sub: sub = request.values.get("sub") if sub and sub not in subs: sub = None + if v.is_suspended: return {"error": "You can't perform this action while banned."}, 403 if v and v.patron: diff --git a/files/templates/header.html b/files/templates/header.html index 2c2da8d45..473d968fd 100644 --- a/files/templates/header.html +++ b/files/templates/header.html @@ -7,6 +7,15 @@

💖🌈 welcome to rdrama.net: the official site for r/subredditdrama
+ {% elif SITE_NAME == '2Much4You' %} + +
+ {% for s in subs %} + /s/{{s}} + {% endfor %} +
{% else %}