mirror of https://gitlab.com/bashrc2/epicyon
merge-requests/30/head
commit
609a118e55
|
@ -123,74 +123,76 @@ def download_conversation_posts(session, http_prefix: str, base_dir: str,
|
|||
post_filename = \
|
||||
locate_post(base_dir, nickname, domain, post_id)
|
||||
if post_filename:
|
||||
post_json = load_json(post_filename)
|
||||
post_json_object = load_json(post_filename)
|
||||
else:
|
||||
post_json = get_json(signing_priv_key_pem, session, post_id,
|
||||
as_header, None, debug, __version__,
|
||||
http_prefix, domain)
|
||||
post_json_object = \
|
||||
get_json(signing_priv_key_pem, session, post_id,
|
||||
as_header, None, debug, __version__,
|
||||
http_prefix, domain)
|
||||
if debug:
|
||||
if not post_json:
|
||||
if not post_json_object:
|
||||
print(post_id + ' returned no json')
|
||||
while post_json:
|
||||
if not isinstance(post_json, dict):
|
||||
while post_json_object:
|
||||
if not isinstance(post_json_object, dict):
|
||||
break
|
||||
if not has_object_dict(post_json):
|
||||
if not post_json.get('attributedTo'):
|
||||
print(str(post_json))
|
||||
if not has_object_dict(post_json_object):
|
||||
if not post_json_object.get('attributedTo'):
|
||||
print(str(post_json_object))
|
||||
if debug:
|
||||
print(post_id + ' has no attributedTo')
|
||||
break
|
||||
if not isinstance(post_json['attributedTo'], str):
|
||||
if not isinstance(post_json_object['attributedTo'], str):
|
||||
break
|
||||
if not post_json.get('published'):
|
||||
if not post_json_object.get('published'):
|
||||
if debug:
|
||||
print(post_id + ' has no published date')
|
||||
break
|
||||
if not post_json.get('to'):
|
||||
if not post_json_object.get('to'):
|
||||
if debug:
|
||||
print(post_id + ' has no "to" list')
|
||||
break
|
||||
if not isinstance(post_json['to'], list):
|
||||
if not isinstance(post_json_object['to'], list):
|
||||
break
|
||||
if 'cc' not in post_json:
|
||||
if 'cc' not in post_json_object:
|
||||
if debug:
|
||||
print(post_id + ' has no "cc" list')
|
||||
break
|
||||
if not isinstance(post_json['cc'], list):
|
||||
if not isinstance(post_json_object['cc'], list):
|
||||
break
|
||||
wrapped_post = {
|
||||
"@context": "https://www.w3.org/ns/activitystreams",
|
||||
'id': post_id + '/activity',
|
||||
'type': 'Create',
|
||||
'actor': post_json['attributedTo'],
|
||||
'published': post_json['published'],
|
||||
'to': post_json['to'],
|
||||
'cc': post_json['cc'],
|
||||
'object': post_json
|
||||
'actor': post_json_object['attributedTo'],
|
||||
'published': post_json_object['published'],
|
||||
'to': post_json_object['to'],
|
||||
'cc': post_json_object['cc'],
|
||||
'object': post_json_object
|
||||
}
|
||||
post_json = wrapped_post
|
||||
if not post_json['object'].get('published'):
|
||||
post_json_object = wrapped_post
|
||||
if not post_json_object['object'].get('published'):
|
||||
break
|
||||
|
||||
# render harmless any dangerous markup
|
||||
harmless_markup(post_json)
|
||||
harmless_markup(post_json_object)
|
||||
|
||||
conversation_view = [post_json] + conversation_view
|
||||
if not post_json['object'].get('inReplyTo'):
|
||||
conversation_view = [post_json_object] + conversation_view
|
||||
if not post_json_object['object'].get('inReplyTo'):
|
||||
if debug:
|
||||
print(post_id + ' is not a reply')
|
||||
break
|
||||
post_id = post_json['object']['inReplyTo']
|
||||
post_id = post_json_object['object']['inReplyTo']
|
||||
post_id = remove_id_ending(post_id)
|
||||
post_filename = \
|
||||
locate_post(base_dir, nickname, domain, post_id)
|
||||
if post_filename:
|
||||
post_json = load_json(post_filename)
|
||||
post_json_object = load_json(post_filename)
|
||||
else:
|
||||
post_json = get_json(signing_priv_key_pem, session, post_id,
|
||||
as_header, None, debug, __version__,
|
||||
http_prefix, domain)
|
||||
post_json_object = \
|
||||
get_json(signing_priv_key_pem, session, post_id,
|
||||
as_header, None, debug, __version__,
|
||||
http_prefix, domain)
|
||||
if debug:
|
||||
if not post_json:
|
||||
if not post_json_object:
|
||||
print(post_id + ' returned no json')
|
||||
return conversation_view
|
||||
|
|
|
@ -1726,7 +1726,7 @@ h3 {
|
|||
font-size: var(--font-size-header);
|
||||
font-family: 'Arial, Helvetica, sans-serif';
|
||||
padding: var(--button-height-padding);
|
||||
max-width: 400px;
|
||||
max-width: 80%;
|
||||
min-width: 80px;
|
||||
cursor: pointer;
|
||||
margin: 0 5px;
|
||||
|
@ -2540,7 +2540,7 @@ h3 {
|
|||
font-size: var(--font-size3);
|
||||
font-family: 'Arial, Helvetica, sans-serif';
|
||||
padding: var(--button-height-padding-mobile);
|
||||
max-width: 400px;
|
||||
max-width: 80%;
|
||||
min-width: 80px;
|
||||
cursor: pointer;
|
||||
margin: 0 15px;
|
||||
|
@ -3352,7 +3352,7 @@ h3 {
|
|||
font-size: var(--font-size3);
|
||||
font-family: 'Arial, Helvetica, sans-serif';
|
||||
padding: var(--button-height-padding-tiny);
|
||||
max-width: 400px;
|
||||
max-width: 80%;
|
||||
min-width: 80px;
|
||||
cursor: pointer;
|
||||
margin: 0 15px;
|
||||
|
|
|
@ -2729,12 +2729,23 @@ def html_individual_post(recent_posts_cache: {}, max_recent_posts: int,
|
|||
by_str_handle = by_str_nickname + '@' + by_str_domain
|
||||
if translate.get(by_text):
|
||||
by_text = translate[by_text]
|
||||
post_str += \
|
||||
'<p>' + by_text + ' <a href="' + by_str + '" tabindex="10">@' + \
|
||||
by_str_handle + '</a>' + by_text_extra + '\n'
|
||||
|
||||
# Liked by handle
|
||||
domain_full = get_full_domain(domain, port)
|
||||
actor = '/users/' + nickname
|
||||
post_str += \
|
||||
'<p>' + by_text + ' '
|
||||
post_str += \
|
||||
'<form method="POST" accept-charset="UTF-8" action="' + \
|
||||
actor + '/searchhandle">\n' + \
|
||||
'<input type="hidden" ' + \
|
||||
'name="actor" value="' + actor + '">' + \
|
||||
'<input type="hidden" ' + \
|
||||
'name="searchtext" value="' + by_str + \
|
||||
'"><button type="submit" ' + \
|
||||
'class="followApproveHandle" ' + \
|
||||
'name="submitSearch" tabindex="10">' + \
|
||||
by_str_handle + '</button></form>'
|
||||
post_str += by_text_extra + '\n'
|
||||
follow_str = ' <form method="POST" ' + \
|
||||
'accept-charset="UTF-8" action="' + actor + '/searchhandle">\n'
|
||||
follow_str += \
|
||||
|
|
Loading…
Reference in New Issue