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): if os.path.isfile(possible_cache_entry):
return http_prefix + '://' + \ return http_prefix + '://' + \
domain + users_path.replace('#', '/') + nickname 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 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): if text_in_file(accept_deny_actor, approve_follows_filename):
actor_found = True actor_found = True
break 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: if not actor_found:
return return
try: try:
@ -292,6 +297,10 @@ def is_follower_of_person(base_dir: str, nickname: str, domain: str,
if url in followers_str: if url in followers_str:
already_following = True already_following = True
break break
if not already_following:
url = '://' + follower_domain + '/' + follower_nickname
if url in followers_str:
already_following = True
return already_following return already_following
@ -679,6 +688,10 @@ def store_follow_request(base_dir: str,
if url in followers_str: if url in followers_str:
already_following = True already_following = True
break break
if not already_following:
url = '://' + domain_full + '/' + nickname
if url in followers_str:
already_following = True
if already_following: if already_following:
if debug: if debug:

View File

@ -69,6 +69,14 @@ def _get_followers_for_domain(base_dir: str,
result.append(url) result.append(url)
found = True found = True
break 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: elif '://' + search_domain in line_str:
result.append(line_str) result.append(line_str)
result.sort() result.sort()

View File

@ -1145,6 +1145,10 @@ def _person_receive_update(base_dir: str,
if actor in person_json['id']: if actor in person_json['id']:
users_str_found = True users_str_found = True
break 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 not users_str_found:
if debug: if debug:
print('actor: ' + actor) 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_domain = approve_handle.split('@')[1].strip()
req_prefix = http_prefix + '://' + req_domain req_prefix = http_prefix + '://' + req_domain
paths = get_user_paths() paths = get_user_paths()
if req_prefix + '/' + req_nick in approve_follows_str: for user_path in paths:
exists = True if req_prefix + user_path + req_nick in approve_follows_str:
approve_handle_full = req_prefix + '/' + req_nick exists = True
if group_account: approve_handle_full = req_prefix + user_path + req_nick
approve_handle_full = '!' + approve_handle_full if group_account:
approve_handle_full = '!' + approve_handle_full
break
if not exists: if not exists:
for user_path in paths: if req_prefix + '/' + req_nick in approve_follows_str:
if req_prefix + user_path + req_nick in approve_follows_str: exists = True
exists = True approve_handle_full = req_prefix + '/' + req_nick
approve_handle_full = req_prefix + user_path + req_nick if group_account:
if group_account: approve_handle_full = '!' + approve_handle_full
approve_handle_full = '!' + approve_handle_full
break
if not exists: if not exists:
print('Manual follow accept: ' + approve_handle_full + print('Manual follow accept: ' + approve_handle_full +
' not in requests file "' + ' not in requests file "' +

View File

@ -337,6 +337,14 @@ def _get_inactive_accounts(base_dir: str, nickname: str, domain: str,
result.append(handle) result.append(handle)
found = True found = True
break 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: if found:
break break
elif '://' in handle: elif '://' in handle: