Merge branch 'main' of gitlab.com:bashrc2/epicyon

merge-requests/30/head
Bob Mottram 2022-03-28 23:05:27 +01:00
commit 1d52829e42
4 changed files with 50 additions and 24 deletions

View File

@ -2314,6 +2314,10 @@ if args.followers:
nickname = args.followers.split('/profile/')[1] nickname = args.followers.split('/profile/')[1]
nickname = nickname.replace('\n', '').replace('\r', '') nickname = nickname.replace('\n', '').replace('\r', '')
domain = args.followers.split('/profile/')[0] 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: elif '/channel/' in args.followers:
nickname = args.followers.split('/channel/')[1] nickname = args.followers.split('/channel/')[1]
nickname = nickname.replace('\n', '').replace('\r', '') 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('/accounts/', '/actor/')
person_url = person_url.replace('/channel/', '/actor/') person_url = person_url.replace('/channel/', '/actor/')
person_url = person_url.replace('/profile/', '/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('/u/', '/actor/')
person_url = person_url.replace('/c/', '/actor/') person_url = person_url.replace('/c/', '/actor/')
if not person_url: if not person_url:

View File

@ -4068,7 +4068,8 @@ def _receive_follow_request(session, session_onion, session_i2p,
return False return False
if not has_users_path(message_json['actor']): if not has_users_path(message_json['actor']):
if debug: if debug:
print('DEBUG: users/profile/accounts/channel missing from actor') print('DEBUG: ' +
'users/profile/author/accounts/channel missing from actor')
return False return False
domain, temp_port = get_domain_from_actor(message_json['actor']) domain, temp_port = get_domain_from_actor(message_json['actor'])
from_port = port from_port = port
@ -4090,7 +4091,7 @@ def _receive_follow_request(session, session_onion, session_i2p,
message_json['to'] = message_json['object'] message_json['to'] = message_json['object']
if not has_users_path(message_json['object']): if not has_users_path(message_json['object']):
if debug: if debug:
print('DEBUG: users/profile/channel/accounts ' + print('DEBUG: users/profile/author/channel/accounts ' +
'not found within object') 'not found within object')
return False return False
domain_to_follow, temp_port = get_domain_from_actor(message_json['object']) domain_to_follow, temp_port = get_domain_from_actor(message_json['object'])

View File

@ -1139,7 +1139,7 @@ def get_user_paths() -> []:
e.g. /users/nickname, /channel/nickname e.g. /users/nickname, /channel/nickname
""" """
return ('/users/', '/profile/', '/accounts/', '/channel/', '/u/', return ('/users/', '/profile/', '/accounts/', '/channel/', '/u/',
'/c/', '/video-channels/') '/c/', '/video-channels/', '/author/')
def get_group_paths() -> []: def get_group_paths() -> []:
@ -1943,7 +1943,7 @@ def _get_reserved_words() -> str:
'activity', 'undo', 'pinned', 'activity', 'undo', 'pinned',
'actor', 'Actor', 'instance.actor', 'actor', 'Actor', 'instance.actor',
'reply', 'replies', 'question', 'like', 'reply', 'replies', 'question', 'like',
'likes', 'users', 'statuses', 'tags', 'likes', 'users', 'statuses', 'tags', 'author',
'accounts', 'headers', 'accounts', 'headers',
'channels', 'profile', 'u', 'c', 'channels', 'profile', 'u', 'c',
'updates', 'repeat', 'announce', 'updates', 'repeat', 'announce',

View File

@ -565,7 +565,7 @@ def _get_announce_icon_html(is_announced: bool,
timeline_post_bookmark: str, timeline_post_bookmark: str,
box_name: str, box_name: str,
max_announce_count: int) -> 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 = '' announce_str = ''
@ -1438,7 +1438,7 @@ def individual_post_as_html(signing_priv_key_pem: str,
allow_local_network_access: bool, allow_local_network_access: bool,
theme_name: str, system_language: str, theme_name: str, system_language: str,
max_like_count: int, max_like_count: int,
showRepeats: bool, show_repeats: bool,
show_icons: bool, show_icons: bool,
manually_approves_followers: bool, manually_approves_followers: bool,
show_public_only: 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('/', '-') timeline_post_bookmark = timeline_post_bookmark.replace('/', '-')
# If this is the inbox timeline then don't show the repeat icon on any DMs # 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 is_public_repeat = False
post_is_dm = is_dm(post_json_object) post_is_dm = is_dm(post_json_object)
if showRepeats: if show_repeats:
if post_is_dm: if post_is_dm:
show_repeat_icon = False show_repeat_icon = False
else: else:
@ -1922,17 +1922,6 @@ def individual_post_as_html(signing_priv_key_pem: str,
container_class_icons = 'containericons dm' container_class_icons = 'containericons dm'
container_class = 'container 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 any content warning from the cwlists directory
add_cw_from_lists(post_json_object, cw_lists, translate, lists_enabled) 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 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 = '<br>' + footer_str
if not post_json_object['object'].get('summary'): if not post_json_object['object'].get('summary'):
post_json_object['object']['summary'] = '' post_json_object['object']['summary'] = ''
post_json_object['object']['summaryMap'] = { post_json_object['object']['summaryMap'] = {
@ -1986,6 +1970,42 @@ def individual_post_as_html(signing_priv_key_pem: str,
if not content_str: if not content_str:
return '' return ''
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 \
':no_boost:' in content_str or \
':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 \
':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,
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 = '<br>' + footer_str
summary_str = get_summary_from_post(post_json_object, system_language, summary_str = get_summary_from_post(post_json_object, system_language,
languages_understood) languages_understood)
is_patch = is_git_patch(base_dir, nickname, domain, is_patch = is_git_patch(base_dir, nickname, domain,