remove referrer from html tags

remotes/1693176582716663532/tmp_refs/heads/watchparty
Aevann1 2022-10-29 23:42:30 +02:00
parent 3bd8384c05
commit 06314f92b1
21 changed files with 27 additions and 31 deletions

File diff suppressed because one or more lines are too long

View File

@ -5,5 +5,5 @@ this.addEventListener('pointerover',LiteYTEmbed.warmConnections,{once:!0});this.
static addPrefetch(kind,url,as){const linkEl=document.createElement('link');linkEl.rel=kind;linkEl.href=url;if(as){linkEl.as=as}
document.head.append(linkEl)}
static warmConnections(){if(LiteYTEmbed.preconnected)return;LiteYTEmbed.addPrefetch('preconnect','https://www.youtube-nocookie.com');LiteYTEmbed.addPrefetch('preconnect','https://www.google.com');LiteYTEmbed.addPrefetch('preconnect','https://googleads.g.doubleclick.net');LiteYTEmbed.addPrefetch('preconnect','https://static.doubleclick.net');LiteYTEmbed.preconnected=!0}
addIframe(){if(this.classList.contains('lyt-activated'))return;this.classList.add('lyt-activated');const params=new URLSearchParams(this.getAttribute('params')||[]);params.append('autoplay','1');const iframeEl=document.createElement('iframe');iframeEl.width=560;iframeEl.height=315;iframeEl.sandbox='allow-scripts allow-same-origin allow-popups';iframeEl.title=this.playLabel;iframeEl.allow='accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture';iframeEl.allowFullscreen=!0;iframeEl.src=`https://www.youtube-nocookie.com/embed/${encodeURIComponent(this.videoId)}?${params.toString()}`;iframeEl.referrerPolicy="no-referrer";this.append(iframeEl);iframeEl.focus()}}
addIframe(){if(this.classList.contains('lyt-activated'))return;this.classList.add('lyt-activated');const params=new URLSearchParams(this.getAttribute('params')||[]);params.append('autoplay','1');const iframeEl=document.createElement('iframe');iframeEl.width=560;iframeEl.height=315;iframeEl.sandbox='allow-scripts allow-same-origin allow-popups';iframeEl.title=this.playLabel;iframeEl.allow='accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture';iframeEl.allowFullscreen=!0;iframeEl.src=`https://www.youtube-nocookie.com/embed/${encodeURIComponent(this.videoId)}?${params.toString()}`;this.append(iframeEl);iframeEl.focus()}}
customElements.define('lite-youtube',LiteYTEmbed)

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -46,7 +46,6 @@ def allowed_attributes(tag, name, value):
if name == 'data-bs-toggle' and value == 'tooltip': return True
if name in ['g','b','glow'] and not value: return True
if name in ['alt','title']: return True
if name == 'referrerpolicy' and value == 'no-referrer': return True
return False
if tag == 'lite-youtube':
@ -272,9 +271,6 @@ def sanitize(sanitized, golden=True, limit_pings=0, showmore=True, count_marseys
tag["src"] = "/i/l.webp"
tag['alt'] = f'![]({tag["data-src"]})'
if not is_site_url(tag["data-src"]):
tag['referrerpolicy'] = "no-referrer"
if tag.parent.name != 'a':
a = soup.new_tag("a", href=tag["data-src"])
if not is_site_url(a["href"]):

View File

@ -162,7 +162,7 @@
<a class="user-name text-decoration-none" href="{{c.author.url}}" data-pop-info='{{c.author.json_popover(v) | tojson}}' onclick='popclick(event)' data-bs-placement="bottom" data-bs-toggle="popover" data-bs-trigger="click" data-content-id="popover" tabindex="0" style="color:#{{c.author.name_color}}; font-size:12px; font-weight:bold;">
<div class="profile-pic-30-wrapper">
<img referrerpolicy="no-referrer" loading="lazy" src="{{c.author.profile_url}}" class="profile-pic-30 mr-2">
<img loading="lazy" src="{{c.author.profile_url}}" class="profile-pic-30 mr-2">
{% if c.author.hat_active -%}
<img class="profile-pic-30-hat hat" loading="lazy" src="{{c.author.hat_active}}?h=7" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{c.author.hat_tooltip(v)}}">
{%- endif %}

