diff --git a/blog.py b/blog.py index 44e045686..204c3da95 100644 --- a/blog.py +++ b/blog.py @@ -318,6 +318,7 @@ def _html_blog_post_content(debug: bool, session, authorized: bool, post_json_object: {}, handle: str, restrict_to_domain: bool, peertube_instances: [], + loops_instances: [], system_language: str, person_cache: {}, blog_separator: str) -> str: @@ -410,7 +411,9 @@ def _html_blog_post_content(debug: bool, session, authorized: bool, blog_str += '
' + attachment_str + '
' if json_content: content_str = add_embedded_elements(translate, json_content, - peertube_instances, domain_full) + peertube_instances, + loops_instances, + domain_full) if post_json_object['object'].get('tag'): post_json_object_tags = post_json_object['object']['tag'] content_str = replace_emoji_from_tags(session, base_dir, @@ -596,6 +599,7 @@ def html_blog_post(session, authorized: bool, nickname: str, domain: str, domain_full: str, post_json_object: {}, peertube_instances: [], + loops_instances: [], system_language: str, person_cache: {}, debug: bool, content_license_url: str) -> str: """Returns a html blog post @@ -630,7 +634,9 @@ def html_blog_post(session, authorized: bool, nickname, domain, domain_full, post_json_object, None, False, - peertube_instances, system_language, + peertube_instances, + loops_instances, + system_language, person_cache, '
') # show rss links @@ -659,7 +665,9 @@ def html_blog_page(authorized: bool, session, base_dir: str, http_prefix: str, translate: {}, nickname: str, domain: str, port: int, no_of_items: int, page_number: int, - peertube_instances: [], system_language: str, + peertube_instances: [], + loops_instances: [], + system_language: str, person_cache: {}, debug: bool) -> str: """Returns a html blog page containing posts """ @@ -724,8 +732,8 @@ def html_blog_page(authorized: bool, session, base_dir, http_prefix, translate, nickname, domain, domain_full, item, None, True, peertube_instances, - system_language, person_cache, - '
') + loops_instances, system_language, + person_cache, '
') if len(timeline_json['orderedItems']) >= no_of_items: blog_str += navigate_str @@ -868,7 +876,9 @@ def html_blog_view(authorized: bool, session, base_dir: str, http_prefix: str, translate: {}, domain: str, port: int, no_of_items: int, - peertube_instances: [], system_language: str, + peertube_instances: [], + loops_instances: [], + system_language: str, person_cache: {}, debug: bool) -> str: """Show the blog main page """ @@ -891,6 +901,7 @@ def html_blog_view(authorized: bool, base_dir, http_prefix, translate, nickname, domain, port, no_of_items, 1, peertube_instances, + loops_instances, system_language, person_cache, debug) domain_full = get_full_domain(domain, port) diff --git a/daemon.py b/daemon.py index b31c75502..605f0a031 100644 --- a/daemon.py +++ b/daemon.py @@ -40,6 +40,7 @@ from blocking import set_broch_mode from webapp_utils import load_buy_sites from webapp_accesskeys import load_access_keys_for_accounts from webapp_media import load_peertube_instances +from webapp_media import load_loops_instances from shares import run_federated_shares_daemon from shares import run_federated_shares_watchdog from shares import create_shared_item_federation_token @@ -475,6 +476,7 @@ class EpicyonServer(ThreadingHTTPServer): shared_item_federation_tokens = None shared_item_federation_tokens = None peertube_instances: list[str] = [] + loops_instances: list[str] = [] max_mentions: int = 10 max_emoji: int = 10 max_hashtags: int = 10 @@ -1344,6 +1346,10 @@ def run_daemon(accounts_data_dir: str, httpd.peertube_instances: list[str] = [] load_peertube_instances(base_dir, httpd.peertube_instances) + # load loops instances from file into a list + httpd.loops_instances: list[str] = [] + load_loops_instances(base_dir, httpd.loops_instances) + create_initial_last_seen(base_dir, http_prefix) httpd.max_mentions = max_mentions @@ -1375,6 +1381,7 @@ def run_daemon(accounts_data_dir: str, httpd.max_followers, httpd.allow_local_network_access, httpd.peertube_instances, + httpd.loops_instances, verify_all_signatures, httpd.theme_name, httpd.system_language, diff --git a/daemon_get.py b/daemon_get.py index f7e09b4a0..5878a18f4 100644 --- a/daemon_get.py +++ b/daemon_get.py @@ -827,6 +827,7 @@ def daemon_http_get(self) -> None: self.server.twitter_replacement_domain, self.server.show_published_date_only, self.server.peertube_instances, + self.server.loops_instances, self.server.allow_local_network_access, self.server.theme_name, self.server.system_language, @@ -1959,6 +1960,7 @@ def daemon_http_get(self) -> None: self.server.port, MAX_POSTS_IN_BLOGS_FEED, self.server.peertube_instances, + self.server.loops_instances, self.server.system_language, self.server.person_cache, self.server.debug) @@ -1995,6 +1997,7 @@ def daemon_http_get(self) -> None: self.server.debug, curr_session, MAX_POSTS_IN_BLOGS_FEED, self.server.peertube_instances, + self.server.loops_instances, self.server.system_language, self.server.person_cache, self.server.fitness): @@ -2039,6 +2042,7 @@ def daemon_http_get(self) -> None: self.server.domain_full, post_json_object, self.server.peertube_instances, + self.server.loops_instances, self.server.system_language, self.server.person_cache, self.server.debug, @@ -3166,6 +3170,7 @@ def daemon_http_get(self) -> None: twitter_replacement_domain, show_published_date_only, self.server.peertube_instances, + self.server.loops_instances, allow_local_network_access, self.server.theme_name, self.server.system_language, @@ -3279,6 +3284,7 @@ def daemon_http_get(self) -> None: self.server.twitter_replacement_domain, self.server.show_published_date_only, self.server.peertube_instances, + self.server.loops_instances, self.server.allow_local_network_access, self.server.theme_name, self.server.system_language, @@ -3593,6 +3599,7 @@ def daemon_http_get(self) -> None: self.server.twitter_replacement_domain, self.server.show_published_date_only, self.server.peertube_instances, + self.server.loops_instances, self.server.allow_local_network_access, self.server.theme_name, self.server.max_like_count, @@ -3793,6 +3800,7 @@ def daemon_http_get(self) -> None: self.server.twitter_replacement_domain, self.server.show_published_date_only, self.server.peertube_instances, + self.server.loops_instances, self.server.allow_local_network_access, self.server.theme_name, self.server.system_language, @@ -3846,6 +3854,7 @@ def daemon_http_get(self) -> None: self.server.twitter_replacement_domain, self.server.show_published_date_only, self.server.peertube_instances, + self.server.loops_instances, self.server.allow_local_network_access, self.server.theme_name, self.server.system_language, @@ -3902,6 +3911,7 @@ def daemon_http_get(self) -> None: self.server.twitter_replacement_domain, self.server.show_published_date_only, self.server.peertube_instances, + self.server.loops_instances, self.server.allow_local_network_access, self.server.theme_name, self.server.system_language, @@ -3956,6 +3966,7 @@ def daemon_http_get(self) -> None: self.server.twitter_replacement_domain, self.server.show_published_date_only, self.server.peertube_instances, + self.server.loops_instances, self.server.allow_local_network_access, self.server.theme_name, self.server.system_language, @@ -4008,6 +4019,7 @@ def daemon_http_get(self) -> None: self.server.twitter_replacement_domain, self.server.show_published_date_only, self.server.peertube_instances, + self.server.loops_instances, self.server.allow_local_network_access, self.server.theme_name, self.server.system_language, @@ -4059,6 +4071,7 @@ def daemon_http_get(self) -> None: self.server.twitter_replacement_domain, self.server.show_published_date_only, self.server.peertube_instances, + self.server.loops_instances, self.server.allow_local_network_access, self.server.theme_name, self.server.system_language, @@ -4109,6 +4122,7 @@ def daemon_http_get(self) -> None: self.server.twitter_replacement_domain, self.server.show_published_date_only, self.server.peertube_instances, + self.server.loops_instances, self.server.allow_local_network_access, self.server.theme_name, self.server.system_language, @@ -4159,6 +4173,7 @@ def daemon_http_get(self) -> None: self.server.twitter_replacement_domain, self.server.show_published_date_only, self.server.peertube_instances, + self.server.loops_instances, self.server.allow_local_network_access, self.server.theme_name, self.server.system_language, @@ -4211,6 +4226,7 @@ def daemon_http_get(self) -> None: self.server.twitter_replacement_domain, self.server.show_published_date_only, self.server.peertube_instances, + self.server.loops_instances, self.server.allow_local_network_access, self.server.theme_name, self.server.system_language, @@ -4260,6 +4276,7 @@ def daemon_http_get(self) -> None: self.server.twitter_replacement_domain, self.server.show_published_date_only, self.server.peertube_instances, + self.server.loops_instances, self.server.allow_local_network_access, self.server.theme_name, self.server.system_language, @@ -4519,6 +4536,7 @@ def daemon_http_get(self) -> None: self.server.port, cookie, self.server.peertube_instances, + self.server.loops_instances, self.server.access_keys, self.server.key_shortcuts, self.server.default_reply_interval_hrs, @@ -4617,6 +4635,7 @@ def daemon_http_get(self) -> None: self.server.twitter_replacement_domain, self.server.show_published_date_only, self.server.peertube_instances, + self.server.loops_instances, self.server.allow_local_network_access, self.server.max_like_count, self.server.signing_priv_key_pem, @@ -4662,6 +4681,7 @@ def daemon_http_get(self) -> None: self.server.twitter_replacement_domain, self.server.show_published_date_only, self.server.peertube_instances, + self.server.loops_instances, self.server.allow_local_network_access, self.server.theme_name, self.server.system_language, @@ -4706,6 +4726,7 @@ def daemon_http_get(self) -> None: self.server.twitter_replacement_domain, self.server.show_published_date_only, self.server.peertube_instances, + self.server.loops_instances, self.server.allow_local_network_access, self.server.system_language, self.server.max_like_count, @@ -4747,6 +4768,7 @@ def daemon_http_get(self) -> None: self.server.twitter_replacement_domain, self.server.show_published_date_only, self.server.peertube_instances, + self.server.loops_instances, self.server.allow_local_network_access, self.server.system_language, self.server.max_like_count, @@ -4793,6 +4815,7 @@ def daemon_http_get(self) -> None: self.server.yt_replace_domain, self.server.twitter_replacement_domain, self.server.peertube_instances, + self.server.loops_instances, self.server.account_timezone, self.server.bold_reading, self.server.show_published_date_only, @@ -4853,6 +4876,7 @@ def daemon_http_get(self) -> None: self.server.theme_name, self.server.dormant_months, self.server.peertube_instances, + self.server.loops_instances, self.server.allow_local_network_access, self.server.text_mode_banner, self.server.system_language, @@ -4902,6 +4926,7 @@ def daemon_http_get(self) -> None: self.server.signing_priv_key_pem, self.server.content_license_url, self.server.peertube_instances, + self.server.loops_instances, self.server.city, self.server.account_timezone, self.server.bold_reading, @@ -4961,6 +4986,7 @@ def daemon_http_get(self) -> None: self.server.twitter_replacement_domain, self.server.show_published_date_only, self.server.peertube_instances, + self.server.loops_instances, self.server.allow_local_network_access, self.server.theme_name, self.server.system_language, @@ -5010,6 +5036,7 @@ def daemon_http_get(self) -> None: self.server.twitter_replacement_domain, self.server.show_published_date_only, self.server.peertube_instances, + self.server.loops_instances, self.server.allow_local_network_access, self.server.theme_name, self.server.system_language, @@ -5075,6 +5102,7 @@ def daemon_http_get(self) -> None: self.server.publish_button_at_top, self.server.theme_name, self.server.peertube_instances, + self.server.loops_instances, self.server.text_mode_banner, self.server.system_language, self.server.max_like_count, @@ -5136,6 +5164,7 @@ def daemon_http_get(self) -> None: self.server.publish_button_at_top, self.server.theme_name, self.server.peertube_instances, + self.server.loops_instances, self.server.text_mode_banner, self.server.system_language, self.server.max_like_count, @@ -5197,6 +5226,7 @@ def daemon_http_get(self) -> None: self.server.publish_button_at_top, self.server.theme_name, self.server.peertube_instances, + self.server.loops_instances, self.server.text_mode_banner, self.server.system_language, self.server.max_like_count, @@ -5258,6 +5288,7 @@ def daemon_http_get(self) -> None: self.server.publish_button_at_top, self.server.theme_name, self.server.peertube_instances, + self.server.loops_instances, self.server.text_mode_banner, self.server.system_language, self.server.max_like_count, @@ -5322,6 +5353,7 @@ def daemon_http_get(self) -> None: self.server.publish_button_at_top, self.server.theme_name, self.server.peertube_instances, + self.server.loops_instances, self.server.text_mode_banner, self.server.system_language, self.server.max_like_count, @@ -5384,6 +5416,7 @@ def daemon_http_get(self) -> None: self.server.publish_button_at_top, self.server.theme_name, self.server.peertube_instances, + self.server.loops_instances, self.server.allow_local_network_access, self.server.text_mode_banner, self.server.system_language, @@ -5446,6 +5479,7 @@ def daemon_http_get(self) -> None: self.server.publish_button_at_top, self.server.theme_name, self.server.peertube_instances, + self.server.loops_instances, self.server.text_mode_banner, self.server.system_language, self.server.max_like_count, @@ -5503,6 +5537,7 @@ def daemon_http_get(self) -> None: self.server.publish_button_at_top, self.server.theme_name, self.server.peertube_instances, + self.server.loops_instances, self.server.allow_local_network_access, self.server.text_mode_banner, self.server.system_language, @@ -5556,6 +5591,7 @@ def daemon_http_get(self) -> None: self.server.publish_button_at_top, self.server.theme_name, self.server.peertube_instances, + self.server.loops_instances, self.server.allow_local_network_access, self.server.text_mode_banner, self.server.system_language, @@ -5708,6 +5744,7 @@ def daemon_http_get(self) -> None: self.server.publish_button_at_top, self.server.theme_name, self.server.peertube_instances, + self.server.loops_instances, self.server.text_mode_banner, self.server.system_language, self.server.max_like_count, @@ -5770,6 +5807,7 @@ def daemon_http_get(self) -> None: self.server.publish_button_at_top, self.server.theme_name, self.server.peertube_instances, + self.server.loops_instances, self.server.allow_local_network_access, self.server.text_mode_banner, self.server.system_language, @@ -5837,6 +5875,7 @@ def daemon_http_get(self) -> None: self.server.publish_button_at_top, self.server.theme_name, self.server.peertube_instances, + self.server.loops_instances, self.server.text_mode_banner, self.server.system_language, self.server.max_like_count, @@ -5891,6 +5930,7 @@ def daemon_http_get(self) -> None: self.server.theme_name, self.server.dormant_months, self.server.peertube_instances, + self.server.loops_instances, self.server.allow_local_network_access, self.server.text_mode_banner, self.server.system_language, @@ -5953,6 +5993,7 @@ def daemon_http_get(self) -> None: self.server.theme_name, self.server.dormant_months, self.server.peertube_instances, + self.server.loops_instances, self.server.allow_local_network_access, self.server.text_mode_banner, self.server.system_language, @@ -6011,6 +6052,7 @@ def daemon_http_get(self) -> None: self.server.theme_name, self.server.dormant_months, self.server.peertube_instances, + self.server.loops_instances, self.server.allow_local_network_access, self.server.text_mode_banner, self.server.system_language, @@ -6070,6 +6112,7 @@ def daemon_http_get(self) -> None: self.server.newswire, self.server.theme_name, self.server.peertube_instances, + self.server.loops_instances, self.server.allow_local_network_access, self.server.text_mode_banner, self.server.system_language, @@ -6129,6 +6172,7 @@ def daemon_http_get(self) -> None: self.server.theme_name, self.server.dormant_months, self.server.peertube_instances, + self.server.loops_instances, self.server.allow_local_network_access, self.server.text_mode_banner, self.server.system_language, @@ -6189,6 +6233,7 @@ def daemon_http_get(self) -> None: self.server.theme_name, self.server.dormant_months, self.server.peertube_instances, + self.server.loops_instances, self.server.allow_local_network_access, self.server.text_mode_banner, self.server.system_language, diff --git a/daemon_get_blog.py b/daemon_get_blog.py index 624d0f716..8b4436639 100644 --- a/daemon_get_blog.py +++ b/daemon_get_blog.py @@ -25,6 +25,7 @@ def show_blog_page(self, authorized: bool, curr_session, max_posts_in_blogs_feed: int, peertube_instances: [], + loops_instances: [], system_language: str, person_cache: {}, fitness: {}) -> bool: @@ -69,6 +70,7 @@ def show_blog_page(self, authorized: bool, domain, port, max_posts_in_blogs_feed, page_number, peertube_instances, + loops_instances, system_language, person_cache, debug) diff --git a/daemon_get_buttons.py b/daemon_get_buttons.py index 2ffbde246..50792eede 100644 --- a/daemon_get_buttons.py +++ b/daemon_get_buttons.py @@ -228,6 +228,7 @@ def delete_button(self, calling_domain: str, path: str, twitter_replacement_domain: str, show_published_date_only: bool, peertube_instances: [], + loops_instances: [], allow_local_network_access: bool, theme_name: str, system_language: str, @@ -338,6 +339,7 @@ def delete_button(self, calling_domain: str, path: str, twitter_replacement_domain, show_published_date_only, peertube_instances, + loops_instances, allow_local_network_access, theme_name, system_language, diff --git a/daemon_get_buttons_announce.py b/daemon_get_buttons_announce.py index 9275e2ab9..124c4145d 100644 --- a/daemon_get_buttons_announce.py +++ b/daemon_get_buttons_announce.py @@ -59,6 +59,7 @@ def announce_button(self, calling_domain: str, path: str, twitter_replacement_domain: str, show_published_date_only: bool, peertube_instances: [], + loops_instances: [], allow_local_network_access: bool, theme_name: str, max_like_count: int, @@ -261,6 +262,7 @@ def announce_button(self, calling_domain: str, path: str, twitter_replacement_domain, show_published_date_only, peertube_instances, + loops_instances, allow_local_network_access, theme_name, system_language, diff --git a/daemon_get_buttons_bookmark.py b/daemon_get_buttons_bookmark.py index 82e3b02c3..8feb89c13 100644 --- a/daemon_get_buttons_bookmark.py +++ b/daemon_get_buttons_bookmark.py @@ -51,6 +51,7 @@ def bookmark_button(self, calling_domain: str, path: str, twitter_replacement_domain: str, show_published_date_only: bool, peertube_instances: [], + loops_instances: [], allow_local_network_access: bool, theme_name: str, system_language: str, @@ -214,6 +215,7 @@ def bookmark_button(self, calling_domain: str, path: str, twitter_replacement_domain, show_published_date_only, peertube_instances, + loops_instances, allow_local_network_access, theme_name, system_language, @@ -279,6 +281,7 @@ def bookmark_button_undo(self, calling_domain: str, path: str, twitter_replacement_domain: str, show_published_date_only: bool, peertube_instances: [], + loops_instances: [], allow_local_network_access: bool, theme_name: str, system_language: str, @@ -441,6 +444,7 @@ def bookmark_button_undo(self, calling_domain: str, path: str, twitter_replacement_domain, show_published_date_only, peertube_instances, + loops_instances, allow_local_network_access, theme_name, system_language, diff --git a/daemon_get_buttons_like.py b/daemon_get_buttons_like.py index 7e8d49c91..ad3072503 100644 --- a/daemon_get_buttons_like.py +++ b/daemon_get_buttons_like.py @@ -54,6 +54,7 @@ def like_button(self, calling_domain: str, path: str, twitter_replacement_domain: str, show_published_date_only: bool, peertube_instances: [], + loops_instances: [], allow_local_network_access: bool, theme_name: str, system_language: str, @@ -261,6 +262,7 @@ def like_button(self, calling_domain: str, path: str, twitter_replacement_domain, show_published_date_only, peertube_instances, + loops_instances, allow_local_network_access, theme_name, system_language, @@ -334,6 +336,7 @@ def like_button_undo(self, calling_domain: str, path: str, twitter_replacement_domain: str, show_published_date_only: bool, peertube_instances: [], + loops_instances: [], allow_local_network_access: bool, theme_name: str, system_language: str, @@ -532,6 +535,7 @@ def like_button_undo(self, calling_domain: str, path: str, twitter_replacement_domain, show_published_date_only, peertube_instances, + loops_instances, allow_local_network_access, theme_name, system_language, diff --git a/daemon_get_buttons_mute.py b/daemon_get_buttons_mute.py index 348080a58..f189cd5b3 100644 --- a/daemon_get_buttons_mute.py +++ b/daemon_get_buttons_mute.py @@ -46,6 +46,7 @@ def mute_button(self, calling_domain: str, path: str, twitter_replacement_domain: str, show_published_date_only: bool, peertube_instances: [], + loops_instances: [], allow_local_network_access: bool, theme_name: str, system_language: str, @@ -169,6 +170,7 @@ def mute_button(self, calling_domain: str, path: str, twitter_replacement_domain, show_published_date_only, peertube_instances, + loops_instances, allow_local_network_access, theme_name, system_language, @@ -236,6 +238,7 @@ def mute_button_undo(self, calling_domain: str, path: str, twitter_replacement_domain: str, show_published_date_only: bool, peertube_instances: [], + loops_instances: [], allow_local_network_access: bool, theme_name: str, system_language: str, @@ -359,6 +362,7 @@ def mute_button_undo(self, calling_domain: str, path: str, twitter_replacement_domain, show_published_date_only, peertube_instances, + loops_instances, allow_local_network_access, theme_name, system_language, diff --git a/daemon_get_buttons_reaction.py b/daemon_get_buttons_reaction.py index 1e5c00758..d877b7ae6 100644 --- a/daemon_get_buttons_reaction.py +++ b/daemon_get_buttons_reaction.py @@ -55,6 +55,7 @@ def reaction_button(self, calling_domain: str, path: str, twitter_replacement_domain: str, show_published_date_only: bool, peertube_instances: [], + loops_instances: [], allow_local_network_access: bool, theme_name: str, system_language: str, @@ -291,6 +292,7 @@ def reaction_button(self, calling_domain: str, path: str, twitter_replacement_domain, show_published_date_only, peertube_instances, + loops_instances, allow_local_network_access, theme_name, system_language, @@ -362,6 +364,7 @@ def reaction_button_undo(self, calling_domain: str, path: str, twitter_replacement_domain: str, show_published_date_only: bool, peertube_instances: [], + loops_instances: [], allow_local_network_access: bool, theme_name: str, system_language: str, @@ -585,6 +588,7 @@ def reaction_button_undo(self, calling_domain: str, path: str, twitter_replacement_domain, show_published_date_only, peertube_instances, + loops_instances, allow_local_network_access, theme_name, system_language, diff --git a/daemon_get_feeds.py b/daemon_get_feeds.py index ecd9e3c58..9b152736c 100644 --- a/daemon_get_feeds.py +++ b/daemon_get_feeds.py @@ -54,6 +54,7 @@ def show_shares_feed(self, authorized: bool, theme_name: str, dormant_months: int, peertube_instances: [], + loops_instances: [], allow_local_network_access: bool, text_mode_banner: str, system_language: str, @@ -153,6 +154,7 @@ def show_shares_feed(self, authorized: bool, theme_name, dormant_months, peertube_instances, + loops_instances, allow_local_network_access, text_mode_banner, debug, @@ -250,6 +252,7 @@ def show_following_feed(self, authorized: bool, theme_name: str, dormant_months: int, peertube_instances: [], + loops_instances: [], allow_local_network_access: bool, text_mode_banner: str, system_language: str, @@ -352,6 +355,7 @@ def show_following_feed(self, authorized: bool, theme_name, dormant_months, peertube_instances, + loops_instances, allow_local_network_access, text_mode_banner, debug, @@ -456,6 +460,7 @@ def show_moved_feed(self, authorized: bool, theme_name: str, dormant_months: int, peertube_instances: [], + loops_instances: [], allow_local_network_access: bool, text_mode_banner: str, system_language: str, @@ -553,6 +558,7 @@ def show_moved_feed(self, authorized: bool, theme_name, dormant_months, peertube_instances, + loops_instances, allow_local_network_access, text_mode_banner, debug, @@ -649,6 +655,7 @@ def show_inactive_feed(self, authorized: bool, newswire: {}, theme_name: str, peertube_instances: [], + loops_instances: [], allow_local_network_access: bool, text_mode_banner: str, system_language: str, @@ -747,6 +754,7 @@ def show_inactive_feed(self, authorized: bool, theme_name, dormant_months, peertube_instances, + loops_instances, allow_local_network_access, text_mode_banner, debug, @@ -845,6 +853,7 @@ def show_followers_feed(self, authorized: bool, theme_name: str, dormant_months: int, peertube_instances: [], + loops_instances: [], allow_local_network_access: bool, text_mode_banner: str, system_language: str, @@ -944,6 +953,7 @@ def show_followers_feed(self, authorized: bool, theme_name, dormant_months, peertube_instances, + loops_instances, allow_local_network_access, text_mode_banner, debug, diff --git a/daemon_get_hashtag.py b/daemon_get_hashtag.py index 6affa397a..87f73191d 100644 --- a/daemon_get_hashtag.py +++ b/daemon_get_hashtag.py @@ -167,6 +167,7 @@ def hashtag_search2(self, calling_domain: str, twitter_replacement_domain: str, show_published_date_only: bool, peertube_instances: [], + loops_instances: [], allow_local_network_access: bool, theme_name: str, system_language: str, @@ -235,6 +236,7 @@ def hashtag_search2(self, calling_domain: str, twitter_replacement_domain, show_published_date_only, peertube_instances, + loops_instances, allow_local_network_access, theme_name, system_language, diff --git a/daemon_get_post.py b/daemon_get_post.py index e5c0ba369..34394913c 100644 --- a/daemon_get_post.py +++ b/daemon_get_post.py @@ -73,6 +73,7 @@ def _show_post_from_file(self, post_filename: str, liked_by: str, twitter_replacement_domain: str, show_published_date_only: bool, peertube_instances: [], + loops_instances: [], allow_local_network_access: bool, theme_name: str, system_language: str, @@ -160,6 +161,7 @@ def _show_post_from_file(self, post_filename: str, liked_by: str, twitter_replacement_domain, show_published_date_only, peertube_instances, + loops_instances, allow_local_network_access, theme_name, system_language, @@ -247,6 +249,7 @@ def show_individual_post(self, ssml_getreq: bool, authorized: bool, twitter_replacement_domain: str, show_published_date_only: bool, peertube_instances: [], + loops_instances: [], allow_local_network_access: bool, theme_name: str, system_language: str, @@ -352,6 +355,7 @@ def show_individual_post(self, ssml_getreq: bool, authorized: bool, twitter_replacement_domain, show_published_date_only, peertube_instances, + loops_instances, allow_local_network_access, theme_name, system_language, @@ -408,6 +412,7 @@ def show_new_post(self, edit_post_params: {}, twitter_replacement_domain: str, show_published_date_only: bool, peertube_instances: [], + loops_instances: [], allow_local_network_access: bool, max_like_count: int, signing_priv_key_pem: str, @@ -529,6 +534,7 @@ def show_new_post(self, edit_post_params: {}, twitter_replacement_domain, show_published_date_only, peertube_instances, + loops_instances, allow_local_network_access, system_language, languages_understood, @@ -590,6 +596,7 @@ def show_individual_at_post(self, ssml_getreq: bool, authorized: bool, twitter_replacement_domain: str, show_published_date_only: bool, peertube_instances: [], + loops_instances: [], allow_local_network_access: bool, theme_name: str, system_language: str, @@ -702,6 +709,7 @@ def show_individual_at_post(self, ssml_getreq: bool, authorized: bool, twitter_replacement_domain, show_published_date_only, peertube_instances, + loops_instances, allow_local_network_access, theme_name, system_language, @@ -746,6 +754,7 @@ def show_likers_of_post(self, authorized: bool, twitter_replacement_domain: str, show_published_date_only: bool, peertube_instances: [], + loops_instances: [], allow_local_network_access: bool, system_language: str, max_like_count: int, @@ -797,6 +806,7 @@ def show_likers_of_post(self, authorized: bool, twitter_replacement_domain, show_published_date_only, peertube_instances, + loops_instances, allow_local_network_access, system_language, max_like_count, @@ -849,6 +859,7 @@ def show_announcers_of_post(self, authorized: bool, twitter_replacement_domain: str, show_published_date_only: bool, peertube_instances: [], + loops_instances: [], allow_local_network_access: bool, system_language: str, max_like_count: int, @@ -901,6 +912,7 @@ def show_announcers_of_post(self, authorized: bool, twitter_replacement_domain, show_published_date_only, peertube_instances, + loops_instances, allow_local_network_access, system_language, max_like_count, @@ -949,6 +961,7 @@ def show_replies_to_post(self, authorized: bool, yt_replace_domain: str, twitter_replacement_domain: str, peertube_instances: [], + loops_instances: [], account_timezone: {}, bold_reading_nicknames: {}, show_published_date_only: bool, @@ -1059,6 +1072,7 @@ def show_replies_to_post(self, authorized: bool, twitter_replacement_domain, show_published_date_only, peertube_instances, + loops_instances, allow_local_network_access, theme_name, system_language, @@ -1181,6 +1195,7 @@ def show_replies_to_post(self, authorized: bool, twitter_replacement_domain, show_published_date_only, peertube_instances, + loops_instances, allow_local_network_access, theme_name, system_language, @@ -1254,6 +1269,7 @@ def show_notify_post(self, authorized: bool, twitter_replacement_domain: str, show_published_date_only: bool, peertube_instances: [], + loops_instances: [], allow_local_network_access: bool, theme_name: str, system_language: str, @@ -1316,6 +1332,7 @@ def show_notify_post(self, authorized: bool, twitter_replacement_domain, show_published_date_only, peertube_instances, + loops_instances, allow_local_network_access, theme_name, system_language, @@ -1362,6 +1379,7 @@ def show_conversation_thread(self, authorized: bool, twitter_replacement_domain: str, show_published_date_only: bool, peertube_instances: [], + loops_instances: [], allow_local_network_access: bool, theme_name: str, system_language: str, @@ -1444,6 +1462,7 @@ def show_conversation_thread(self, authorized: bool, twitter_replacement_domain, show_published_date_only, peertube_instances, + loops_instances, allow_local_network_access, theme_name, system_language, diff --git a/daemon_get_profile.py b/daemon_get_profile.py index 51f810839..118eb3bd8 100644 --- a/daemon_get_profile.py +++ b/daemon_get_profile.py @@ -70,6 +70,7 @@ def show_person_profile(self, authorized: bool, theme_name: str, dormant_months: int, peertube_instances: [], + loops_instances: [], allow_local_network_access: bool, text_mode_banner: str, system_language: str, @@ -138,6 +139,7 @@ def show_person_profile(self, authorized: bool, theme_name, dormant_months, peertube_instances, + loops_instances, allow_local_network_access, text_mode_banner, debug, @@ -237,6 +239,7 @@ def show_roles(self, calling_domain: str, referer_domain: str, theme_name: str, dormant_months: int, peertube_instances: [], + loops_instances: [], allow_local_network_access: bool, text_mode_banner: str, system_language: str, @@ -313,6 +316,7 @@ def show_roles(self, calling_domain: str, referer_domain: str, theme_name, dormant_months, peertube_instances, + loops_instances, allow_local_network_access, text_mode_banner, debug, @@ -388,7 +392,9 @@ def show_skills(self, calling_domain: str, referer_domain: str, shared_items_federated_domains: [], signing_priv_key_pem: str, content_license_url: str, - peertube_instances: [], city: str, + peertube_instances: [], + loops_instances: [], + city: str, account_timezone: {}, bold_reading_nicknames: {}, max_shares_on_profile: int, @@ -474,6 +480,7 @@ def show_skills(self, calling_domain: str, referer_domain: str, theme_name, dormant_months, peertube_instances, + loops_instances, allow_local_network_access, text_mode_banner, debug, @@ -559,6 +566,7 @@ def edit_profile2(self, calling_domain: str, path: str, domain: str, port: int, cookie: str, peertube_instances: [], + loops_instances: [], access_keys: {}, key_shortcuts: {}, default_reply_interval_hrs: int, @@ -594,6 +602,7 @@ def edit_profile2(self, calling_domain: str, path: str, default_timeline, theme_name, peertube_instances, + loops_instances, text_mode_banner, user_agents_blocked, crawlers_allowed, diff --git a/daemon_get_reactions.py b/daemon_get_reactions.py index 83728bf3d..3404eb56b 100644 --- a/daemon_get_reactions.py +++ b/daemon_get_reactions.py @@ -35,6 +35,7 @@ def reaction_picker2(self, calling_domain: str, path: str, twitter_replacement_domain: str, show_published_date_only: bool, peertube_instances: [], + loops_instances: [], allow_local_network_access: bool, theme_name: str, system_language: str, @@ -142,6 +143,7 @@ def reaction_picker2(self, calling_domain: str, path: str, twitter_replacement_domain, show_published_date_only, peertube_instances, + loops_instances, allow_local_network_access, theme_name, system_language, diff --git a/daemon_get_timeline.py b/daemon_get_timeline.py index 9e1103948..3da965735 100644 --- a/daemon_get_timeline.py +++ b/daemon_get_timeline.py @@ -70,6 +70,7 @@ def show_media_timeline(self, authorized: bool, publish_button_at_top: bool, theme_name: str, peertube_instances: [], + loops_instances: [], text_mode_banner: str, system_language: str, max_like_count: int, @@ -188,6 +189,7 @@ def show_media_timeline(self, authorized: bool, authorized, theme_name, peertube_instances, + loops_instances, allow_local_network_access, text_mode_banner, access_keys, @@ -294,6 +296,7 @@ def show_blogs_timeline(self, authorized: bool, publish_button_at_top: bool, theme_name: str, peertube_instances: [], + loops_instances: [], text_mode_banner: str, system_language: str, max_like_count: int, @@ -407,6 +410,7 @@ def show_blogs_timeline(self, authorized: bool, authorized, theme_name, peertube_instances, + loops_instances, allow_local_network_access, text_mode_banner, access_keys, @@ -511,6 +515,7 @@ def show_news_timeline(self, authorized: bool, publish_button_at_top: bool, theme_name: str, peertube_instances: [], + loops_instances: [], allow_local_network_access: bool, text_mode_banner: str, system_language: str, @@ -630,6 +635,7 @@ def show_news_timeline(self, authorized: bool, authorized, theme_name, peertube_instances, + loops_instances, allow_local_network_access, text_mode_banner, access_keys, @@ -734,6 +740,7 @@ def show_features_timeline(self, authorized: bool, publish_button_at_top: bool, theme_name: str, peertube_instances: [], + loops_instances: [], text_mode_banner: str, system_language: str, max_like_count: int, @@ -847,6 +854,7 @@ def show_features_timeline(self, authorized: bool, authorized, theme_name, peertube_instances, + loops_instances, allow_local_network_access, text_mode_banner, access_keys, @@ -947,6 +955,7 @@ def show_shares_timeline(self, authorized: bool, publish_button_at_top: bool, theme_name: str, peertube_instances: [], + loops_instances: [], allow_local_network_access: bool, text_mode_banner: str, system_language: str, @@ -1023,6 +1032,7 @@ def show_shares_timeline(self, authorized: bool, publish_button_at_top, authorized, theme_name, peertube_instances, + loops_instances, allow_local_network_access, text_mode_banner, access_keys, @@ -1099,6 +1109,7 @@ def show_wanted_timeline(self, authorized: bool, publish_button_at_top: bool, theme_name: str, peertube_instances: [], + loops_instances: [], allow_local_network_access: bool, text_mode_banner: str, system_language: str, @@ -1174,6 +1185,7 @@ def show_wanted_timeline(self, authorized: bool, publish_button_at_top, authorized, theme_name, peertube_instances, + loops_instances, allow_local_network_access, text_mode_banner, access_keys, @@ -1254,6 +1266,7 @@ def show_bookmarks_timeline(self, authorized: bool, publish_button_at_top: bool, theme_name: str, peertube_instances: [], + loops_instances: [], text_mode_banner: str, system_language: str, max_like_count: int, @@ -1362,6 +1375,7 @@ def show_bookmarks_timeline(self, authorized: bool, authorized, theme_name, peertube_instances, + loops_instances, allow_local_network_access, text_mode_banner, access_keys, @@ -1466,6 +1480,7 @@ def show_outbox_timeline(self, authorized: bool, publish_button_at_top: bool, theme_name: str, peertube_instances: [], + loops_instances: [], allow_local_network_access: bool, text_mode_banner: str, system_language: str, @@ -1586,6 +1601,7 @@ def show_outbox_timeline(self, authorized: bool, authorized, theme_name, peertube_instances, + loops_instances, allow_local_network_access, text_mode_banner, access_keys, @@ -1680,6 +1696,7 @@ def show_mod_timeline(self, authorized: bool, publish_button_at_top: bool, theme_name: str, peertube_instances: [], + loops_instances: [], text_mode_banner: str, system_language: str, max_like_count: int, @@ -1785,6 +1802,7 @@ def show_mod_timeline(self, authorized: bool, authorized, moderation_action_str, theme_name, peertube_instances, + loops_instances, allow_local_network_access, text_mode_banner, access_keys, @@ -1888,6 +1906,7 @@ def show_dms(self, authorized: bool, publish_button_at_top: bool, theme_name: str, peertube_instances: [], + loops_instances: [], text_mode_banner: str, system_language: str, max_like_count: int, @@ -1999,6 +2018,7 @@ def show_dms(self, authorized: bool, publish_button_at_top, authorized, theme_name, peertube_instances, + loops_instances, allow_local_network_access, text_mode_banner, access_keys, @@ -2104,6 +2124,7 @@ def show_replies(self, authorized: bool, publish_button_at_top: bool, theme_name: str, peertube_instances: [], + loops_instances: [], text_mode_banner: str, system_language: str, max_like_count: int, @@ -2215,6 +2236,7 @@ def show_replies(self, authorized: bool, publish_button_at_top, authorized, theme_name, peertube_instances, + loops_instances, allow_local_network_access, text_mode_banner, access_keys, @@ -2321,6 +2343,7 @@ def show_inbox(self, authorized: bool, publish_button_at_top: bool, theme_name: str, peertube_instances: [], + loops_instances: [], text_mode_banner: str, system_language: str, max_like_count: int, @@ -2444,6 +2467,7 @@ def show_inbox(self, authorized: bool, authorized, theme_name, peertube_instances, + loops_instances, allow_local_network_access, text_mode_banner, access_keys, diff --git a/daemon_post.py b/daemon_post.py index f78511ade..fa0bc0bcc 100644 --- a/daemon_post.py +++ b/daemon_post.py @@ -428,6 +428,7 @@ def daemon_http_post(self) -> None: self.server.theme_name, self.server.dyslexic_font, self.server.peertube_instances, + self.server.loops_instances, self.server.mitm_servers) self.server.postreq_busy = False return @@ -581,6 +582,7 @@ def daemon_http_post(self) -> None: self.server.twitter_replacement_domain, self.server.show_published_date_only, self.server.peertube_instances, + self.server.loops_instances, self.server.allow_local_network_access, self.server.theme_name, self.server.system_language, @@ -846,6 +848,7 @@ def daemon_http_post(self) -> None: self.server.signing_priv_key_pem, self.server.twitter_replacement_domain, self.server.peertube_instances, + self.server.loops_instances, self.server.yt_replace_domain, self.server.cached_webfingers, self.server.recent_posts_cache, @@ -1025,6 +1028,7 @@ def daemon_http_post(self) -> None: self.server.show_published_date_only, self.server.min_images_for_accounts, self.server.peertube_instances, + self.server.loops_instances, self.server.max_mentions, self.server.max_emoji, self.server.max_recent_posts, diff --git a/daemon_post_person_options.py b/daemon_post_person_options.py index ad3eee95f..3c029dd1a 100644 --- a/daemon_post_person_options.py +++ b/daemon_post_person_options.py @@ -234,6 +234,7 @@ def _person_options_view(self, options_confirm_params: str, show_published_date_only: bool, default_timeline: str, peertube_instances: [], + loops_instances: [], allow_local_network_access: bool, theme_name: str, system_language: str, @@ -321,6 +322,7 @@ def _person_options_view(self, options_confirm_params: str, show_published_date_only, default_timeline, peertube_instances, + loops_instances, allow_local_network_access, theme_name, access_keys, @@ -901,6 +903,7 @@ def _person_options_dm(self, options_confirm_params: str, twitter_replacement_domain: str, show_published_date_only: bool, peertube_instances: [], + loops_instances: [], allow_local_network_access: bool, max_like_count: int, signing_priv_key_pem: str, @@ -979,6 +982,7 @@ def _person_options_dm(self, options_confirm_params: str, twitter_replacement_domain, show_published_date_only, peertube_instances, + loops_instances, allow_local_network_access, system_language, languages_understood, @@ -1154,6 +1158,7 @@ def _person_options_report(self, options_confirm_params: str, twitter_replacement_domain: str, show_published_date_only: bool, peertube_instances: [], + loops_instances: [], allow_local_network_access: bool, max_like_count: int, signing_priv_key_pem: str, @@ -1232,6 +1237,7 @@ def _person_options_report(self, options_confirm_params: str, twitter_replacement_domain, show_published_date_only, peertube_instances, + loops_instances, allow_local_network_access, system_language, languages_understood, @@ -1282,6 +1288,7 @@ def person_options2(self, path: str, signing_priv_key_pem: str, twitter_replacement_domain: str, peertube_instances: [], + loops_instances: [], yt_replace_domain: str, cached_webfingers: {}, recent_posts_cache: {}, @@ -1426,6 +1433,7 @@ def person_options2(self, path: str, show_published_date_only, default_timeline, peertube_instances, + loops_instances, allow_local_network_access, theme_name, system_language, @@ -1646,6 +1654,7 @@ def person_options2(self, path: str, twitter_replacement_domain, show_published_date_only, peertube_instances, + loops_instances, allow_local_network_access, max_like_count, signing_priv_key_pem, @@ -1719,6 +1728,7 @@ def person_options2(self, path: str, twitter_replacement_domain, show_published_date_only, peertube_instances, + loops_instances, allow_local_network_access, max_like_count, signing_priv_key_pem, diff --git a/daemon_post_profile.py b/daemon_post_profile.py index 2298727a4..df200c49e 100644 --- a/daemon_post_profile.py +++ b/daemon_post_profile.py @@ -100,6 +100,8 @@ from pixelfed import get_pixelfed from pixelfed import set_pixelfed from peertube import get_peertube from peertube import set_peertube +from loops import get_loops +from loops import set_loops from xmpp import get_xmpp_address from xmpp import set_xmpp_address from matrix import get_matrix_address @@ -292,6 +294,33 @@ def _profile_post_peertube_instances(base_dir: str, fields: {}, self, peertube_instances.clear() +def _profile_post_loops_instances(base_dir: str, fields: {}, self, + loops_instances: []) -> None: + """ HTTP POST save Loops instances list + """ + loops_instances_file = data_dir(base_dir) + '/loops.txt' + if fields.get('ptInstances'): + loops_instances.clear() + save_string(fields['loopsInstances'], loops_instances_file, + 'EX: unable to write loops ' + + loops_instances_file) + pt_instances_list = fields['ptInstances'].split('\n') + if pt_instances_list: + for url in pt_instances_list: + url = url.strip() + if not url: + continue + if url in loops_instances: + continue + loops_instances.append(url) + else: + if is_a_file(loops_instances_file): + erase_file(loops_instances_file, + 'EX: _profile_edit unable to delete ' + + loops_instances_file) + loops_instances.clear() + + def _profile_post_block_federated(base_dir: str, fields: {}, self) -> None: """ HTTP POST save blocking API endpoints """ @@ -2061,6 +2090,22 @@ def _profile_post_peertube(actor_json: {}, fields: {}, return actor_changed +def _profile_post_loops(actor_json: {}, fields: {}, + actor_changed: bool) -> bool: + """ HTTP POST change Loops channel address + """ + current_loops = get_loops(actor_json) + if fields.get('loopsChannel'): + if fields['loopsChannel'] != current_loops: + set_loops(actor_json, fields['loopsChannel']) + actor_changed = True + else: + if current_loops: + set_loops(actor_json, '') + actor_changed = True + return actor_changed + + def _profile_post_pronouns(actor_json: {}, fields: {}, actor_changed: bool) -> bool: """ HTTP POST change pronouns @@ -2614,6 +2659,7 @@ def profile_edit(self, calling_domain: str, cookie: str, translate: {}, theme_name: str, dyslexic_font: bool, peertube_instances: [], + loops_instances: [], mitm_servers: []) -> None: """Updates your user profile after editing via the Edit button on the profile screen @@ -2973,6 +3019,10 @@ def profile_edit(self, calling_domain: str, cookie: str, _profile_post_peertube(actor_json, fields, actor_changed) + actor_changed = \ + _profile_post_loops(actor_json, fields, + actor_changed) + actor_changed = \ _profile_post_pronouns(actor_json, fields, actor_changed) @@ -3292,6 +3342,8 @@ def profile_edit(self, calling_domain: str, cookie: str, _profile_post_robots_txt(base_dir, fields, self) _profile_post_peertube_instances(base_dir, fields, self, peertube_instances) + _profile_post_loops_instances(base_dir, fields, self, + loops_instances) _profile_post_git_projects(base_dir, nickname, domain, fields) diff --git a/daemon_post_receive.py b/daemon_post_receive.py index a8fa903e8..65328bb78 100644 --- a/daemon_post_receive.py +++ b/daemon_post_receive.py @@ -108,6 +108,7 @@ def _receive_new_post_process_newpost(self, fields: {}, twitter_replacement_domain: str, show_published_date_only: bool, peertube_instances: [], + loops_instances: [], theme_name: str, max_like_count: int, cw_lists: {}, @@ -231,6 +232,7 @@ def _receive_new_post_process_newpost(self, fields: {}, twitter_replacement_domain, show_published_date_only, peertube_instances, + loops_instances, theme_name, max_like_count, cw_lists, @@ -554,6 +556,7 @@ def _receive_new_post_process_newunlisted(self, fields: {}, twitter_replacement_domain: str, show_published_date_only: bool, peertube_instances: [], + loops_instances: [], theme_name: str, max_like_count: int, cw_lists: {}, @@ -661,6 +664,7 @@ def _receive_new_post_process_newunlisted(self, fields: {}, twitter_replacement_domain, show_published_date_only, peertube_instances, + loops_instances, theme_name, max_like_count, cw_lists, @@ -726,6 +730,7 @@ def _receive_new_post_process_newfollowers(self, fields: {}, twitter_replacement_domain: str, show_published_date_only: bool, peertube_instances: [], + loops_instances: [], theme_name: str, max_like_count: int, cw_lists: {}, @@ -843,6 +848,7 @@ def _receive_new_post_process_newfollowers(self, fields: {}, twitter_replacement_domain, show_published_date_only, peertube_instances, + loops_instances, theme_name, max_like_count, cw_lists, @@ -909,6 +915,7 @@ def _receive_new_post_process_newdm(self, fields: {}, twitter_replacement_domain: str, show_published_date_only: bool, peertube_instances: [], + loops_instances: [], theme_name: str, max_like_count: int, cw_lists: {}, @@ -1034,6 +1041,7 @@ def _receive_new_post_process_newdm(self, fields: {}, twitter_replacement_domain, show_published_date_only, peertube_instances, + loops_instances, theme_name, max_like_count, cw_lists, @@ -1100,6 +1108,7 @@ def _receive_new_post_process_newreminder(self, fields: {}, nickname: str, twitter_replacement_domain: str, show_published_date_only: bool, peertube_instances: [], + loops_instances: [], theme_name: str, max_like_count: int, cw_lists: {}, @@ -1209,6 +1218,7 @@ def _receive_new_post_process_newreminder(self, fields: {}, nickname: str, twitter_replacement_domain, show_published_date_only, peertube_instances, + loops_instances, theme_name, max_like_count, cw_lists, @@ -1441,6 +1451,7 @@ def _receive_new_post_process_newreading(self, fields: {}, twitter_replacement_domain: str, show_published_date_only: bool, peertube_instances: [], + loops_instances: [], theme_name: str, max_like_count: int, cw_lists: {}, @@ -1569,6 +1580,7 @@ def _receive_new_post_process_newreading(self, fields: {}, twitter_replacement_domain, show_published_date_only, peertube_instances, + loops_instances, theme_name, max_like_count, cw_lists, @@ -1778,6 +1790,7 @@ def _receive_new_post_process(self, post_type: str, path: str, headers: {}, show_published_date_only: bool, min_images_for_accounts: [], peertube_instances: [], + loops_instances: [], max_mentions: int, max_emoji: int, max_recent_posts: int, cached_webfingers: {}, @@ -2125,6 +2138,7 @@ def _receive_new_post_process(self, post_type: str, path: str, headers: {}, twitter_replacement_domain, show_published_date_only, peertube_instances, + loops_instances, theme_name, max_like_count, cw_lists, @@ -2204,6 +2218,7 @@ def _receive_new_post_process(self, post_type: str, path: str, headers: {}, twitter_replacement_domain, show_published_date_only, peertube_instances, + loops_instances, theme_name, max_like_count, cw_lists, @@ -2253,6 +2268,7 @@ def _receive_new_post_process(self, post_type: str, path: str, headers: {}, twitter_replacement_domain, show_published_date_only, peertube_instances, + loops_instances, theme_name, max_like_count, cw_lists, @@ -2301,6 +2317,7 @@ def _receive_new_post_process(self, post_type: str, path: str, headers: {}, twitter_replacement_domain, show_published_date_only, peertube_instances, + loops_instances, theme_name, max_like_count, cw_lists, @@ -2350,6 +2367,7 @@ def _receive_new_post_process(self, post_type: str, path: str, headers: {}, twitter_replacement_domain, show_published_date_only, peertube_instances, + loops_instances, theme_name, max_like_count, cw_lists, @@ -2424,6 +2442,7 @@ def _receive_new_post_process(self, post_type: str, path: str, headers: {}, twitter_replacement_domain, show_published_date_only, peertube_instances, + loops_instances, theme_name, max_like_count, cw_lists, @@ -2481,6 +2500,7 @@ def receive_new_post(self, post_type, path: str, show_published_date_only: bool, min_images_for_accounts: [], peertube_instances: [], + loops_instances: [], max_mentions: int, max_emoji: int, max_recent_posts: int, cached_webfingers: {}, @@ -2626,6 +2646,7 @@ def receive_new_post(self, post_type, path: str, show_published_date_only, min_images_for_accounts, peertube_instances, + loops_instances, max_mentions, max_emoji, max_recent_posts, cached_webfingers, diff --git a/daemon_post_search.py b/daemon_post_search.py index 3b695c331..3366f813c 100644 --- a/daemon_post_search.py +++ b/daemon_post_search.py @@ -75,6 +75,7 @@ def _receive_search_hashtag(self, actor_str: str, twitter_replacement_domain: str, show_published_date_only: bool, peertube_instances: [], + loops_instances: [], allow_local_network_access: bool, theme_name: str, system_language: str, @@ -125,6 +126,7 @@ def _receive_search_hashtag(self, actor_str: str, twitter_replacement_domain, show_published_date_only, peertube_instances, + loops_instances, allow_local_network_access, theme_name, system_language, @@ -215,6 +217,7 @@ def _receive_search_my_posts(self, search_str: str, twitter_replacement_domain: str, show_published_date_only: bool, peertube_instances: [], + loops_instances: [], allow_local_network_access: bool, theme_name: str, system_language: str, @@ -283,6 +286,7 @@ def _receive_search_my_posts(self, search_str: str, twitter_replacement_domain, show_published_date_only, peertube_instances, + loops_instances, allow_local_network_access, theme_name, 'outbox', system_language, @@ -334,6 +338,7 @@ def _receive_search_bookmarks(self, search_str: str, twitter_replacement_domain: str, show_published_date_only: bool, peertube_instances: [], + loops_instances: [], allow_local_network_access: bool, theme_name: str, system_language: str, @@ -402,6 +407,7 @@ def _receive_search_bookmarks(self, search_str: str, twitter_replacement_domain, show_published_date_only, peertube_instances, + loops_instances, allow_local_network_access, theme_name, 'bookmarks', system_language, @@ -454,6 +460,7 @@ def _receive_search_handle(self, search_str: str, show_published_date_only: bool, default_timeline: str, peertube_instances: [], + loops_instances: [], allow_local_network_access: bool, theme_name: str, system_language: str, @@ -622,6 +629,7 @@ def _receive_search_handle(self, search_str: str, show_published_date_only, default_timeline, peertube_instances, + loops_instances, allow_local_network_access, theme_name, access_keys, @@ -793,6 +801,7 @@ def receive_search_query(self, calling_domain: str, cookie: str, twitter_replacement_domain: str, show_published_date_only: bool, peertube_instances: [], + loops_instances: [], allow_local_network_access: bool, theme_name: str, system_language: str, @@ -907,6 +916,7 @@ def receive_search_query(self, calling_domain: str, cookie: str, twitter_replacement_domain, show_published_date_only, peertube_instances, + loops_instances, allow_local_network_access, theme_name, system_language, @@ -959,6 +969,7 @@ def receive_search_query(self, calling_domain: str, cookie: str, twitter_replacement_domain, show_published_date_only, peertube_instances, + loops_instances, allow_local_network_access, theme_name, system_language, @@ -998,6 +1009,7 @@ def receive_search_query(self, calling_domain: str, cookie: str, twitter_replacement_domain, show_published_date_only, peertube_instances, + loops_instances, allow_local_network_access, theme_name, system_language, @@ -1039,6 +1051,7 @@ def receive_search_query(self, calling_domain: str, cookie: str, show_published_date_only, default_timeline, peertube_instances, + loops_instances, allow_local_network_access, theme_name, system_language, diff --git a/daemon_utils.py b/daemon_utils.py index 627da1e46..e907c9d01 100644 --- a/daemon_utils.py +++ b/daemon_utils.py @@ -58,6 +58,7 @@ from music import get_music_site_url from youtube import get_youtube from pixelfed import get_pixelfed from peertube import get_peertube +from loops import get_loops from xmpp import get_xmpp_address from matrix import get_matrix_address from ssb import get_ssb_address @@ -148,6 +149,7 @@ def post_to_outbox(self, message_json: {}, version: str, self.server.low_bandwidth, self.server.signing_priv_key_pem, self.server.peertube_instances, + self.server.loops_instances, self.server.theme_name, self.server.max_like_count, self.server.max_recent_posts, @@ -699,6 +701,7 @@ def show_person_options(self, calling_domain: str, path: str, music_site_url = None youtube = None peertube = None + loops = None xmpp_address = None matrix_address = None blog_address = None @@ -746,6 +749,7 @@ def show_person_options(self, calling_domain: str, path: str, music_site_url = get_music_site_url(actor_json) youtube = get_youtube(actor_json) peertube = get_peertube(actor_json) + loops = get_loops(actor_json) xmpp_address = get_xmpp_address(actor_json) matrix_address = get_matrix_address(actor_json) ssb_address = get_ssb_address(actor_json) @@ -828,7 +832,7 @@ def show_person_options(self, calling_domain: str, path: str, self.server.blocked_cache, repo_url, self.server.sites_unavailable, - youtube, peertube, pixelfed, + youtube, peertube, loops, pixelfed, discord, music_site_url, art_site_url, self.server.mitm_servers, diff --git a/inbox.py b/inbox.py index 8a87ab71f..54248e47b 100644 --- a/inbox.py +++ b/inbox.py @@ -191,6 +191,7 @@ def _inbox_store_post_to_html_cache(recent_posts_cache: {}, allow_deletion: bool, boxname: str, show_published_date_only: bool, peertube_instances: [], + loops_instances: [], allow_local_network_access: bool, theme_name: str, system_language: str, max_like_count: int, @@ -235,7 +236,8 @@ def _inbox_store_post_to_html_cache(recent_posts_cache: {}, http_prefix, __version__, boxname, yt_replace_domain, twitter_replacement_domain, show_published_date_only, - peertube_instances, allow_local_network_access, + peertube_instances, loops_instances, + allow_local_network_access, theme_name, system_language, max_like_count, not_dm, True, True, False, True, False, cw_lists, lists_enabled, timezone, mitm, @@ -867,6 +869,7 @@ def update_edited_post(base_dir: str, twitter_replacement_domain: str, show_published_date_only: bool, peertube_instances: [], + loops_instances: [], theme_name: str, max_like_count: int, cw_lists: {}, dogwhistles: {}, min_images_for_accounts: [], @@ -926,6 +929,7 @@ def update_edited_post(base_dir: str, twitter_replacement_domain, show_published_date_only, peertube_instances, + loops_instances, theme_name, max_like_count, cw_lists, dogwhistles, min_images_for_accounts, @@ -1872,6 +1876,7 @@ def _inbox_after_initial(server, inbox_start_time, show_published_date_only: bool, allow_local_network_access: bool, peertube_instances: [], + loops_instances: [], last_bounce_message: [], theme_name: str, system_language: str, max_like_count: int, @@ -2005,6 +2010,7 @@ def _inbox_after_initial(server, inbox_start_time, yt_replace_domain, twitter_replacement_domain, peertube_instances, + loops_instances, allow_local_network_access, theme_name, system_language, max_like_count, cw_lists, lists_enabled, @@ -2037,6 +2043,7 @@ def _inbox_after_initial(server, inbox_start_time, yt_replace_domain, twitter_replacement_domain, peertube_instances, + loops_instances, allow_local_network_access, theme_name, system_language, max_like_count, cw_lists, lists_enabled, @@ -2070,6 +2077,7 @@ def _inbox_after_initial(server, inbox_start_time, yt_replace_domain, twitter_replacement_domain, peertube_instances, + loops_instances, allow_local_network_access, theme_name, system_language, max_like_count, cw_lists, lists_enabled, @@ -2105,6 +2113,7 @@ def _inbox_after_initial(server, inbox_start_time, yt_replace_domain, twitter_replacement_domain, peertube_instances, + loops_instances, allow_local_network_access, theme_name, system_language, max_like_count, cw_lists, lists_enabled, @@ -2137,6 +2146,7 @@ def _inbox_after_initial(server, inbox_start_time, yt_replace_domain, twitter_replacement_domain, peertube_instances, + loops_instances, allow_local_network_access, theme_name, system_language, max_like_count, cw_lists, lists_enabled, @@ -2169,6 +2179,7 @@ def _inbox_after_initial(server, inbox_start_time, yt_replace_domain, twitter_replacement_domain, peertube_instances, + loops_instances, allow_local_network_access, theme_name, system_language, max_like_count, cw_lists, lists_enabled, @@ -2202,6 +2213,7 @@ def _inbox_after_initial(server, inbox_start_time, yt_replace_domain, twitter_replacement_domain, peertube_instances, + loops_instances, allow_local_network_access, theme_name, system_language, max_like_count, cw_lists, lists_enabled, @@ -2256,6 +2268,7 @@ def _inbox_after_initial(server, inbox_start_time, max_recent_posts, allow_deletion, peertube_instances, + loops_instances, max_like_count, cw_lists, lists_enabled, bold_reading, dogwhistles, mitm, server.min_images_for_accounts, @@ -2330,6 +2343,7 @@ def _inbox_after_initial(server, inbox_start_time, yt_replace_domain, twitter_replacement_domain, peertube_instances, + loops_instances, allow_local_network_access, theme_name, system_language, max_like_count, @@ -2683,6 +2697,7 @@ def _inbox_after_initial(server, inbox_start_time, boxname, show_pub_date_only, peertube_instances, + loops_instances, allow_local_net_access, theme_name, system_language, @@ -2893,6 +2908,7 @@ def run_inbox_queue_watchdog(httpd, project_version: str, httpd.max_followers, httpd.allow_local_network_access, httpd.peertube_instances, + httpd.loops_instances, verify_all_signatures, httpd.theme_name, httpd.system_language, @@ -3425,6 +3441,7 @@ def run_inbox_queue(server, max_followers: int, allow_local_network_access: bool, peertube_instances: [], + loops_instances: [], verify_all_signatures: bool, theme_name: str, system_language: str, max_like_count: int, signing_priv_key_pem: str, @@ -3986,6 +4003,7 @@ def run_inbox_queue(server, twitter_replacement_domain, show_published_date_only, peertube_instances, + loops_instances, theme_name, max_like_count, cw_lists, dogwhistles, server.min_images_for_accounts, @@ -4107,6 +4125,7 @@ def run_inbox_queue(server, show_published_date_only, allow_local_network_access, peertube_instances, + loops_instances, last_bounce_message, theme_name, system_language, max_like_count, diff --git a/inbox_receive.py b/inbox_receive.py index 35b2590c3..17d38c583 100644 --- a/inbox_receive.py +++ b/inbox_receive.py @@ -379,6 +379,7 @@ def receive_edit_to_post(recent_posts_cache: {}, message_json: {}, twitter_replacement_domain: str, show_published_date_only: bool, peertube_instances: [], + loops_instances: [], theme_name: str, max_like_count: int, cw_lists: {}, dogwhistles: {}, min_images_for_accounts: [], @@ -526,6 +527,7 @@ def receive_edit_to_post(recent_posts_cache: {}, message_json: {}, twitter_replacement_domain, show_published_date_only, peertube_instances, + loops_instances, allow_local_network_access, theme_name, system_language, max_like_count, not_dm, @@ -672,6 +674,7 @@ def receive_update_activity(recent_posts_cache: {}, session, base_dir: str, twitter_replacement_domain: str, show_published_date_only: bool, peertube_instances: [], + loops_instances: [], theme_name: str, max_like_count: int, cw_lists: {}, dogwhistles: {}, min_images_for_accounts: [], @@ -727,6 +730,7 @@ def receive_update_activity(recent_posts_cache: {}, session, base_dir: str, twitter_replacement_domain, show_published_date_only, peertube_instances, + loops_instances, theme_name, max_like_count, cw_lists, dogwhistles, min_images_for_accounts, @@ -978,6 +982,7 @@ def receive_like(recent_posts_cache: {}, yt_replace_domain: str, twitter_replacement_domain: str, peertube_instances: [], + loops_instances: [], allow_local_network_access: bool, theme_name: str, system_language: str, max_like_count: int, cw_lists: {}, @@ -1102,6 +1107,7 @@ def receive_like(recent_posts_cache: {}, twitter_replacement_domain, show_published_date_only, peertube_instances, + loops_instances, allow_local_network_access, theme_name, system_language, max_like_count, not_dm, @@ -1194,6 +1200,7 @@ def receive_reaction(recent_posts_cache: {}, yt_replace_domain: str, twitter_replacement_domain: str, peertube_instances: [], + loops_instances: [], allow_local_network_access: bool, theme_name: str, system_language: str, max_like_count: int, cw_lists: {}, @@ -1354,6 +1361,7 @@ def receive_reaction(recent_posts_cache: {}, twitter_replacement_domain, show_published_date_only, peertube_instances, + loops_instances, allow_local_network_access, theme_name, system_language, max_like_count, not_dm, @@ -1385,6 +1393,7 @@ def receive_zot_reaction(recent_posts_cache: {}, yt_replace_domain: str, twitter_replacement_domain: str, peertube_instances: [], + loops_instances: [], allow_local_network_access: bool, theme_name: str, system_language: str, max_like_count: int, cw_lists: {}, @@ -1554,6 +1563,7 @@ def receive_zot_reaction(recent_posts_cache: {}, twitter_replacement_domain, show_published_date_only, peertube_instances, + loops_instances, allow_local_network_access, theme_name, system_language, max_like_count, not_dm, @@ -1585,6 +1595,7 @@ def receive_bookmark(recent_posts_cache: {}, yt_replace_domain: str, twitter_replacement_domain: str, peertube_instances: [], + loops_instances: [], allow_local_network_access: bool, theme_name: str, system_language: str, max_like_count: int, cw_lists: {}, @@ -1696,6 +1707,7 @@ def receive_bookmark(recent_posts_cache: {}, twitter_replacement_domain, show_published_date_only, peertube_instances, + loops_instances, allow_local_network_access, theme_name, system_language, max_like_count, not_dm, @@ -1809,6 +1821,7 @@ def receive_announce(recent_posts_cache: {}, max_recent_posts: int, allow_deletion: bool, peertube_instances: [], + loops_instances: [], max_like_count: int, cw_lists: {}, lists_enabled: str, bold_reading: bool, dogwhistles: {}, mitm: bool, @@ -2021,6 +2034,7 @@ def receive_announce(recent_posts_cache: {}, twitter_replacement_domain, show_published_date_only, peertube_instances, + loops_instances, allow_local_network_access, theme_name, system_language, max_like_count, not_dm, @@ -2186,6 +2200,7 @@ def receive_question_vote(server, base_dir: str, nickname: str, domain: str, yt_replace_domain: str, twitter_replacement_domain: str, peertube_instances: [], + loops_instances: [], allow_local_network_access: bool, theme_name: str, system_language: str, max_like_count: int, @@ -2247,6 +2262,7 @@ def receive_question_vote(server, base_dir: str, nickname: str, domain: str, twitter_replacement_domain, show_published_date_only, peertube_instances, + loops_instances, allow_local_network_access, theme_name, system_language, max_like_count, not_dm, diff --git a/inbox_receive_undo.py b/inbox_receive_undo.py index 0a2c3f8c9..5c2138798 100644 --- a/inbox_receive_undo.py +++ b/inbox_receive_undo.py @@ -177,6 +177,7 @@ def receive_undo_like(recent_posts_cache: {}, yt_replace_domain: str, twitter_replacement_domain: str, peertube_instances: [], + loops_instances: [], allow_local_network_access: bool, theme_name: str, system_language: str, max_like_count: int, cw_lists: {}, @@ -287,6 +288,7 @@ def receive_undo_like(recent_posts_cache: {}, twitter_replacement_domain, show_published_date_only, peertube_instances, + loops_instances, allow_local_network_access, theme_name, system_language, max_like_count, not_dm, @@ -319,6 +321,7 @@ def receive_undo_reaction(recent_posts_cache: {}, yt_replace_domain: str, twitter_replacement_domain: str, peertube_instances: [], + loops_instances: [], allow_local_network_access: bool, theme_name: str, system_language: str, max_like_count: int, cw_lists: {}, @@ -447,6 +450,7 @@ def receive_undo_reaction(recent_posts_cache: {}, twitter_replacement_domain, show_published_date_only, peertube_instances, + loops_instances, allow_local_network_access, theme_name, system_language, max_like_count, not_dm, @@ -478,6 +482,7 @@ def receive_undo_bookmark(recent_posts_cache: {}, yt_replace_domain: str, twitter_replacement_domain: str, peertube_instances: [], + loops_instances: [], allow_local_network_access: bool, theme_name: str, system_language: str, max_like_count: int, cw_lists: {}, @@ -591,6 +596,7 @@ def receive_undo_bookmark(recent_posts_cache: {}, twitter_replacement_domain, show_published_date_only, peertube_instances, + loops_instances, allow_local_network_access, theme_name, system_language, max_like_count, not_dm, diff --git a/loops.py b/loops.py new file mode 100644 index 000000000..816bf777a --- /dev/null +++ b/loops.py @@ -0,0 +1,139 @@ +__filename__ = "loops.py" +__author__ = "Bob Mottram" +__license__ = "AGPL3+" +__version__ = "1.7.0" +__maintainer__ = "Bob Mottram" +__email__ = "bob@libreserver.org" +__status__ = "Production" +__module_group__ = "Profile Metadata" + + +from utils import get_attachment_property_value +from utils import remove_html +from utils import string_contains + +loops_fieldnames = ['loops'] + + +def get_loops(actor_json: {}) -> str: + """Returns Loops for the given actor + """ + if not actor_json.get('attachment'): + return '' + if not isinstance(actor_json['attachment'], list): + return '' + for property_value in actor_json['attachment']: + if not isinstance(property_value, dict): + print("WARN: actor attachment is not dict: " + str(property_value)) + continue + name_value: str = None + if property_value.get('name'): + if isinstance(property_value['name'], str): + name_value = property_value['name'].lower() + elif property_value.get('schema:name'): + if isinstance(property_value['schema:name'], str): + name_value = property_value['schema:name'].lower() + if not name_value: + continue + if not string_contains(name_value, loops_fieldnames): + continue + if not property_value.get('type'): + continue + if not isinstance(property_value['type'], str): + continue + prop_value_name, _ = \ + get_attachment_property_value(property_value) + if not prop_value_name: + continue + if not property_value['type'].endswith('PropertyValue'): + continue + loops_text = property_value[prop_value_name] + return remove_html(loops_text) + + for property_value in actor_json['attachment']: + if not isinstance(property_value, dict): + print("WARN: actor attachment is not dict: " + str(property_value)) + continue + if not property_value.get('type'): + continue + if not isinstance(property_value['type'], str): + continue + prop_value_name, _ = \ + get_attachment_property_value(property_value) + if not prop_value_name: + continue + if not property_value['type'].endswith('PropertyValue'): + continue + loops_text: str = property_value[prop_value_name] + if '//loops.' not in loops_text: + continue + return remove_html(loops_text) + return '' + + +def set_loops(actor_json: {}, loops: str) -> None: + """Sets Loops for the given actor + """ + if not actor_json.get('attachment'): + actor_json['attachment']: list[dict] = [] + + # remove any existing value + property_found = None + for property_value in actor_json['attachment']: + if not isinstance(property_value, dict): + print("WARN: actor attachment is not dict: " + str(property_value)) + continue + name_value: str = None + if property_value.get('name'): + if isinstance(property_value['name'], str): + name_value = property_value['name'].lower() + elif property_value.get('schema:name'): + if isinstance(property_value['schema:name'], str): + name_value = property_value['schema:name'].lower() + if not name_value: + continue + if not property_value.get('type'): + continue + if not string_contains(name_value, loops_fieldnames): + continue + property_found = property_value + break + + if property_found: + actor_json['attachment'].remove(property_found) + + for property_value in actor_json['attachment']: + if not isinstance(property_value, dict): + print("WARN: actor attachment is not dict: " + str(property_value)) + continue + name_value: str = None + if property_value.get('name'): + if isinstance(property_value['name'], str): + name_value = property_value['name'] + elif property_value.get('schema:name'): + if isinstance(property_value['schema:name'], str): + name_value = property_value['schema:name'] + if not name_value: + continue + if not property_value.get('type'): + continue + if not isinstance(property_value['type'], str): + continue + name_value = name_value.lower() + if not string_contains(name_value, loops_fieldnames): + continue + if not property_value['type'].endswith('PropertyValue'): + continue + prop_value_name, _ = \ + get_attachment_property_value(property_value) + if not prop_value_name: + continue + property_value[prop_value_name] = remove_html(loops) + return + + new_loops = { + "type": "PropertyValue", + "name": "Loops", + "value": remove_html(loops) + } + actor_json['attachment'].append(new_loops) diff --git a/outbox.py b/outbox.py index 0e86f3e81..d59071a83 100644 --- a/outbox.py +++ b/outbox.py @@ -299,7 +299,9 @@ def post_message_to_outbox(session, translate: {}, shared_item_federation_tokens: {}, low_bandwidth: bool, signing_priv_key_pem: str, - peertube_instances: str, theme: str, + peertube_instances: str, + loops_instances: str, + theme: str, max_like_count: int, max_recent_posts: int, cw_lists: {}, lists_enabled: str, @@ -720,6 +722,7 @@ def post_message_to_outbox(session, translate: {}, twitter_replacement_domain, show_published_date_only, peertube_instances, + loops_instances, allow_local_network_access, theme, system_language, max_like_count, diff --git a/pgp.py b/pgp.py index f86b641f1..a3c7892f0 100644 --- a/pgp.py +++ b/pgp.py @@ -32,6 +32,7 @@ from art import get_art_site_url from music import get_music_site_url from youtube import get_youtube from peertube import get_peertube +from loops import get_loops from xmpp import get_xmpp_address from matrix import get_matrix_address from briar import get_briar_address @@ -944,6 +945,9 @@ def actor_to_vcard(actor: {}, domain: str, translate: {}) -> str: peertube = get_peertube(actor) if peertube: vcard_str += 'SOCIALPROFILE;SERVICE-TYPE=PeerTube:' + peertube + '\n' + loops = get_loops(actor) + if loops: + vcard_str += 'SOCIALPROFILE;SERVICE-TYPE=Loops:' + loops + '\n' website = get_website(actor, translate) if website: vcard_str += 'URL:' + website + '\n' @@ -1061,6 +1065,11 @@ def actor_to_vcard_xml(actor: {}, domain: str, translate: {}) -> str: vcard_str += ' ' + \ 'peertube' + \ '' + peertube + '\n' + loops = get_loops(actor) + if loops: + vcard_str += ' ' + \ + 'loops' + \ + '' + loops + '\n' deltachat_invite = get_deltachat_invite(actor, translate) if deltachat_invite: vcard_str += ' ' + \ diff --git a/schedule.py b/schedule.py index b09d5ee9f..42a6ffc80 100644 --- a/schedule.py +++ b/schedule.py @@ -158,6 +158,7 @@ def _update_post_schedule(base_dir: str, handle: str, httpd, httpd.low_bandwidth, httpd.signing_priv_key_pem, httpd.peertube_instances, + httpd.loops_instances, httpd.theme_name, httpd.max_like_count, httpd.max_recent_posts, diff --git a/translations/ar.json b/translations/ar.json index b3dd15ecd..6993e193e 100644 --- a/translations/ar.json +++ b/translations/ar.json @@ -769,5 +769,6 @@ "Organisation": "منظمة", "Group": "مجموعة", "minutes": "دقائق", - "Availability": "التوافر" + "Availability": "التوافر", + "Loops Instances": "حلقات التكرار" } diff --git a/translations/bn.json b/translations/bn.json index cd97c1a04..c344a92ed 100644 --- a/translations/bn.json +++ b/translations/bn.json @@ -769,5 +769,6 @@ "Organisation": "সংগঠন", "Group": "গ্রুপ", "minutes": "মিনিট", - "Availability": "প্রাপ্যতা" + "Availability": "প্রাপ্যতা", + "Loops Instances": "লুপ ইনস্ট্যান্স" } diff --git a/translations/ca.json b/translations/ca.json index 1d0bbc839..f7a6272ed 100644 --- a/translations/ca.json +++ b/translations/ca.json @@ -769,5 +769,6 @@ "Organisation": "Organització", "Group": "Grup", "minutes": "minuts", - "Availability": "Disponibilitat" + "Availability": "Disponibilitat", + "Loops Instances": "Instàncies de bucles" } diff --git a/translations/cy.json b/translations/cy.json index 9185fb027..7c5389916 100644 --- a/translations/cy.json +++ b/translations/cy.json @@ -769,5 +769,6 @@ "Organisation": "Sefydliad", "Group": "Grŵp", "minutes": "munudau", - "Availability": "Argaeledd" + "Availability": "Argaeledd", + "Loops Instances": "Achosion Dolenni" } diff --git a/translations/de.json b/translations/de.json index ec03baf09..bd568f269 100644 --- a/translations/de.json +++ b/translations/de.json @@ -769,5 +769,6 @@ "Organisation": "Organisation", "Group": "Gruppe", "minutes": "minuten", - "Availability": "Verfügbarkeit" + "Availability": "Verfügbarkeit", + "Loops Instances": "Schleifeninstanzen" } diff --git a/translations/el.json b/translations/el.json index 290ab45b1..65cec68a6 100644 --- a/translations/el.json +++ b/translations/el.json @@ -769,5 +769,6 @@ "Organisation": "Οργάνωση", "Group": "Ομάδα", "minutes": "πρακτικά", - "Availability": "Διαθεσιμότητα" + "Availability": "Διαθεσιμότητα", + "Loops Instances": "Παρουσίες βρόχων" } diff --git a/translations/en.json b/translations/en.json index d7a0b5b44..ea72f5a64 100644 --- a/translations/en.json +++ b/translations/en.json @@ -769,5 +769,6 @@ "Organisation": "Organisation", "Group": "Group", "minutes": "minutes", - "Availability": "Availability" + "Availability": "Availability", + "Loops Instances": "Loops Instances" } diff --git a/translations/es.json b/translations/es.json index bee8752a5..cefefec34 100644 --- a/translations/es.json +++ b/translations/es.json @@ -769,5 +769,6 @@ "Organisation": "Organización", "Group": "Grupo", "minutes": "minutos", - "Availability": "Disponibilidad" + "Availability": "Disponibilidad", + "Loops Instances": "Instancias de bucles" } diff --git a/translations/fa.json b/translations/fa.json index 55855f356..a04436982 100644 --- a/translations/fa.json +++ b/translations/fa.json @@ -769,5 +769,6 @@ "Organisation": "سازمان", "Group": "گروه", "minutes": "دقیقه", - "Availability": "در دسترس بودن" + "Availability": "در دسترس بودن", + "Loops Instances": "نمونه‌های حلقه‌ها" } diff --git a/translations/fi.json b/translations/fi.json index 05208b1ff..fb97594e5 100644 --- a/translations/fi.json +++ b/translations/fi.json @@ -769,5 +769,6 @@ "Organisation": "Organisaatio", "Group": "Ryhmä", "minutes": "minuuttia", - "Availability": "Saatavuus" + "Availability": "Saatavuus", + "Loops Instances": "Silmukat-instanssit" } diff --git a/translations/fr.json b/translations/fr.json index d0a38704c..848efe7e3 100644 --- a/translations/fr.json +++ b/translations/fr.json @@ -769,5 +769,6 @@ "Organisation": "Organisation", "Group": "Groupe", "minutes": "minutes", - "Availability": "Disponibilité" + "Availability": "Disponibilité", + "Loops Instances": "Instances de boucles" } diff --git a/translations/ga.json b/translations/ga.json index 9c42a73f3..3f77db0a7 100644 --- a/translations/ga.json +++ b/translations/ga.json @@ -769,5 +769,6 @@ "Organisation": "Eagraíocht", "Group": "Grúpa", "minutes": "nóiméad", - "Availability": "Infhaighteacht" + "Availability": "Infhaighteacht", + "Loops Instances": "Cásanna Lúb" } diff --git a/translations/he.json b/translations/he.json index 7ee38feb1..a3836adfb 100644 --- a/translations/he.json +++ b/translations/he.json @@ -769,5 +769,6 @@ "Organisation": "אִרגוּן", "Group": "קְבוּצָה", "minutes": "פּרוֹטוֹקוֹל", - "Availability": "זְמִינוּת" + "Availability": "זְמִינוּת", + "Loops Instances": "מופעי לולאות" } diff --git a/translations/hi.json b/translations/hi.json index 8e1fab7ae..fe0f70b64 100644 --- a/translations/hi.json +++ b/translations/hi.json @@ -769,5 +769,6 @@ "Organisation": "संगठन", "Group": "समूह", "minutes": "मिनट", - "Availability": "उपलब्धता" + "Availability": "उपलब्धता", + "Loops Instances": "लूप इंस्टेंस" } diff --git a/translations/it.json b/translations/it.json index 473138455..dda6065fd 100644 --- a/translations/it.json +++ b/translations/it.json @@ -769,5 +769,6 @@ "Organisation": "Organizzazione", "Group": "Gruppo", "minutes": "minuti", - "Availability": "Disponibilità" + "Availability": "Disponibilità", + "Loops Instances": "Istanze di cicli" } diff --git a/translations/ja.json b/translations/ja.json index 5c3b38b6f..064a68796 100644 --- a/translations/ja.json +++ b/translations/ja.json @@ -769,5 +769,6 @@ "Organisation": "組織", "Group": "グループ", "minutes": "分", - "Availability": "可用性" + "Availability": "可用性", + "Loops Instances": "ループインスタンス" } diff --git a/translations/ko.json b/translations/ko.json index 3e484bc97..246fe2eae 100644 --- a/translations/ko.json +++ b/translations/ko.json @@ -769,5 +769,6 @@ "Organisation": "조직", "Group": "그룹", "minutes": "분", - "Availability": "유효성" + "Availability": "유효성", + "Loops Instances": "루프 인스턴스" } diff --git a/translations/ku.json b/translations/ku.json index 13ae2b1eb..786eeaf5b 100644 --- a/translations/ku.json +++ b/translations/ku.json @@ -769,5 +769,6 @@ "Organisation": "Sazûman", "Group": "Kom", "minutes": "deqîqe", - "Availability": "Berdestbûnî" + "Availability": "Berdestbûnî", + "Loops Instances": "Nimûneyên Loopan" } diff --git a/translations/nl.json b/translations/nl.json index 2428dd06d..655b3adaf 100644 --- a/translations/nl.json +++ b/translations/nl.json @@ -769,5 +769,6 @@ "Organisation": "Organisatie", "Group": "Groep", "minutes": "notulen", - "Availability": "Beschikbaarheid" + "Availability": "Beschikbaarheid", + "Loops Instances": "Lusinstanties" } diff --git a/translations/oc.json b/translations/oc.json index a3c868b07..01dc56288 100644 --- a/translations/oc.json +++ b/translations/oc.json @@ -765,5 +765,6 @@ "Organisation": "Organisation", "Group": "Group", "minutes": "minutes", - "Availability": "Availability" + "Availability": "Availability", + "Loops Instances": "Loops Instances" } diff --git a/translations/pl.json b/translations/pl.json index 3b5d9ee13..71dd98775 100644 --- a/translations/pl.json +++ b/translations/pl.json @@ -769,5 +769,6 @@ "Organisation": "Organizacja", "Group": "Grupa", "minutes": "protokół", - "Availability": "Dostępność" + "Availability": "Dostępność", + "Loops Instances": "Instancje pętli" } diff --git a/translations/pt.json b/translations/pt.json index d5c9a2c6b..98b947473 100644 --- a/translations/pt.json +++ b/translations/pt.json @@ -769,5 +769,6 @@ "Organisation": "Organização", "Group": "Grupo", "minutes": "minutos", - "Availability": "Disponibilidade" + "Availability": "Disponibilidade", + "Loops Instances": "Instâncias de Loops" } diff --git a/translations/ru.json b/translations/ru.json index 153ca506f..aff58417a 100644 --- a/translations/ru.json +++ b/translations/ru.json @@ -769,5 +769,6 @@ "Organisation": "Организация", "Group": "Группа", "minutes": "минут", - "Availability": "Доступность" + "Availability": "Доступность", + "Loops Instances": "Экземпляры циклов" } diff --git a/translations/sw.json b/translations/sw.json index 860490062..d088d98c2 100644 --- a/translations/sw.json +++ b/translations/sw.json @@ -769,5 +769,6 @@ "Organisation": "Shirika", "Group": "Kundi", "minutes": "dakika", - "Availability": "Upatikanaji" + "Availability": "Upatikanaji", + "Loops Instances": "Matukio ya Mizunguko" } diff --git a/translations/tr.json b/translations/tr.json index 04e5bd3c8..de2bc596e 100644 --- a/translations/tr.json +++ b/translations/tr.json @@ -769,5 +769,6 @@ "Organisation": "Organizasyon", "Group": "Grup", "minutes": "dakika", - "Availability": "Müsaitlik" + "Availability": "Müsaitlik", + "Loops Instances": "Döngü Örnekleri" } diff --git a/translations/uk.json b/translations/uk.json index bad37f33f..212c86ca5 100644 --- a/translations/uk.json +++ b/translations/uk.json @@ -769,5 +769,6 @@ "Organisation": "Організація", "Group": "Група", "minutes": "хвилин", - "Availability": "Наявність" + "Availability": "Наявність", + "Loops Instances": "Екземпляри циклів" } diff --git a/translations/yi.json b/translations/yi.json index 699eb749a..46fd90a58 100644 --- a/translations/yi.json +++ b/translations/yi.json @@ -769,5 +769,6 @@ "Organisation": "אָרגאַניזאַציע", "Group": "גרופּע", "minutes": "מינוטן", - "Availability": "פאַראַנען" + "Availability": "פאַראַנען", + "Loops Instances": "לופּס אינסטאַנסן" } diff --git a/translations/zh.json b/translations/zh.json index 3384131bd..02d49cf2b 100644 --- a/translations/zh.json +++ b/translations/zh.json @@ -769,5 +769,6 @@ "Organisation": "组织", "Group": "团体", "minutes": "分钟", - "Availability": "可用性" + "Availability": "可用性", + "Loops Instances": "循环实例" } diff --git a/webapp_confirm.py b/webapp_confirm.py index 08663bf98..6e6d2c337 100644 --- a/webapp_confirm.py +++ b/webapp_confirm.py @@ -38,6 +38,7 @@ def html_confirm_delete(server, twitter_replacement_domain: str, show_published_date_only: bool, peertube_instances: [], + loops_instances: [], allow_local_network_access: bool, theme_name: str, system_language: str, max_like_count: int, signing_priv_key_pem: str, @@ -108,7 +109,9 @@ def html_confirm_delete(server, yt_replace_domain, twitter_replacement_domain, show_published_date_only, - peertube_instances, allow_local_network_access, + peertube_instances, + loops_instances, + allow_local_network_access, theme_name, system_language, max_like_count, False, False, False, False, False, False, cw_lists, lists_enabled, timezone, mitm, diff --git a/webapp_conversation.py b/webapp_conversation.py index b884f680b..7eb897d22 100644 --- a/webapp_conversation.py +++ b/webapp_conversation.py @@ -44,6 +44,7 @@ def html_conversation_view(authorized: bool, post_id: str, twitter_replacement_domain: str, show_published_date_only: bool, peertube_instances: [], + loops_instances: [], allow_local_network_access: bool, theme_name: str, system_language: str, @@ -156,6 +157,7 @@ def html_conversation_view(authorized: bool, post_id: str, twitter_replacement_domain, show_published_date_only, peertube_instances, + loops_instances, allow_local_network_access, theme_name, system_language, max_like_count, diff --git a/webapp_create_post.py b/webapp_create_post.py index efb2cd770..6c1214394 100644 --- a/webapp_create_post.py +++ b/webapp_create_post.py @@ -265,6 +265,7 @@ def html_new_post(edit_post_params: {}, twitter_replacement_domain: str, show_published_date_only: bool, peertube_instances: [], + loops_instances: [], allow_local_network_access: bool, system_language: str, languages_understood: [], @@ -462,6 +463,7 @@ def html_new_post(edit_post_params: {}, twitter_replacement_domain, show_published_date_only, peertube_instances, + loops_instances, allow_local_network_access, theme, system_language, max_like_count, diff --git a/webapp_frontscreen.py b/webapp_frontscreen.py index 4badb1541..3b9f062dc 100644 --- a/webapp_frontscreen.py +++ b/webapp_frontscreen.py @@ -34,6 +34,7 @@ def _html_front_screen_posts(recent_posts_cache: {}, max_recent_posts: int, twitter_replacement_domain: str, show_published_date_only: bool, peertube_instances: [], + loops_instances: [], allow_local_network_access: bool, theme_name: str, system_language: str, max_like_count: int, @@ -100,6 +101,7 @@ def _html_front_screen_posts(recent_posts_cache: {}, max_recent_posts: int, twitter_replacement_domain, show_published_date_only, peertube_instances, + loops_instances, allow_local_network_access, theme_name, system_language, max_like_count, @@ -139,6 +141,7 @@ def html_front_screen(signing_priv_key_pem: str, show_published_date_only: bool, newswire: {}, theme: str, peertube_instances: [], + loops_instances: [], allow_local_network_access: bool, access_keys: {}, system_language: str, max_like_count: int, @@ -224,6 +227,7 @@ def html_front_screen(signing_priv_key_pem: str, twitter_replacement_domain, show_published_date_only, peertube_instances, + loops_instances, allow_local_network_access, theme, system_language, max_like_count, diff --git a/webapp_likers.py b/webapp_likers.py index 6b552f105..e387c7bda 100644 --- a/webapp_likers.py +++ b/webapp_likers.py @@ -40,6 +40,7 @@ def html_likers_of_post(base_dir: str, nickname: str, twitter_replacement_domain: str, show_published_date_only: bool, peertube_instances: [], + loops_instances: [], allow_local_network_access: bool, system_language: str, max_like_count: int, signing_priv_key_pem: str, @@ -121,6 +122,7 @@ def html_likers_of_post(base_dir: str, nickname: str, twitter_replacement_domain, show_published_date_only, peertube_instances, + loops_instances, allow_local_network_access, theme, system_language, max_like_count, diff --git a/webapp_media.py b/webapp_media.py index e49ee9004..c495c01f4 100644 --- a/webapp_media.py +++ b/webapp_media.py @@ -35,8 +35,30 @@ def load_peertube_instances(base_dir: str, peertube_instances: []) -> None: peertube_instances.append(url) +def load_loops_instances(base_dir: str, loops_instances: []) -> None: + """Loads loops instances from file into the given list + """ + loops_list = None + loops_instances_filename = data_dir(base_dir) + '/loops.txt' + if is_a_file(loops_instances_filename): + loops_str = \ + load_string(loops_instances_filename, + 'EX: load_loops_instances unable to read ' + + loops_instances_filename + ' [ex]') + if loops_str: + loops_str = loops_str.replace('\r', '') + loops_list = loops_str.split('\n') + if not loops_list: + return + for url in loops_list: + if url in loops_instances: + continue + loops_instances.append(url) + + def _add_embedded_video_from_sites(content: str, peertube_instances: [], + loops_instances: [], width: int, height: int, domain: str) -> str: """Adds embedded videos @@ -273,6 +295,73 @@ def _add_embedded_video_from_sites(content: str, url = url.replace('/w/', '/embed/') url = url.replace('/watch/', '/embed/') + content += \ + "
\n\n" + \ + "\n\n
\n" + return content + + if loops_instances: + # only create an embedded video for a limited set of + # Loops sites. + loops_sites = loops_instances + else: + # A default minimal set of loops instances + loops_sites = ( + ) + for site in loops_sites: + site = site.strip() + if not site: + continue + if len(site) < 5: + continue + if '.' not in site: + continue + site_str = site + if site.startswith('http://'): + site = site.replace('http://', '') + elif site.startswith('https://'): + site = site.replace('https://', '') + if site.endswith('.onion') or site.endswith('.i2p'): + site_str = 'http://' + site + else: + site_str = 'https://' + site + site_str = '"' + site_str + if site_str not in content: + continue + url = content.split(site_str)[1] + if '"' not in url: + continue + url = url.split('"')[0] + if not url: + continue + # TODO check this on Loops instances + possible_endings = ( + '/trending', '/home', '/overview', + '/recently-added', '/local', '/about') + if string_ends_with(url, possible_endings): + # ignore various loops endpoints + continue + if '/c/' in url or '/m/' in url: + # don't try to embed loops channel page + continue + if '?sort=' in url: + # don't try to embed a sorted list + continue + if '/w/' in url: + if '/videos/' not in url: + url = url.replace('/w/', '/videos/embed/') + else: + url = url.replace('/w/', '/embed/') + url = url.replace('/watch/', '/embed/') + content += \ "
\n\n" + \ "