From 23a2fb8cf5b28703121b497126e7262e205ebc71 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 28 Feb 2022 16:19:26 +0000 Subject: [PATCH 1/3] Debug --- follow.py | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/follow.py b/follow.py index e229502f8..9fa0b70f3 100644 --- a/follow.py +++ b/follow.py @@ -738,21 +738,19 @@ def followed_account_accepts(session, base_dir: str, http_prefix: str, accept_handle = nickname + '@' + domain # send accept back - if debug: - print('DEBUG: sending Accept activity for ' + - 'follow request which arrived at ' + - nickname_to_follow + '@' + domain_to_follow + - ' back to ' + accept_handle) + print('Sending follow Accept activity for ' + + 'follow request which arrived at ' + + nickname_to_follow + '@' + domain_to_follow + + ' back to ' + accept_handle) accept_json = create_accept(base_dir, federation_list, nickname_to_follow, domain_to_follow, port, person_url, '', http_prefix, follow_json) - if debug: - pprint(accept_json) - print('DEBUG: sending follow Accept from ' + - nickname_to_follow + '@' + domain_to_follow + - ' port ' + str(port) + ' to ' + - accept_handle + ' port ' + str(from_port)) + pprint(accept_json) + print('DEBUG: sending follow Accept from ' + + nickname_to_follow + '@' + domain_to_follow + + ' port ' + str(port) + ' to ' + + accept_handle + ' port ' + str(from_port)) client_to_server = False if removeFollowActivity: @@ -765,7 +763,8 @@ def followed_account_accepts(session, base_dir: str, http_prefix: str, try: os.remove(follow_activity_filename) except OSError: - print('EX: followed_account_accepts unable to delete ' + + print('EX: follow Accept ' + + 'followed_account_accepts unable to delete ' + follow_activity_filename) group_account = False From d14f31b883fc2bc6e8ef3a83cd076bc63cbb46f9 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 28 Feb 2022 19:37:33 +0000 Subject: [PATCH 2/3] Fix manual follower approval --- follow.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/follow.py b/follow.py index 9fa0b70f3..0d632184f 100644 --- a/follow.py +++ b/follow.py @@ -582,7 +582,7 @@ def follow_approval_required(base_dir: str, nickname_to_follow: str, if os.path.isfile(actor_filename): actor = load_json(actor_filename) if actor: - if actor.get('manually_approves_followers'): + if 'manuallyApprovesFollowers' in actor: manually_approve_follows = actor['manuallyApprovesFollowers'] else: if debug: @@ -757,8 +757,7 @@ def followed_account_accepts(session, base_dir: str, http_prefix: str, # remove the follow request json follow_activity_filename = \ acct_dir(base_dir, nickname_to_follow, domain_to_follow) + \ - '/requests/' + \ - nickname + '@' + domain + '.follow' + '/requests/' + nickname + '@' + domain + '.follow' if os.path.isfile(follow_activity_filename): try: os.remove(follow_activity_filename) @@ -1454,7 +1453,7 @@ def follower_approval_active(base_dir: str, if os.path.isfile(actor_filename): actor_json = load_json(actor_filename) if actor_json: - if actor_json.get('manuallyApprovesFollowers'): + if 'manuallyApprovesFollowers' in actor_json: manually_approves_followers = \ actor_json['manuallyApprovesFollowers'] return manually_approves_followers From 1e957d181c450013e03618436c4bcc84366f2809 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 28 Feb 2022 20:05:47 +0000 Subject: [PATCH 3/3] Debug show follow accept --- acceptreject.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/acceptreject.py b/acceptreject.py index 55dc41060..054350110 100644 --- a/acceptreject.py +++ b/acceptreject.py @@ -97,7 +97,7 @@ def _accept_follow(base_dir: str, domain: str, message_json: {}, print('DEBUG: No "to" parameter in follow Accept') return if debug: - print('DEBUG: follow Accept received') + print('DEBUG: follow Accept received ' + str(message_json)) this_actor = message_json['object']['actor'] nickname = get_nickname_from_actor(this_actor) if not nickname: