From e1b3340e6ad3f7bda740653aa68ef19d01aff698 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Fri, 30 Dec 2022 17:32:49 +0000 Subject: [PATCH 1/8] Check that post has content --- conversation.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/conversation.py b/conversation.py index bfc85d6fe..21257c7f4 100644 --- a/conversation.py +++ b/conversation.py @@ -168,6 +168,8 @@ def download_conversation_posts(session, http_prefix: str, base_dir: str, 'object': post_json } post_json = wrapped_post + if not post_json['object'].get('content'): + break conversation_view = [post_json] + conversation_view if not post_json['object'].get('inReplyTo'): if debug: From 302e685a35152ade3608c353d4299e7b8921a9e3 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Fri, 30 Dec 2022 17:44:44 +0000 Subject: [PATCH 2/8] Test different field --- conversation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conversation.py b/conversation.py index 21257c7f4..9802f1ec8 100644 --- a/conversation.py +++ b/conversation.py @@ -168,7 +168,7 @@ def download_conversation_posts(session, http_prefix: str, base_dir: str, 'object': post_json } post_json = wrapped_post - if not post_json['object'].get('content'): + if not post_json['object'].get('published'): break conversation_view = [post_json] + conversation_view if not post_json['object'].get('inReplyTo'): From d305bff9bde2899e0ca8d338edec4ad2cd1ee378 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Fri, 30 Dec 2022 17:51:34 +0000 Subject: [PATCH 3/8] Redirect warning --- session.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/session.py b/session.py index 78998fe35..f71df18d3 100644 --- a/session.py +++ b/session.py @@ -109,6 +109,8 @@ def _get_json_request(session, url: str, domain_full: str, session_headers: {}, print('WARN: get_json Not Found url: ' + url) elif result.status_code == 410: print('WARN: get_json no longer available url: ' + url) + elif result.status_code == 303: + print('WARN: get_json redirect not permitted: ' + url) else: session_headers2 = session_headers.copy() if session_headers2.get('Authorization'): From fae91dca0efdd10dea2f38d278a7b0a94e001304 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Fri, 30 Dec 2022 19:17:38 +0000 Subject: [PATCH 4/8] Extra users path --- utils.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/utils.py b/utils.py index 2d85da306..ce258e548 100644 --- a/utils.py +++ b/utils.py @@ -1376,7 +1376,8 @@ def get_user_paths() -> []: e.g. /users/nickname, /channel/nickname """ return ('/users/', '/profile/', '/accounts/', '/channel/', '/u/', - '/c/', '/video-channels/', '/author/', '/activitypub/') + '/c/', '/video-channels/', '/author/', '/activitypub/', + '/actors/') def get_group_paths() -> []: @@ -2313,7 +2314,7 @@ def _get_reserved_words() -> str: 'searchemoji', 'catalog', 'conversationId', 'mention', 'http', 'https', 'ipfs', 'ipns', 'ontologies', 'data', 'postedit', 'moved', - 'inactive', 'activitypub') + 'inactive', 'activitypub', 'actors') def get_nickname_validation_pattern() -> str: From 88e493e5392b3806f0092e99d0f9d2f99594a4b2 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Fri, 30 Dec 2022 19:20:40 +0000 Subject: [PATCH 5/8] Extra users path --- person.py | 1 + 1 file changed, 1 insertion(+) diff --git a/person.py b/person.py index 6badac74a..e5eeb4402 100644 --- a/person.py +++ b/person.py @@ -1644,6 +1644,7 @@ def get_actor_json(host_domain: str, handle: str, http: bool, gnunet: bool, print(original_actor + ' is a group actor') person_url = original_actor else: + print('Test 1') handle = nickname + '@' + domain wf_request = webfinger_handle(session, handle, http_prefix, cached_webfingers, From 7bc91cfdefd2974f7b9b93aa08ef3c8bfaf3e648 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Fri, 30 Dec 2022 19:21:18 +0000 Subject: [PATCH 6/8] Debug --- person.py | 1 - 1 file changed, 1 deletion(-) diff --git a/person.py b/person.py index e5eeb4402..6badac74a 100644 --- a/person.py +++ b/person.py @@ -1644,7 +1644,6 @@ def get_actor_json(host_domain: str, handle: str, http: bool, gnunet: bool, print(original_actor + ' is a group actor') person_url = original_actor else: - print('Test 1') handle = nickname + '@' + domain wf_request = webfinger_handle(session, handle, http_prefix, cached_webfingers, From 9446b4ecf9b8b38bae1e35335e78e90e25803c2b Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Fri, 30 Dec 2022 19:35:10 +0000 Subject: [PATCH 7/8] Less strict parsing of webfinger type --- posts.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/posts.py b/posts.py index c27a7a0a1..3d11250b2 100644 --- a/posts.py +++ b/posts.py @@ -173,7 +173,8 @@ def get_user_url(wf_request: {}, source_id: int, debug: bool) -> str: for link in wf_request['links']: if not (link.get('type') and link.get('href')): continue - if link['type'] != 'application/activity+json': + if 'application/activity+json' not in link['type'] and \ + 'application/ld+json' not in link['type']: continue if '/@' not in link['href']: if debug and not has_users_path(link['href']): From 16548ddbad80ed78866218ea26aed18632edb8a8 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Fri, 30 Dec 2022 19:40:48 +0000 Subject: [PATCH 8/8] Check for dict --- webapp_profile.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/webapp_profile.py b/webapp_profile.py index bab835c6a..e01576a08 100644 --- a/webapp_profile.py +++ b/webapp_profile.py @@ -97,6 +97,8 @@ def _valid_profile_preview_post(post_json_object: {}, """Returns true if the given post should appear on a person/group profile after searching for a handle """ + if not isinstance(post_json_object, dict): + return False, None is_announced_feed_item = False if is_create_inside_announce(post_json_object): is_announced_feed_item = True