yggdrasil addresses

main
bashrc 2026-02-23 14:50:40 +00:00
parent 900a0fe638
commit 5f054fa6fb
5 changed files with 64 additions and 4 deletions

View File

@ -19,6 +19,7 @@ from quote import get_quote_toot_url
from timeFunctions import date_utcnow
from timeFunctions import date_from_string_format
from timeFunctions import get_current_time_int
from utils import is_yggdrasil_address
from utils import get_user_paths
from utils import contains_statuses
from utils import data_dir
@ -697,7 +698,8 @@ def is_blocked_domain(base_dir: str, domain: str,
"""Is the given domain blocked?
"""
if '.' not in domain:
return False
if not is_yggdrasil_address(domain):
return False
if is_evil(domain):
return True

View File

@ -937,7 +937,7 @@ def _command_options() -> None:
sys.exit()
http_prefix = 'https'
if argb.http or argb.i2p:
if argb.http or argb.i2p or argb.yggdrasil_domain:
http_prefix = 'http'
elif argb.ipfs:
http_prefix = 'ipfs'
@ -1035,6 +1035,10 @@ def _command_options() -> None:
proxy_type = 'i2p'
if domain.endswith('.i2p'):
argb.port = 80
elif argb.yggdrasil_domain or is_yggdrasil_address(domain):
proxy_type = 'yggdrasil'
if is_yggdrasil_address(domain):
argb.port = 80
elif argb.gnunet:
proxy_type = 'gnunet'
if not argb.language:
@ -1080,6 +1084,10 @@ def _command_options() -> None:
proxy_type = 'i2p'
if domain.endswith('.i2p'):
argb.port = 80
elif argb.yggdrasil_domain or is_yggdrasil_address(domain):
proxy_type = 'yggdrasil'
if is_yggdrasil_address(domain):
argb.port = 80
elif argb.gnunet:
proxy_type = 'gnunet'
if not argb.language:
@ -1116,6 +1124,10 @@ def _command_options() -> None:
proxy_type = 'i2p'
if domain.endswith('.i2p'):
argb.port = 80
elif argb.yggdrasil_domain or is_yggdrasil_address(domain):
proxy_type = 'yggdrasil'
if is_yggdrasil_address(domain):
argb.port = 80
elif argb.gnunet:
proxy_type = 'gnunet'
word_frequency = {}
@ -1176,6 +1188,10 @@ def _command_options() -> None:
proxy_type = 'i2p'
if domain.endswith('.i2p'):
argb.port = 80
elif argb.yggdrasil_domain or is_yggdrasil_address(domain):
proxy_type = 'yggdrasil'
if is_yggdrasil_address(domain):
argb.port = 80
elif argb.gnunet:
proxy_type = 'gnunet'
word_frequency = {}
@ -1228,6 +1244,10 @@ def _command_options() -> None:
proxy_type = 'i2p'
if domain.endswith('.i2p'):
argb.port = 80
elif argb.yggdrasil_domain or is_yggdrasil_address(domain):
proxy_type = 'i2p'
if is_yggdrasil_address(domain):
argb.port = 80
elif argb.gnunet:
proxy_type = 'gnunet'
max_blocked_domains = 0
@ -1319,6 +1339,8 @@ def _command_options() -> None:
proxy_type = 'tor'
elif argb.i2p or domain.endswith('.i2p'):
proxy_type = 'i2p'
elif argb.yggdrasil_domain or is_yggdrasil_address(domain):
proxy_type = 'yggdrasil'
elif argb.gnunet:
proxy_type = 'gnunet'
if not argb.language:
@ -1803,6 +1825,8 @@ def _command_options() -> None:
proxy_type = 'tor'
elif argb.i2p or domain.endswith('.i2p'):
proxy_type = 'i2p'
elif argb.yggdrasil_domain or is_yggdrasil_address(domain):
proxy_type = 'yggdrasil'
elif argb.gnunet:
proxy_type = 'gnunet'
@ -2099,6 +2123,10 @@ def _command_options() -> None:
proxy_type = 'i2p'
if domain.endswith('.i2p'):
argb.port = 80
elif argb.yggdrasil_domain or is_yggdrasil_address(domain):
proxy_type = 'yggdrasil'
if is_yggdrasil_address(domain):
argb.port = 80
elif argb.gnunet:
proxy_type = 'gnunet'
session = create_session(proxy_type)
@ -2183,6 +2211,10 @@ def _command_options() -> None:
proxy_type = 'i2p'
if domain.endswith('.i2p'):
argb.port = 80
elif argb.yggdrasil_domain or is_yggdrasil_address(domain):
proxy_type = 'yggdrasil'
if is_yggdrasil_address(domain):
argb.port = 80
elif argb.gnunet:
proxy_type = 'gnunet'
if not domain:
@ -2981,6 +3013,8 @@ def _command_options() -> None:
http_prefix = 'ipns'
if argb.i2p:
http_prefix = 'http'
if argb.yggdrasil_domain:
http_prefix = 'http'
if argb.migrations:
cached_webfingers = {}
@ -2992,6 +3026,10 @@ def _command_options() -> None:
http_prefix = 'http'
port = 80
proxy_type = 'i2p'
elif is_yggdrasil_address(domain):
http_prefix = 'http'
port = 80
proxy_type = 'yggdrasil'
elif argb.ipfs:
http_prefix = 'ipfs'
port = 80
@ -3119,6 +3157,10 @@ def _command_options() -> None:
http_prefix = 'http'
port = 80
proxy_type = 'i2p'
elif is_yggdrasil_address(domain):
http_prefix = 'http'
port = 80
proxy_type = 'yggdrasil'
elif argb.gnunet:
http_prefix = 'gnunet'
port = 80
@ -3586,6 +3628,10 @@ def _command_options() -> None:
proxy_type = 'i2p'
if domain.endswith('.i2p'):
argb.port = 80
elif argb.yggdrasil_domain or is_yggdrasil_address(domain):
proxy_type = 'yggdrasil'
if is_yggdrasil_address(domain):
argb.port = 80
elif argb.gnunet:
proxy_type = 'gnunet'

View File

@ -50,7 +50,11 @@ def _port_domain_remove(domain: str) -> str:
if ':' in domain:
if domain.startswith('did:'):
return domain
domain = domain.split(':')[0]
if ']:' not in domain:
domain = domain.split(':')[0]
else:
# yggdrasil domain
domain = domain.split(']:')[0] + ']'
return domain

View File

@ -342,7 +342,11 @@ def _hashtag_add(base_dir: str, http_prefix: str, domain_full: str,
post_json_object['object']['content'] = content
domain = domain_full
if ':' in domain:
domain = domain.split(':')[0]
if ']:' not in domain:
domain = domain.split(':')[0]
else:
# yggdrassil domain
domain = domain.split(']:')[0] + ']'
store_hash_tags(base_dir, 'news', domain,
http_prefix, domain_full,
post_json_object, translate, session)

View File

@ -40,6 +40,7 @@ from media import process_meta_data
from flags import is_image_file
from timeFunctions import date_utcnow
from timeFunctions import get_current_time_int
from utils import is_yggdrasil_address
from utils import get_person_icon
from utils import account_is_indexable
from utils import get_instance_url
@ -1948,6 +1949,9 @@ def get_actor_json(host_domain: str, handle: str, http: bool, gnunet: bool,
elif domain.endswith('.i2p'):
http_prefix = 'http'
proxy_type = 'i2p'
elif is_yggdrasil_address(domain):
http_prefix = 'http'
proxy_type = 'yggdrasil'
elif gnunet:
http_prefix = 'gnunet'
proxy_type = 'gnunet'