View File

@ -4,7 +4,7 @@
<div class="modal-body text-center p-0">
<div class="d-inline-block position-relative">
<a href="/" rel="nofollow noopener noreferrer" target="_blank" id="desktop-expanded-image-wrap-link">
<img loading="lazy" alt="expanded image" referrerpolicy="no-referrer" src="" class="img-fluid rounded" id="desktop-expanded-image" style="min-width: 250px;min-width: min(250px,50vw);max-height:90vh;border:5px white solid">
<img loading="lazy" alt="expanded image" src="" class="img-fluid rounded" id="desktop-expanded-image" style="min-width: 250px;min-width: min(250px,50vw);max-height:90vh;border:5px white solid">
</a>
</div>
</div>

View File

@ -61,7 +61,7 @@ Text 2
<tr>
<td>Images (will embed automatically if from <a href="#approved">approved hosts</a>)</td>
<td>https://i.imgur.com/SwVuagI_d.webp</td>
<td><img loading="lazy" alt="example image" referrerpolicy="no-referrer" src="https://i.imgur.com/SwVuagI_d.webp"></td>
<td><img loading="lazy" alt="example image" src="https://i.imgur.com/SwVuagI_d.webp"></td>
</tr>
<tr>
<td>Youtube Videos</td>
@ -517,10 +517,10 @@ line breaks
<tr>
<td>Images</td>
<td>
&lt;img referrerpolicy="no-referrer" src="https://i.imgur.com/SwVuagI_d.webp" width="200"&gt;
&lt;img src="https://i.imgur.com/SwVuagI_d.webp" width="200"&gt;
</td>
<td>
<img loading="lazy" alt="example image" referrerpolicy="no-referrer" src="https://i.imgur.com/SwVuagI_d.webp" width="200">
<img loading="lazy" alt="example image" src="https://i.imgur.com/SwVuagI_d.webp" width="200">
</td>
</tr>
</tbody>

View File

@ -108,7 +108,7 @@
<tr>
<td>
<div class="profile-pic-75-wrapper mt-4">
<img referrerpolicy="no-referrer" loading="lazy" alt="avatar" src="{{v.profile_url}}" class="profile-pic-75">
<img loading="lazy" alt="avatar" src="{{v.profile_url}}" class="profile-pic-75">
<img loading="lazy" alt="{{hat.name}}" class="profile-pic-75-hat" src="/i/hats/{{hat.name}}.webp?h=7">
</div>
</td>

View File

@ -218,7 +218,7 @@
aria-haspopup="true" aria-expanded="false">
<div class="d-flex">
<div class="profile-pic-35-wrapper">
<img referrerpolicy="no-referrer" loading="lazy" src="{{v.profile_url}}" class="profile-pic-35">
<img loading="lazy" src="{{v.profile_url}}" class="profile-pic-35">
{% if v.hat_active -%}
<img id="profile-pic-35-hat" class="profile-pic-35-hat hat" loading="lazy" src="{{v.hat_active}}?h=7">
{% elif request.path == '/hats' %}

View File

@ -53,7 +53,7 @@
<tbody>
{% for id, link, thumb, name, title, viewers in live %}
<tr onclick="go_to(event,'{{link}}')">
<td width="48"><img loading="lazy" class="thumb" src="{{thumb}}" alt="{{name}} thumbnail" referrerpolicy="no-referrer" width="48"></td>
<td width="48"><img loading="lazy" class="thumb" src="{{thumb}}" alt="{{name}} thumbnail" width="48"></td>
<td>{{name}}</td>
<td>{{title}}</td>
<td>{{viewers}} watching</td>
@ -78,7 +78,7 @@
<tbody>
{% for id, link, thumb, name, minutes, actual, views in offline %}
<tr onclick="go_to(event,'{{link}}')">
<td width="48"><img loading="lazy" class="thumb" src="{{thumb}}" alt="{{name}} thumbnail" referrerpolicy="no-referrer" width="48"></td>
<td width="48"><img loading="lazy" class="thumb" src="{{thumb}}" alt="{{name}} thumbnail" width="48"></td>
<td>{{name}}</td>
<td>{{actual}} ago</td>
<td>{{views}} views</td>

View File

