From 5d4b09ef620e4caa84da4bbba3f173e3abe4c820 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Wed, 23 Feb 2022 07:02:07 +0200 Subject: [PATCH] fd --- files/classes/user.py | 2 +- files/helpers/alerts.py | 2 +- files/helpers/filters.py | 2 +- files/helpers/sanitize.py | 6 +-- files/routes/posts.py | 2 +- files/routes/settings.py | 1 - files/templates/admins.html | 2 +- files/templates/agendaposters.html | 2 +- files/templates/banned.html | 4 +- files/templates/comments.html | 2 +- files/templates/followers.html | 2 +- files/templates/following.html | 2 +- files/templates/grassed.html | 2 +- files/templates/leaderboard.html | 56 ++++++++++++------------- files/templates/marseys.html | 2 +- files/templates/patrons.html | 2 +- files/templates/rentoids.html | 2 +- files/templates/settings_blocks.html | 2 +- files/templates/shadowbanned.html | 2 +- files/templates/sub/blockers.html | 2 +- files/templates/sub/exilees.html | 4 +- files/templates/sub/mods.html | 2 +- files/templates/submission.html | 2 +- files/templates/submission_listing.html | 2 +- files/templates/thiefs.html | 6 +-- files/templates/user_listing.html | 2 +- files/templates/userpage.html | 4 +- files/templates/viewers.html | 2 +- files/templates/voters.html | 4 +- files/templates/votes.html | 4 +- 30 files changed, 65 insertions(+), 66 deletions(-) diff --git a/files/classes/user.py b/files/classes/user.py index 84e4f9dcd3..4edf46f2e4 100644 --- a/files/classes/user.py +++ b/files/classes/user.py @@ -214,7 +214,7 @@ class User(Base): @property @lazy def paid_dues(self): - return self.admin_level > 1 or self.club_allowed or self.truecoins > int(environ.get("DUES").strip()) and self.club_allowed != False + return self.admin_level > 1 or self.patron > 1 or self.club_allowed in {True,None} or self.truecoins > int(environ.get("DUES").strip()) def any_block_exists(self, other): diff --git a/files/helpers/alerts.py b/files/helpers/alerts.py index ad82c84b46..840560f527 100644 --- a/files/helpers/alerts.py +++ b/files/helpers/alerts.py @@ -67,7 +67,7 @@ def NOTIFY_USERS(text, v): if id == 0: continue if word in text.lower() and id not in notify_users and v.id != id: notify_users.add(id) - soup = BeautifulSoup(text, features="html.parser") + soup = BeautifulSoup(text, 'xml') for mention in soup.find_all("a", href=re.compile("^\/id\/([0-9]+)")): id = int(mention["href"].split("/id/")[1]) if id != v.id: diff --git a/files/helpers/filters.py b/files/helpers/filters.py index bcfb2b086d..dbde828983 100644 --- a/files/helpers/filters.py +++ b/files/helpers/filters.py @@ -5,7 +5,7 @@ from files.classes import BannedDomain def filter_comment_html(html_text): - soup = BeautifulSoup(html_text, features="html.parser") + soup = BeautifulSoup(html_text, 'xml') links = soup.find_all("a") diff --git a/files/helpers/sanitize.py b/files/helpers/sanitize.py index 60f9adc13e..d662c0fb4b 100644 --- a/files/helpers/sanitize.py +++ b/files/helpers/sanitize.py @@ -126,7 +126,7 @@ def sanitize(sanitized, noimages=False, alert=False, comment=False, edit=False): for i in re.finditer("

@((\w|-){1,25})", sanitized, re.A): u = get_user(i.group(1), graceful=True) if u: - sanitized = sanitized.replace(i.group(0), f'''

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

@{u.username}''', 1) else: sanitized = re.sub('(^|\s|\n|

)\/?((r|u)\/(\w|-){3,25})', r'\1/\2', sanitized, re.A) @@ -139,7 +139,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}'s profile picture@{u.username}''', 1) + sanitized = sanitized.replace(i.group(0), f'''{i.group(1)}@{u.username}''', 1) for i in re.finditer('https://i\.imgur\.com/(([^_]*?)\.(jpg|png|jpeg))(?!)', sanitized): @@ -168,7 +168,7 @@ def sanitize(sanitized, noimages=False, alert=False, comment=False, edit=False): ] ).clean(sanitized) - soup = BeautifulSoup(sanitized, features="html.parser") + soup = BeautifulSoup(sanitized, 'xml') for tag in soup.find_all("img"): if tag.get("src") and tag.get("class") != ['pp20']: diff --git a/files/routes/posts.py b/files/routes/posts.py index 5ac5e876b4..f663a40eb7 100644 --- a/files/routes/posts.py +++ b/files/routes/posts.py @@ -670,7 +670,7 @@ def thumbnail_thread(pid): if x.headers.get("Content-Type","").startswith("text/html"): - soup=BeautifulSoup(x.content, 'html.parser') + soup=BeautifulSoup(x.content, 'xml') thumb_candidate_urls=[] diff --git a/files/routes/settings.py b/files/routes/settings.py index 93af1791f6..ea1ea70251 100644 --- a/files/routes/settings.py +++ b/files/routes/settings.py @@ -483,7 +483,6 @@ def gumroad(v): v.procoins += procoins send_repeatable_notification(v.id, f"You have received {procoins} Marseybux! You can use them to buy awards in the [shop](/shop).") - if v.truecoins > 150 and v.patron: v.cluballowed = True if v.patron > 1 and v.verified == None: v.verified = "Verified" g.db.add(v) diff --git a/files/templates/admins.html b/files/templates/admins.html index 7b14da7296..26bc6f4817 100644 --- a/files/templates/admins.html +++ b/files/templates/admins.html @@ -22,7 +22,7 @@ {% for user in admins %} {{loop.index}} - @{{user.username}}'s profile picture{{user.username}}{% if user.admin_level == 1 and v and v.admin_level > 1 %}{% endif %} + {{user.username}}{% if user.admin_level == 1 and v and v.admin_level > 1 %}{% endif %} {{user.truecoins}} {{user.modaction_num}} diff --git a/files/templates/agendaposters.html b/files/templates/agendaposters.html index 53d43e2718..5c30b759b9 100644 --- a/files/templates/agendaposters.html +++ b/files/templates/agendaposters.html @@ -11,7 +11,7 @@ {% for user in users %} {{loop.index}} - @{{user.username}}'s profile picture{{user.username}} + {{user.username}} {% endfor %} diff --git a/files/templates/banned.html b/files/templates/banned.html index b6362adc83..8a1fd8b4b2 100644 --- a/files/templates/banned.html +++ b/files/templates/banned.html @@ -13,9 +13,9 @@ {% for user in users %} {{loop.index}} - @{{user.username}}'s profile picture{{user.username}} + {{user.username}} {% if user.ban_reason %}{{user.ban_reason}}{% endif %} - @{{user.banned_by.username}}'s profile picture{{user.banned_by.username}} + {{user.banned_by.username}} {% endfor %} diff --git a/files/templates/comments.html b/files/templates/comments.html index 9190c8b3d8..82e1c17e33 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -223,7 +223,7 @@ {% if not c.author %} {{c.print()}} {% endif %} - @{{c.author_name}}'s profile picture{{c.author_name}} + {{c.author_name}} {% if c.author.customtitle %}  {% if c.author.quadrant %}{{c.author.quadrant}} quadrant{% endif %}{{c.author.customtitle | safe}}{% endif %} {% endif %} diff --git a/files/templates/followers.html b/files/templates/followers.html index b876e794cd..b8babe243b 100644 --- a/files/templates/followers.html +++ b/files/templates/followers.html @@ -21,7 +21,7 @@ {% for user in users %} {{loop.index}} - @{{user.username}}'s profile picture{{user.username}} + {{user.username}} {% if v.id == u.id %}

