From 01c1aca0c4d44a4a4363881b8078ba9598f1ca20 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 23 Apr 2024 11:27:57 +0100 Subject: [PATCH] Tidying --- daemon_get.py | 38 +++++++++++++- daemon_get_feeds.py | 121 ++++++++++++++++++++++++++------------------ 2 files changed, 109 insertions(+), 50 deletions(-) diff --git a/daemon_get.py b/daemon_get.py index 7dbad6beb..528affac8 100644 --- a/daemon_get.py +++ b/daemon_get.py @@ -5016,7 +5016,43 @@ def daemon_http_get(self) -> None: getreq_start_time, proxy_type, cookie, self.server.debug, - curr_session, FOLLOWS_PER_PAGE): + curr_session, FOLLOWS_PER_PAGE, + self.server.access_keys, + self.server.key_shortcuts, + self.server.city, + self.server.account_timezone, + self.server.content_license_url, + self.server.shared_items_federated_domains, + self.server.bold_reading, + self.server.max_shares_on_profile, + self.server.sites_unavailable, + self.server.signing_priv_key_pem, + self.server.rss_icon_at_top, + self.server.icons_as_buttons, + self.server.default_timeline, + self.server.recent_posts_cache, + self.server.max_recent_posts, + self.server.translate, + self.server.project_version, + self.server.cached_webfingers, + self.server.person_cache, + self.server.yt_replace_domain, + self.server.twitter_replacement_domain, + self.server.show_published_date_only, + self.server.newswire, + self.server.theme_name, + self.server.dormant_months, + self.server.peertube_instances, + self.server.allow_local_network_access, + self.server.text_mode_banner, + self.server.system_language, + self.server.max_like_count, + self.server.cw_lists, + self.server.lists_enabled, + self.server.buy_sites, + self.server.no_of_books, + self.server.auto_cw_cache, + self.server.fitness): self.server.getreq_busy = False return diff --git a/daemon_get_feeds.py b/daemon_get_feeds.py index 86fc20cf6..5fb8e2ed2 100644 --- a/daemon_get_feeds.py +++ b/daemon_get_feeds.py @@ -401,7 +401,42 @@ def show_moved_feed(self, authorized: bool, domain: str, port: int, getreq_start_time, proxy_type: str, cookie: str, debug: str, curr_session, - follows_per_page: int) -> bool: + follows_per_page: int, + access_keys: {}, + key_shortcuts: {}, city: str, + account_timezone: {}, + content_license_url: str, + shared_items_federated_domains: [], + bold_reading_nicknames: {}, + max_shares_on_profile: int, + sites_unavailable: [], + signing_priv_key_pem: str, + rss_icon_at_top: bool, + icons_as_buttons: bool, + default_timeline: str, + recent_posts_cache: {}, + max_recent_posts: int, + translate: {}, + project_version: str, + cached_webfingers: {}, + person_cache: {}, + yt_replace_domain: str, + twitter_replacement_domain: str, + show_published_date_only: bool, + newswire: {}, + theme_name: str, + dormant_months: int, + peertube_instances: [], + allow_local_network_access: bool, + text_mode_banner: str, + system_language: str, + max_like_count: int, + cw_lists: {}, + lists_enabled: {}, + buy_sites: [], + no_of_books: int, + auto_cw_cache: {}, + fitness: {}) -> bool: """Shows the moved feed for a particular account/actor """ following = \ @@ -441,82 +476,71 @@ def show_moved_feed(self, authorized: bool, http_404(self, 81) return True - access_keys = self.server.access_keys city = None timezone = None if '/users/' in path: nickname = path.split('/users/')[1] if '/' in nickname: nickname = nickname.split('/')[0] - if self.server.key_shortcuts.get(nickname): - access_keys = \ - self.server.key_shortcuts[nickname] + if key_shortcuts.get(nickname): + access_keys = key_shortcuts[nickname] + + city = get_spoofed_city(city, base_dir, nickname, domain) + if account_timezone.get(nickname): + timezone = account_timezone.get(nickname) - city = get_spoofed_city(self.server.city, - base_dir, nickname, domain) - if self.server.account_timezone.get(nickname): - timezone = \ - self.server.account_timezone.get(nickname) - content_license_url = \ - self.server.content_license_url - shared_items_federated_domains = \ - self.server.shared_items_federated_domains bold_reading = False - if self.server.bold_reading.get(nickname): + if bold_reading_nicknames.get(nickname): bold_reading = True - max_shares_on_profile = \ - self.server.max_shares_on_profile - sites_unavailable = \ - self.server.sites_unavailable + msg = \ - html_profile(self.server.signing_priv_key_pem, - self.server.rss_icon_at_top, - self.server.icons_as_buttons, - self.server.default_timeline, - self.server.recent_posts_cache, - self.server.max_recent_posts, - self.server.translate, - self.server.project_version, + html_profile(signing_priv_key_pem, + rss_icon_at_top, + icons_as_buttons, + default_timeline, + recent_posts_cache, + max_recent_posts, + translate, + project_version, base_dir, http_prefix, authorized, get_person, 'moved', curr_session, - self.server.cached_webfingers, - self.server.person_cache, - self.server.yt_replace_domain, - self.server.twitter_replacement_domain, - self.server.show_published_date_only, - self.server.newswire, - self.server.theme_name, - self.server.dormant_months, - self.server.peertube_instances, - self.server.allow_local_network_access, - self.server.text_mode_banner, + cached_webfingers, + person_cache, + yt_replace_domain, + twitter_replacement_domain, + show_published_date_only, + newswire, + theme_name, + dormant_months, + peertube_instances, + allow_local_network_access, + text_mode_banner, debug, access_keys, city, - self.server.system_language, - self.server.max_like_count, + system_language, + max_like_count, shared_items_federated_domains, following, page_number, follows_per_page, - self.server.cw_lists, - self.server.lists_enabled, + cw_lists, + lists_enabled, content_license_url, timezone, bold_reading, - self.server.buy_sites, + buy_sites, None, max_shares_on_profile, sites_unavailable, - self.server.no_of_books, - self.server.auto_cw_cache).encode('utf-8') + no_of_books, + auto_cw_cache).encode('utf-8') msglen = len(msg) set_headers(self, 'text/html', msglen, cookie, calling_domain, False) write2(self, msg) fitness_performance(getreq_start_time, - self.server.fitness, - '_GET', '_show_moved_feed', + fitness, '_GET', '_show_moved_feed', debug) return True else: @@ -539,8 +563,7 @@ def show_moved_feed(self, authorized: bool, None, calling_domain, False) write2(self, msg) fitness_performance(getreq_start_time, - self.server.fitness, - '_GET', '_show_moved_feed json', + fitness, '_GET', '_show_moved_feed json', debug) else: http_404(self, 81)