Compare commits
5 commits
aea29c581b
...
9a80555a13
| Author | SHA1 | Date | |
|---|---|---|---|
| 9a80555a13 | |||
| 71b478a2e2 | |||
| fc8183d464 | |||
| f5b6843968 | |||
| b4df8218ff |
3 changed files with 9 additions and 3 deletions
|
|
@ -4,6 +4,7 @@ import requests
|
|||
|
||||
KLDSCP_SUPPORTED_ORIGINS = [
|
||||
"amnezia.org",
|
||||
"belsat.eu",
|
||||
"doxa.team",
|
||||
"holod.media",
|
||||
"memorialcenter.org",
|
||||
|
|
@ -12,6 +13,9 @@ KLDSCP_SUPPORTED_ORIGINS = [
|
|||
"semnasem.org",
|
||||
"theins.ru",
|
||||
"thenewtab.io",
|
||||
"thenewtab.support",
|
||||
"vot-tak.tv",
|
||||
"vpnpay.io",
|
||||
"zaodno.org",
|
||||
]
|
||||
|
||||
|
|
|
|||
|
|
@ -64,16 +64,18 @@ def fetch_url(base: str, url: str) -> str | None:
|
|||
content_length = response.headers.get("Content-Length")
|
||||
if content_length is not None:
|
||||
try:
|
||||
if int(content_length) > 500_000:
|
||||
if int(content_length) > 2_500_000:
|
||||
return None
|
||||
except ValueError:
|
||||
pass # Invalid Content-Length format, proceed to stream
|
||||
content = b""
|
||||
for chunk in response.iter_content(chunk_size=1024):
|
||||
content += chunk
|
||||
if len(content) > 500_000:
|
||||
if len(content) > 2_500_000:
|
||||
return None
|
||||
content_type = response.headers.get("Content-Type", "")
|
||||
if content_type == "":
|
||||
return None
|
||||
return encode_data_uri(content, content_type)
|
||||
except requests.exceptions.RequestException:
|
||||
return None
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@
|
|||
</div>
|
||||
</summary>
|
||||
<div class="snap-trust-header__content">
|
||||
{{ gettext('This story is a copy of an article from <a href="{site_url}" class="snap-trust-header__sitelink">{site_title}</a>. It is delivered to you from a trusted archive to assure its availability over time.').format(site_url=site_url, site_title=site_title) }} <p>
|
||||
{{ gettext('This story is a copy of an article from <a href="{site_url}" class="snap-trust-header__sitelink">{site_title}</a>. It is delivered to you from a trusted archive to assure its availability over time.').format(site_url=site_url, site_title=site_title) | safe }} <p>
|
||||
<a href="{{ article_url }}" class="snap-footer-link">
|
||||
{{ gettext("View the article source") }}
|
||||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue