From 00109c4bd811c7a5698cc494ae9ed15129fd3d26 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sat, 26 Nov 2022 15:31:46 +0000 Subject: [PATCH] Option to reverse timeline sequence --- daemon.py | 74 +++++++++++++++++++++++++++++++++------- webapp_moderation.py | 5 +-- webapp_timeline.py | 81 ++++++++++++++++++++++++++++++-------------- 3 files changed, 120 insertions(+), 40 deletions(-) diff --git a/daemon.py b/daemon.py index c5ae60165..437170ad1 100644 --- a/daemon.py +++ b/daemon.py @@ -12264,6 +12264,9 @@ class PubServer(BaseHTTPRequestHandler): bold_reading = False if self.server.bold_reading.get(nickname): bold_reading = True + reverse_sequence = False + if nickname in self.server.reverse_sequence: + reverse_sequence = True msg = \ html_inbox(default_timeline, recent_posts_cache, @@ -12307,7 +12310,8 @@ class PubServer(BaseHTTPRequestHandler): timezone, bold_reading, self.server.dogwhistles, ua_str, - self.server.min_images_for_accounts) + self.server.min_images_for_accounts, + reverse_sequence) if getreq_start_time: fitness_performance(getreq_start_time, self.server.fitness, @@ -12440,6 +12444,9 @@ class PubServer(BaseHTTPRequestHandler): bold_reading = False if self.server.bold_reading.get(nickname): bold_reading = True + reverse_sequence = False + if nickname in self.server.reverse_sequence: + reverse_sequence = True msg = \ html_inbox_dms(self.server.default_timeline, self.server.recent_posts_cache, @@ -12481,7 +12488,8 @@ class PubServer(BaseHTTPRequestHandler): self.server.lists_enabled, timezone, bold_reading, self.server.dogwhistles, ua_str, - self.server.min_images_for_accounts) + self.server.min_images_for_accounts, + reverse_sequence) msg = msg.encode('utf-8') msglen = len(msg) self._set_headers('text/html', msglen, @@ -12604,6 +12612,9 @@ class PubServer(BaseHTTPRequestHandler): bold_reading = False if self.server.bold_reading.get(nickname): bold_reading = True + reverse_sequence = False + if nickname in self.server.reverse_sequence: + reverse_sequence = True msg = \ html_inbox_replies(self.server.default_timeline, self.server.recent_posts_cache, @@ -12646,7 +12657,8 @@ class PubServer(BaseHTTPRequestHandler): timezone, bold_reading, self.server.dogwhistles, ua_str, - self.server.min_images_for_accounts) + self.server.min_images_for_accounts, + reverse_sequence) msg = msg.encode('utf-8') msglen = len(msg) self._set_headers('text/html', msglen, @@ -12765,6 +12777,9 @@ class PubServer(BaseHTTPRequestHandler): bold_reading = False if self.server.bold_reading.get(nickname): bold_reading = True + reverse_sequence = False + if nickname in self.server.reverse_sequence: + reverse_sequence = True msg = \ html_inbox_media(self.server.default_timeline, self.server.recent_posts_cache, @@ -12807,7 +12822,8 @@ class PubServer(BaseHTTPRequestHandler): self.server.lists_enabled, timezone, bold_reading, self.server.dogwhistles, ua_str, - self.server.min_images_for_accounts) + self.server.min_images_for_accounts, + reverse_sequence) msg = msg.encode('utf-8') msglen = len(msg) self._set_headers('text/html', msglen, @@ -12926,6 +12942,9 @@ class PubServer(BaseHTTPRequestHandler): bold_reading = False if self.server.bold_reading.get(nickname): bold_reading = True + reverse_sequence = False + if nickname in self.server.reverse_sequence: + reverse_sequence = True msg = \ html_inbox_blogs(self.server.default_timeline, self.server.recent_posts_cache, @@ -12968,7 +12987,8 @@ class PubServer(BaseHTTPRequestHandler): self.server.lists_enabled, timezone, bold_reading, self.server.dogwhistles, ua_str, - self.server.min_images_for_accounts) + self.server.min_images_for_accounts, + reverse_sequence) msg = msg.encode('utf-8') msglen = len(msg) self._set_headers('text/html', msglen, @@ -13094,6 +13114,9 @@ class PubServer(BaseHTTPRequestHandler): bold_reading = False if self.server.bold_reading.get(nickname): bold_reading = True + reverse_sequence = False + if nickname in self.server.reverse_sequence: + reverse_sequence = True msg = \ html_inbox_news(self.server.default_timeline, self.server.recent_posts_cache, @@ -13137,7 +13160,8 @@ class PubServer(BaseHTTPRequestHandler): self.server.lists_enabled, timezone, bold_reading, self.server.dogwhistles, ua_str, - self.server.min_images_for_accounts) + self.server.min_images_for_accounts, + reverse_sequence) msg = msg.encode('utf-8') msglen = len(msg) self._set_headers('text/html', msglen, @@ -13267,6 +13291,9 @@ class PubServer(BaseHTTPRequestHandler): bold_reading = True min_images_for_accounts = \ self.server.min_images_for_accounts + reverse_sequence = False + if nickname in self.server.reverse_sequence: + reverse_sequence = True msg = \ html_inbox_features(self.server.default_timeline, self.server.recent_posts_cache, @@ -13310,7 +13337,8 @@ class PubServer(BaseHTTPRequestHandler): self.server.lists_enabled, timezone, bold_reading, self.server.dogwhistles, ua_str, - min_images_for_accounts) + min_images_for_accounts, + reverse_sequence) msg = msg.encode('utf-8') msglen = len(msg) self._set_headers('text/html', msglen, @@ -13395,6 +13423,9 @@ class PubServer(BaseHTTPRequestHandler): bold_reading = False if self.server.bold_reading.get(nickname): bold_reading = True + reverse_sequence = False + if nickname in self.server.reverse_sequence: + reverse_sequence = True msg = \ html_shares(self.server.default_timeline, self.server.recent_posts_cache, @@ -13434,7 +13465,8 @@ class PubServer(BaseHTTPRequestHandler): self.server.lists_enabled, timezone, bold_reading, self.server.dogwhistles, ua_str, - self.server.min_images_for_accounts) + self.server.min_images_for_accounts, + reverse_sequence) msg = msg.encode('utf-8') msglen = len(msg) self._set_headers('text/html', msglen, @@ -13492,6 +13524,9 @@ class PubServer(BaseHTTPRequestHandler): bold_reading = False if self.server.bold_reading.get(nickname): bold_reading = True + reverse_sequence = False + if nickname in self.server.reverse_sequence: + reverse_sequence = True msg = \ html_wanted(self.server.default_timeline, self.server.recent_posts_cache, @@ -13531,7 +13566,8 @@ class PubServer(BaseHTTPRequestHandler): self.server.lists_enabled, timezone, bold_reading, self.server.dogwhistles, ua_str, - self.server.min_images_for_accounts) + self.server.min_images_for_accounts, + reverse_sequence) msg = msg.encode('utf-8') msglen = len(msg) self._set_headers('text/html', msglen, @@ -13627,6 +13663,9 @@ class PubServer(BaseHTTPRequestHandler): bold_reading = False if self.server.bold_reading.get(nickname): bold_reading = True + reverse_sequence = False + if nickname in self.server.reverse_sequence: + reverse_sequence = True msg = \ html_bookmarks(self.server.default_timeline, self.server.recent_posts_cache, @@ -13669,7 +13708,8 @@ class PubServer(BaseHTTPRequestHandler): self.server.lists_enabled, timezone, bold_reading, self.server.dogwhistles, ua_str, - self.server.min_images_for_accounts) + self.server.min_images_for_accounts, + reverse_sequence) msg = msg.encode('utf-8') msglen = len(msg) self._set_headers('text/html', msglen, @@ -13785,6 +13825,9 @@ class PubServer(BaseHTTPRequestHandler): bold_reading = False if self.server.bold_reading.get(nickname): bold_reading = True + reverse_sequence = False + if nickname in self.server.reverse_sequence: + reverse_sequence = True msg = \ html_outbox(self.server.default_timeline, self.server.recent_posts_cache, @@ -13825,7 +13868,8 @@ class PubServer(BaseHTTPRequestHandler): self.server.lists_enabled, timezone, bold_reading, self.server.dogwhistles, ua_str, - self.server.min_images_for_accounts) + self.server.min_images_for_accounts, + reverse_sequence) msg = msg.encode('utf-8') msglen = len(msg) self._set_headers('text/html', msglen, @@ -13936,6 +13980,9 @@ class PubServer(BaseHTTPRequestHandler): bold_reading = True min_images_for_accounts = \ self.server.min_images_for_accounts + reverse_sequence = False + if nickname in self.server.reverse_sequence: + reverse_sequence = True msg = \ html_moderation(self.server.default_timeline, self.server.recent_posts_cache, @@ -13978,7 +14025,8 @@ class PubServer(BaseHTTPRequestHandler): timezone, bold_reading, self.server.dogwhistles, ua_str, - min_images_for_accounts) + min_images_for_accounts, + reverse_sequence) msg = msg.encode('utf-8') msglen = len(msg) self._set_headers('text/html', msglen, @@ -21888,6 +21936,8 @@ def run_daemon(max_hashtags: int, # caches css files httpd.css_cache = {} + httpd.reverse_sequence = [] + httpd.clacks = get_config_param(base_dir, 'clacks') if not httpd.clacks: if clacks: diff --git a/webapp_moderation.py b/webapp_moderation.py index cd6f35d50..3e9120c3e 100644 --- a/webapp_moderation.py +++ b/webapp_moderation.py @@ -60,7 +60,8 @@ def html_moderation(default_timeline: str, cw_lists: {}, lists_enabled: str, timezone: str, bold_reading: bool, dogwhistles: {}, ua_str: str, - min_images_for_accounts: []) -> str: + min_images_for_accounts: [], + reverse_sequence: bool) -> str: """Show the moderation feed as html This is what you see when selecting the "mod" timeline """ @@ -87,7 +88,7 @@ def html_moderation(default_timeline: str, max_like_count, shared_items_federated_domains, signing_priv_key_pem, cw_lists, lists_enabled, timezone, bold_reading, dogwhistles, ua_str, - min_images_for_accounts) + min_images_for_accounts, reverse_sequence) def html_account_info(translate: {}, diff --git a/webapp_timeline.py b/webapp_timeline.py index 73d213670..5499809fa 100644 --- a/webapp_timeline.py +++ b/webapp_timeline.py @@ -499,7 +499,8 @@ def html_timeline(default_timeline: str, cw_lists: {}, lists_enabled: str, timezone: str, bold_reading: bool, dogwhistles: {}, ua_str: str, - min_images_for_accounts: []) -> str: + min_images_for_accounts: [], + reverse_sequence: bool) -> str: """Show the timeline as html """ enable_timing_log = False @@ -1033,9 +1034,15 @@ def html_timeline(default_timeline: str, last_post_id = \ remove_id_ending(item['id']).replace('/', '#') item_ctr += 1 - tl_str += text_mode_separator + curr_tl_str - if separator_str: - tl_str += separator_str + if not reverse_sequence: + tl_str += text_mode_separator + curr_tl_str + if separator_str: + tl_str += separator_str + else: + tl_str = text_mode_separator + curr_tl_str + tl_str + if separator_str: + tl_str = text_mode_separator + curr_tl_str + \ + separator_str + tl_str if box_name == 'tlmedia': tl_str += '\n' @@ -1272,7 +1279,8 @@ def html_shares(default_timeline: str, cw_lists: {}, lists_enabled: str, timezone: str, bold_reading: bool, dogwhistles: {}, ua_str: str, - min_images_for_accounts: []) -> str: + min_images_for_accounts: [], + reverse_sequence: bool) -> str: """Show the shares timeline as html """ manually_approve_followers = \ @@ -1304,7 +1312,8 @@ def html_shares(default_timeline: str, signing_priv_key_pem, cw_lists, lists_enabled, timezone, bold_reading, dogwhistles, ua_str, - min_images_for_accounts) + min_images_for_accounts, + reverse_sequence) def html_wanted(default_timeline: str, @@ -1335,7 +1344,8 @@ def html_wanted(default_timeline: str, cw_lists: {}, lists_enabled: str, timezone: str, bold_reading: bool, dogwhistles: {}, ua_str: str, - min_images_for_accounts: []) -> str: + min_images_for_accounts: [], + reverse_sequence: bool) -> str: """Show the wanted timeline as html """ manually_approve_followers = \ @@ -1367,7 +1377,8 @@ def html_wanted(default_timeline: str, signing_priv_key_pem, cw_lists, lists_enabled, timezone, bold_reading, dogwhistles, ua_str, - min_images_for_accounts) + min_images_for_accounts, + reverse_sequence) def html_inbox(default_timeline: str, @@ -1399,7 +1410,8 @@ def html_inbox(default_timeline: str, cw_lists: {}, lists_enabled: str, timezone: str, bold_reading: bool, dogwhistles: {}, ua_str: str, - min_images_for_accounts: []) -> str: + min_images_for_accounts: [], + reverse_sequence: bool) -> str: """Show the inbox as html """ manually_approve_followers = \ @@ -1431,7 +1443,8 @@ def html_inbox(default_timeline: str, signing_priv_key_pem, cw_lists, lists_enabled, timezone, bold_reading, dogwhistles, ua_str, - min_images_for_accounts) + min_images_for_accounts, + reverse_sequence) def html_bookmarks(default_timeline: str, @@ -1463,7 +1476,8 @@ def html_bookmarks(default_timeline: str, cw_lists: {}, lists_enabled: str, timezone: str, bold_reading: bool, dogwhistles: {}, ua_str: str, - min_images_for_accounts: []) -> str: + min_images_for_accounts: [], + reverse_sequence: bool) -> str: """Show the bookmarks as html """ manually_approve_followers = \ @@ -1494,7 +1508,8 @@ def html_bookmarks(default_timeline: str, shared_items_federated_domains, signing_priv_key_pem, cw_lists, lists_enabled, timezone, bold_reading, dogwhistles, ua_str, - min_images_for_accounts) + min_images_for_accounts, + reverse_sequence) def html_inbox_dms(default_timeline: str, @@ -1526,7 +1541,8 @@ def html_inbox_dms(default_timeline: str, cw_lists: {}, lists_enabled: str, timezone: str, bold_reading: bool, dogwhistles: {}, ua_str: str, - min_images_for_accounts: []) -> str: + min_images_for_accounts: [], + reverse_sequence: bool) -> str: """Show the DM timeline as html """ artist = is_artist(base_dir, nickname) @@ -1553,7 +1569,8 @@ def html_inbox_dms(default_timeline: str, signing_priv_key_pem, cw_lists, lists_enabled, timezone, bold_reading, dogwhistles, ua_str, - min_images_for_accounts) + min_images_for_accounts, + reverse_sequence) def html_inbox_replies(default_timeline: str, @@ -1585,7 +1602,8 @@ def html_inbox_replies(default_timeline: str, cw_lists: {}, lists_enabled: str, timezone: str, bold_reading: bool, dogwhistles: {}, ua_str: str, - min_images_for_accounts: []) -> str: + min_images_for_accounts: [], + reverse_sequence: bool) -> str: """Show the replies timeline as html """ artist = is_artist(base_dir, nickname) @@ -1610,7 +1628,8 @@ def html_inbox_replies(default_timeline: str, access_keys, system_language, max_like_count, shared_items_federated_domains, signing_priv_key_pem, cw_lists, lists_enabled, timezone, bold_reading, - dogwhistles, ua_str, min_images_for_accounts) + dogwhistles, ua_str, min_images_for_accounts, + reverse_sequence) def html_inbox_media(default_timeline: str, @@ -1642,7 +1661,8 @@ def html_inbox_media(default_timeline: str, cw_lists: {}, lists_enabled: str, timezone: str, bold_reading: bool, dogwhistles: {}, ua_str: str, - min_images_for_accounts: []) -> str: + min_images_for_accounts: [], + reverse_sequence: bool) -> str: """Show the media timeline as html """ artist = is_artist(base_dir, nickname) @@ -1667,7 +1687,8 @@ def html_inbox_media(default_timeline: str, access_keys, system_language, max_like_count, shared_items_federated_domains, signing_priv_key_pem, cw_lists, lists_enabled, timezone, bold_reading, - dogwhistles, ua_str, min_images_for_accounts) + dogwhistles, ua_str, min_images_for_accounts, + reverse_sequence) def html_inbox_blogs(default_timeline: str, @@ -1699,7 +1720,8 @@ def html_inbox_blogs(default_timeline: str, cw_lists: {}, lists_enabled: str, timezone: str, bold_reading: bool, dogwhistles: {}, ua_str: str, - min_images_for_accounts: []) -> str: + min_images_for_accounts: [], + reverse_sequence: bool) -> str: """Show the blogs timeline as html """ artist = is_artist(base_dir, nickname) @@ -1724,7 +1746,8 @@ def html_inbox_blogs(default_timeline: str, access_keys, system_language, max_like_count, shared_items_federated_domains, signing_priv_key_pem, cw_lists, lists_enabled, timezone, bold_reading, - dogwhistles, ua_str, min_images_for_accounts) + dogwhistles, ua_str, min_images_for_accounts, + reverse_sequence) def html_inbox_features(default_timeline: str, @@ -1757,7 +1780,8 @@ def html_inbox_features(default_timeline: str, cw_lists: {}, lists_enabled: str, timezone: str, bold_reading: bool, dogwhistles: {}, ua_str: str, - min_images_for_accounts: []) -> str: + min_images_for_accounts: [], + reverse_sequence: bool) -> str: """Show the features timeline as html """ return html_timeline(default_timeline, @@ -1781,7 +1805,8 @@ def html_inbox_features(default_timeline: str, access_keys, system_language, max_like_count, shared_items_federated_domains, signing_priv_key_pem, cw_lists, lists_enabled, timezone, bold_reading, - dogwhistles, ua_str, min_images_for_accounts) + dogwhistles, ua_str, min_images_for_accounts, + reverse_sequence) def html_inbox_news(default_timeline: str, @@ -1813,7 +1838,8 @@ def html_inbox_news(default_timeline: str, cw_lists: {}, lists_enabled: str, timezone: str, bold_reading: bool, dogwhistles: {}, ua_str: str, - min_images_for_accounts: []) -> str: + min_images_for_accounts: [], + reverse_sequence: bool) -> str: """Show the news timeline as html """ return html_timeline(default_timeline, @@ -1837,7 +1863,8 @@ def html_inbox_news(default_timeline: str, access_keys, system_language, max_like_count, shared_items_federated_domains, signing_priv_key_pem, cw_lists, lists_enabled, timezone, bold_reading, - dogwhistles, ua_str, min_images_for_accounts) + dogwhistles, ua_str, min_images_for_accounts, + reverse_sequence) def html_outbox(default_timeline: str, @@ -1869,7 +1896,8 @@ def html_outbox(default_timeline: str, cw_lists: {}, lists_enabled: str, timezone: str, bold_reading: bool, dogwhistles: {}, ua_str: str, - min_images_for_accounts: []) -> str: + min_images_for_accounts: [], + reverse_sequence: bool) -> str: """Show the Outbox as html """ manually_approve_followers = \ @@ -1896,4 +1924,5 @@ def html_outbox(default_timeline: str, access_keys, system_language, max_like_count, shared_items_federated_domains, signing_priv_key_pem, cw_lists, lists_enabled, timezone, bold_reading, - dogwhistles, ua_str, min_images_for_accounts) + dogwhistles, ua_str, min_images_for_accounts, + reverse_sequence)