remotes/1693045480750635534/spooky-22
Aevann1 2022-03-21 22:56:43 +02:00
parent 5d8dde0ff9
commit ec80510e4b
14 changed files with 23 additions and 21 deletions

View File

@ -54,7 +54,7 @@ def notif_comment(text, autojanny=False):
def notif_comment2(p):
search_html = f'%</a> has mentioned you: <a href="/post/{p.id}" rel="nofollow">%'
search_html = f'%</a> has mentioned you: <a href="/post/{p.id}">%'
existing = g.db.query(Comment.id).filter(Comment.author_id == NOTIFICATIONS_ID, Comment.parent_submission == None, Comment.body_html.like(search_html)).first()

View File

@ -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'''<p><a href="/id/{u.id}"><img loading="lazy" src="/uid/{u.id}/pic" class="pp20">@{u.username}</a>''', 1)
sanitized = sanitized.replace(i.group(0), f'''<p><a href="/id/{u.id}"><img loading="lazy" src="/pp/{u.id}">@{u.username}</a>''', 1)
else:
sanitized = reddit_regex.sub(r'\1<a href="https://old.reddit.com/\2" rel="nofollow noopener noreferrer">/\2</a>', sanitized)
sanitized = sub_regex.sub(r'\1<a href="/\2" rel="nofollow noopener noreferrer">/\2</a>', sanitized)
sanitized = sub_regex.sub(r'\1<a href="/\2">/\2</a>', 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)}<a href="/id/{u.id}">@{u.username}</a>', 1)
else:
sanitized = sanitized.replace(i.group(0), f'''{i.group(1)}<a href="/id/{u.id}"><img loading="lazy" src="/uid/{u.id}/pic" class="pp20">@{u.username}</a>''', 1)
sanitized = sanitized.replace(i.group(0), f'''{i.group(1)}<a href="/id/{u.id}"><img loading="lazy" src="/pp/{u.id}">@{u.username}</a>''', 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"

View File

@ -884,6 +884,7 @@ def remove_follow(username, v):
return {"message": "Follower removed!"}
@app.get("/pp/<id>")
@app.get("/uid/<id>/pic")
@app.get("/uid/<id>/pic/profile")
@app.get("/logged_out/uid/<id>/pic")

View File

@ -15,7 +15,7 @@
{% if v %}
<style>:root{--primary:#{{v.themecolor}}}</style>
<link rel="stylesheet" href="/static/assets/css/main.css?v=182"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?v=30">
<link rel="stylesheet" href="/static/assets/css/main.css?v=183"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?v=30">
{% if v.agendaposter %}
<style>
html {
@ -39,7 +39,7 @@
{% endif %}
{% else %}
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
<link rel="stylesheet" href="/static/assets/css/main.css?v=182"><link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?v=30">
<link rel="stylesheet" href="/static/assets/css/main.css?v=183"><link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?v=30">
{% endif %}
</head>

View File

@ -7,7 +7,7 @@
<script src="/static/assets/js/bootstrap.js?v=245"></script>
{% if v %}
<style>:root{--primary:#{{v.themecolor}}}</style>
<link rel="stylesheet" href="/static/assets/css/main.css?v=182">
<link rel="stylesheet" href="/static/assets/css/main.css?v=183">
<link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?v=30">
{% if v.agendaposter %}
<style>
@ -32,7 +32,7 @@
{% endif %}
{% else %}
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
<link rel="stylesheet" href="/static/assets/css/main.css?v=182">
<link rel="stylesheet" href="/static/assets/css/main.css?v=183">
<link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?v=30">
{% endif %}

View File

@ -163,7 +163,7 @@ You can use Markdown formatting:
<tr>
<td>Username Mention</td>
<td>@QuadNarca</td>
<td><a class="d-inline-block" href="/@QuadNarca"><img alt="@QuadNarca profile picture" loading="lazy" src="/uid/29/pic" class="pp20">@QuadNarca</a></td>
<td><a class="d-inline-block" href="/@QuadNarca"><img alt="@QuadNarca profile picture" loading="lazy" src="/pp/29">@QuadNarca</a></td>
</tr>
<tr>
<td>Subreddit Mention</td>

View File

@ -6,7 +6,7 @@
{% block content %}
{% if v %}
<style>:root{--primary:#{{v.themecolor}}}</style>
<link rel="stylesheet" href="/static/assets/css/main.css?v=182"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?v=30">
<link rel="stylesheet" href="/static/assets/css/main.css?v=183"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?v=30">
{% if v.agendaposter %}
<style>
html {
@ -30,7 +30,7 @@
{% endif %}
{% else %}
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
<link rel="stylesheet" href="/static/assets/css/main.css?v=182"><link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?v=30">
<link rel="stylesheet" href="/static/assets/css/main.css?v=183"><link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?v=30">
{% endif %}
<div class="row justify-content-around">

View File

@ -18,7 +18,7 @@
{% endblock %}
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
<link rel="stylesheet" href="/static/assets/css/main.css?v=182">
<link rel="stylesheet" href="/static/assets/css/main.css?v=183">
<link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?v=30">
</head>

View File

@ -14,7 +14,7 @@
<title>2-Step Login - {{SITE_NAME}}</title>
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
<link rel="stylesheet" href="/static/assets/css/main.css?v=182"><link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?v=30">
<link rel="stylesheet" href="/static/assets/css/main.css?v=183"><link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?v=30">
</head>

View File

@ -34,7 +34,7 @@
<style>:root{--primary:#{{v.themecolor}}}</style>
<link rel="stylesheet" href="/static/assets/css/main.css?v=182"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?v=30">
<link rel="stylesheet" href="/static/assets/css/main.css?v=183"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?v=30">
{% if v.agendaposter %}
<style>
html {

View File

@ -39,10 +39,10 @@
{% if v %}
<style>:root{--primary:#{{v.themecolor}}}</style>
<link rel="stylesheet" href="/static/assets/css/main.css?v=182"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?v=30">
<link rel="stylesheet" href="/static/assets/css/main.css?v=183"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?v=30">
{% else %}
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
<link rel="stylesheet" href="/static/assets/css/main.css?v=182"><link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?v=30">
<link rel="stylesheet" href="/static/assets/css/main.css?v=183"><link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?v=30">
{% endif %}
</head>

View File

@ -31,7 +31,7 @@
<title>{% if ref_user %}{{ref_user.username}} invites you to {{SITE_NAME}}{% else %}Sign up - {{SITE_NAME}}{% endif %}</title>
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
<link rel="stylesheet" href="/static/assets/css/main.css?v=182"><link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?v=30">
<link rel="stylesheet" href="/static/assets/css/main.css?v=183"><link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?v=30">
</head>

View File

@ -32,7 +32,7 @@
<title>{% if ref_user %}{{ref_user.username}} invites you to {{SITE_NAME}}{% else %}{{SITE_NAME}}{% endif %}</title>
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
<link rel="stylesheet" href="/static/assets/css/main.css?v=182"><link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?v=30">
<link rel="stylesheet" href="/static/assets/css/main.css?v=183"><link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?v=30">
</head>

View File

@ -26,7 +26,7 @@
{% block stylesheets %}
{% if v %}
<style>:root{--primary:#{{v.themecolor}}}</style>
<link rel="stylesheet" href="/static/assets/css/main.css?v=182"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?v=30">
<link rel="stylesheet" href="/static/assets/css/main.css?v=183"><link rel="stylesheet" href="/static/assets/css/{{v.theme}}.css?v=30">
{% if v.agendaposter %}
<style>
html {
@ -50,7 +50,7 @@
{% endif %}
{% else %}
<style>:root{--primary:#{{config('DEFAULT_COLOR')}}</style>
<link rel="stylesheet" href="/static/assets/css/main.css?v=182">
<link rel="stylesheet" href="/static/assets/css/main.css?v=183">
<link rel="stylesheet" href="/static/assets/css/{{config('DEFAULT_THEME')}}.css?v=30">
{% endif %}
{% endblock %}