From 0f2eb87e31d436e1aa04847ea6420d75bce610a4 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Tue, 11 Jan 2022 00:43:00 +0200 Subject: [PATCH] bb --- files/helpers/markdown.py | 4 ++++ files/routes/posts.py | 8 ++++---- files/routes/search.py | 2 ++ files/templates/comments.html | 2 +- files/templates/formatting.html | 4 ++-- files/templates/header.html | 4 ++-- files/templates/log.html | 4 ++-- files/templates/settings_profile.html | 4 ++-- files/templates/submission_listing.html | 2 +- files/templates/userpage.html | 8 ++++---- 10 files changed, 24 insertions(+), 18 deletions(-) diff --git a/files/helpers/markdown.py b/files/helpers/markdown.py index d83f187bc..37d5f7831 100644 --- a/files/helpers/markdown.py +++ b/files/helpers/markdown.py @@ -39,6 +39,8 @@ class CustomRenderer(HTMLRenderer): user = get_user(target, graceful=True) + if not user: return f"{space}@{target}" + return f'''{space}@{user.username}'s profile picture@{user.username}''' def render_sub_mention(self, token): @@ -64,6 +66,8 @@ class Renderer(HTMLRenderer): user = get_user(target, graceful=True) + if not user: return f"{space}@{target}" + return f'{space}@{user.username}' def render_sub_mention(self, token): diff --git a/files/routes/posts.py b/files/routes/posts.py index ee5a53f3f..6c80c68ee 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -401,9 +401,9 @@ def edit_post(pid, v): if p.author_id != v.id and not (v.admin_level > 1 and v.admin_level > 2): abort(403) - title = request.values.get("title", "").strip() + title = request.values.get("title", "").strip().replace('‎','') - body = request.values.get("body", "").strip() + body = request.values.get("body", "").strip().replace('‎','') if len(body) > 10000: return {"error":"Character limit is 10000!"}, 403 @@ -691,14 +691,14 @@ def submit_post(v): if not v or v.oldsite: template = '' else: template = 'CHRISTMAS/' - title = request.values.get("title", "").strip()[:500] + title = request.values.get("title", "").strip()[:500].replace('‎','') url = request.values.get("url", "").strip() if v.agendaposter and not v.marseyawarded: title = torture_ap(title, v.username) title_html = filter_emojis_only(title) - body = request.values.get("body", "").strip() + body = request.values.get("body", "").strip().replace('‎','') if v.marseyawarded and len(list(re.finditer('>[^<\s+]|[^>\s+]<', title_html))) > 0: return {"error":"You can only type marseys!"}, 40 diff --git a/files/routes/search.py b/files/routes/search.py index 9749130d3..fc4e3463f 100644 --- a/files/routes/search.py +++ b/files/routes/search.py @@ -67,6 +67,7 @@ def searchposts(v): if 'author' in criteria: author = get_user(criteria['author']) + if not author: return {"error": f"User not found"} if author.is_private and v.admin_level < 2 and not v.eye: if request.headers.get("Authorization"): return {"error": f"@{author.username}'s profile is private; You can't use the 'author' syntax on them"} @@ -214,6 +215,7 @@ def searchcomments(v): if 'author' in criteria: author = get_user(criteria['author']) + if not author: return {"error": f"User not found"} if author.is_private and v.admin_level < 2 and not v.eye: if request.headers.get("Authorization"): return {"error": f"@{author.username}'s profile is private; You can't use the 'author' syntax on them"} diff --git a/files/templates/comments.html b/files/templates/comments.html index 5728b9cdf..8ce4e9910 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -210,7 +210,7 @@ {% if c.author.verified %} {% endif %} - @{{c.author.username}}'s profile picture{{c.author.username}} + @{{c.author.username}}'s profile picture{{c.author.username}} {% if c.author.customtitle %}  {% if c.author.quadrant %}{{c.author.quadrant}} quadrant{% endif %}{{c.author.customtitle | safe}}{% endif %} {% if c.parent_comment_id and not standalone and level != 1 %}{{ c.parent_comment.author.username }}{% endif %} diff --git a/files/templates/formatting.html b/files/templates/formatting.html index f36c0a571..c97d896a2 100644 --- a/files/templates/formatting.html +++ b/files/templates/formatting.html @@ -54,7 +54,7 @@ You can use Markdown formatting: Images https://i.imgur.com/Lf6dfPO.jpg - example image + example image Youtube Videos @@ -445,7 +445,7 @@ line breaks <img src="https://i.imgur.com/SwVuagI_d.webp" width="200"> - example image + example image diff --git a/files/templates/header.html b/files/templates/header.html index 92611bcbc..451b3a6df 100644 --- a/files/templates/header.html +++ b/files/templates/header.html @@ -95,8 +95,8 @@
your profile picture
{{v.username}}
-
{{'COINS_NAME' | app_config}}{{v.coins}} {{'COINS_NAME' | app_config}}
-
marseybux{{v.procoins}} Marseybux
+
{{'COINS_NAME' | app_config}}{{v.coins}} {{'COINS_NAME' | app_config}}
+
marseybux{{v.procoins}} Marseybux
diff --git a/files/templates/log.html b/files/templates/log.html index b53454ad1..1cb599a76 100644 --- a/files/templates/log.html +++ b/files/templates/log.html @@ -61,7 +61,7 @@ @@ -95,7 +95,7 @@
- avatar + avatar
diff --git a/files/templates/settings_profile.html b/files/templates/settings_profile.html index 3df0b357a..f63a52992 100644 --- a/files/templates/settings_profile.html +++ b/files/templates/settings_profile.html @@ -182,7 +182,7 @@
- your profile picture + your profile picture
@@ -224,7 +224,7 @@
- +
diff --git a/files/templates/submission_listing.html b/files/templates/submission_listing.html index 5958538c2..c2e1fe313 100644 --- a/files/templates/submission_listing.html +++ b/files/templates/submission_listing.html @@ -193,7 +193,7 @@ {% if p.active_flags %}{{p.active_flags}} Reports{% endif %} {% if p.author.verified %} {% endif %} - @{{p.author.profile_url}}'s profile picture{{p.author.username}}{% if p.author.customtitle %}  {% if p.author.quadrant %}{{p.author.quadrant}} quadrant{% endif %}{{p.author.customtitle | safe}}{% endif %} + @{{p.author.profile_url}}'s profile picture{{p.author.username}}{% if p.author.customtitle %}  {% if p.author.quadrant %}{{p.author.quadrant}} quadrant{% endif %}{{p.author.customtitle | safe}}{% endif %}  {{p.age_string}}   ({% if p.is_image %}image post{% elif p.is_video %}video post{% elif p.realurl(v) %}{{p.domain}}{% else %}text post{% endif %}) diff --git a/files/templates/userpage.html b/files/templates/userpage.html index 74eaed0be..1062c5785 100644 --- a/files/templates/userpage.html +++ b/files/templates/userpage.html @@ -105,10 +105,10 @@
{{u.coins}} - {{'COINS_NAME' | app_config}}   + {{'COINS_NAME' | app_config}}   {{u.procoins}} - marseybux   + marseybux   {{u.stored_subscriber_count}} follower{{'s' if u.stored_subscriber_count != 1 else ''}}   @@ -380,10 +380,10 @@
{{u.coins}} - {{'COINS_NAME' | app_config}}   + {{'COINS_NAME' | app_config}}   {{u.procoins}} - marseybux   + marseybux   {{u.stored_subscriber_count}} follower{{'s' if u.stored_subscriber_count != 1 else ''}}