From b2cf24b947e672a9da75cc1313f0c92842c1a376 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Thu, 2 Sep 2021 22:33:48 +0200 Subject: [PATCH] fd --- files/helpers/markdown.py | 4 ++-- files/helpers/sanitize.py | 10 +++++----- files/templates/comments.html | 8 ++++---- files/templates/default.html | 2 +- files/templates/email/password_reset.html | 2 +- files/templates/errors/patron.html | 2 +- files/templates/expanded_image_modal.html | 4 ++-- files/templates/expanded_video_modal.html | 4 ++-- files/templates/formatting.html | 4 ++-- files/templates/header.html | 8 ++++---- files/templates/message.html | 4 ---- files/templates/submission.html | 10 +++++----- files/templates/submission_listing.html | 12 ++++++------ files/templates/userpage.html | 8 ++++---- 14 files changed, 39 insertions(+), 43 deletions(-) diff --git a/files/helpers/markdown.py b/files/helpers/markdown.py index e4663b8e3..2eb51b469 100644 --- a/files/helpers/markdown.py +++ b/files/helpers/markdown.py @@ -92,9 +92,9 @@ class CustomRenderer(HTMLRenderer): def render_sub_mention(self, token): space = token.target[0] target = token.target[1] - return f'{space}r/{target}' + return f'{space}r/{target}' def render_redditor_mention(self, token): space = token.target[0] target = token.target[1] - return f'{space}u/{target}' \ No newline at end of file + return f'{space}u/{target}' \ No newline at end of file diff --git a/files/helpers/sanitize.py b/files/helpers/sanitize.py index 26515bb43..918a06bf7 100644 --- a/files/helpers/sanitize.py +++ b/files/helpers/sanitize.py @@ -101,7 +101,7 @@ def a_modify(attrs, whatever): domain = parsed_url.netloc attrs[(None, "target")] = "_blank" if domain and not domain.endswith(domain): - attrs[(None, "rel")] = "nofollow noopener" + attrs[(None, "rel")] = "nofollow noopener noreferrer" # Force https for all external links in comments # (Website already forces its own https) @@ -162,13 +162,13 @@ def sanitize(sanitized, noimages=False): #print(tag.get('class')) # set classes and wrap in link - tag["rel"] = "nofollow" + tag["rel"] = "nofollow noopener noreferrer" tag["style"] = "max-height: 100px; max-width: 100%;" tag["class"] = "in-comment-image rounded-sm my-2" link = soup.new_tag("a") link["href"] = tag["src"] - link["rel"] = "nofollow noopener" + link["rel"] = "nofollow noopener noreferrer" link["target"] = "_blank" link["onclick"] = f"expandDesktopImage('{tag['src']}');" @@ -241,7 +241,7 @@ def sanitize(sanitized, noimages=False): for rd in ["https://reddit.com/", "https://new.reddit.com/", "https://www.reddit.com/", "https://redd.it/"]: sanitized = sanitized.replace(rd, "https://old.reddit.com/") - sanitized = re.sub(' (https:\/\/[^ <>]*)', r' \1', sanitized) - sanitized = re.sub('

(https:\/\/[^ <>]*)', r'

\1', sanitized) + sanitized = re.sub(' (https:\/\/[^ <>]*)', r' \1', sanitized) + sanitized = re.sub('

(https:\/\/[^ <>]*)', r'

\1', sanitized) return sanitized diff --git a/files/templates/comments.html b/files/templates/comments.html index bf07ee6b8..77a9bb425 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -60,7 +60,7 @@ {% endfor %}

