diff --git a/daemon_get.py b/daemon_get.py index 6614e5087..b5088fbab 100644 --- a/daemon_get.py +++ b/daemon_get.py @@ -340,9 +340,10 @@ def daemon_http_get(self) -> None: ua_str = get_user_agent(self) - if 'Epicyon/' in ua_str: - log_epicyon_instances(self.server.base_dir, calling_domain, - self.server.known_epicyon_instances) + if ua_str: + if 'Epicyon/' in ua_str: + log_epicyon_instances(self.server.base_dir, calling_domain, + self.server.known_epicyon_instances) if not _permitted_crawler_path(self.path): block, self.server.blocked_cache_last_updated, llm = \ @@ -2968,6 +2969,7 @@ def daemon_http_get(self) -> None: default_timeline = self.server.default_timeline shared_items_domains = \ self.server.shared_items_federated_domains + known_instances = self.server.known_epicyon_instances msg = \ html_links_mobile(self.server.base_dir, nickname, self.server.domain_full, @@ -2980,7 +2982,8 @@ def daemon_http_get(self) -> None: default_timeline, self.server.theme_name, access_keys, - shared_items_domains).encode('utf-8') + shared_items_domains, + known_instances).encode('utf-8') msglen = len(msg) set_headers(self, 'text/html', msglen, cookie, calling_domain, False) diff --git a/daemon_get_feeds.py b/daemon_get_feeds.py index 65eb897df..375f807ee 100644 --- a/daemon_get_feeds.py +++ b/daemon_get_feeds.py @@ -126,6 +126,8 @@ def show_shares_feed(self, authorized: bool, bold_reading = False if bold_reading_nicknames.get(nickname): bold_reading = True + known_epicyon_instances = \ + self.server.known_epicyon_instances msg = \ html_profile(signing_priv_key_pem, rss_icon_at_top, @@ -166,7 +168,8 @@ def show_shares_feed(self, authorized: bool, max_shares_on_profile, sites_unavailable, no_of_books, - auto_cw_cache) + auto_cw_cache, + known_epicyon_instances) msg = msg.encode('utf-8') msglen = len(msg) set_headers(self, 'text/html', msglen, @@ -310,6 +313,8 @@ def show_following_feed(self, authorized: bool, bold_reading = True if not authorized and hide_follows.get(nickname): following = {} + known_epicyon_instances = \ + self.server.known_epicyon_instances msg = \ html_profile(signing_priv_key_pem, @@ -352,7 +357,8 @@ def show_following_feed(self, authorized: bool, max_shares_on_profile, sites_unavailable, no_of_books, - auto_cw_cache).encode('utf-8') + auto_cw_cache, + known_epicyon_instances).encode('utf-8') msglen = len(msg) set_headers(self, 'text/html', msglen, cookie, calling_domain, False) @@ -497,6 +503,9 @@ def show_moved_feed(self, authorized: bool, if bold_reading_nicknames.get(nickname): bold_reading = True + known_epicyon_instances = \ + self.server.known_epicyon_instances + msg = \ html_profile(signing_priv_key_pem, rss_icon_at_top, @@ -538,7 +547,8 @@ def show_moved_feed(self, authorized: bool, max_shares_on_profile, sites_unavailable, no_of_books, - auto_cw_cache).encode('utf-8') + auto_cw_cache, + known_epicyon_instances).encode('utf-8') msglen = len(msg) set_headers(self, 'text/html', msglen, cookie, calling_domain, False) @@ -677,6 +687,8 @@ def show_inactive_feed(self, authorized: bool, bold_reading = False if bold_reading_nicknames.get(nickname): bold_reading = True + known_epicyon_instances = \ + self.server.known_epicyon_instances msg = \ html_profile(signing_priv_key_pem, rss_icon_at_top, @@ -718,7 +730,8 @@ def show_inactive_feed(self, authorized: bool, max_shares_on_profile, sites_unavailable, no_of_books, - auto_cw_cache).encode('utf-8') + auto_cw_cache, + known_epicyon_instances).encode('utf-8') msglen = len(msg) set_headers(self, 'text/html', msglen, cookie, calling_domain, False) @@ -859,6 +872,8 @@ def show_followers_feed(self, authorized: bool, bold_reading = False if bold_reading_nicknames.get(nickname): bold_reading = True + known_epicyon_instances = \ + self.server.known_epicyon_instances msg = \ html_profile(signing_priv_key_pem, rss_icon_at_top, @@ -901,7 +916,8 @@ def show_followers_feed(self, authorized: bool, max_shares_on_profile, sites_unavailable, no_of_books, - auto_cw_cache).encode('utf-8') + auto_cw_cache, + known_epicyon_instances).encode('utf-8') msglen = len(msg) set_headers(self, 'text/html', msglen, cookie, calling_domain, False) diff --git a/daemon_get_profile.py b/daemon_get_profile.py index fa391a497..ef768a4ef 100644 --- a/daemon_get_profile.py +++ b/daemon_get_profile.py @@ -110,6 +110,8 @@ def show_person_profile(self, authorized: bool, bold_reading = False if bold_reading_nicknames.get(nickname): bold_reading = True + known_epicyon_instances = \ + self.server.known_epicyon_instances msg = \ html_profile(signing_priv_key_pem, rss_icon_at_top, @@ -147,7 +149,8 @@ def show_person_profile(self, authorized: bool, max_shares_on_profile, sites_unavailable, no_of_books, - auto_cw_cache).encode('utf-8') + auto_cw_cache, + known_epicyon_instances).encode('utf-8') msglen = len(msg) set_headers(self, 'text/html', msglen, cookie, calling_domain, False) @@ -265,6 +268,8 @@ def show_roles(self, calling_domain: str, referer_domain: str, bold_reading = False if bold_reading_nicknames.get(nickname): bold_reading = True + known_epicyon_instances = \ + self.server.known_epicyon_instances msg = \ html_profile(signing_priv_key_pem, rss_icon_at_top, @@ -302,7 +307,8 @@ def show_roles(self, calling_domain: str, referer_domain: str, max_shares_on_profile, sites_unavailable, no_of_books, - auto_cw_cache) + auto_cw_cache, + known_epicyon_instances) msg = msg.encode('utf-8') msglen = len(msg) set_headers(self, 'text/html', msglen, @@ -412,6 +418,8 @@ def show_skills(self, calling_domain: str, referer_domain: str, bold_reading = False if bold_reading_nicknames.get(nick): bold_reading = True + known_epicyon_instances = \ + self.server.known_epicyon_instances msg = \ html_profile(signing_priv_key_pem, rss_icon_at_top, @@ -451,7 +459,8 @@ def show_skills(self, calling_domain: str, referer_domain: str, max_shares_on_profile, sites_unavailable, no_of_books, - auto_cw_cache) + auto_cw_cache, + known_epicyon_instances) msg = msg.encode('utf-8') msglen = len(msg) set_headers(self, 'text/html', msglen, diff --git a/daemon_get_timeline.py b/daemon_get_timeline.py index 560e4437c..bd01f209e 100644 --- a/daemon_get_timeline.py +++ b/daemon_get_timeline.py @@ -154,6 +154,8 @@ def show_media_timeline(self, authorized: bool, show_announces = True if hide_announces.get(nickname): show_announces = False + known_epicyon_instances = \ + self.server.known_epicyon_instances msg = \ html_inbox_media(default_timeline, recent_posts_cache, @@ -200,7 +202,8 @@ def show_media_timeline(self, authorized: bool, reverse_sequence, last_post_id, buy_sites, auto_cw_cache, - show_announces) + show_announces, + known_epicyon_instances) msg = msg.encode('utf-8') msglen = len(msg) set_headers(self, 'text/html', msglen, @@ -361,6 +364,8 @@ def show_blogs_timeline(self, authorized: bool, last_post_id = path.split(';lastpost=')[1] if ';' in last_post_id: last_post_id = last_post_id.split(';')[0] + known_epicyon_instances = \ + self.server.known_epicyon_instances msg = \ html_inbox_blogs(default_timeline, recent_posts_cache, @@ -406,7 +411,8 @@ def show_blogs_timeline(self, authorized: bool, min_images_for_accounts, reverse_sequence, last_post_id, buy_sites, - auto_cw_cache) + auto_cw_cache, + known_epicyon_instances) msg = msg.encode('utf-8') msglen = len(msg) set_headers(self, 'text/html', msglen, @@ -571,6 +577,8 @@ def show_news_timeline(self, authorized: bool, reverse_sequence = False if nickname in reverse_sequence_nicknames: reverse_sequence = True + known_epicyon_instances = \ + self.server.known_epicyon_instances msg = \ html_inbox_news(default_timeline, recent_posts_cache, @@ -617,7 +625,8 @@ def show_news_timeline(self, authorized: bool, min_images_for_accounts, reverse_sequence, buy_sites, - auto_cw_cache) + auto_cw_cache, + known_epicyon_instances) msg = msg.encode('utf-8') msglen = len(msg) set_headers(self, 'text/html', msglen, @@ -777,6 +786,8 @@ def show_features_timeline(self, authorized: bool, reverse_sequence = False if nickname in reverse_sequence_nicknames: reverse_sequence = True + known_epicyon_instances = \ + self.server.known_epicyon_instances msg = \ html_inbox_features(default_timeline, recent_posts_cache, @@ -823,7 +834,8 @@ def show_features_timeline(self, authorized: bool, min_images_for_accounts, reverse_sequence, buy_sites, - auto_cw_cache) + auto_cw_cache, + known_epicyon_instances) msg = msg.encode('utf-8') msglen = len(msg) set_headers(self, 'text/html', msglen, @@ -947,6 +959,8 @@ def show_shares_timeline(self, authorized: bool, reverse_sequence = False if nickname in reverse_sequence_nicknames: reverse_sequence = True + known_epicyon_instances = \ + self.server.known_epicyon_instances msg = \ html_shares(default_timeline, recent_posts_cache, @@ -989,7 +1003,8 @@ def show_shares_timeline(self, authorized: bool, min_images_for_accounts, reverse_sequence, buy_sites, - auto_cw_cache) + auto_cw_cache, + known_epicyon_instances) msg = msg.encode('utf-8') msglen = len(msg) set_headers(self, 'text/html', msglen, @@ -1089,6 +1104,8 @@ def show_wanted_timeline(self, authorized: bool, reverse_sequence = False if nickname in reverse_sequence_nicknames: reverse_sequence = True + known_epicyon_instances = \ + self.server.known_epicyon_instances msg = \ html_wanted(default_timeline, recent_posts_cache, @@ -1131,7 +1148,8 @@ def show_wanted_timeline(self, authorized: bool, min_images_for_accounts, reverse_sequence, buy_sites, - auto_cw_cache) + auto_cw_cache, + known_epicyon_instances) msg = msg.encode('utf-8') msglen = len(msg) set_headers(self, 'text/html', msglen, @@ -1264,6 +1282,8 @@ def show_bookmarks_timeline(self, authorized: bool, reverse_sequence = False if nickname in reverse_sequence_nicknames: reverse_sequence = True + known_epicyon_instances = \ + self.server.known_epicyon_instances msg = \ html_bookmarks(default_timeline, recent_posts_cache, @@ -1309,7 +1329,8 @@ def show_bookmarks_timeline(self, authorized: bool, min_images_for_accounts, reverse_sequence, buy_sites, - auto_cw_cache) + auto_cw_cache, + known_epicyon_instances) msg = msg.encode('utf-8') msglen = len(msg) set_headers(self, 'text/html', msglen, @@ -1471,6 +1492,8 @@ def show_outbox_timeline(self, authorized: bool, show_announces = True if hide_announces.get(nickname): show_announces = False + known_epicyon_instances = \ + self.server.known_epicyon_instances msg = \ html_outbox(default_timeline, recent_posts_cache, @@ -1515,7 +1538,8 @@ def show_outbox_timeline(self, authorized: bool, reverse_sequence, buy_sites, auto_cw_cache, - show_announces) + show_announces, + known_epicyon_instances) msg = msg.encode('utf-8') msglen = len(msg) set_headers(self, 'text/html', msglen, @@ -1658,6 +1682,8 @@ def show_mod_timeline(self, authorized: bool, reverse_sequence = False if nickname in reverse_sequence_nicknames: reverse_sequence = True + known_epicyon_instances = \ + self.server.known_epicyon_instances msg = \ html_moderation(default_timeline, recent_posts_cache, @@ -1703,7 +1729,8 @@ def show_mod_timeline(self, authorized: bool, min_images_for_accounts, reverse_sequence, buy_sites, - auto_cw_cache) + auto_cw_cache, + known_epicyon_instances) msg = msg.encode('utf-8') msglen = len(msg) set_headers(self, 'text/html', msglen, @@ -1861,6 +1888,8 @@ def show_dms(self, authorized: bool, last_post_id = path.split(';lastpost=')[1] if ';' in last_post_id: last_post_id = last_post_id.split(';')[0] + known_epicyon_instances = \ + self.server.known_epicyon_instances msg = \ html_inbox_dms(default_timeline, recent_posts_cache, @@ -1905,7 +1934,8 @@ def show_dms(self, authorized: bool, min_images_for_accounts, reverse_sequence, last_post_id, buy_sites, - auto_cw_cache) + auto_cw_cache, + known_epicyon_instances) msg = msg.encode('utf-8') msglen = len(msg) set_headers(self, 'text/html', msglen, @@ -2066,6 +2096,8 @@ def show_replies(self, authorized: bool, last_post_id = path.split(';lastpost=')[1] if ';' in last_post_id: last_post_id = last_post_id.split(';')[0] + known_epicyon_instances = \ + self.server.known_epicyon_instances msg = \ html_inbox_replies(default_timeline, recent_posts_cache, @@ -2111,7 +2143,8 @@ def show_replies(self, authorized: bool, min_images_for_accounts, reverse_sequence, last_post_id, buy_sites, - auto_cw_cache) + auto_cw_cache, + known_epicyon_instances) msg = msg.encode('utf-8') msglen = len(msg) set_headers(self, 'text/html', msglen, @@ -2283,6 +2316,8 @@ def show_inbox(self, authorized: bool, show_announces = True if hide_announces.get(nickname): show_announces = False + known_epicyon_instances = \ + self.server.known_epicyon_instances msg = \ html_inbox(default_timeline, recent_posts_cache, @@ -2330,7 +2365,8 @@ def show_inbox(self, authorized: bool, reverse_sequence, last_post_id, buy_sites, auto_cw_cache, - show_announces) + show_announces, + known_epicyon_instances) if getreq_start_time: fitness_performance(getreq_start_time, fitness, '_GET', '_show_inbox3', diff --git a/daemon_head.py b/daemon_head.py index 2a041ae99..dc05a2462 100644 --- a/daemon_head.py +++ b/daemon_head.py @@ -38,9 +38,10 @@ def daemon_http_head(self) -> None: ua_str = get_user_agent(self) - if 'Epicyon/' in ua_str: - log_epicyon_instances(self.server.base_dir, calling_domain, - self.server.known_epicyon_instances) + if ua_str: + if 'Epicyon/' in ua_str: + log_epicyon_instances(self.server.base_dir, calling_domain, + self.server.known_epicyon_instances) if self.headers.get('Host'): calling_domain = decoded_host(self.headers['Host']) diff --git a/daemon_post.py b/daemon_post.py index 616224861..5eccc4f62 100644 --- a/daemon_post.py +++ b/daemon_post.py @@ -164,9 +164,10 @@ def daemon_http_post(self) -> None: ua_str = get_user_agent(self) - if 'Epicyon/' in ua_str: - log_epicyon_instances(self.server.base_dir, calling_domain, - self.server.known_epicyon_instances) + if ua_str: + if 'Epicyon/' in ua_str: + log_epicyon_instances(self.server.base_dir, calling_domain, + self.server.known_epicyon_instances) block, self.server.blocked_cache_last_updated, _ = \ blocked_user_agent(calling_domain, ua_str, diff --git a/webapp_column_left.py b/webapp_column_left.py index 61835417b..8eb54fcd0 100644 --- a/webapp_column_left.py +++ b/webapp_column_left.py @@ -123,7 +123,8 @@ def get_left_column_content(base_dir: str, nickname: str, domain_full: str, rss_icon_at_top: bool, show_header_image: bool, front_page: bool, theme: str, access_keys: {}, - shared_items_federated_domains: []) -> str: + shared_items_federated_domains: [], + known_epicyon_instances: []) -> str: """Returns html content for the left column """ html_str = '' @@ -351,10 +352,11 @@ def get_left_column_content(base_dir: str, nickname: str, domain_full: str, html_str += \ '
' + \ translate['About this Instance'] + '
' - html_str += \ - '' + \ - translate['Epicyon Instances'] + '
' + if known_epicyon_instances: + html_str += \ + '' + \ + translate['Epicyon Instances'] + '
' html_str += \ '' + \ translate['User Manual'] + '
' @@ -379,7 +381,8 @@ def html_links_mobile(base_dir: str, icons_as_buttons: bool, default_timeline: str, theme: str, access_keys: {}, - shared_items_federated_domains: []) -> str: + shared_items_federated_domains: [], + known_epicyon_instances: []) -> str: """Show the left column links within mobile view """ html_str = '' @@ -426,7 +429,8 @@ def html_links_mobile(base_dir: str, False, timeline_path, rss_icon_at_top, False, False, theme, access_keys, - shared_items_federated_domains) + shared_items_federated_domains, + known_epicyon_instances) if editor and not _links_exist(base_dir): html_str += '