Misskey-style instance actor endpoint

merge-requests/30/head
Bob Mottram 2022-02-26 17:07:14 +00:00
parent 154578c00e
commit b8e4ecbd66
4 changed files with 13 additions and 3 deletions

View File

@ -13986,6 +13986,7 @@ class PubServer(BaseHTTPRequestHandler):
# instance actor # instance actor
if self.path == '/actor' or \ if self.path == '/actor' or \
self.path == '/users/instance.actor' or \
self.path == '/users/actor' or \ self.path == '/users/actor' or \
self.path == '/Actor' or \ self.path == '/Actor' or \
self.path == '/users/Actor': self.path == '/users/Actor':

View File

@ -1523,8 +1523,13 @@ def get_actor_json(hostDomain: str, handle: str, http: bool, gnunet: bool,
person_url = None person_url = None
wf_request = None wf_request = None
if '://' in original_actor and \ original_actor_lower = original_actor.lower()
original_actor.lower().endswith('/actor'): 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: if debug:
print(original_actor + ' is an instance actor') print(original_actor + ' is an instance actor')
person_url = original_actor person_url = original_actor

View File

@ -2759,7 +2759,8 @@ def send_signed_json(post_json_object: {}, session, base_dir: str,
print("to_person_id: " + str(to_person_id)) print("to_person_id: " + str(to_person_id))
print("shared_inbox_url: " + str(shared_inbox_url)) print("shared_inbox_url: " + str(shared_inbox_url))
if 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 inbox_url = shared_inbox_url
if not inbox_url: if not inbox_url:

View File

@ -3047,6 +3047,8 @@ def test_client_to_server(base_dir: str):
print(">>> s2s post arrived in Bob's inbox") print(">>> s2s post arrived in Bob's inbox")
time.sleep(2)
calendar_path = bob_dir + '/accounts/bob@' + bob_domain + '/calendar' calendar_path = bob_dir + '/accounts/bob@' + bob_domain + '/calendar'
if not os.path.isdir(calendar_path): if not os.path.isdir(calendar_path):
print('Missing calendar path: ' + calendar_path) print('Missing calendar path: ' + calendar_path)
@ -6744,4 +6746,5 @@ def run_all_tests():
_test_followers_on_domain(base_dir) _test_followers_on_domain(base_dir)
_test_follows(base_dir) _test_follows(base_dir)
_test_group_followers(base_dir) _test_group_followers(base_dir)
time.sleep(2)
print('Tests succeeded\n') print('Tests succeeded\n')