Handle no user path

main
Bob Mottram 2023-05-10 12:53:38 +01:00
parent 322d06e26a
commit 705792d2fb
6 changed files with 50 additions and 12 deletions

View File

@ -879,6 +879,10 @@ def _mention_to_url(base_dir: str, http_prefix: str,
if os.path.isfile(possible_cache_entry):
return http_prefix + '://' + \
domain + users_path.replace('#', '/') + nickname
possible_cache_entry = \
cache_path_start + '#' + nickname + '.json'
if os.path.isfile(possible_cache_entry):
return http_prefix + '://' + domain + '/' + nickname
return http_prefix + '://' + domain + '/users/' + nickname

View File

@ -130,6 +130,11 @@ def _remove_from_follow_base(base_dir: str,
if text_in_file(accept_deny_actor, approve_follows_filename):
actor_found = True
break
if not actor_found:
accept_deny_actor = \
'://' + accept_deny_domain + '/' + accept_deny_nickname
if text_in_file(accept_deny_actor, approve_follows_filename):
actor_found = True
if not actor_found:
return
try:
@ -292,6 +297,10 @@ def is_follower_of_person(base_dir: str, nickname: str, domain: str,
if url in followers_str:
already_following = True
break
if not already_following:
url = '://' + follower_domain + '/' + follower_nickname
if url in followers_str:
already_following = True
return already_following
@ -679,6 +688,10 @@ def store_follow_request(base_dir: str,
if url in followers_str:
already_following = True
break
if not already_following:
url = '://' + domain_full + '/' + nickname
if url in followers_str:
already_following = True
if already_following:
if debug:

View File

@ -69,6 +69,14 @@ def _get_followers_for_domain(base_dir: str,
result.append(url)
found = True
break
if not found:
url = prefix + '://' + search_domain + '/' + nick
filename = base_dir + '/cache/actors/' + \
url.replace('/', '#') + '.json'
if os.path.isfile(filename):
if url not in result:
result.append(url)
found = True
elif '://' + search_domain in line_str:
result.append(line_str)
result.sort()

View File

@ -1145,6 +1145,10 @@ def _person_receive_update(base_dir: str,
if actor in person_json['id']:
users_str_found = True
break
if not users_str_found:
actor = update_domain_full + '/' + update_nickname
if actor in person_json['id']:
users_str_found = True
if not users_str_found:
if debug:
print('actor: ' + actor)

View File

@ -178,19 +178,20 @@ def manual_approve_follow_request(session, session_onion, session_i2p,
req_domain = approve_handle.split('@')[1].strip()
req_prefix = http_prefix + '://' + req_domain
paths = get_user_paths()
if req_prefix + '/' + req_nick in approve_follows_str:
exists = True
approve_handle_full = req_prefix + '/' + req_nick
if group_account:
approve_handle_full = '!' + approve_handle_full
for user_path in paths:
if req_prefix + user_path + req_nick in approve_follows_str:
exists = True
approve_handle_full = req_prefix + user_path + req_nick
if group_account:
approve_handle_full = '!' + approve_handle_full
break
if not exists:
for user_path in paths:
if req_prefix + user_path + req_nick in approve_follows_str:
exists = True
approve_handle_full = req_prefix + user_path + req_nick
if group_account:
approve_handle_full = '!' + approve_handle_full
break
if req_prefix + '/' + req_nick in approve_follows_str:
exists = True
approve_handle_full = req_prefix + '/' + req_nick
if group_account:
approve_handle_full = '!' + approve_handle_full
if not exists:
print('Manual follow accept: ' + approve_handle_full +
' not in requests file "' +

View File

@ -337,6 +337,14 @@ def _get_inactive_accounts(base_dir: str, nickname: str, domain: str,
result.append(handle)
found = True
break
if not found:
actor = \
http_prefix + follower_domain + '/' + \
follower_nickname
if is_dormant(base_dir, nickname, domain, actor,
dormant_months):
result.append(handle)
found = True
if found:
break
elif '://' in handle: