forked from MarseyWorld/MarseyWorld
truncate Approved Media Hosts in /formatting
parent
d784bafbce
commit
3ce86d1408
|
@ -889,6 +889,12 @@ approved_embed_hosts = [
|
||||||
'i.ytimg.com/vi',
|
'i.ytimg.com/vi',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
approved_embed_hosts_domains = []
|
||||||
|
for h in approved_embed_hosts:
|
||||||
|
domain = tldextract.extract(h).registered_domain
|
||||||
|
if domain not in approved_embed_hosts_domains:
|
||||||
|
approved_embed_hosts_domains.append(domain)
|
||||||
|
|
||||||
if SITE_IMAGES not in approved_embed_hosts:
|
if SITE_IMAGES not in approved_embed_hosts:
|
||||||
approved_embed_hosts = [SITE_IMAGES] + approved_embed_hosts
|
approved_embed_hosts = [SITE_IMAGES] + approved_embed_hosts
|
||||||
|
|
||||||
|
|
|
@ -376,7 +376,7 @@ def mutes(v):
|
||||||
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400, key_func=get_ID)
|
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400, key_func=get_ID)
|
||||||
@auth_required
|
@auth_required
|
||||||
def formatting(v):
|
def formatting(v):
|
||||||
return render_template("formatting.html", v=v, allowed_tags=allowed_tags, allowed_styles=allowed_styles)
|
return render_template("formatting.html", v=v, allowed_tags=allowed_tags, allowed_styles=allowed_styles, approved_embed_hosts_domains=approved_embed_hosts_domains)
|
||||||
|
|
||||||
@app.get("/app")
|
@app.get("/app")
|
||||||
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400)
|
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400)
|
||||||
|
|
|
@ -456,7 +456,7 @@ And we allow custom HTML in most places:
|
||||||
Image files, video files, and audio files from these sources will get embedded automatically:
|
Image files, video files, and audio files from these sources will get embedded automatically:
|
||||||
|
|
||||||
<ul class="mt-3">
|
<ul class="mt-3">
|
||||||
{% for host in approved_embed_hosts %}
|
{% for host in approved_embed_hosts_domains %}
|
||||||
<li>{{host}}</li>
|
<li>{{host}}</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
Loading…
Reference in New Issue