- More comments + More comments
{% endif %} {% endif %} @@ -279,7 +279,7 @@ {% endif %} {% endif %} -
  • Context
  • +
  • Context
  • Copy link
  • {% if v %} @@ -406,7 +406,7 @@ {% endfor %}
    - More comments + More comments
    {% endif %} {% endif %} @@ -436,7 +436,7 @@
  • Copy link
  • -
  • Context
  • +
  • Context
  • Report
  • diff --git a/files/templates/default.html b/files/templates/default.html index 2d3e8bc46..34b73c8dc 100644 --- a/files/templates/default.html +++ b/files/templates/default.html @@ -1066,7 +1066,7 @@ - + {% include "header.html" %} diff --git a/files/templates/email/password_reset.html b/files/templates/email/password_reset.html index 249c4524b..9ec767ff5 100644 --- a/files/templates/email/password_reset.html +++ b/files/templates/email/password_reset.html @@ -14,7 +14,7 @@
    - Reset password + Reset password
    diff --git a/files/templates/errors/patron.html b/files/templates/errors/patron.html index 677366249..1a7668365 100644 --- a/files/templates/errors/patron.html +++ b/files/templates/errors/patron.html @@ -13,7 +13,7 @@

    401 Not Authorized

    This page is only available to {% if "rdrama" in request.host %}paypigs{% else %}patrons{% endif %}:

    - {{'GUMROAD_LINK' | app_config}} + {{'GUMROAD_LINK' | app_config}} diff --git a/files/templates/expanded_image_modal.html b/files/templates/expanded_image_modal.html index f60eb617d..1657726bd 100644 --- a/files/templates/expanded_image_modal.html +++ b/files/templates/expanded_image_modal.html @@ -6,11 +6,11 @@ diff --git a/files/templates/expanded_video_modal.html b/files/templates/expanded_video_modal.html index d6060adae..cb95a85ea 100644 --- a/files/templates/expanded_video_modal.html +++ b/files/templates/expanded_video_modal.html @@ -6,11 +6,11 @@ diff --git a/files/templates/formatting.html b/files/templates/formatting.html index 43ff72424..4b921e96e 100644 --- a/files/templates/formatting.html +++ b/files/templates/formatting.html @@ -133,12 +133,12 @@ We also have some custom hooks for mentioning users and subreddits. Note that th Subreddit Mention r/{{'SITE_NAME' | app_config}} - r/{{'SITE_NAME' | app_config}} + r/{{'SITE_NAME' | app_config}} Redditor Mention u/Bardfinn - u/Bardfinn + u/Bardfinn diff --git a/files/templates/header.html b/files/templates/header.html index 9c31bf8fc..b6ed0fc4f 100644 --- a/files/templates/header.html +++ b/files/templates/header.html @@ -104,9 +104,9 @@ Android app Rules Changelog - Source code + Source code Discord - Donate + Donate {% if 'rdrama' in request.host %}Archives{% endif %} Contact us @@ -160,9 +160,9 @@ - + - + {% if 'rdrama' in request.host %}{% endif %} diff --git a/files/templates/message.html b/files/templates/message.html index f14b00c38..35779c2fa 100644 --- a/files/templates/message.html +++ b/files/templates/message.html @@ -20,11 +20,7 @@

    {{title}}

    {{message if message else error}}
    - {% if link and link_text %} - {{link_text}} - {% else %} Go to homepage - {% endif %} diff --git a/files/templates/submission.html b/files/templates/submission.html index 6baa0012a..ef2f2efa0 100644 --- a/files/templates/submission.html +++ b/files/templates/submission.html @@ -233,7 +233,7 @@ {% if not p.is_image and p.thumb_url and not p.embed_url %}
    - Unable to load image + Unable to load image
    {% endif %} @@ -281,7 +281,7 @@ {% endif %} {% if p.realurl(v) %} -

    {{title | safe}}

    +

    {{title | safe}}

    {% else %}

    {{title | safe}}

    {% endif %} @@ -302,7 +302,7 @@
    
     
     							{% elif not p.embed_url and not p.is_image %}
    -							
    +							
     								
    {{p.domain|truncate(30, True)}} @@ -315,7 +315,7 @@ {% if p.is_image %}
    @@ -501,7 +501,7 @@ {% if not p.is_image %}
    - +
    {% endif %} diff --git a/files/templates/submission_listing.html b/files/templates/submission_listing.html index 4cf97761d..aee6be953 100644 --- a/files/templates/submission_listing.html +++ b/files/templates/submission_listing.html @@ -66,15 +66,15 @@
    {% if not p.url %} - + {% elif p.is_image %} - + {% else %} - + {% endif %} @@ -117,14 +117,14 @@   {{p.views}} views
    -
    +
    {{p.realtitle(v) | safe}}
    {% if p.thumb_url %}
    - post image + post image
    {% endif %} @@ -225,7 +225,7 @@