From 5f054fa6fbaac87948199fa90e84dc13e0908368 Mon Sep 17 00:00:00 2001 From: bashrc Date: Mon, 23 Feb 2026 14:50:40 +0000 Subject: [PATCH] yggdrasil addresses --- blocking.py | 4 +++- epicyon.py | 48 +++++++++++++++++++++++++++++++++++++++++++- followingCalendar.py | 6 +++++- newsdaemon.py | 6 +++++- person.py | 4 ++++ 5 files changed, 64 insertions(+), 4 deletions(-) diff --git a/blocking.py b/blocking.py index ecd07fe3a..bc1099a5e 100644 --- a/blocking.py +++ b/blocking.py @@ -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 diff --git a/epicyon.py b/epicyon.py index 2d011a7dd..d761fd96d 100644 --- a/epicyon.py +++ b/epicyon.py @@ -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' diff --git a/followingCalendar.py b/followingCalendar.py index 290e2040c..214cde0cc 100644 --- a/followingCalendar.py +++ b/followingCalendar.py @@ -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 diff --git a/newsdaemon.py b/newsdaemon.py index 3aed230be..46b33066a 100644 --- a/newsdaemon.py +++ b/newsdaemon.py @@ -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) diff --git a/person.py b/person.py index 1ca4b1329..f744428df 100644 --- a/person.py +++ b/person.py @@ -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'