@ -86,7 +86,7 @@
<div class="d-flex align-items-center">
<span class="rounded">
<div class="profile-pic-35-wrapper">
<img referrerpolicy="no-referrer" loading="lazy" src="{{ma.user.profile_url}}" alt="avatar" class="profile-pic-35">
<img loading="lazy" src="{{ma.user.profile_url}}" alt="avatar" class="profile-pic-35">
{% if ma.user.hat_active -%}
<img id="profile-pic-35-hat" class="profile-pic-35-hat hat" loading="lazy" src="{{ma.user.hat_active}}?h=7" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{ma.user.hat_tooltip(v)}}">
{%- endif %}

View File

@ -74,7 +74,7 @@
<div class="d-flex align-items-center">
<span class="rounded">
<div class="profile-pic-35-wrapper">
<img referrerpolicy="no-referrer" loading="lazy" src="{{ma.user.profile_url}}" alt="avatar" class="profile-pic-35">
<img loading="lazy" src="{{ma.user.profile_url}}" alt="avatar" class="profile-pic-35">
{% if ma.user.hat_active -%}
<img id="profile-pic-35-hat" class="profile-pic-35-hat hat" loading="lazy" src="{{ma.user.hat_active}}?h=7" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{ma.user.hat_tooltip(v)}}">
{%- endif %}

View File

@ -3,7 +3,7 @@
<img loading="lazy" class="pop-banner w-100 h-64 object-cover">
<div class="d-flex align-items-end px-3 mt-n6 mb-3">
<div class="profile-pic-75-wrapper">
<img referrerpolicy="no-referrer" loading="lazy" class="pop-picture profile-pic-75">
<img loading="lazy" class="pop-picture profile-pic-75">
<img class="pop-hat profile-pic-75-hat hat" loading="lazy">
</div>
<div class="px-3 text-truncate">

View File

@ -211,7 +211,7 @@
<div class="d-flex">
<div class="title w-lg-25 text-md-center">
<img referrerpolicy="no-referrer" loading="lazy" alt="your profile picture" src="{{v.profile_url}}" class="profile-pic-75">
<img loading="lazy" alt="your profile picture" src="{{v.profile_url}}" class="profile-pic-75">
</div>
<div class="body w-lg-100 my-auto">

View File

@ -672,7 +672,7 @@
{% endif %}
<a class="user-name text-decoration-none" href="{{p.author.url}}" data-pop-info='{{p.author.json_popover(v) | tojson}}' onclick='popclick(event)' data-bs-placement="bottom" data-bs-toggle="popover" data-bs-trigger="click" data-content-id="popover" tabindex="0" style="color: #{{p.author.name_color}}; font-weight: bold"class="user-name">
<div class="profile-pic-30-wrapper">
<img referrerpolicy="no-referrer" loading="lazy" src="{{p.author.profile_url}}" class="profile-pic-30 mr-2">
<img loading="lazy" src="{{p.author.profile_url}}" class="profile-pic-30 mr-2">
{% if p.author.hat_active -%}
<img class="profile-pic-30-hat hat" loading="lazy" src="{{p.author.hat_active}}?h=7" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{p.author.hat_tooltip(v)}}">
{%- endif %}

View File

@ -169,7 +169,7 @@
{% endif %}
<a class="user-name text-decoration-none" href="{{p.author.url}}" data-pop-info='{{p.author.json_popover(v) | tojson}}' onclick='popclick(event)' data-bs-placement="bottom" data-bs-toggle="popover" data-bs-trigger="click" data-content-id="popover" tabindex="0" style="color: #{{p.author.name_color}}; font-weight: bold;">
<div class="profile-pic-30-wrapper" style="margin-top:9px">
<img referrerpolicy="no-referrer" loading="lazy" src="{{p.author.profile_url}}" class="profile-pic-30 mr-2">
<img loading="lazy" src="{{p.author.profile_url}}" class="profile-pic-30 mr-2">
{% if p.author.hat_active -%}
<img class="profile-pic-30-hat hat" loading="lazy" src="{{p.author.hat_active}}?h=7" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{p.author.hat_tooltip(v)}}">
{%- endif %}

View File

