From ec80510e4b3cbd134c5916fac98243d0b87a4ccb Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Mon, 21 Mar 2022 22:56:43 +0200 Subject: [PATCH] fds --- files/helpers/alerts.py | 2 +- files/helpers/sanitize.py | 9 +++++---- files/routes/users.py | 1 + files/templates/authforms.html | 4 ++-- files/templates/default.html | 4 ++-- files/templates/formatting.html | 2 +- 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 ++-- 14 files changed, 23 insertions(+), 21 deletions(-) diff --git a/files/helpers/alerts.py b/files/helpers/alerts.py index 31138a7c6..476cc1d2e 100644 --- a/files/helpers/alerts.py +++ b/files/helpers/alerts.py @@ -54,7 +54,7 @@ def notif_comment(text, autojanny=False): def notif_comment2(p): - search_html = f'% has mentioned you: %' + search_html = f'% has mentioned you: %' existing = g.db.query(Comment.id).filter(Comment.author_id == NOTIFICATIONS_ID, Comment.parent_submission == None, Comment.body_html.like(search_html)).first() diff --git a/files/helpers/sanitize.py b/files/helpers/sanitize.py index 482d88921..8c565d70b 100644 --- a/files/helpers/sanitize.py +++ b/files/helpers/sanitize.py @@ -127,11 +127,11 @@ def sanitize(sanitized, noimages=False, alert=False, comment=False, edit=False): u = get_user(i.group(1), graceful=True) if u: - sanitized = sanitized.replace(i.group(0), f'''

@{u.username}''', 1) + sanitized = sanitized.replace(i.group(0), f'''

@{u.username}''', 1) else: sanitized = reddit_regex.sub(r'\1/\2', sanitized) - sanitized = sub_regex.sub(r'\1/\2', sanitized) + sanitized = sub_regex.sub(r'\1/\2', sanitized) captured = [] for i in mention_regex.finditer(sanitized): @@ -144,7 +144,7 @@ def sanitize(sanitized, noimages=False, alert=False, comment=False, edit=False): if noimages: sanitized = sanitized.replace(i.group(0), f'{i.group(1)}@{u.username}', 1) else: - sanitized = sanitized.replace(i.group(0), f'''{i.group(1)}@{u.username}''', 1) + sanitized = sanitized.replace(i.group(0), f'''{i.group(1)}@{u.username}''', 1) sanitized = imgur_regex.sub(r'\1_d.webp?maxwidth=9999&fidelity=high', sanitized) @@ -175,7 +175,7 @@ def sanitize(sanitized, noimages=False, alert=False, comment=False, edit=False): soup = BeautifulSoup(sanitized, 'lxml') for tag in soup.find_all("img"): - if tag.get("src") and tag.get("class") != ['pp20']: + if tag.get("src") and not tag["src"].startswith('/pp/'): tag["class"] = "in-comment-image" tag["loading"] = "lazy" tag["data-src"] = tag["src"] @@ -187,6 +187,7 @@ def sanitize(sanitized, noimages=False, alert=False, comment=False, edit=False): tag['referrerpolicy'] = "no-referrer" for tag in soup.find_all("a"): + del tag["rel"] if tag.get("href"): if not tag["href"].startswith(SITE_FULL) and not tag["href"].startswith('/') and not tag["href"].startswith(SITE_FULL2): tag["target"] = "_blank" diff --git a/files/routes/users.py b/files/routes/users.py index a3ce50806..3f67feb4c 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -884,6 +884,7 @@ def remove_follow(username, v): return {"message": "Follower removed!"} +@app.get("/pp/") @app.get("/uid//pic") @app.get("/uid//pic/profile") @app.get("/logged_out/uid//pic") diff --git a/files/templates/authforms.html b/files/templates/authforms.html index a9c6d6768..3072fe661 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 d476bdb21..edc427c58 100644 --- a/files/templates/default.html +++ b/files/templates/default.html @@ -7,7 +7,7 @@ {% if v %} - + {% if v.agendaposter %} - + {% endif %} diff --git a/files/templates/formatting.html b/files/templates/formatting.html index cdaf2186d..b7d2316bc 100644 --- a/files/templates/formatting.html +++ b/files/templates/formatting.html @@ -163,7 +163,7 @@ You can use Markdown formatting: Username Mention @QuadNarca - @QuadNarca profile picture@QuadNarca + @QuadNarca profile picture@QuadNarca Subreddit Mention diff --git a/files/templates/log.html b/files/templates/log.html index 044aff6f3..d5921093d 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 055202ba0..3d2d81879 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 e15b9b5c0..53e73004a 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 ef9f7d8bb..a2d5bd952 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 1365f4c97..6f4d60cbf 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 63bc074bb..e2472d112 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 c9df6be65..7939a6908 100644 --- a/files/templates/submit.html +++ b/files/templates/submit.html @@ -26,7 +26,7 @@ {% block stylesheets %} {% if v %} - + {% if v.agendaposter %} - + {% endif %} {% endblock %}