mirror of https://gitlab.com/bashrc2/epicyon
merge-requests/30/head
commit
18598297a2
3
inbox.py
3
inbox.py
|
@ -2693,7 +2693,7 @@ def _receive_announce(recent_posts_cache: {},
|
||||||
announced_actor_nickname + '@' + announced_actor_domain)
|
announced_actor_nickname + '@' + announced_actor_domain)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# is this post in the outbox of the person?
|
# is this post in the inbox or outbox of the account?
|
||||||
post_filename = locate_post(base_dir, nickname, domain,
|
post_filename = locate_post(base_dir, nickname, domain,
|
||||||
message_json['object'])
|
message_json['object'])
|
||||||
if not post_filename:
|
if not post_filename:
|
||||||
|
@ -2701,6 +2701,7 @@ def _receive_announce(recent_posts_cache: {},
|
||||||
print('DEBUG: announce post not found in inbox or outbox')
|
print('DEBUG: announce post not found in inbox or outbox')
|
||||||
print(message_json['object'])
|
print(message_json['object'])
|
||||||
return True
|
return True
|
||||||
|
# add actor to the list of announcers for a post
|
||||||
update_announce_collection(recent_posts_cache, base_dir, post_filename,
|
update_announce_collection(recent_posts_cache, base_dir, post_filename,
|
||||||
message_json['actor'], nickname, domain, debug)
|
message_json['actor'], nickname, domain, debug)
|
||||||
if debug:
|
if debug:
|
||||||
|
|
|
@ -362,7 +362,7 @@ def _save_individual_post_as_html_to_cache(base_dir: str,
|
||||||
with open(cached_post_filename, 'w+', encoding='utf-8') as fp_cache:
|
with open(cached_post_filename, 'w+', encoding='utf-8') as fp_cache:
|
||||||
fp_cache.write(post_html)
|
fp_cache.write(post_html)
|
||||||
return True
|
return True
|
||||||
except Exception as ex:
|
except OSError as ex:
|
||||||
print('ERROR: saving post to cache, ' + str(ex))
|
print('ERROR: saving post to cache, ' + str(ex))
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -916,7 +916,9 @@ def _get_like_icon_html(nickname: str, domain_full: str,
|
||||||
return like_str
|
return like_str
|
||||||
|
|
||||||
|
|
||||||
def _get_bookmark_icon_html(nickname: str, domain_full: str,
|
def _get_bookmark_icon_html(base_dir: str,
|
||||||
|
nickname: str, domain: str,
|
||||||
|
domain_full: str,
|
||||||
post_json_object: {},
|
post_json_object: {},
|
||||||
is_moderation_post: bool,
|
is_moderation_post: bool,
|
||||||
translate: {},
|
translate: {},
|
||||||
|
@ -924,7 +926,8 @@ def _get_bookmark_icon_html(nickname: str, domain_full: str,
|
||||||
post_start_time, box_name: str,
|
post_start_time, box_name: str,
|
||||||
page_number_param: str,
|
page_number_param: str,
|
||||||
timeline_post_bookmark: str,
|
timeline_post_bookmark: str,
|
||||||
first_post_id: str) -> str:
|
first_post_id: str,
|
||||||
|
post_url: str) -> str:
|
||||||
"""Returns html for bookmark icon/button
|
"""Returns html for bookmark icon/button
|
||||||
"""
|
"""
|
||||||
bookmark_str = ''
|
bookmark_str = ''
|
||||||
|
@ -932,6 +935,9 @@ def _get_bookmark_icon_html(nickname: str, domain_full: str,
|
||||||
if is_moderation_post:
|
if is_moderation_post:
|
||||||
return bookmark_str
|
return bookmark_str
|
||||||
|
|
||||||
|
if not locate_post(base_dir, nickname, domain, post_url):
|
||||||
|
return bookmark_str
|
||||||
|
|
||||||
bookmark_icon = 'bookmark_inactive.png'
|
bookmark_icon = 'bookmark_inactive.png'
|
||||||
bookmark_link = 'bookmark'
|
bookmark_link = 'bookmark'
|
||||||
bookmark_emoji = ''
|
bookmark_emoji = ''
|
||||||
|
@ -2133,9 +2139,13 @@ def individual_post_as_html(signing_priv_key_pem: str,
|
||||||
translate, post_json_object['actor'],
|
translate, post_json_object['actor'],
|
||||||
theme_name, system_language,
|
theme_name, system_language,
|
||||||
box_name)
|
box_name)
|
||||||
with open(announce_filename + '.tts', 'w+',
|
try:
|
||||||
encoding='utf-8') as ttsfile:
|
with open(announce_filename + '.tts', 'w+',
|
||||||
ttsfile.write('\n')
|
encoding='utf-8') as ttsfile:
|
||||||
|
ttsfile.write('\n')
|
||||||
|
except OSError:
|
||||||
|
print('EX: unable to write tts ' +
|
||||||
|
announce_filename + '.tts')
|
||||||
|
|
||||||
is_announced = True
|
is_announced = True
|
||||||
|
|
||||||
|
@ -2295,15 +2305,14 @@ def individual_post_as_html(signing_priv_key_pem: str,
|
||||||
_log_post_timing(enable_timing_log, post_start_time, '12.5')
|
_log_post_timing(enable_timing_log, post_start_time, '12.5')
|
||||||
|
|
||||||
bookmark_str = \
|
bookmark_str = \
|
||||||
_get_bookmark_icon_html(nickname, domain_full,
|
_get_bookmark_icon_html(base_dir, nickname, domain,
|
||||||
post_json_object,
|
domain_full, post_json_object,
|
||||||
is_moderation_post,
|
is_moderation_post, translate,
|
||||||
translate,
|
|
||||||
enable_timing_log,
|
enable_timing_log,
|
||||||
post_start_time, box_name,
|
post_start_time, box_name,
|
||||||
page_number_param,
|
page_number_param,
|
||||||
timeline_post_bookmark,
|
timeline_post_bookmark,
|
||||||
first_post_id)
|
first_post_id, message_id)
|
||||||
|
|
||||||
_log_post_timing(enable_timing_log, post_start_time, '12.9')
|
_log_post_timing(enable_timing_log, post_start_time, '12.9')
|
||||||
|
|
||||||
|
@ -2652,8 +2661,10 @@ def individual_post_as_html(signing_priv_key_pem: str,
|
||||||
translate)
|
translate)
|
||||||
if map_str:
|
if map_str:
|
||||||
map_str = '<center>\n' + map_str + '</center>\n'
|
map_str = '<center>\n' + map_str + '</center>\n'
|
||||||
if map_str and post_json_object['object'].get('attributedTo'):
|
attrib = None
|
||||||
|
if post_json_object['object'].get('attributedTo'):
|
||||||
attrib = post_json_object['object']['attributedTo']
|
attrib = post_json_object['object']['attributedTo']
|
||||||
|
if map_str and attrib:
|
||||||
# is this being sent by the author?
|
# is this being sent by the author?
|
||||||
if '://' + domain_full + '/users/' + nickname in attrib:
|
if '://' + domain_full + '/users/' + nickname in attrib:
|
||||||
location_domain = location_str
|
location_domain = location_str
|
||||||
|
|
|
@ -226,6 +226,11 @@ def html_profile_after_search(recent_posts_cache: {}, max_recent_posts: int,
|
||||||
display_name = search_nickname
|
display_name = search_nickname
|
||||||
if profile_json.get('name'):
|
if profile_json.get('name'):
|
||||||
display_name = profile_json['name']
|
display_name = profile_json['name']
|
||||||
|
display_name = remove_html(display_name)
|
||||||
|
display_name = \
|
||||||
|
add_emoji_to_display_name(session, base_dir, http_prefix,
|
||||||
|
nickname, domain,
|
||||||
|
display_name, False, translate)
|
||||||
|
|
||||||
locked_account = get_locked_account(profile_json)
|
locked_account = get_locked_account(profile_json)
|
||||||
if locked_account:
|
if locked_account:
|
||||||
|
@ -246,6 +251,10 @@ def html_profile_after_search(recent_posts_cache: {}, max_recent_posts: int,
|
||||||
profile_description = ''
|
profile_description = ''
|
||||||
if profile_json.get('summary'):
|
if profile_json.get('summary'):
|
||||||
profile_description = profile_json['summary']
|
profile_description = profile_json['summary']
|
||||||
|
profile_description = \
|
||||||
|
add_emoji_to_display_name(session, base_dir, http_prefix,
|
||||||
|
nickname, domain,
|
||||||
|
profile_description, False, translate)
|
||||||
outbox_url = None
|
outbox_url = None
|
||||||
if not profile_json.get('outbox'):
|
if not profile_json.get('outbox'):
|
||||||
if debug:
|
if debug:
|
||||||
|
@ -468,7 +477,7 @@ def _get_profile_header(base_dir: str, http_prefix: str, nickname: str,
|
||||||
' <b>' + occupation_name + '</b><br>\n'
|
' <b>' + occupation_name + '</b><br>\n'
|
||||||
|
|
||||||
html_str += \
|
html_str += \
|
||||||
' <h1>' + remove_html(display_name) + '\n</h1>\n' + \
|
' <h1>' + display_name + '\n</h1>\n' + \
|
||||||
occupation_str
|
occupation_str
|
||||||
|
|
||||||
html_str += \
|
html_str += \
|
||||||
|
@ -577,7 +586,7 @@ def _get_profile_header_after_search(nickname: str, default_timeline: str,
|
||||||
display_name = search_nickname
|
display_name = search_nickname
|
||||||
html_str += \
|
html_str += \
|
||||||
' <h1>\n' + \
|
' <h1>\n' + \
|
||||||
' ' + remove_html(display_name) + '\n' + \
|
' ' + display_name + '\n' + \
|
||||||
' </h1>\n' + \
|
' </h1>\n' + \
|
||||||
' <p><b>@' + search_nickname + '@' + search_domain_full + \
|
' <p><b>@' + search_nickname + '@' + search_domain_full + \
|
||||||
'</b><br>\n'
|
'</b><br>\n'
|
||||||
|
@ -692,15 +701,17 @@ def html_profile(signing_priv_key_pem: str,
|
||||||
domain, port = get_domain_from_actor(profile_json['id'])
|
domain, port = get_domain_from_actor(profile_json['id'])
|
||||||
if not domain:
|
if not domain:
|
||||||
return ""
|
return ""
|
||||||
|
display_name = remove_html(profile_json['name'])
|
||||||
display_name = \
|
display_name = \
|
||||||
add_emoji_to_display_name(session, base_dir, http_prefix,
|
add_emoji_to_display_name(session, base_dir, http_prefix,
|
||||||
nickname, domain,
|
nickname, domain,
|
||||||
profile_json['name'], True, translate)
|
display_name, True, translate)
|
||||||
domain_full = get_full_domain(domain, port)
|
domain_full = get_full_domain(domain, port)
|
||||||
|
profile_description = profile_json['summary']
|
||||||
profile_description = \
|
profile_description = \
|
||||||
add_emoji_to_display_name(session, base_dir, http_prefix,
|
add_emoji_to_display_name(session, base_dir, http_prefix,
|
||||||
nickname, domain,
|
nickname, domain,
|
||||||
profile_json['summary'], False, translate)
|
profile_description, False, translate)
|
||||||
if profile_description:
|
if profile_description:
|
||||||
profile_description = standardize_text(profile_description)
|
profile_description = standardize_text(profile_description)
|
||||||
posts_button = 'button'
|
posts_button = 'button'
|
||||||
|
|
Loading…
Reference in New Issue