From b8e4ecbd6610f8c259374ef130dfec550988d6fc Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sat, 26 Feb 2022 17:07:14 +0000 Subject: [PATCH] Misskey-style instance actor endpoint --- daemon.py | 1 + person.py | 9 +++++++-- posts.py | 3 ++- tests.py | 3 +++ 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/daemon.py b/daemon.py index 4ec5de574..10e24a73a 100644 --- a/daemon.py +++ b/daemon.py @@ -13986,6 +13986,7 @@ class PubServer(BaseHTTPRequestHandler): # instance actor if self.path == '/actor' or \ + self.path == '/users/instance.actor' or \ self.path == '/users/actor' or \ self.path == '/Actor' or \ self.path == '/users/Actor': diff --git a/person.py b/person.py index 02f566159..835950d47 100644 --- a/person.py +++ b/person.py @@ -1523,8 +1523,13 @@ def get_actor_json(hostDomain: str, handle: str, http: bool, gnunet: bool, person_url = None wf_request = None - if '://' in original_actor and \ - original_actor.lower().endswith('/actor'): + original_actor_lower = original_actor.lower() + ends_with_instance_actor = False + if original_actor_lower.endswith('/actor') or \ + original_actor_lower.endswith('/instance.actor'): + ends_with_instance_actor = True + + if '://' in original_actor and ends_with_instance_actor: if debug: print(original_actor + ' is an instance actor') person_url = original_actor diff --git a/posts.py b/posts.py index 117e6656c..2144c917e 100644 --- a/posts.py +++ b/posts.py @@ -2759,7 +2759,8 @@ def send_signed_json(post_json_object: {}, session, base_dir: str, print("to_person_id: " + str(to_person_id)) print("shared_inbox_url: " + str(shared_inbox_url)) if inbox_url: - if inbox_url.endswith('/actor/inbox'): + if inbox_url.endswith('/actor/inbox') or \ + inbox_url.endswith('/instance.actor/inbox'): inbox_url = shared_inbox_url if not inbox_url: diff --git a/tests.py b/tests.py index 1236e1429..c481112ff 100644 --- a/tests.py +++ b/tests.py @@ -3047,6 +3047,8 @@ def test_client_to_server(base_dir: str): print(">>> s2s post arrived in Bob's inbox") + time.sleep(2) + calendar_path = bob_dir + '/accounts/bob@' + bob_domain + '/calendar' if not os.path.isdir(calendar_path): print('Missing calendar path: ' + calendar_path) @@ -6744,4 +6746,5 @@ def run_all_tests(): _test_followers_on_domain(base_dir) _test_follows(base_dir) _test_group_followers(base_dir) + time.sleep(2) print('Tests succeeded\n')