@ -167,7 +167,7 @@
<img loading="lazy" src="/asset_submissions/hats/{{hat.name}}.webp?s={{range(1, 10000000)|random}}" style="max-width:50%;border:5px white solid">
<div class="profile-pic-100-wrapper ml-4 mt-4">
<img referrerpolicy="no-referrer" loading="lazy" alt="avatar" src="{{v.profile_url}}" class="profile-pic-100">
<img loading="lazy" alt="avatar" src="{{v.profile_url}}" class="profile-pic-100">
<img loading="lazy" class="profile-pic-100-hat" src="/asset_submissions/hats/{{hat.name}}.webp?s={{range(1, 10000000)|random}}">
</div>

View File

@ -1,6 +1,6 @@
<a style="color:#{{user.name_color}};font-weight:bold" href="/@{{user.username}}">
<div class="profile-pic-20-wrapper mb-2">
<img referrerpolicy="no-referrer" loading="lazy" src="{{user.profile_url}}" class="pp20">
<img loading="lazy" src="{{user.profile_url}}" class="pp20">
{% if user.hat_active -%}
<img class="profile-pic-20-hat hat" loading="lazy" src="{{user.hat_active}}?h=7" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{user.hat_tooltip(v)}}">
{%- endif %}

View File

@ -5,7 +5,7 @@
<div style="position: relative;">
<img loading="lazy" src="{{u.banner_url}}" class="card-img-top" alt="@{{u.username}} user banner" height=175 style="object-fit: cover">
<div class="profile-pic-50-wrapper" style="position: absolute; left: 15px; bottom: 15px; box-sizing: content-box;">
<img referrerpolicy="no-referrer" loading="lazy" src="{{u.profile_url}}" class="profile-pic-50">
<img loading="lazy" src="{{u.profile_url}}" class="profile-pic-50">
{% if u.hat_active -%}
<img id="profile-pic-50-hat" class="profile-pic-50-hat hat" loading="lazy" src="{{u.hat_active}}?h=7" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{u.hat_tooltip(v)}}">
{%- endif %}

View File

@ -44,7 +44,7 @@
<div class="d-md-flex text-center text-md-left">
<div id="profile--pfp" {% if u.hat_active %}class="profile--pfp--hat hat"{% endif %}>
<a rel="nofollow noopener noreferrer" href="{% if u.highres %}{{u.highres}}{% else %}{{u.profile_url}}{% endif %}" class="profile-pic-100-wrapper">
<img referrerpolicy="no-referrer" onclick="expandDesktopImage('{% if u.highres %}{{u.highres}}{% else %}{{u.profile_url}}{% endif %}')" loading="lazy" src="{{u.profile_url}}" class="profile-pic profile-pic-100 mb-5">
<img onclick="expandDesktopImage('{% if u.highres %}{{u.highres}}{% else %}{{u.profile_url}}{% endif %}')" loading="lazy" src="{{u.profile_url}}" class="profile-pic profile-pic-100 mb-5">
{% if u.hat_active -%}
<img onclick="expandDesktopImage('{% if u.highres %}{{u.highres}}{% else %}{{u.profile_url}}{% endif %}')" class="profile-pic-100-hat hat" loading="lazy" src="{{u.hat_active}}?h=7" data-bs-toggle="tooltip" data-bs-placement="bottom" title="{{u.hat_tooltip(v)}}">
{%- endif %}
@ -271,7 +271,7 @@
<div class="col">
<div style="margin-top: -34px;" id="profile-mobile--pfp">
<a rel="nofollow noopener noreferrer" href="{% if u.highres %}{{u.highres}}{% else %}{{u.profile_url}}{% endif %}" class="profile-pic-65-wrapper">
<img referrerpolicy="no-referrer" onclick="expandDesktopImage('{% if u.highres %}{{u.highres}}{% else %}{{u.profile_url}}{% endif %}')" loading="lazy" src="{{u.profile_url}}" class="profile-pic-65 bg-white mb-2">
<img onclick="expandDesktopImage('{% if u.highres %}{{u.highres}}{% else %}{{u.profile_url}}{% endif %}')" loading="lazy" src="{{u.profile_url}}" class="profile-pic-65 bg-white mb-2">
{% if u.hat_active -%}
<img onclick="expandDesktopImage('{% if u.highres %}{{u.highres}}{% else %}{{u.profile_url}}{% endif %}')" class="profile-pic-65-hat hat" loading="lazy" src="{{u.hat_active}}?h=7">
{%- endif %}