From 692acccd7f8eb9d61e1da959ad2544b38507fc60 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 28 Mar 2022 21:13:37 +0100 Subject: [PATCH 1/5] Snake case --- webapp_post.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/webapp_post.py b/webapp_post.py index 0dfd1a2ef..f215a2e5e 100644 --- a/webapp_post.py +++ b/webapp_post.py @@ -1438,7 +1438,7 @@ def individual_post_as_html(signing_priv_key_pem: str, allow_local_network_access: bool, theme_name: str, system_language: str, max_like_count: int, - showRepeats: bool, + show_repeats: bool, show_icons: bool, manually_approves_followers: bool, show_public_only: bool, @@ -1583,10 +1583,10 @@ def individual_post_as_html(signing_priv_key_pem: str, timeline_post_bookmark = timeline_post_bookmark.replace('/', '-') # If this is the inbox timeline then don't show the repeat icon on any DMs - show_repeat_icon = showRepeats + show_repeat_icon = show_repeats is_public_repeat = False post_is_dm = is_dm(post_json_object) - if showRepeats: + if show_repeats: if post_is_dm: show_repeat_icon = False else: From 57b96c6c33f4e58bccb3bcfcd2ce575c66d60f90 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 28 Mar 2022 22:13:07 +0100 Subject: [PATCH 2/5] Don't show announce icon if emoji indicates no boost --- webapp_post.py | 45 ++++++++++++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 17 deletions(-) diff --git a/webapp_post.py b/webapp_post.py index f215a2e5e..78873669f 100644 --- a/webapp_post.py +++ b/webapp_post.py @@ -565,7 +565,7 @@ def _get_announce_icon_html(is_announced: bool, timeline_post_bookmark: str, box_name: str, max_announce_count: int) -> str: - """Returns html for announce icon/button + """Returns html for announce icon/button at the bottom of the post """ announce_str = '' @@ -1922,17 +1922,6 @@ def individual_post_as_html(signing_priv_key_pem: str, container_class_icons = 'containericons dm' container_class = 'container dm' - new_footer_str = \ - _get_footer_with_icons(show_icons, - container_class_icons, - reply_str, announce_str, - like_str, reaction_str, bookmark_str, - delete_str, mute_str, edit_str, - post_json_object, published_link, - time_class, published_str) - if new_footer_str: - footer_str = new_footer_str - # add any content warning from the cwlists directory add_cw_from_lists(post_json_object, cw_lists, translate, lists_enabled) @@ -1951,11 +1940,6 @@ def individual_post_as_html(signing_priv_key_pem: str, system_language: sensitive_str } - # add an extra line if there is a content warning, - # for better vertical spacing on mobile - if post_is_sensitive: - footer_str = '
' + footer_str - if not post_json_object['object'].get('summary'): post_json_object['object']['summary'] = '' post_json_object['object']['summaryMap'] = { @@ -1986,6 +1970,33 @@ def individual_post_as_html(signing_priv_key_pem: str, if not content_str: return '' + # does an emoji indicate no boost preference? + # if so then don't show the repeat/announce icon + if content_str: + if ':boost_no:' in content_str or \ + ':noboost:' in content_str or \ + ':noboosts:' in content_str or \ + ':no_boost:' in content_str or \ + ':no_boosts:' in content_str or \ + ':boosts_no:' in content_str: + announce_str = '' + + new_footer_str = \ + _get_footer_with_icons(show_icons, + container_class_icons, + reply_str, announce_str, + like_str, reaction_str, bookmark_str, + delete_str, mute_str, edit_str, + post_json_object, published_link, + time_class, published_str) + if new_footer_str: + footer_str = new_footer_str + + # add an extra line if there is a content warning, + # for better vertical spacing on mobile + if post_is_sensitive: + footer_str = '
' + footer_str + summary_str = get_summary_from_post(post_json_object, system_language, languages_understood) is_patch = is_git_patch(base_dir, nickname, domain, From 9d2628d013fc61ae5cec08481844d75a410df9bc Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 28 Mar 2022 22:23:38 +0100 Subject: [PATCH 3/5] Don't show reply icon if emoji indicates no replies --- webapp_post.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/webapp_post.py b/webapp_post.py index 78873669f..0ec9bc029 100644 --- a/webapp_post.py +++ b/webapp_post.py @@ -1980,6 +1980,13 @@ def individual_post_as_html(signing_priv_key_pem: str, ':no_boosts:' in content_str or \ ':boosts_no:' in content_str: announce_str = '' + if ':reply_no:' in content_str or \ + ':noreply:' in content_str or \ + ':noreplies:' in content_str or \ + ':no_reply:' in content_str or \ + ':no_replies:' in content_str or \ + ':replies_no:' in content_str: + reply_str = '' new_footer_str = \ _get_footer_with_icons(show_icons, From 70cb0f6299e4a4674debae23ae59e5371da261aa Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 28 Mar 2022 22:26:39 +0100 Subject: [PATCH 4/5] Comments --- webapp_post.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/webapp_post.py b/webapp_post.py index 0ec9bc029..61fbf0fae 100644 --- a/webapp_post.py +++ b/webapp_post.py @@ -1970,9 +1970,9 @@ def individual_post_as_html(signing_priv_key_pem: str, if not content_str: return '' - # does an emoji indicate no boost preference? - # if so then don't show the repeat/announce icon if content_str: + # does an emoji indicate a no boost preference? + # if so then don't show the repeat/announce icon if ':boost_no:' in content_str or \ ':noboost:' in content_str or \ ':noboosts:' in content_str or \ @@ -1980,6 +1980,8 @@ def individual_post_as_html(signing_priv_key_pem: str, ':no_boosts:' in content_str or \ ':boosts_no:' in content_str: announce_str = '' + # does an emoji indicate a no replies preference? + # if so then don't show the reply icon if ':reply_no:' in content_str or \ ':noreply:' in content_str or \ ':noreplies:' in content_str or \ From 7857b3f369a1a972120f790114a712ec133271b4 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 28 Mar 2022 22:45:11 +0100 Subject: [PATCH 5/5] 'author' users path for pixelfed --- epicyon.py | 5 +++++ inbox.py | 5 +++-- utils.py | 4 ++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/epicyon.py b/epicyon.py index 9590c433a..2f8bb5875 100644 --- a/epicyon.py +++ b/epicyon.py @@ -2314,6 +2314,10 @@ if args.followers: nickname = args.followers.split('/profile/')[1] nickname = nickname.replace('\n', '').replace('\r', '') domain = args.followers.split('/profile/')[0] + elif '/author/' in args.followers: + nickname = args.followers.split('/author/')[1] + nickname = nickname.replace('\n', '').replace('\r', '') + domain = args.followers.split('/author/')[0] elif '/channel/' in args.followers: nickname = args.followers.split('/channel/')[1] nickname = nickname.replace('\n', '').replace('\r', '') @@ -2401,6 +2405,7 @@ if args.followers: person_url = person_url.replace('/accounts/', '/actor/') person_url = person_url.replace('/channel/', '/actor/') person_url = person_url.replace('/profile/', '/actor/') + person_url = person_url.replace('/author/', '/actor/') person_url = person_url.replace('/u/', '/actor/') person_url = person_url.replace('/c/', '/actor/') if not person_url: diff --git a/inbox.py b/inbox.py index 87a6f16f3..f5cce538b 100644 --- a/inbox.py +++ b/inbox.py @@ -4068,7 +4068,8 @@ def _receive_follow_request(session, session_onion, session_i2p, return False if not has_users_path(message_json['actor']): if debug: - print('DEBUG: users/profile/accounts/channel missing from actor') + print('DEBUG: ' + + 'users/profile/author/accounts/channel missing from actor') return False domain, temp_port = get_domain_from_actor(message_json['actor']) from_port = port @@ -4090,7 +4091,7 @@ def _receive_follow_request(session, session_onion, session_i2p, message_json['to'] = message_json['object'] if not has_users_path(message_json['object']): if debug: - print('DEBUG: users/profile/channel/accounts ' + + print('DEBUG: users/profile/author/channel/accounts ' + 'not found within object') return False domain_to_follow, temp_port = get_domain_from_actor(message_json['object']) diff --git a/utils.py b/utils.py index e65cb083e..7a93dd934 100644 --- a/utils.py +++ b/utils.py @@ -1139,7 +1139,7 @@ def get_user_paths() -> []: e.g. /users/nickname, /channel/nickname """ return ('/users/', '/profile/', '/accounts/', '/channel/', '/u/', - '/c/', '/video-channels/') + '/c/', '/video-channels/', '/author/') def get_group_paths() -> []: @@ -1943,7 +1943,7 @@ def _get_reserved_words() -> str: 'activity', 'undo', 'pinned', 'actor', 'Actor', 'instance.actor', 'reply', 'replies', 'question', 'like', - 'likes', 'users', 'statuses', 'tags', + 'likes', 'users', 'statuses', 'tags', 'author', 'accounts', 'headers', 'channels', 'profile', 'u', 'c', 'updates', 'repeat', 'announce',