From 2838f94fb5e8ea7951e33327b7cf6d8950e4b408 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 26 Dec 2022 15:41:21 +0000 Subject: [PATCH 1/6] Validate actor url from webfinger --- posts.py | 9 +++++++-- utils.py | 4 ++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/posts.py b/posts.py index 36095d780..ddded0ee0 100644 --- a/posts.py +++ b/posts.py @@ -32,6 +32,7 @@ from webfinger import webfinger_handle from httpsig import create_signed_header from siteactive import site_is_active from languages import understood_post_language +from utils import contains_invalid_actor_url_chars from utils import acct_handle_dir from utils import is_dm from utils import remove_eol @@ -233,8 +234,12 @@ def get_user_url(wf_request: {}, source_id: int, debug: bool) -> str: 'contains single user instance actor ' + str(source_id) + ' ' + str(link)) else: - return link['href'].replace('/@', '/users/') - return link['href'] + url = link['href'].replace('/@', '/users/') + if not contains_invalid_actor_url_chars(url): + return url + url = link['href'] + if not contains_invalid_actor_url_chars(url): + return url return None diff --git a/utils.py b/utils.py index acf5901fe..aaf999258 100644 --- a/utils.py +++ b/utils.py @@ -41,8 +41,8 @@ INVALID_CHARACTERS = ( INVALID_ACTOR_URL_CHARACTERS = ( '
', '​', '<', '>', '%', '{', '}', '|', '\\', '^', '`', - '?', '#', '[', ']', '@', '!', '$', '&', "'", '(', ')', - '*', '+', ',', ';', '=' + '?', '#', '[', ']', '!', '$', '&', "'", '(', ')', '*', + '+', ',', ';', '=' ) From 2d05e184eb26f3e9d7b8297ae8dfee817286de91 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 26 Dec 2022 16:40:50 +0000 Subject: [PATCH 2/6] No one post overlap between timeline pages --- posts.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/posts.py b/posts.py index ddded0ee0..506e1daaf 100644 --- a/posts.py +++ b/posts.py @@ -4028,8 +4028,10 @@ def _create_box_items(base_dir: str, if first_post_id and total_posts_count == 0: if first_post_id not in post_filename: continue - total_posts_count = \ - int((page_number - 1) * items_per_page) + if first_post_id in post_filename: + total_posts_count = \ + int((page_number - 1) * items_per_page) + continue # Has this post passed through the newswire voting stage? if not _passed_newswire_voting(newswire_votes_threshold, From b22c8c6531c369a727b48273e85557a355f9e5b2 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 26 Dec 2022 17:12:35 +0000 Subject: [PATCH 3/6] One post overlap --- posts.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/posts.py b/posts.py index 506e1daaf..ddded0ee0 100644 --- a/posts.py +++ b/posts.py @@ -4028,10 +4028,8 @@ def _create_box_items(base_dir: str, if first_post_id and total_posts_count == 0: if first_post_id not in post_filename: continue - if first_post_id in post_filename: - total_posts_count = \ - int((page_number - 1) * items_per_page) - continue + total_posts_count = \ + int((page_number - 1) * items_per_page) # Has this post passed through the newswire voting stage? if not _passed_newswire_voting(newswire_votes_threshold, From 83affc43ee705a5c51a837a7ac2ca23ffa3b8537 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 26 Dec 2022 21:43:37 +0000 Subject: [PATCH 4/6] Avoid overlap between timeline pages --- webapp_timeline.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/webapp_timeline.py b/webapp_timeline.py index ee1ab8374..b8f663dcf 100644 --- a/webapp_timeline.py +++ b/webapp_timeline.py @@ -951,6 +951,7 @@ def html_timeline(default_timeline: str, last_post_id = '' + last_item_str = '' if timeline_json: # if this is the media timeline then add an extra gallery container if box_name == 'tlmedia': @@ -1032,20 +1033,19 @@ def html_timeline(default_timeline: str, if curr_tl_str: if curr_tl_str not in tl_items_str: + last_item_str = text_mode_separator + curr_tl_str last_post_id = \ remove_id_ending(item['id']).replace('/', '#') item_ctr += 1 if not reverse_sequence: - tl_items_str += text_mode_separator + curr_tl_str + tl_items_str += last_item_str if separator_str: tl_items_str += separator_str else: - tl_items_str = \ - text_mode_separator + curr_tl_str + \ - tl_items_str + tl_items_str = last_item_str + tl_items_str if separator_str: tl_items_str = \ - text_mode_separator + curr_tl_str + \ + last_item_str + \ separator_str + tl_items_str tl_str += tl_items_str @@ -1058,7 +1058,12 @@ def html_timeline(default_timeline: str, # page down arrow if item_ctr > 0: - tl_str += text_mode_separator + # if showing the page down icon then remove the last item so that + # firstpost does not overlap on the next timeline + if last_item_str: + tl_str = tl_str.replace(last_item_str, '') + else: + tl_str += text_mode_separator first_post = '' if last_post_id: first_post = ';firstpost=' + last_post_id.replace('#', '--') From 7ef5923234b4820ea972ef9872de7e1a99d95126 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 26 Dec 2022 21:59:24 +0000 Subject: [PATCH 5/6] Extra separator --- webapp_timeline.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/webapp_timeline.py b/webapp_timeline.py index b8f663dcf..760c33a89 100644 --- a/webapp_timeline.py +++ b/webapp_timeline.py @@ -1062,8 +1062,7 @@ def html_timeline(default_timeline: str, # firstpost does not overlap on the next timeline if last_item_str: tl_str = tl_str.replace(last_item_str, '') - else: - tl_str += text_mode_separator + tl_str += text_mode_separator first_post = '' if last_post_id: first_post = ';firstpost=' + last_post_id.replace('#', '--') From 067e862e1582353d7b8bec785ee72635ddffe463 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 26 Dec 2022 22:10:21 +0000 Subject: [PATCH 6/6] Text banner --- theme/henge/banner.txt | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/theme/henge/banner.txt b/theme/henge/banner.txt index 93c88b2f1..9a5219f57 100644 --- a/theme/henge/banner.txt +++ b/theme/henge/banner.txt @@ -1,7 +1,6 @@ - ____ _________ __ _____ ___ ____ - / _]| \ | / ]| | | / \ | \ - | [_ | o ) | / / | | || || _ | - | _]| _/| |/ / | ~ || O || | | - | [_ | | | / \_ |___, || || | | - | || | | \ || || || | | - |_____||__| |____\____||____/ \___/ |__|__| + ███████╗██████╗░██╗░█████╗░██╗░░░██╗░█████╗░███╗░░██╗ + ██╔════╝██╔══██╗██║██╔══██╗╚██╗░██╔╝██╔══██╗████╗░██║ + █████╗░░██████╔╝██║██║░░╚═╝░╚████╔╝░██║░░██║██╔██╗██║ + ██╔══╝░░██╔═══╝░██║██║░░██╗░░╚██╔╝░░██║░░██║██║╚████║ + ███████╗██║░░░░░██║╚█████╔╝░░░██║░░░╚█████╔╝██║░╚███║ + ╚══════╝╚═╝░░░░░╚═╝░╚════╝░░░░╚═╝░░░░╚════╝░╚═╝░░╚══╝