Compare commits
1 commit
9a80555a13
...
aea29c581b
| Author | SHA1 | Date | |
|---|---|---|---|
| aea29c581b |
3 changed files with 3 additions and 9 deletions
|
|
@ -4,7 +4,6 @@ import requests
|
||||||
|
|
||||||
KLDSCP_SUPPORTED_ORIGINS = [
|
KLDSCP_SUPPORTED_ORIGINS = [
|
||||||
"amnezia.org",
|
"amnezia.org",
|
||||||
"belsat.eu",
|
|
||||||
"doxa.team",
|
"doxa.team",
|
||||||
"holod.media",
|
"holod.media",
|
||||||
"memorialcenter.org",
|
"memorialcenter.org",
|
||||||
|
|
@ -13,9 +12,6 @@ KLDSCP_SUPPORTED_ORIGINS = [
|
||||||
"semnasem.org",
|
"semnasem.org",
|
||||||
"theins.ru",
|
"theins.ru",
|
||||||
"thenewtab.io",
|
"thenewtab.io",
|
||||||
"thenewtab.support",
|
|
||||||
"vot-tak.tv",
|
|
||||||
"vpnpay.io",
|
|
||||||
"zaodno.org",
|
"zaodno.org",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -64,18 +64,16 @@ def fetch_url(base: str, url: str) -> str | None:
|
||||||
content_length = response.headers.get("Content-Length")
|
content_length = response.headers.get("Content-Length")
|
||||||
if content_length is not None:
|
if content_length is not None:
|
||||||
try:
|
try:
|
||||||
if int(content_length) > 2_500_000:
|
if int(content_length) > 500_000:
|
||||||
return None
|
return None
|
||||||
except ValueError:
|
except ValueError:
|
||||||
pass # Invalid Content-Length format, proceed to stream
|
pass # Invalid Content-Length format, proceed to stream
|
||||||
content = b""
|
content = b""
|
||||||
for chunk in response.iter_content(chunk_size=1024):
|
for chunk in response.iter_content(chunk_size=1024):
|
||||||
content += chunk
|
content += chunk
|
||||||
if len(content) > 2_500_000:
|
if len(content) > 500_000:
|
||||||
return None
|
return None
|
||||||
content_type = response.headers.get("Content-Type", "")
|
content_type = response.headers.get("Content-Type", "")
|
||||||
if content_type == "":
|
|
||||||
return None
|
|
||||||
return encode_data_uri(content, content_type)
|
return encode_data_uri(content, content_type)
|
||||||
except requests.exceptions.RequestException:
|
except requests.exceptions.RequestException:
|
||||||
return None
|
return None
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,7 @@
|
||||||
</div>
|
</div>
|
||||||
</summary>
|
</summary>
|
||||||
<div class="snap-trust-header__content">
|
<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) | safe }} <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) }} <p>
|
||||||
<a href="{{ article_url }}" class="snap-footer-link">
|
<a href="{{ article_url }}" class="snap-footer-link">
|
||||||
{{ gettext("View the article source") }}
|
{{ gettext("View the article source") }}
|
||||||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
<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