Remove indexes

merge-requests/30/head
Bob Mottram 2023-01-05 22:54:29 +00:00
parent 9d59739632
commit 3b5b19ebf4
1 changed files with 3 additions and 17 deletions

View File

@ -1107,13 +1107,6 @@ def html_hashtag_search_remote(nickname: str, domain: str, port: int,
elif page_number < 1: elif page_number < 1:
page_number = 1 page_number = 1
# get the start end end within the index file
start_index = int((page_number - 1) * posts_per_page)
end_index = start_index + posts_per_page
no_of_lines = len(lines)
if end_index >= no_of_lines and no_of_lines > 0:
end_index = no_of_lines - 1
instance_title = \ instance_title = \
get_config_param(base_dir, 'instanceTitle') get_config_param(base_dir, 'instanceTitle')
hashtag_search_form = \ hashtag_search_form = \
@ -1136,7 +1129,7 @@ def html_hashtag_search_remote(nickname: str, domain: str, port: int,
tag_link = '/users/' + nickname + '?remotetag=' + \ tag_link = '/users/' + nickname + '?remotetag=' + \
hashtag_url.replace('/', '--') hashtag_url.replace('/', '--')
if start_index > 0: if page_number > 1:
# previous page link # previous page link
hashtag_search_form += \ hashtag_search_form += \
' <center>\n' + \ ' <center>\n' + \
@ -1148,18 +1141,14 @@ def html_hashtag_search_remote(nickname: str, domain: str, port: int,
translate['Page up'] + \ translate['Page up'] + \
'" alt="' + translate['Page up'] + \ '" alt="' + translate['Page up'] + \
'"></a>\n </center>\n' '"></a>\n </center>\n'
index = start_index for post_id in lines:
while index <= end_index:
post_id = lines[index]
post_json_object = \ post_json_object = \
get_json(signing_priv_key_pem, get_json(signing_priv_key_pem,
session, post_id, as_header, None, debug, session, post_id, as_header, None, debug,
__version__, http_prefix, domain) __version__, http_prefix, domain)
if not post_json_object: if not post_json_object:
index += 1
continue continue
if not isinstance(post_json_object, dict): if not isinstance(post_json_object, dict):
index += 1
continue continue
if not has_object_dict(post_json_object): if not has_object_dict(post_json_object):
if post_json_object.get('id') and \ if post_json_object.get('id') and \
@ -1178,10 +1167,8 @@ def html_hashtag_search_remote(nickname: str, domain: str, port: int,
} }
post_json_object = new_post_json_object post_json_object = new_post_json_object
else: else:
index += 1
continue continue
if not is_public_post(post_json_object): if not is_public_post(post_json_object):
index += 1
continue continue
show_individual_post_icons = False show_individual_post_icons = False
allow_deletion = False allow_deletion = False
@ -1225,9 +1212,8 @@ def html_hashtag_search_remote(nickname: str, domain: str, port: int,
minimize_all_images, None) minimize_all_images, None)
if post_str: if post_str:
hashtag_search_form += separator_str + post_str hashtag_search_form += separator_str + post_str
index += 1
if end_index < no_of_lines - 1: if len(lines) >= 5:
# next page link # next page link
hashtag_search_form += \ hashtag_search_form += \
' <center>\n' + \ ' <center>\n' + \