From 0b8abce4091a9e8956315419a958ad9e5951c058 Mon Sep 17 00:00:00 2001 From: beese_buck <16601315+cant-be-blenk@users.noreply.github.com> Date: Tue, 18 Jan 2022 21:27:32 -0800 Subject: [PATCH 1/8] make seals gooder I think --- files/templates/submission.html | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/files/templates/submission.html b/files/templates/submission.html index f607afe24d..a8228c8b2e 100644 --- a/files/templates/submission.html +++ b/files/templates/submission.html @@ -34,12 +34,16 @@ } } - @keyframes wholesome1 { - 0% {top:0%; left: 50%;} - 25% {top:50%; left:98%;} - 50% {top:98%; left: 50%} - 75% {top:50%; left:0%;} - 100% {top:0%; left: 50%;} + @keyframes moveX { + from { left: 0; } to { left: 98%; } + } + + @keyframes moveY { + from { top: 0; } to { top: 98%; } + } + + .seal { + animation: moveX 4s linear 0s infinite alternate, moveY 6.8s linear 0s infinite alternate !important; } .seal { @@ -48,13 +52,6 @@ pointer-events: none; width: 100% !important; height: 100% !important; - animation-duration: 10s !important; - animation-iteration-count: infinite !important; - animation-fill-mode: forwards !important; - animation-timing-function: linear !important; - } - .seal1 { - animation-name: wholesome1 !important; }
From aa375fbc5171cd835a82435ce5bcbaeb2eb358db Mon Sep 17 00:00:00 2001 From: beese_buck <16601315+cant-be-blenk@users.noreply.github.com> Date: Tue, 18 Jan 2022 21:40:09 -0800 Subject: [PATCH 2/8] many seals (possibly invading ur beach) --- files/templates/submission.html | 49 +++++++++++---------------------- 1 file changed, 16 insertions(+), 33 deletions(-) diff --git a/files/templates/submission.html b/files/templates/submission.html index a8228c8b2e..47b5931f10 100644 --- a/files/templates/submission.html +++ b/files/templates/submission.html @@ -34,6 +34,14 @@ } } + .seal { + position:fixed; + z-index:9999; + pointer-events: none; + width: 100% !important; + height: 100% !important; + } + @keyframes moveX { from { left: 0; } to { left: 98%; } } @@ -42,16 +50,9 @@ from { top: 0; } to { top: 98%; } } - .seal { + .seal1 { animation: moveX 4s linear 0s infinite alternate, moveY 6.8s linear 0s infinite alternate !important; - } - - .seal { - position:fixed; - z-index:9999; - pointer-events: none; - width: 100% !important; - height: 100% !important; + animation-delay:0s; }
@@ -61,15 +62,9 @@ {% if p.award_count("wholesome") > 1 %}
@@ -79,15 +74,9 @@ {% if p.award_count("wholesome") > 2 %}
@@ -97,15 +86,9 @@ {% if p.award_count("wholesome") > 3 %}
From 3cb523625f8025ba76908e69745ed6b5d98f637b Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Wed, 19 Jan 2022 10:14:33 +0200 Subject: [PATCH 3/8] fds --- files/routes/users.py | 63 ++++++++++---------------------- files/templates/leaderboard.html | 8 ++-- 2 files changed, 23 insertions(+), 48 deletions(-) diff --git a/files/routes/users.py b/files/routes/users.py index 70d0cb6e1d..4bb1be7e8b 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -16,7 +16,7 @@ import gevent if PUSHER_ID: beams_client = PushNotifications(instance_id=PUSHER_ID, secret_key=PUSHER_KEY) def leaderboard_thread(): - global users9, userss9, users12, userss12, users13, userss13, users15, userss15 + global users9, userss9, users11, users13, userss13, users15, userss15 db = db_session() @@ -29,30 +29,6 @@ def leaderboard_thread(): users9 = sorted(users9, key=lambda x: x[1], reverse=True) userss9 = users9[:25] - - badges = db.query(Badge.user_id, func.count(Badge.user_id)).group_by(Badge.user_id).order_by(func.count(Badge.user_id).desc()).all() - badges = dict(badges) - users11 = db.query(User).filter(User.id.in_(badges.keys())).all() - users12 = [] - for user in users11: users12.append((user, badges[user.id])) - users12 = sorted(users12, key=lambda x: x[1], reverse=True) - userss12 = users12[:25] - - if SITE_NAME == 'Drama': - users13 = {} - for k, val in marseys.items(): - if val in users13: users13[val] += 1 - else: users13[val] = 1 - - users13.pop('unknown','anton-d') - users132 = db.query(User).filter(func.lower(User.username).in_(users13.keys())).all() - users133 = [] - for user in users132: - users133.append((user, users13[user.username.lower()])) - users13 = sorted(users133, key=lambda x: x[1], reverse=True) - userss13 = users13[:25] - else: userss13 = None - votes1 = db.query(Vote.user_id, func.count(Vote.user_id)).filter(Vote.vote_type==1).group_by(Vote.user_id).order_by(func.count(Vote.user_id).desc()).all() votes2 = db.query(CommentVote.user_id, func.count(CommentVote.user_id)).filter(CommentVote.vote_type==1).group_by(CommentVote.user_id).order_by(func.count(CommentVote.user_id).desc()).all() votes3 = Counter(dict(votes1)) + Counter(dict(votes2)) @@ -328,50 +304,49 @@ def leaderboard(v): users = g.db.query(User) users1 = users.order_by(User.coins.desc()).limit(25).all() - users2 = users.order_by(User.stored_subscriber_count.desc()).limit(25).all() - users3 = users.order_by(User.post_count.desc()).limit(25).all() - users4 = users.order_by(User.comment_count.desc()).limit(25).all() - users5 = users.order_by(User.received_award_count.desc()).limit(25).all() - if SITE == 'pcmemes.net': users6 = users.order_by(User.basedcount.desc()).limit(25).all() - else: users6 = None - users7 = users.order_by(User.coins_spent.desc()).limit(25).all() - users10 = users.order_by(User.truecoins.desc()).limit(25).all() - sq = g.db.query(User.id, func.rank().over(order_by=User.coins.desc()).label("rank")).subquery() pos1 = g.db.query(sq.c.id, sq.c.rank).filter(sq.c.id == v.id).limit(1).one()[1] + users2 = users.order_by(User.stored_subscriber_count.desc()).limit(25).all() sq = g.db.query(User.id, func.rank().over(order_by=User.stored_subscriber_count.desc()).label("rank")).subquery() pos2 = g.db.query(sq.c.id, sq.c.rank).filter(sq.c.id == v.id).limit(1).one()[1] + users3 = users.order_by(User.post_count.desc()).limit(25).all() sq = g.db.query(User.id, func.rank().over(order_by=User.post_count.desc()).label("rank")).subquery() pos3 = g.db.query(sq.c.id, sq.c.rank).filter(sq.c.id == v.id).limit(1).one()[1] + users4 = users.order_by(User.comment_count.desc()).limit(25).all() sq = g.db.query(User.id, func.rank().over(order_by=User.comment_count.desc()).label("rank")).subquery() pos4 = g.db.query(sq.c.id, sq.c.rank).filter(sq.c.id == v.id).limit(1).one()[1] + users5 = users.order_by(User.received_award_count.desc()).limit(25).all() sq = g.db.query(User.id, func.rank().over(order_by=User.received_award_count.desc()).label("rank")).subquery() pos5 = g.db.query(sq.c.id, sq.c.rank).filter(sq.c.id == v.id).limit(1).one()[1] if request.host == 'pcmemes.net': + users6 = users.order_by(User.basedcount.desc()).limit(25).all() sq = g.db.query(User.id, func.rank().over(order_by=User.basedcount.desc()).label("rank")).subquery() pos6 = g.db.query(sq.c.id, sq.c.rank).filter(sq.c.id == v.id).limit(1).one()[1] - else: pos6 = None - + else: + users6 = None + pos6 = None + + users7 = users.order_by(User.coins_spent.desc()).limit(25).all() sq = g.db.query(User.id, func.rank().over(order_by=User.coins_spent.desc()).label("rank")).subquery() pos7 = g.db.query(sq.c.id, sq.c.rank).filter(sq.c.id == v.id).limit(1).one()[1] - sq = g.db.query(User.id, func.rank().over(order_by=User.truecoins.desc()).label("rank")).subquery() - pos10 = g.db.query(sq.c.id, sq.c.rank).filter(sq.c.id == v.id).limit(1).one()[1] - try: pos9 = [x[0].id for x in users9].index(v.id) pos9 = (pos9+1, users9[pos9][1]) except: pos9 = (len(users9)+1, 0) - try: - pos12 = [x[0].id for x in users12].index(v.id) - pos12 = (pos12+1, users12[pos12][1]) - except: pos12 = (len(users12)+1, 0) + users10 = users.order_by(User.truecoins.desc()).limit(25).all() + sq = g.db.query(User.id, func.rank().over(order_by=User.truecoins.desc()).label("rank")).subquery() + pos10 = g.db.query(sq.c.id, sq.c.rank).filter(sq.c.id == v.id).limit(1).one()[1] + + sq = g.db.query(Badge.user_id, func.count(Badge.user_id).label("count"), func.rank().over(order_by=func.count(Badge.user_id).desc()).label("rank")).order_by(func.count(Badge.user_id).desc()).group_by(Badge.user_id).subquery() + users11 = g.db.query(User, sq.c.count).join(sq, User.id==sq.c.user_id).limit(25).all() + pos11 = g.db.query(sq.c.rank, sq.c.count).filter(User.id == v.id).limit(1).one() try: pos13 = [x[0].id for x in users13].index(v.id) @@ -383,7 +358,7 @@ def leaderboard(v): pos15 = (pos15+1, users15[pos15][1]) except: pos15 = (len(users15)+1, 0) - return render_template("leaderboard.html", v=v, users1=users1, pos1=pos1, users2=users2, pos2=pos2, users3=users3, pos3=pos3, users4=users4, pos4=pos4, users5=users5, pos5=pos5, users6=users6, pos6=pos6, users7=users7, pos7=pos7, users9=userss9, pos9=pos9, users10=users10, pos10=pos10, users12=userss12, pos12=pos12, users13=userss13, pos13=pos13, users15=userss15, pos15=pos15) + return render_template("leaderboard.html", v=v, users1=users1, pos1=pos1, users2=users2, pos2=pos2, users3=users3, pos3=pos3, users4=users4, pos4=pos4, users5=users5, pos5=pos5, users6=users6, pos6=pos6, users7=users7, pos7=pos7, users9=userss9, pos9=pos9, users10=users10, pos10=pos10, users11=users11, pos11=pos11, users13=userss13, pos13=pos13, users15=userss15, pos15=pos15) @app.get("/@/css") @auth_required diff --git a/files/templates/leaderboard.html b/files/templates/leaderboard.html index 477a33a103..ab6b30e6c4 100644 --- a/files/templates/leaderboard.html +++ b/files/templates/leaderboard.html @@ -289,18 +289,18 @@ - {% for user in users12 %} + {% for user in users11 %} {{loop.index}} @{{user[0].username}}'s profile picture{{user[0].username}} {{user[1]}} {% endfor %} - {% if pos12 and pos12[0] > 25 %} + {% if pos11 and pos11[0] > 25 %} - {{pos12[0]}} + {{pos11[0]}} @{{v.username}}'s profile picture{{v.username}} - {{pos12[1]}} + {{pos11[1]}} {% endif %} From 0605913bb21782111e1599811f72c74099fd88a7 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Wed, 19 Jan 2022 10:39:31 +0200 Subject: [PATCH 4/8] fds --- files/templates/authforms.html | 4 ++-- files/templates/default.html | 6 +++--- files/templates/log.html | 4 ++-- files/templates/login.html | 2 +- files/templates/login_2fa.html | 2 +- files/templates/settings.html | 2 +- files/templates/settings2.html | 4 ++-- files/templates/sign_up.html | 2 +- files/templates/sign_up_failed_ref.html | 2 +- files/templates/submit.html | 4 ++-- 10 files changed, 16 insertions(+), 16 deletions(-) diff --git a/files/templates/authforms.html b/files/templates/authforms.html index c7e0aeac09..2f03d2ccdb 100644 --- a/files/templates/authforms.html +++ b/files/templates/authforms.html @@ -15,7 +15,7 @@ {% if v %} - + {% if v.agendaposter %} - + {% endif %} diff --git a/files/templates/default.html b/files/templates/default.html index 10ff6fb622..764fd4a910 100644 --- a/files/templates/default.html +++ b/files/templates/default.html @@ -7,7 +7,7 @@ {% if v %} - + {% if v.agendaposter %} - + {% endif %} @@ -210,7 +210,7 @@ - + {% block Banner %} {% if '@' not in request.path %} diff --git a/files/templates/log.html b/files/templates/log.html index 241dd7950e..7162323f49 100644 --- a/files/templates/log.html +++ b/files/templates/log.html @@ -6,7 +6,7 @@ {% block content %} {% if v %} - + {% if v.agendaposter %} - + {% endif %}
diff --git a/files/templates/login.html b/files/templates/login.html index e4e9ad77da..f28a001801 100644 --- a/files/templates/login.html +++ b/files/templates/login.html @@ -18,7 +18,7 @@ {% endblock %} - + diff --git a/files/templates/login_2fa.html b/files/templates/login_2fa.html index 4182c0fd66..2e2a327196 100644 --- a/files/templates/login_2fa.html +++ b/files/templates/login_2fa.html @@ -14,7 +14,7 @@ 2-Step Login - {{SITE_NAME}} - + diff --git a/files/templates/settings.html b/files/templates/settings.html index 680db4f83c..9b4c4a59ca 100644 --- a/files/templates/settings.html +++ b/files/templates/settings.html @@ -34,7 +34,7 @@ - + {% if v.agendaposter %} - + {% else %} - + {% endif %} diff --git a/files/templates/sign_up.html b/files/templates/sign_up.html index a4bd08c7d5..b06f3a993c 100644 --- a/files/templates/sign_up.html +++ b/files/templates/sign_up.html @@ -31,7 +31,7 @@ {% if ref_user %}{{ref_user.username}} invites you to {{SITE_NAME}}{% else %}Sign up - {{SITE_NAME}}{% endif %} - + diff --git a/files/templates/sign_up_failed_ref.html b/files/templates/sign_up_failed_ref.html index 60afa12b10..04f7759565 100644 --- a/files/templates/sign_up_failed_ref.html +++ b/files/templates/sign_up_failed_ref.html @@ -32,7 +32,7 @@ {% if ref_user %}{{ref_user.username}} invites you to {{SITE_NAME}}{% else %}{{SITE_NAME}}{% endif %} - + diff --git a/files/templates/submit.html b/files/templates/submit.html index 111a58ce61..edb7e61621 100644 --- a/files/templates/submit.html +++ b/files/templates/submit.html @@ -26,7 +26,7 @@ {% block stylesheets %} {% if v %} - + {% if v.agendaposter %} - + {% endif %} {% endblock %} From c1ab1964e99fc7152b609b4e2bdc2cbe2d6fb9cd Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Wed, 19 Jan 2022 10:42:38 +0200 Subject: [PATCH 5/8] 1 --- files/routes/comments.py | 2 +- files/routes/discord.py | 2 +- files/routes/feeds.py | 2 +- files/routes/login.py | 4 ++-- files/routes/posts.py | 8 ++++---- files/routes/settings.py | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/files/routes/comments.py b/files/routes/comments.py index 55bdd69970..8e46fb4768 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -474,7 +474,7 @@ def api_comment(v): 'notification': { 'title': f'New reply by @{c.author_name}', 'body': notifbody, - 'deep_link': f'https://{site}/comment/{c.id}?context=9&read=true#context', + 'deep_link': f'{request.host_url}comment/{c.id}?context=9&read=true#context', 'icon': f'{request.host_url}assets/images/{SITE_NAME}/icon.webp', } }, diff --git a/files/routes/discord.py b/files/routes/discord.py index 912735b6dd..18b16ee938 100644 --- a/files/routes/discord.py +++ b/files/routes/discord.py @@ -58,7 +58,7 @@ def discord_redirect(v): 'client_secret': CLIENT_SECRET, 'grant_type': 'authorization_code', 'code': code, - 'redirect_uri': f"https://{app.config['SERVER_NAME']}/discord_redirect", + 'redirect_uri': f"{request.host_url}discord_redirect", 'scope': 'identify guilds.join' } headers={ diff --git a/files/routes/feeds.py b/files/routes/feeds.py index de35acd7f7..06e7e25928 100644 --- a/files/routes/feeds.py +++ b/files/routes/feeds.py @@ -53,7 +53,7 @@ def feeds_user(v=None, sort='hot', t='all'): with tag("name"): text(post.author.username) with tag("uri"): - text(f'https://{site}/@{post.author.username}') + text(f'{request.host_url}@{post.author.username}') doc.stag("link", href=full_link(post.permalink)) diff --git a/files/routes/login.py b/files/routes/login.py index 3526546618..c263cb6002 100644 --- a/files/routes/login.py +++ b/files/routes/login.py @@ -366,7 +366,7 @@ def post_forgot(): if user: now = int(time.time()) token = generate_hash(f"{user.id}+{now}+forgot+{user.login_nonce}") - url = f"https://{app.config['SERVER_NAME']}/reset?id={user.id}&time={now}&token={token}" + url = f"{request.host_url}reset?id={user.id}&time={now}&token={token}" send_mail(to_address=user.email, subject="Password Reset Request", @@ -487,7 +487,7 @@ def request_2fa_disable(): valid=int(time.time()) token=generate_hash(f"{user.id}+{user.username}+disable2fa+{valid}+{user.mfa_secret}+{user.login_nonce}") - action_url=f"https://{app.config['SERVER_NAME']}/reset_2fa?id={user.id}&t={valid}&token={token}" + action_url=f"{request.host_url}reset_2fa?id={user.id}&t={valid}&token={token}" send_mail(to_address=user.email, subject="2FA Removal Request", diff --git a/files/routes/posts.py b/files/routes/posts.py index 4887c2e855..5a5b26221e 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -77,7 +77,7 @@ def publish(pid, v): cache.delete_memoized(User.userpagelisting) if v.admin_level > 1 and ("[changelog]" in post.title or "(changelog)" in post.title): - send_discord_message(f"https://{site}{post.permalink}") + send_discord_message(f"{request.host_url}{post.permalink[1:]}") cache.delete_memoized(changeloglist) g.db.commit() @@ -579,7 +579,7 @@ def thumbnail_thread(pid): fetch_url = post.url - if fetch_url.startswith('/'): fetch_url = f"https://{site}{fetch_url}" + if fetch_url.startswith('/'): fetch_url = f"{request.host_url}{fetch_url[1:]}" headers={"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.72 Safari/537.36"} @@ -1053,7 +1053,7 @@ def submit_post(v): rev = f"* [unddit.com](https://unddit.com/{rev})\n" else: rev = '' newposturl = new_post.url - if newposturl.startswith('/'): newposturl = f"https://{site}{newposturl}" + if newposturl.startswith('/'): newposturl = f"{request.host_url}{newposturl[1:]}" body += f"Snapshots:\n\n{rev}* [archive.org](https://web.archive.org/{newposturl})\n* [archive.ph](https://archive.ph/?url={quote(newposturl)}&run=1) (click to archive)\n\n" gevent.spawn(archiveorg, newposturl) @@ -1105,7 +1105,7 @@ def submit_post(v): cache.delete_memoized(frontlist) cache.delete_memoized(User.userpagelisting) if v.admin_level > 1 and ("[changelog]" in new_post.title or "(changelog)" in new_post.title) and not new_post.private: - send_discord_message(f"https://{site}{new_post.permalink}") + send_discord_message(f"{request.host_url}{new_post.permalink[1:]}") cache.delete_memoized(changeloglist) if v.id in (PIZZASHILL_ID, HIL_ID): diff --git a/files/routes/settings.py b/files/routes/settings.py index 1710510e74..dfa9c0e0c5 100644 --- a/files/routes/settings.py +++ b/files/routes/settings.py @@ -543,7 +543,7 @@ def settings_security_post(v): if new_email == v.email: return render_template("settings_security.html", v=v, error="That email is already yours!") - url = f"https://{app.config['SERVER_NAME']}/activate" + url = f"{request.host_url}activate" now = int(time.time()) From d5d8cde87cbca9adb3aa0cd3f93871fc9fa77487 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Wed, 19 Jan 2022 11:07:13 +0200 Subject: [PATCH 6/8] fds --- files/classes/flags.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/classes/flags.py b/files/classes/flags.py index e719c403ca..fa88ffd0b8 100644 --- a/files/classes/flags.py +++ b/files/classes/flags.py @@ -2,7 +2,7 @@ from sqlalchemy import * from sqlalchemy.orm import relationship from files.__main__ import Base from files.helpers.lazy import lazy -from files.helpers.const import censor_slurs +from files.helpers.const import * import time class Flag(Base): From 81078c5877ebe82765c04eb54be8d76791e7685c Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Wed, 19 Jan 2022 11:07:16 +0200 Subject: [PATCH 7/8] fds --- files/classes/award.py | 6 +- files/classes/badges.py | 6 +- files/classes/comment.py | 10 +-- files/classes/mod_logs.py | 7 +-- files/classes/submission.py | 27 ++++---- files/classes/user.py | 14 ++--- files/helpers/const.py | 31 +++++++++- files/helpers/jinja2.py | 27 -------- files/helpers/sanitize.py | 4 +- files/mail/__init__.py | 5 +- files/routes/admin.py | 8 +-- files/routes/comments.py | 3 - files/routes/discord.py | 1 - files/routes/feeds.py | 2 +- files/routes/front.py | 1 - files/routes/posts.py | 10 ++- files/routes/settings.py | 1 - files/routes/static.py | 5 +- files/routes/votes.py | 2 +- files/templates/comment_failed.html | 4 +- files/templates/submission.html | 82 +++++++++---------------- files/templates/submission_listing.html | 2 +- files/templates/submit.html | 2 +- 23 files changed, 101 insertions(+), 159 deletions(-) delete mode 100644 files/helpers/jinja2.py diff --git a/files/classes/award.py b/files/classes/award.py index 30e1fcb2a3..c557888758 100644 --- a/files/classes/award.py +++ b/files/classes/award.py @@ -3,11 +3,7 @@ from sqlalchemy.orm import relationship from files.__main__ import Base from os import environ from files.helpers.lazy import lazy -from files.helpers.const import AWARDS - -site_name = environ.get("SITE_NAME").strip() - - +from files.helpers.const import * class AwardRelationship(Base): diff --git a/files/classes/badges.py b/files/classes/badges.py index 2ec4d5ee26..00e48195a5 100644 --- a/files/classes/badges.py +++ b/files/classes/badges.py @@ -3,11 +3,9 @@ from sqlalchemy.orm import relationship from files.__main__ import Base, app from os import environ from files.helpers.lazy import lazy -from files.helpers.const import BADGES +from files.helpers.const import * from datetime import datetime -site_name = environ.get("SITE_NAME").strip() - class Badge(Base): __tablename__ = "badges" @@ -63,5 +61,5 @@ class Badge(Base): return {'text': self.text, 'name': self.name, 'url': self.url, - 'icon_url':f"https://{app.config['SERVER_NAME']}{self.path}" + 'icon_url':f"{SITE_FULL}{self.path}" } \ No newline at end of file diff --git a/files/classes/comment.py b/files/classes/comment.py index 93302aabfc..623c21e035 100644 --- a/files/classes/comment.py +++ b/files/classes/comment.py @@ -7,15 +7,11 @@ from sqlalchemy import * from sqlalchemy.orm import relationship from files.__main__ import Base from files.classes.votes import CommentVote -from files.helpers.const import AUTOPOLLER_ID, AUTOBETTER_ID, censor_slurs +from files.helpers.const import * from files.helpers.lazy import lazy from .flags import CommentFlag from random import randint -site = environ.get("DOMAIN").strip() -if site == 'pcmemes.net': cc = "SPLASH MOUNTAIN" -else: cc = "COUNTRY CLUB" - class Comment(Base): __tablename__ = "comments" @@ -324,7 +320,7 @@ class Comment(Base): return data def realbody(self, v): - if self.post and self.post.club and not (v and (v.paid_dues or v.id in [self.author_id, self.post.author_id])): return f"

{cc} ONLY

" + if self.post and self.post.club and not (v and (v.paid_dues or v.id in [self.author_id, self.post.author_id])): return f"

{CC} ONLY

" body = self.body_html @@ -364,7 +360,7 @@ class Comment(Base): return body def plainbody(self, v): - if self.post and self.post.club and not (v and (v.paid_dues or v.id in [self.author_id, self.post.author_id])): return f"

{cc} ONLY

" + if self.post and self.post.club and not (v and (v.paid_dues or v.id in [self.author_id, self.post.author_id])): return f"

{CC} ONLY

" body = self.body diff --git a/files/classes/mod_logs.py b/files/classes/mod_logs.py index 62d6d1e5af..59db52b3e0 100644 --- a/files/classes/mod_logs.py +++ b/files/classes/mod_logs.py @@ -5,10 +5,7 @@ import time from files.helpers.lazy import lazy from os import environ from copy import deepcopy - -site = environ.get("DOMAIN").strip() -if site == 'pcmemes.net': cc = "SPLASH MOUNTAIN" -else: cc = "COUNTRY CLUB" +from files.helpers.const import * class ModAction(Base): __tablename__ = "modactions" @@ -94,7 +91,7 @@ class ModAction(Base): def target_link(self): if self.target_user: return f'{self.target_user.username}' elif self.target_post: - if self.target_post.club: return f'{cc} ONLY' + if self.target_post.club: return f'{CC} ONLY' return f'{self.target_post.title.replace("<","").replace(">","")}' elif self.target_comment_id: return f'comment' diff --git a/files/classes/submission.py b/files/classes/submission.py index 69194a7309..e3311e400d 100644 --- a/files/classes/submission.py +++ b/files/classes/submission.py @@ -7,17 +7,12 @@ from flask import render_template from sqlalchemy import * from sqlalchemy.orm import relationship from files.__main__ import Base -from files.helpers.const import AUTOPOLLER_ID, AUTOBETTER_ID, censor_slurs, TROLLTITLES +from files.helpers.const import * from files.helpers.lazy import lazy from .flags import Flag from .comment import Comment from flask import g -site = environ.get("DOMAIN").strip() -site_name = environ.get("SITE_NAME").strip() -if site == 'pcmemes.net': cc = "SPLASH MOUNTAIN" -else: cc = "COUNTRY CLUB" - class Submission(Base): __tablename__ = "submissions" @@ -232,22 +227,22 @@ class Submission(Base): @property @lazy def thumb_url(self): - if self.over_18: return f"https://{site}/static/assets/images/nsfw.webp" - elif not self.url: return f"https://{site}/static/assets/images/{site_name}/default_text.webp" + if self.over_18: return f"{SITE_FULL}/static/assets/images/nsfw.webp" + elif not self.url: return f"{SITE_FULL}/static/assets/images/{SITE_NAME}/default_text.webp" elif self.thumburl: return self.thumburl - elif self.is_youtube or self.is_video: return f"https://{site}/static/assets/images/default_thumb_yt.webp" - else: return f"https://{site}/static/assets/images/default_thumb_link.webp" + elif self.is_youtube or self.is_video: return f"{SITE_FULL}/static/assets/images/default_thumb_yt.webp" + else: return f"{SITE_FULL}/static/assets/images/default_thumb_link.webp" @property @lazy def full_thumb(self): - if self.thumb_url.startswith('/'): return f'https://{site}' + self.thumb_url + if self.thumb_url.startswith('/'): return SITE_FULL + self.thumb_url return self.thumb_url @property @lazy def full_url(self): - if self.url and self.url.startswith('/'): return f'https://{site}' + self.url + if self.url and self.url.startswith('/'): return SITE_FULL + self.url return self.url @property @@ -352,7 +347,7 @@ class Submission(Base): else: return "" def realbody(self, v): - if self.club and not (v and (v.paid_dues or v.id == self.author_id)): return f"

{cc} ONLY

" + if self.club and not (v and (v.paid_dues or v.id == self.author_id)): return f"

{CC} ONLY

" body = self.body_html @@ -382,7 +377,7 @@ class Submission(Base): return body def plainbody(self, v): - if self.club and not (v and (v.paid_dues or v.id == self.author_id)): return f"

{cc} ONLY

" + if self.club and not (v and (v.paid_dues or v.id == self.author_id)): return f"

{CC} ONLY

" body = self.body @@ -402,7 +397,7 @@ class Submission(Base): def realtitle(self, v): if self.club and not (v and (v.paid_dues or v.id == self.author_id)): if v: return random.choice(TROLLTITLES).format(username=v.username) - else: return f'{cc} MEMBERS ONLY' + else: return f'{CC} MEMBERS ONLY' elif self.title_html: title = self.title_html else: title = self.title @@ -414,7 +409,7 @@ class Submission(Base): def plaintitle(self, v): if self.club and not (v and (v.paid_dues or v.id == self.author_id)): if v: return random.choice(TROLLTITLES).format(username=v.username) - else: return f'{cc} MEMBERS ONLY' + else: return f'{CC} MEMBERS ONLY' else: title = self.title title = censor_slurs(title, v) diff --git a/files/classes/user.py b/files/classes/user.py index 5aec1a24b7..d220ca2173 100644 --- a/files/classes/user.py +++ b/files/classes/user.py @@ -18,8 +18,6 @@ from files.helpers.security import * import random from os import environ, remove, path -site = environ.get("DOMAIN").strip() -site_name = environ.get("SITE_NAME").strip() defaulttheme = environ.get("DEFAULT_THEME", "midnight").strip() defaultcolor = environ.get("DEFAULT_COLOR", "fff").strip() defaulttimefilter = environ.get("DEFAULT_TIME_FILTER", "all").strip() @@ -28,7 +26,7 @@ cardview = bool(int(environ.get("CARD_VIEW", 1))) class User(Base): __tablename__ = "users" - if site == "pcmemes.net": + if SITE == "pcmemes.net": quadrant = Column(String) basedcount = Column(Integer, default=0) pills = deferred(Column(String, default="")) @@ -428,15 +426,15 @@ class User(Base): @lazy def banner_url(self): if self.bannerurl: return self.bannerurl - else: return f"https://{site}/static/assets/images/{site_name}/site_preview.webp?a=1" + else: return f"{SITE_FULL}/static/assets/images/{SITE_NAME}/site_preview.webp?a=1" @property @lazy def profile_url(self): - if self.agendaposter: return f"https://{site}/static/assets/images/defaultpictures/agendaposter/{random.randint(1, 50)}.webp?a=204" + if self.agendaposter: return f"{SITE_FULL}/static/assets/images/defaultpictures/agendaposter/{random.randint(1, 50)}.webp?a=204" if self.profileurl: return self.profileurl - if "rama" in site: return f"https://{site}/static/assets/images/defaultpictures/{random.randint(1, 150)}.webp?a=202" - return f"https://{site}/static/assets/images/default-profile-pic.webp?a=204" + if SITE_NAME == 'Drama': return f"{SITE_FULL}/static/assets/images/defaultpictures/{random.randint(1, 150)}.webp?a=202" + return f"{SITE_FULL}/static/assets/images/default-profile-pic.webp?a=204" @lazy def json_popover(self, v): @@ -457,7 +455,7 @@ class User(Base): @property @lazy def full_profileurl(self): - if self.profile_url.startswith('/'): return f'https://{site}' + self.profile_url + if self.profile_url.startswith('/'): return SITE_FULL + self.profile_url return self.profile_url @property diff --git a/files/helpers/const.py b/files/helpers/const.py index 5dc9db6e9e..b7be3ab134 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -2,9 +2,15 @@ from os import environ, listdir import re from copy import deepcopy from json import loads +from files.__main__ import app SITE = environ.get("DOMAIN", '').strip() SITE_NAME = environ.get("SITE_NAME", '').strip() +if SITE == "localhost": SITE_FULL = 'http://' + SITE +else: SITE_FULL = 'https://' + SITE +if SITE == 'pcmemes.net': CC = "SPLASH MOUNTAIN" +else: CC = "COUNTRY CLUB" +CC_TITLE = CC.title() with open("files/assets/js/emoji_modal.js", 'r') as file: marseytext = file.read().split('emojis: ')[1].split('cops police"},')[0] + '"}}' @@ -787,4 +793,27 @@ NOTIFIED_USERS = { } num_banners = len(listdir('files/assets/images/Drama/banners')) + 1 -num_sidebar = len(listdir('files/assets/images/Drama/sidebar')) + 1 \ No newline at end of file +num_sidebar = len(listdir('files/assets/images/Drama/sidebar')) + 1 + +@app.template_filter("full_link") +def full_link(url): + + return f"{SITE_FULL}{url}" + +@app.template_filter("app_config") +def app_config(x): + return app.config.get(x) + +@app.template_filter("post_embed") +def post_embed(id, v): + + try: id = int(id) + except: return None + + p = get_post(id, v, graceful=True) + + return render_template("submission_listing.html", listing=[p], v=v) + +@app.context_processor +def inject_constants(): + return {"num_banners":num_banners, "num_sidebar":num_sidebar, "environ":environ, "SITE_NAME":SITE_NAME, "AUTOJANNY_ID":AUTOJANNY_ID, "NOTIFICATIONS_ID":NOTIFICATIONS_ID, "PUSHER_ID":PUSHER_ID, "CC":CC, "CC_TITLE":CC_TITLE} \ No newline at end of file diff --git a/files/helpers/jinja2.py b/files/helpers/jinja2.py deleted file mode 100644 index be6a359496..0000000000 --- a/files/helpers/jinja2.py +++ /dev/null @@ -1,27 +0,0 @@ -from files.__main__ import app -from .get import * -from os import listdir, environ -from .const import * - -@app.template_filter("full_link") -def full_link(url): - - return f"https://{app.config['SERVER_NAME']}{url}" - -@app.template_filter("app_config") -def app_config(x): - return app.config.get(x) - -@app.template_filter("post_embed") -def post_embed(id, v): - - try: id = int(id) - except: return None - - p = get_post(id, v, graceful=True) - - return render_template("submission_listing.html", listing=[p], v=v) - -@app.context_processor -def inject_constants(): - return {"num_banners":num_banners, "num_sidebar":num_sidebar, "environ":environ, "SITE_NAME":SITE_NAME, "AUTOJANNY_ID": AUTOJANNY_ID, "NOTIFICATIONS_ID": NOTIFICATIONS_ID, "PUSHER_ID": PUSHER_ID} \ No newline at end of file diff --git a/files/helpers/sanitize.py b/files/helpers/sanitize.py index 993b23fcf7..d205648f46 100644 --- a/files/helpers/sanitize.py +++ b/files/helpers/sanitize.py @@ -9,8 +9,6 @@ from mistletoe import markdown from json import loads, dump from random import random -site = environ.get("DOMAIN").strip() - allowed_tags = tags = ['b', 'blockquote', 'br', @@ -166,7 +164,7 @@ def sanitize(sanitized, noimages=False, alert=False, comment=False, edit=False): for tag in soup.find_all("a"): if tag.get("href"): - if site not in tag["href"] and not tag["href"].startswith('/'): + if not tag["href"].startswith(SITE_FULL) and not tag["href"].startswith('/'): tag["target"] = "_blank" tag["rel"] = "nofollow noopener noreferrer" diff --git a/files/mail/__init__.py b/files/mail/__init__.py index 868febe2fe..469cd098d4 100644 --- a/files/mail/__init__.py +++ b/files/mail/__init__.py @@ -5,17 +5,16 @@ from urllib.parse import quote from files.helpers.security import * from files.helpers.wrappers import * +from files.helpers.const import * from files.classes import * from files.__main__ import app, mail, limiter from flask_mail import Message -site = environ.get("DOMAIN").strip() name = environ.get("SITE_NAME").strip() - def send_mail(to_address, subject, html): - msg = Message(html=html, subject=subject, sender=f"{name}@{site}", recipients=[to_address]) + msg = Message(html=html, subject=subject, sender=f"{name}@{SITE}", recipients=[to_address]) mail.send(msg) diff --git a/files/routes/admin.py b/files/routes/admin.py index bfad24748e..f83209d96d 100644 --- a/files/routes/admin.py +++ b/files/routes/admin.py @@ -17,7 +17,6 @@ from files.helpers.discord import add_role from datetime import datetime import requests -SITE_NAME = environ.get("SITE_NAME", "").strip() GUMROAD_ID = environ.get("GUMROAD_ID", "tfcvri").strip() GUMROAD_TOKEN = environ.get("GUMROAD_TOKEN", "").strip() @@ -25,11 +24,8 @@ 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 SITE_NAME == 'PCM': cc = "splash mountain" -else: cc = "country club" month = datetime.now().strftime('%B') - @app.get("/refund") @admin_level_required(3) def refund(v): @@ -166,7 +162,7 @@ def club_allow(v, username): g.db.add(x) g.db.commit() - return {"message": f"@{username} has been allowed into the {cc}!"} + return {"message": f"@{username} has been allowed into the {CC_TITLE}!"} @app.post("/@/club_ban") @limiter.limit("1/second;30/minute;200/hour;1000/day") @@ -186,7 +182,7 @@ def club_ban(v, username): g.db.add(x) g.db.commit() - return {"message": f"@{username} has been kicked from the {cc}. Deserved."} + return {"message": f"@{username} has been kicked from the {CC_TITLE}. Deserved."} @app.post("/@/make_meme_admin") diff --git a/files/routes/comments.py b/files/routes/comments.py index 8e46fb4768..07519d3d6f 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -11,9 +11,6 @@ from files.__main__ import app, limiter from files.helpers.sanitize import filter_emojis_only import requests -site = environ.get("DOMAIN").strip() -if site == 'pcmemes.net': cc = "SPLASH MOUNTAIN" -else: cc = "COUNTRY CLUB" IMGUR_KEY = environ.get("IMGUR_KEY").strip() if PUSHER_ID: beams_client = PushNotifications(instance_id=PUSHER_ID, secret_key=PUSHER_KEY) diff --git a/files/routes/discord.py b/files/routes/discord.py index 18b16ee938..17e5a140fb 100644 --- a/files/routes/discord.py +++ b/files/routes/discord.py @@ -11,7 +11,6 @@ BOT_TOKEN = environ.get("DISCORD_BOT_TOKEN").strip() COINS_NAME = environ.get("COINS_NAME").strip() DISCORD_ENDPOINT = "https://discordapp.com/api/v6" WELCOME_CHANNEL="846509313941700618" -SITE_NAME = environ.get("SITE_NAME", "").strip() @app.get("/discord") @is_not_permabanned diff --git a/files/routes/feeds.py b/files/routes/feeds.py index 06e7e25928..d7e4e857c8 100644 --- a/files/routes/feeds.py +++ b/files/routes/feeds.py @@ -1,7 +1,7 @@ import html from .front import frontlist from datetime import datetime -from files.helpers.jinja2 import full_link +from files.helpers.const import * from files.helpers.get import * from yattag import Doc from files.helpers.wrappers import * diff --git a/files/routes/front.py b/files/routes/front.py index 0c6373ccd2..a7b3aa8784 100644 --- a/files/routes/front.py +++ b/files/routes/front.py @@ -4,7 +4,6 @@ from files.__main__ import app, cache, limiter from files.classes.submission import Submission defaulttimefilter = environ.get("DEFAULT_TIME_FILTER", "all").strip() -SITE_NAME = environ.get("SITE_NAME", "").strip() @app.post("/clear") @auth_required diff --git a/files/routes/posts.py b/files/routes/posts.py index 5a5b26221e..f6ba288ca9 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -19,17 +19,15 @@ import requests from shutil import copyfile from psutil import cpu_percent -site = environ.get("DOMAIN").strip() -site_name = environ.get("SITE_NAME").strip() IMGUR_KEY = environ.get("IMGUR_KEY").strip() 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]}") +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/") @@ -991,7 +989,7 @@ def submit_post(v): if not new_post.thumburl and new_post.url: if request.host in new_post.url or new_post.url.startswith('/') or request.host == 'rdrama.net' and 'rdrama' in new_post.domain: - new_post.thumburl = f'/static/assets/images/{site_name}/site_preview.webp' + new_post.thumburl = f'/static/assets/images/{SITE_NAME}/site_preview.webp' elif request.headers.get('cf-ipcountry')!="T1": gevent.spawn( thumbnail_thread, new_post.id) diff --git a/files/routes/settings.py b/files/routes/settings.py index dfa9c0e0c5..12809bb139 100644 --- a/files/routes/settings.py +++ b/files/routes/settings.py @@ -20,7 +20,6 @@ valid_password_regex = re.compile("^.{8,100}$") YOUTUBE_KEY = environ.get("YOUTUBE_KEY", "").strip() COINS_NAME = environ.get("COINS_NAME").strip() GUMROAD_TOKEN = environ.get("GUMROAD_TOKEN", "").strip() -SITE_NAME = environ.get("SITE_NAME", "").strip() IMGUR_KEY = environ.get("IMGUR_KEY").strip() GUMROAD_ID = environ.get("GUMROAD_ID", "tfcvri").strip() diff --git a/files/routes/static.py b/files/routes/static.py index 565af3e4b6..2f78698fab 100644 --- a/files/routes/static.py +++ b/files/routes/static.py @@ -9,9 +9,6 @@ import calendar import matplotlib.pyplot as plt from files.classes.mod_logs import ACTIONTYPES, ACTIONTYPES2 -site = environ.get("DOMAIN").strip() -site_name = environ.get("SITE_NAME").strip() - @app.get("/privacy") @auth_required def privacy(v): @@ -246,7 +243,7 @@ def log_item(id, v): @app.get("/static/assets/favicon.ico") def favicon(): - return send_file(f"./assets/images/{site_name}/icon.webp") + return send_file(f"./assets/images/{SITE_NAME}/icon.webp") @app.get("/api") @auth_required diff --git a/files/routes/votes.py b/files/routes/votes.py index a781da8c85..d2396b0acc 100644 --- a/files/routes/votes.py +++ b/files/routes/votes.py @@ -1,6 +1,6 @@ from files.helpers.wrappers import * from files.helpers.get import * -from files.helpers.const import AUTOBETTER_ID +from files.helpers.const import * from files.classes import * from flask import * from files.__main__ import app, limiter, cache diff --git a/files/templates/comment_failed.html b/files/templates/comment_failed.html index ca9621ef87..955cb60afc 100644 --- a/files/templates/comment_failed.html +++ b/files/templates/comment_failed.html @@ -12,8 +12,8 @@

Please remove the following link(s) from your comment, and then you will be able to post it:

    - {% for site in badlinks %} -
  • {{site}}
  • + {% for s in badlinks %} +
  • {{s}}
  • {% endfor %}
diff --git a/files/templates/submission.html b/files/templates/submission.html index 47b5931f10..a40d5a0ca5 100644 --- a/files/templates/submission.html +++ b/files/templates/submission.html @@ -23,6 +23,13 @@ {% if p.award_count("wholesome") %} -
- :#marseywholesome: +
+ + + :#marseywholesome: + +
{% endif %} {% if p.award_count("wholesome") > 1 %} - -
- :#marseywholesome: -
+ + + :#marseywholesome: + + {% endif %} {% if p.award_count("wholesome") > 2 %} - -
- :#marseywholesome: -
+ + + :#marseywholesome: + + {% endif %} {% if p.award_count("wholesome") > 3 %} - -
- :#marseywholesome: -
+ + + :#marseywholesome: + + {% endif %} {% if p.award_count("train") %} @@ -402,13 +380,13 @@ {% endif %} {% if p.realurl(v) %}

- {% if p.club %}{{cc}}{% endif %} + {% if p.club %}{{CC}}{% endif %} {% if p.flair %}{{p.flair | safe}}{% endif %} {{p.realtitle(v) | safe}}

{% else %}

- {% if p.club %}{{cc}}{% endif %} + {% if p.club %}{{CC}}{% endif %} {% if p.flair %}{{p.flair | safe}}{% endif %} {{p.realtitle(v) | safe}}

diff --git a/files/templates/submission_listing.html b/files/templates/submission_listing.html index 14120cc3fa..151afd16fc 100644 --- a/files/templates/submission_listing.html +++ b/files/templates/submission_listing.html @@ -200,7 +200,7 @@
- {% if p.club %}{{cc}}{% endif %} + {% if p.club %}{{CC}}{% endif %} {% if p.flair %}{{p.flair | safe}}{% endif %} {{p.realtitle(v) | safe}}
diff --git a/files/templates/submit.html b/files/templates/submit.html index edb7e61621..bd48af0c40 100644 --- a/files/templates/submit.html +++ b/files/templates/submit.html @@ -160,7 +160,7 @@ {% if v.club_allowed != False %}
- +
{% endif %}

From 0536b03a4615624aa1447d613d23b6dcd2c0aa62 Mon Sep 17 00:00:00 2001
From: Aevann1 
Date: Wed, 19 Jan 2022 11:19:38 +0200
Subject: [PATCH 8/8] fds

---
 files/routes/posts.py           | 16 ++++++++--------
 files/templates/submission.html |  2 +-
 files/templates/submit.html     |  4 ++--
 3 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/files/routes/posts.py b/files/routes/posts.py
index f6ba288ca9..5cb5f05968 100644
--- a/files/routes/posts.py
+++ b/files/routes/posts.py
@@ -398,7 +398,7 @@ def edit_post(pid, v):
 
 	body = request.values.get("body", "").strip().replace('‎','')
 
-	if len(body) > 10000: return {"error":"Character limit is 10000!"}, 403
+	if len(body) > 20000: return {"error":"Character limit is 20000!"}, 403
 
 	if v.marseyawarded:
 		marregex = list(re.finditer("^(:[!#]{0,2}m\w+:\s*)+$", title))
@@ -470,7 +470,7 @@ def edit_post(pid, v):
 		elif v.bird:
 			if len(body) > 140 : return {"error":"You have to type less than 140 characters!"}, 403
 
-		if len(body_html) > 20000: return {"error":"Submission body too long!"}, 400
+		if len(body_html) > 40000: return {"error":"Submission body too long!"}, 400
 
 		p.body_html = body_html
 
@@ -850,10 +850,10 @@ def submit_post(v):
 			g.db.add(ma)
 		return redirect("/notifications")
 
-	if len(str(body)) > 10000:
+	if len(str(body)) > 20000:
 
-		if request.headers.get("Authorization") or request.headers.get("xhr"): return {"error":"10000 character limit for text body."}, 400
-		return render_template("submit.html", v=v, error="10000 character limit for text body.", title=title, url=url, body=request.values.get("body", "")), 400
+		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", 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:
 
@@ -902,7 +902,7 @@ def submit_post(v):
 	elif v.bird:
 		if len(body) > 140 : return {"error":"You have to type less than 140 characters!"}, 403
 
-	if len(body_html) > 20000: return {"error":"Submission body too long!"}, 400
+	if len(body_html) > 40000: return {"error":"Submission body too long!"}, 400
 
 	bans = filter_comment_html(body_html)
 	if bans:
@@ -925,7 +925,7 @@ def submit_post(v):
 		app_id=v.client.application.id if v.client else None,
 		is_bot = request.headers.get("Authorization"),
 		url=url,
-		body=body[:10000],
+		body=body[:20000],
 		body_html=body_html,
 		embed_url=embed,
 		title=title[:500],
@@ -1073,7 +1073,7 @@ def submit_post(v):
 
 	body_html = sanitize(body)
 
-	if len(body_html) < 20000:
+	if len(body_html) < 40000:
 		c = Comment(author_id=SNAPPY_ID,
 			distinguish_level=6,
 			parent_submission=new_post.id,
diff --git a/files/templates/submission.html b/files/templates/submission.html
index a40d5a0ca5..17230e3561 100644
--- a/files/templates/submission.html
+++ b/files/templates/submission.html
@@ -479,7 +479,7 @@
 									
 									
 									
-									 
+									 
 									
 									
diff --git a/files/templates/submit.html b/files/templates/submit.html index bd48af0c40..f7982aeb10 100644 --- a/files/templates/submit.html +++ b/files/templates/submit.html @@ -106,10 +106,10 @@
- +
- +
Toggle preview