Remove follow
{% endif %} diff --git a/files/templates/following.html b/files/templates/following.html index 3c44eb0ae8..1cddc85efa 100644 --- a/files/templates/following.html +++ b/files/templates/following.html @@ -21,7 +21,7 @@ {% for user in users %} {{loop.index}} - @{{user.username}}'s profile picture{{user.username}} + {{user.username}} {% if v.id == u.id %}
Unfollow
{% endif %} diff --git a/files/templates/grassed.html b/files/templates/grassed.html index d104ff55cb..ce953d3742 100644 --- a/files/templates/grassed.html +++ b/files/templates/grassed.html @@ -13,7 +13,7 @@ {% for user in users %} {{loop.index}} - @{{user.username}}'s profile picture{{user.username}} + {{user.username}} {{user.ban_reason.split('by ')[1]}} {% endfor %} diff --git a/files/templates/leaderboard.html b/files/templates/leaderboard.html index 7d03c6cc31..c3c9a2b1cb 100644 --- a/files/templates/leaderboard.html +++ b/files/templates/leaderboard.html @@ -17,14 +17,14 @@ {% for user in users1 %} {{loop.index}} - @{{user.username}}'s profile picture{{user.username}} + {{user.username}} {{user.coins}} {% endfor %} {% if pos1 > 25 %} {{pos1}} - @{{v.username}}'s profile picture{{v.username}} + {{v.username}} {{v.coins}} {% endif %} @@ -52,14 +52,14 @@ {% for user in users7 %} {{loop.index}} - @{{user.username}}'s profile picture{{user.username}} + {{user.username}} {{user.coins_spent}} {% endfor %} {% if pos7 > 25 %} {{pos7}} - @{{v.username}}'s profile picture{{v.username}} + {{v.username}} {{v.coins_spent}} {% endif %} @@ -87,14 +87,14 @@ {% for user in users10 %} {{loop.index}} - @{{user.username}}'s profile picture{{user.username}} + {{user.username}} {{user.truecoins}} {% endfor %} {% if pos10 > 25 %} {{pos10}} - @{{v.username}}'s profile picture{{v.username}} + {{v.username}} {{v.truecoins}} {% endif %} @@ -121,14 +121,14 @@ {% for user in users2 %} {{loop.index}} - @{{user.username}}'s profile picture{{user.username}} + {{user.username}} {{user.stored_subscriber_count}} {% endfor %} {% if pos2 > 25 %} {{pos2}} - @{{v.username}}'s profile picture{{v.username}} + {{v.username}} {{v.stored_subscriber_count}} {% endif %} @@ -153,14 +153,14 @@ {% for user in users3 %} {{loop.index}} - @{{user.username}}'s profile picture{{user.username}} + {{user.username}} {{user.post_count}} {% endfor %} {% if pos3 > 25 %} {{pos3}} - @{{v.username}}'s profile picture{{v.username}} + {{v.username}} {{v.post_count}} {% endif %} @@ -185,14 +185,14 @@ {% for user in users4 %} {{loop.index}} - @{{user.username}}'s profile picture{{user.username}} + {{user.username}} {{user.comment_count}} {% endfor %} {% if pos4 > 25 %} {{pos4}} - @{{v.username}}'s profile picture{{v.username}} + {{v.username}} {{v.comment_count}} {% endif %} @@ -219,14 +219,14 @@ {% for user in users5 %} {{loop.index}} - @{{user.username}}'s profile picture{{user.username}} + {{user.username}} {{user.received_award_count}} {% endfor %} {% if pos5 > 25 %} {{pos5}} - @{{v.username}}'s profile picture{{v.username}} + {{v.username}} {{v.received_award_count}} {% endif %} @@ -255,14 +255,14 @@ {% for user in users9 %} {{loop.index}} - @{{user[0].username}}'s profile picture{{user[0].username}} + {{user[0].username}} {{user[1]}} {% endfor %} {% if pos9 and (pos9[0] > 25 or not pos9[1]) %} {{pos9[0]}} - @{{v.username}}'s profile picture{{v.username}} + {{v.username}} {{pos9[1]}} {% endif %} @@ -292,14 +292,14 @@ {% for user in users11 %} {{loop.index}} - @{{user[0].username}}'s profile picture{{user[0].username}} + {{user[0].username}} {{user[1]}} {% endfor %} {% if pos11 and (pos11[0] > 25 or not pos11[1]) %} {{pos11[0]}} - @{{v.username}}'s profile picture{{v.username}} + {{v.username}} {{pos11[1]}} {% endif %} @@ -329,14 +329,14 @@ {% for user in users6 %} {{loop.index}} - @{{user.username}}'s profile picture{{user.username}} + {{user.username}} {{user.basedcount}} {% endfor %} {% if pos6 > 25 %} {{pos6}} - @{{v.username}}'s profile picture{{v.username}} + {{v.username}} {{v.basedcount}} {% endif %} @@ -366,14 +366,14 @@ {% for user in users12 %} {{loop.index}} - @{{user[0].username}}'s profile picture{{user[0].username}} + {{user[0].username}} {{user[1]}} {% endfor %} {% if pos12 and (pos12[0] > 25 or not pos12[1]) %} {{pos12[0]}} - @{{v.username}}'s profile picture{{v.username}} + {{v.username}} {{pos12[1]}} {% endif %} @@ -404,14 +404,14 @@ {% for user in users13 %} {{loop.index}} - @{{user[0].username}}'s profile picture{{user[0].username}} + {{user[0].username}} {{user[1]}} {% endfor %} {% if pos13 and (pos13[0] > 25 or not pos13[1]) %} {{pos13[0]}} - @{{v.username}}'s profile picture{{v.username}} + {{v.username}} {{pos13[1]}} {% endif %} @@ -432,14 +432,14 @@ {% for user in users14 %} {{loop.index}} - @{{user.username}}'s profile picture{{user.username}} + {{user.username}} {{user.winnings}} {% endfor %} {% if pos14 > 25 %} {{pos14}} - @{{v.username}}'s profile picture{{v.username}} + {{v.username}} {{v.winnings}} {% endif %} @@ -463,14 +463,14 @@ {% for user in users15 %} {{loop.index}} - @{{user.username}}'s profile picture{{user.username}} + {{user.username}} {{user.winnings}} {% endfor %} {% if pos15 > 25 %} {{pos15}} - @{{v.username}}'s profile picture{{v.username}} + {{v.username}} {{v.winnings}} {% endif %} diff --git a/files/templates/marseys.html b/files/templates/marseys.html index 79f9e974e5..a8f8fd9093 100644 --- a/files/templates/marseys.html +++ b/files/templates/marseys.html @@ -22,7 +22,7 @@ {{marsey.name}} :{{marsey.name}}: {{marsey.count}} - @{{author.username}}'s profile picture{{author.username}} + {{author.username}} {% endfor %} {% else %} diff --git a/files/templates/patrons.html b/files/templates/patrons.html index 08b1142a0b..5a4ecb1314 100644 --- a/files/templates/patrons.html +++ b/files/templates/patrons.html @@ -12,7 +12,7 @@ {% for u in users %} {{loop.index}} - @{{u.username}}'s profile picture{{u.username}} + {{u.username}} 2{{u.patron}} diff --git a/files/templates/rentoids.html b/files/templates/rentoids.html index 84b499c709..72dd805de7 100644 --- a/files/templates/rentoids.html +++ b/files/templates/rentoids.html @@ -13,7 +13,7 @@ {% for user in users %} {{loop.index}} - @{{user.username}}'s profile picture{{user.username}} + {{user.username}} {% endfor %} diff --git a/files/templates/settings_blocks.html b/files/templates/settings_blocks.html index ed20e75181..705648c2ec 100644 --- a/files/templates/settings_blocks.html +++ b/files/templates/settings_blocks.html @@ -59,7 +59,7 @@ - @{{block.target.username}}'s profile picture@{{block.target.username}} + @{{block.target.username}} {{block.created_date}} diff --git a/files/templates/shadowbanned.html b/files/templates/shadowbanned.html index 79803af071..72e86f95b0 100644 --- a/files/templates/shadowbanned.html +++ b/files/templates/shadowbanned.html @@ -14,7 +14,7 @@ {% for user in users %} {{loop.index}} - @{{user.username}}'s profile picture{{user.username}} + {{user.username}} {{user.shadowbanned}} {% endfor %} diff --git a/files/templates/sub/blockers.html b/files/templates/sub/blockers.html index 4e825b00d4..8a3b0a95a8 100644 --- a/files/templates/sub/blockers.html +++ b/files/templates/sub/blockers.html @@ -16,7 +16,7 @@ {% for user in users %} {{loop.index}} - @{{user.username}}'s profile picture{{user.username}} + {{user.username}} {% endfor %} diff --git a/files/templates/sub/exilees.html b/files/templates/sub/exilees.html index ac717ed459..bf5531350e 100644 --- a/files/templates/sub/exilees.html +++ b/files/templates/sub/exilees.html @@ -18,8 +18,8 @@ {% set exiler=exile.exiler %} {{loop.index}} - @{{user.username}}'s profile picture{{user.username}} - @{{exiler.username}}'s profile picture{{exiler.username}} + {{user.username}} + {{exiler.username}} {% endfor %} diff --git a/files/templates/sub/mods.html b/files/templates/sub/mods.html index 0f5d8c52d7..57bf127a6d 100644 --- a/files/templates/sub/mods.html +++ b/files/templates/sub/mods.html @@ -18,7 +18,7 @@ {% for user, mod in users %} {{loop.index}} - @{{user.username}}'s profile picture{{user.username}} + {{user.username}} {{mod.created_datetime}} {% if v.id == user.id or v.mod_date(sub.name) and v.mod_date(sub.name) < mod.created_utc %} diff --git a/files/templates/submission.html b/files/templates/submission.html index 6d05256ef3..8e9accb0a4 100644 --- a/files/templates/submission.html +++ b/files/templates/submission.html @@ -735,7 +735,7 @@ {% if p.author.verified %} {% endif %} - @{{p.author_name}}'s profile picture{{p.author_name}}{% if p.author.customtitle %}  {% if p.author.quadrant %}{{p.author.quadrant}} quadrant{% endif %}{{p.author.customtitle | safe}}{% endif %} + {{p.author_name}}{% if p.author.customtitle %}  {% if p.author.quadrant %}{{p.author.quadrant}} quadrant{% endif %}{{p.author.customtitle | safe}}{% endif %} {% 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/submission_listing.html b/files/templates/submission_listing.html index 14a1d8c79a..658378c117 100644 --- a/files/templates/submission_listing.html +++ b/files/templates/submission_listing.html @@ -200,7 +200,7 @@ {% if p.author.verified %} {% endif %} - @{{p.author_name}}'s profile picture{{p.author_name}}{% if p.author.customtitle %}  {% if p.author.quadrant %}{{p.author.quadrant}} quadrant{% endif %}{{p.author.customtitle | safe}}{% endif %} + {{p.author_name}}{% if p.author.customtitle %}  {% if p.author.quadrant %}{{p.author.quadrant}} quadrant{% endif %}{{p.author.customtitle | safe}}{% endif %} {% endif %}  {{p.age_string}}   diff --git a/files/templates/thiefs.html b/files/templates/thiefs.html index 9b4b0d3014..b05694f973 100644 --- a/files/templates/thiefs.html +++ b/files/templates/thiefs.html @@ -13,7 +13,7 @@ {% for user in successful %} {{loop.index}} - @{{user.username}}'s profile picture{{user.username}} + {{user.username}} {% endfor %} @@ -31,7 +31,7 @@ {% for user in failed2 %} {{loop.index}} - @{{user.username}}'s profile picture{{user.username}} + {{user.username}} {% endfor %} @@ -49,7 +49,7 @@ {% for user in failed %} {{loop.index}} - @{{user.username}}'s profile picture{{user.username}} + {{user.username}} {% endfor %} diff --git a/files/templates/user_listing.html b/files/templates/user_listing.html index 30b0f28e0a..040a8ca0ac 100644 --- a/files/templates/user_listing.html +++ b/files/templates/user_listing.html @@ -5,7 +5,7 @@
@{{u.username}} user banner - @{{u.username}}'s profile picture
+
diff --git a/files/templates/userpage.html b/files/templates/userpage.html index 0b68ed7aef..772cac8c81 100644 --- a/files/templates/userpage.html +++ b/files/templates/userpage.html @@ -39,7 +39,7 @@
- @{{u.username}}'s profile picture +
{% if u.is_suspended %} @@ -363,7 +363,7 @@
- @{{u.username}}'s profile picture +
{% if u.is_suspended %} diff --git a/files/templates/viewers.html b/files/templates/viewers.html index 168aaa4e65..64da52856e 100644 --- a/files/templates/viewers.html +++ b/files/templates/viewers.html @@ -12,7 +12,7 @@ {% for view in viewers %} - @{{view.viewer.username}}'s profile picture{{view.viewer.username}} + {{view.viewer.username}} {{view.last_view_string}} {% endfor %} diff --git a/files/templates/voters.html b/files/templates/voters.html index bca565605f..f5f1b35bc9 100644 --- a/files/templates/voters.html +++ b/files/templates/voters.html @@ -18,14 +18,14 @@ {% for user in users %} {{loop.index}} - @{{user[0].username}}'s profile picture{{user[0].username}} + {{user[0].username}} {{user[1]}} {% endfor %} {% if pos and (pos[0] > 25 or not pos[1]) %} {{pos[0]}} - @{{v.username}}'s profile picture{{v.username}} + {{v.username}} {{pos[1]}} {% endif %} diff --git a/files/templates/votes.html b/files/templates/votes.html index 549cf9ad56..f2729b69af 100644 --- a/files/templates/votes.html +++ b/files/templates/votes.html @@ -23,7 +23,7 @@ User {% for vote in ups %} - @{{vote.user.username}}'s profile picture{{vote.user.username}} + {{vote.user.username}} {% endfor %} @@ -32,7 +32,7 @@ User {% for vote in downs %} - @{{vote.user.username}}'s profile picture{{vote.user.username}} + {{vote.user.username}} {% endfor %}