From 441459ce7eb40c08b607d492a844cf718bfb0dbc Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 28 Dec 2022 14:14:44 +0000 Subject: [PATCH] Consistent page up on timeline --- daemon.py | 35 ++++++++++++++++++++++++---- person.py | 2 ++ webapp_moderation.py | 2 +- webapp_timeline.py | 55 +++++++++++++++++++++++++++++--------------- 4 files changed, 69 insertions(+), 25 deletions(-) diff --git a/daemon.py b/daemon.py index 37a66489f..78412d036 100644 --- a/daemon.py +++ b/daemon.py @@ -12457,6 +12457,11 @@ class PubServer(BaseHTTPRequestHandler): reverse_sequence = False if nickname in self.server.reverse_sequence: reverse_sequence = True + last_post_id = None + if ';lastpost=' in path: + last_post_id = path.split(';lastpost=')[1] + if ';' in last_post_id: + last_post_id = last_post_id.split(';')[0] msg = \ html_inbox(default_timeline, recent_posts_cache, @@ -12501,7 +12506,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.dogwhistles, ua_str, self.server.min_images_for_accounts, - reverse_sequence) + reverse_sequence, last_post_id) if getreq_start_time: fitness_performance(getreq_start_time, self.server.fitness, @@ -12637,6 +12642,11 @@ class PubServer(BaseHTTPRequestHandler): reverse_sequence = False if nickname in self.server.reverse_sequence: reverse_sequence = True + last_post_id = None + if ';lastpost=' in path: + last_post_id = path.split(';lastpost=')[1] + if ';' in last_post_id: + last_post_id = last_post_id.split(';')[0] msg = \ html_inbox_dms(self.server.default_timeline, self.server.recent_posts_cache, @@ -12679,7 +12689,7 @@ class PubServer(BaseHTTPRequestHandler): timezone, bold_reading, self.server.dogwhistles, ua_str, self.server.min_images_for_accounts, - reverse_sequence) + reverse_sequence, last_post_id) msg = msg.encode('utf-8') msglen = len(msg) self._set_headers('text/html', msglen, @@ -12805,6 +12815,11 @@ class PubServer(BaseHTTPRequestHandler): reverse_sequence = False if nickname in self.server.reverse_sequence: reverse_sequence = True + last_post_id = None + if ';lastpost=' in path: + last_post_id = path.split(';lastpost=')[1] + if ';' in last_post_id: + last_post_id = last_post_id.split(';')[0] msg = \ html_inbox_replies(self.server.default_timeline, self.server.recent_posts_cache, @@ -12848,7 +12863,7 @@ class PubServer(BaseHTTPRequestHandler): self.server.dogwhistles, ua_str, self.server.min_images_for_accounts, - reverse_sequence) + reverse_sequence, last_post_id) msg = msg.encode('utf-8') msglen = len(msg) self._set_headers('text/html', msglen, @@ -12970,6 +12985,11 @@ class PubServer(BaseHTTPRequestHandler): reverse_sequence = False if nickname in self.server.reverse_sequence: reverse_sequence = True + last_post_id = None + if ';lastpost=' in path: + last_post_id = path.split(';lastpost=')[1] + if ';' in last_post_id: + last_post_id = last_post_id.split(';')[0] msg = \ html_inbox_media(self.server.default_timeline, self.server.recent_posts_cache, @@ -13013,7 +13033,7 @@ class PubServer(BaseHTTPRequestHandler): timezone, bold_reading, self.server.dogwhistles, ua_str, self.server.min_images_for_accounts, - reverse_sequence) + reverse_sequence, last_post_id) msg = msg.encode('utf-8') msglen = len(msg) self._set_headers('text/html', msglen, @@ -13135,6 +13155,11 @@ class PubServer(BaseHTTPRequestHandler): reverse_sequence = False if nickname in self.server.reverse_sequence: reverse_sequence = True + last_post_id = None + if ';lastpost=' in path: + last_post_id = path.split(';lastpost=')[1] + if ';' in last_post_id: + last_post_id = last_post_id.split(';')[0] msg = \ html_inbox_blogs(self.server.default_timeline, self.server.recent_posts_cache, @@ -13178,7 +13203,7 @@ class PubServer(BaseHTTPRequestHandler): timezone, bold_reading, self.server.dogwhistles, ua_str, self.server.min_images_for_accounts, - reverse_sequence) + reverse_sequence, last_post_id) msg = msg.encode('utf-8') msglen = len(msg) self._set_headers('text/html', msglen, diff --git a/person.py b/person.py index 877d6e03a..6badac74a 100644 --- a/person.py +++ b/person.py @@ -996,6 +996,8 @@ def person_box_json(recent_posts_cache: {}, if ';firstpost=' in path: first_post_id = \ path.split(';firstpost=')[1] + if ';' in first_post_id: + first_post_id = first_post_id.split(';')[0] first_post_id = \ first_post_id.replace('--', '/') diff --git a/webapp_moderation.py b/webapp_moderation.py index 3e9120c3e..5ebb799a5 100644 --- a/webapp_moderation.py +++ b/webapp_moderation.py @@ -88,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, reverse_sequence) + min_images_for_accounts, reverse_sequence, None) def html_account_info(translate: {}, diff --git a/webapp_timeline.py b/webapp_timeline.py index 760c33a89..1c8b4f32a 100644 --- a/webapp_timeline.py +++ b/webapp_timeline.py @@ -500,7 +500,8 @@ def html_timeline(default_timeline: str, timezone: str, bold_reading: bool, dogwhistles: {}, ua_str: str, min_images_for_accounts: [], - reverse_sequence: bool) -> str: + reverse_sequence: bool, + last_post_id: str) -> str: """Show the timeline as html """ enable_timing_log = False @@ -925,10 +926,13 @@ def html_timeline(default_timeline: str, tl_str += '
' + \ page_number_buttons(users_path, box_name, page_number, 'timelineposts') + first_post_str = '' + if last_post_id: + first_post_str = ';firstpost=' + last_post_id tl_str += \ '
\n' + \ ' ' + \ '' + \ ' str: + reverse_sequence: bool, + last_post_id: str) -> str: """Show the DM timeline as html """ artist = is_artist(base_dir, nickname) @@ -1580,7 +1594,7 @@ def html_inbox_dms(default_timeline: str, cw_lists, lists_enabled, timezone, bold_reading, dogwhistles, ua_str, min_images_for_accounts, - reverse_sequence) + reverse_sequence, last_post_id) def html_inbox_replies(default_timeline: str, @@ -1613,7 +1627,8 @@ def html_inbox_replies(default_timeline: str, timezone: str, bold_reading: bool, dogwhistles: {}, ua_str: str, min_images_for_accounts: [], - reverse_sequence: bool) -> str: + reverse_sequence: bool, + last_post_id: str) -> str: """Show the replies timeline as html """ artist = is_artist(base_dir, nickname) @@ -1639,7 +1654,7 @@ def html_inbox_replies(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, - reverse_sequence) + reverse_sequence, last_post_id) def html_inbox_media(default_timeline: str, @@ -1672,7 +1687,8 @@ def html_inbox_media(default_timeline: str, timezone: str, bold_reading: bool, dogwhistles: {}, ua_str: str, min_images_for_accounts: [], - reverse_sequence: bool) -> str: + reverse_sequence: bool, + last_post_id: str) -> str: """Show the media timeline as html """ artist = is_artist(base_dir, nickname) @@ -1698,7 +1714,7 @@ def html_inbox_media(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, - reverse_sequence) + reverse_sequence, last_post_id) def html_inbox_blogs(default_timeline: str, @@ -1731,7 +1747,8 @@ def html_inbox_blogs(default_timeline: str, timezone: str, bold_reading: bool, dogwhistles: {}, ua_str: str, min_images_for_accounts: [], - reverse_sequence: bool) -> str: + reverse_sequence: bool, + last_post_id: str) -> str: """Show the blogs timeline as html """ artist = is_artist(base_dir, nickname) @@ -1757,7 +1774,7 @@ def html_inbox_blogs(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, - reverse_sequence) + reverse_sequence, last_post_id) def html_inbox_features(default_timeline: str, @@ -1816,7 +1833,7 @@ def html_inbox_features(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, - reverse_sequence) + reverse_sequence, None) def html_inbox_news(default_timeline: str, @@ -1874,7 +1891,7 @@ def html_inbox_news(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, - reverse_sequence) + reverse_sequence, None) def html_outbox(default_timeline: str, @@ -1935,4 +1952,4 @@ def html_outbox(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, - reverse_sequence) + reverse_sequence, None)