- {% if home %}
+ {% if home or sub and (request.path.startswith('/post') or request.path.startswith('/comment')) %}
{% block sidebar %}
{% include "sidebar_" + SITE_NAME + ".html" %}
{% endblock %}
diff --git a/files/templates/header.html b/files/templates/header.html
index 499d172619..c57569f2ad 100644
--- a/files/templates/header.html
+++ b/files/templates/header.html
@@ -35,7 +35,7 @@
{% set icon = ('marseyblm','marseykween','marseydynamite','marseyblack','marseymyeisha','marseyetika','marseyobama','marseyblackcop','marseysosa','marseyblackface')|random() %}
{% else %}
-
+
{% endif %}
{% if SITE_NAME == 'Drama' %}
diff --git a/files/templates/sub/settings.html b/files/templates/sub/settings.html
index ec617343ae..749a5c0b78 100644
--- a/files/templates/sub/settings.html
+++ b/files/templates/sub/settings.html
@@ -57,7 +57,7 @@
-
+
diff --git a/files/templates/submission_listing.html b/files/templates/submission_listing.html
index 4de2d3f5be..541848e906 100644
--- a/files/templates/submission_listing.html
+++ b/files/templates/submission_listing.html
@@ -296,7 +296,7 @@
{% if p.sub and v.mods(p.sub) %}
- Kick
+ Kick
{% endif %}
From 70c06e26eb2c4631ee52ae2f1f19220c990d3032 Mon Sep 17 00:00:00 2001
From: Aevann1
Date: Fri, 11 Feb 2022 17:06:19 +0200
Subject: [PATCH 4/5] vxc
---
files/routes/posts.py | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/files/routes/posts.py b/files/routes/posts.py
index 1776a8622a..150fa8377c 100644
--- a/files/routes/posts.py
+++ b/files/routes/posts.py
@@ -724,7 +724,10 @@ def thumbnail_thread(pid):
for t in ("submission","comment"):
word = random.choice(('rdrama','marsey'))
- for i in requests.get(f'https://api.pushshift.io/reddit/{t}/search?html_decode=true&q={word}&size=1').json()["data"]:
+ try: data = requests.get(f'https://api.pushshift.io/reddit/{t}/search?html_decode=true&q={word}&size=1').json()["data"]
+ except: break
+
+ for i in data:
body_html = sanitize(f'New {word} mention: https://old.reddit.com{i["permalink"]}?context=89', noimages=True)
@@ -769,8 +772,11 @@ def thumbnail_thread(pid):
if SITE == 'pcmemes.net':
for t in ("submission","comment"):
- for i in requests.get(f'https://api.pushshift.io/reddit/{t}/search?html_decode=true&q=pcmemes.net&size=1').json()["data"]:
+ try: data = requests.get(f'https://api.pushshift.io/reddit/{t}/search?html_decode=true&q=pcmemes.net&size=1').json()["data"]
+ except: break
+
+ for i in data:
body_html = sanitize(f'New pcmemes mention: https://old.reddit.com{i["permalink"]}?context=89', noimages=True)
existing_comment = db.query(Comment.id).filter_by(author_id=NOTIFICATIONS_ID, parent_submission=None, distinguish_level=6, body_html=body_html, level=1, sentto=0).first()
From cdfa8384be66d026f10037068ea8c9a9d9af898d Mon Sep 17 00:00:00 2001
From: Aevann1
Date: Fri, 11 Feb 2022 18:21:48 +0200
Subject: [PATCH 5/5] xvc
---
files/routes/posts.py | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/files/routes/posts.py b/files/routes/posts.py
index 150fa8377c..5540a45e23 100644
--- a/files/routes/posts.py
+++ b/files/routes/posts.py
@@ -95,7 +95,7 @@ def submit_get(v, sub=None):
if request.path.startswith('/s/') and not sub: abort(404)
- return render_template("submit.html", SUBS=() if SITE_NAME == 'Drama' else tuple(x[0] for x in g.db.query(Sub.name).all()), v=v, sub=sub)
+ return render_template("submit.html", SUBS=() if SITE_NAME == 'Drama' else tuple(x[0] for x in g.db.query(Sub.name).order_by(Sub.name).all()), v=v, sub=sub)
@app.get("/post/")
@app.get("/post//")
@@ -888,7 +888,7 @@ def submit_post(v, sub=None):
if domain_obj:
reason = f"Remove the {domain_obj.domain} link from your post and try again. {domain_obj.reason}"
if request.headers.get("Authorization") or request.headers.get("xhr"): return {"error":reason}, 400
- return render_template("submit.html", SUBS=() if SITE_NAME == 'Drama' else tuple(x[0] for x in g.db.query(Sub.name).all()), v=v, error=reason, title=title, url=url, body=request.values.get("body", "")), 400
+ return render_template("submit.html", SUBS=() if SITE_NAME == 'Drama' else tuple(x[0] for x in g.db.query(Sub.name).order_by(Sub.name).all()), v=v, error=reason, title=title, url=url, body=request.values.get("body", "")), 400
elif "twitter.com" == domain:
try: embed = requests.get("https://publish.twitter.com/oembed", timeout=5, params={"url":url, "omit_script":"t"}).json()["html"]
except: embed = None
@@ -910,16 +910,16 @@ def submit_post(v, sub=None):
if not url and not request.values.get("body") and not request.files.get("file", None):
if request.headers.get("Authorization") or request.headers.get("xhr"): return {"error": "`url` or `body` parameter required."}, 400
- return render_template("submit.html", SUBS=() if SITE_NAME == 'Drama' else tuple(x[0] for x in g.db.query(Sub.name).all()), v=v, error="Please enter a url or some text.", title=title, url=url, body=request.values.get("body", "")), 400
+ return render_template("submit.html", SUBS=() if SITE_NAME == 'Drama' else tuple(x[0] for x in g.db.query(Sub.name).order_by(Sub.name).all()), v=v, error="Please enter a url or some text.", title=title, url=url, body=request.values.get("body", "")), 400
if not title:
if request.headers.get("Authorization") or request.headers.get("xhr"): return {"error": "Please enter a better title"}, 400
- return render_template("submit.html", SUBS=() if SITE_NAME == 'Drama' else tuple(x[0] for x in g.db.query(Sub.name).all()), v=v, error="Please enter a better title.", title=title, url=url, body=request.values.get("body", "")), 400
+ return render_template("submit.html", SUBS=() if SITE_NAME == 'Drama' else tuple(x[0] for x in g.db.query(Sub.name).order_by(Sub.name).all()), v=v, error="Please enter a better title.", title=title, url=url, body=request.values.get("body", "")), 400
elif len(title) > 500:
if request.headers.get("Authorization") or request.headers.get("xhr"): return {"error": "500 character limit for titles"}, 400
- else: render_template("submit.html", SUBS=() if SITE_NAME == 'Drama' else tuple(x[0] for x in g.db.query(Sub.name).all()), v=v, error="500 character limit for titles.", title=title[:500], url=url, body=request.values.get("body", "")), 400
+ else: render_template("submit.html", SUBS=() if SITE_NAME == 'Drama' else tuple(x[0] for x in g.db.query(Sub.name).order_by(Sub.name).all()), v=v, error="500 character limit for titles.", title=title[:500], url=url, body=request.values.get("body", "")), 400
if v.marseyawarded:
marregex = list(re.finditer("^(:[!#]{0,2}m\w+:\s*)+$", title, re.A))
@@ -988,12 +988,12 @@ def submit_post(v, sub=None):
if len(str(body)) > 20000:
if request.headers.get("Authorization") or request.headers.get("xhr"): return {"error":"There's a 20000 character limit for text body."}, 400
- return render_template("submit.html", SUBS=() if SITE_NAME == 'Drama' else tuple(x[0] for x in g.db.query(Sub.name).all()), v=v, error="There's a 20000 character limit for text body.", title=title, url=url, body=request.values.get("body", "")), 400
+ return render_template("submit.html", SUBS=() if SITE_NAME == 'Drama' else tuple(x[0] for x in g.db.query(Sub.name).order_by(Sub.name).all()), v=v, error="There's a 20000 character limit for text body.", title=title, url=url, body=request.values.get("body", "")), 400
if len(url) > 2048:
if request.headers.get("Authorization") or request.headers.get("xhr"): return {"error":"2048 character limit for URLs."}, 400
- return render_template("submit.html", SUBS=() if SITE_NAME == 'Drama' else tuple(x[0] for x in g.db.query(Sub.name).all()), v=v, error="2048 character limit for URLs.", title=title, url=url,body=request.values.get("body", "")), 400
+ return render_template("submit.html", SUBS=() if SITE_NAME == 'Drama' else tuple(x[0] for x in g.db.query(Sub.name).order_by(Sub.name).all()), v=v, error="2048 character limit for URLs.", title=title, url=url,body=request.values.get("body", "")), 400
for i in re.finditer('^(https:\/\/.*\.(png|jpg|jpeg|gif|webp|PNG|JPG|JPEG|GIF|WEBP|9999)($|\s|\n))', body, re.M|re.A):
if "wikipedia" not in i.group(1): body = body.replace(i.group(1), f'![]({i.group(1)})')
@@ -1031,7 +1031,7 @@ def submit_post(v, sub=None):
body += f"\n\n{url}"
else:
if request.headers.get("Authorization") or request.headers.get("xhr"): return {"error": "Image/Video files only"}, 400
- return render_template("submit.html", SUBS=() if SITE_NAME == 'Drama' else tuple(x[0] for x in g.db.query(Sub.name).all()), v=v, error="Image/Video files only."), 400
+ return render_template("submit.html", SUBS=() if SITE_NAME == 'Drama' else tuple(x[0] for x in g.db.query(Sub.name).order_by(Sub.name).all()), v=v, error="Image/Video files only."), 400
if '#fortune' in body:
body = body.replace('#fortune', '')
@@ -1054,7 +1054,7 @@ def submit_post(v, sub=None):
reason = f"Remove the {ban.domain} link from your post and try again."
if ban.reason: reason += f" {ban.reason}"
if request.headers.get("Authorization") or request.headers.get("xhr"): return {"error": reason}, 403
- return render_template("submit.html", SUBS=() if SITE_NAME == 'Drama' else tuple(x[0] for x in g.db.query(Sub.name).all()), v=v, error=reason, title=title, url=url, body=request.values.get("body", "")), 403
+ return render_template("submit.html", SUBS=() if SITE_NAME == 'Drama' else tuple(x[0] for x in g.db.query(Sub.name).order_by(Sub.name).all()), v=v, error=reason, title=title, url=url, body=request.values.get("body", "")), 403
if v.club_allowed == False: club = False
else: club = bool(request.values.get("club",""))
@@ -1140,7 +1140,7 @@ def submit_post(v, sub=None):
new_post.url = url
else:
if request.headers.get("Authorization") or request.headers.get("xhr"): return {"error": "File type not allowed"}, 400
- return render_template("submit.html", SUBS=() if SITE_NAME == 'Drama' else tuple(x[0] for x in g.db.query(Sub.name).all()), v=v, error="File type not allowed.", title=title, body=request.values.get("body", "")), 400
+ return render_template("submit.html", SUBS=() if SITE_NAME == 'Drama' else tuple(x[0] for x in g.db.query(Sub.name).order_by(Sub.name).all()), v=v, error="File type not allowed.", title=title, body=request.values.get("body", "")), 400
if not new_post.thumburl and new_post.url: