From dfe62fc1f3023d5c53b4d3b3c7e4d0ff53ec9ba2 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sat, 7 Jan 2023 18:13:15 +0000 Subject: [PATCH 1/3] Avoid ambiguity between variable and function --- conversation.py | 66 +++++++++++++++++++++++++------------------------ 1 file changed, 34 insertions(+), 32 deletions(-) diff --git a/conversation.py b/conversation.py index c42ef2293..689ac7269 100644 --- a/conversation.py +++ b/conversation.py @@ -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 From 13efa85b3b6153ce310d997e1dd350d9b0788b59 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sat, 7 Jan 2023 20:28:31 +0000 Subject: [PATCH 2/3] Replace direct link to mastodon UI --- webapp_post.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/webapp_post.py b/webapp_post.py index 91f7feb0a..ab5594735 100644 --- a/webapp_post.py +++ b/webapp_post.py @@ -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 += \ - '

' + by_text + ' @' + \ - by_str_handle + '' + by_text_extra + '\n' - + # Liked by handle domain_full = get_full_domain(domain, port) actor = '/users/' + nickname + post_str += \ + '

' + by_text + ' ' + post_str += \ + '

\n' + \ + '' + \ + '
' + post_str += by_text_extra + '\n' follow_str = '
\n' follow_str += \ From 7aec0daf66a78d3bd30fa35445e9d5eaee6ff3f4 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sat, 7 Jan 2023 20:32:41 +0000 Subject: [PATCH 3/3] Maximum width for handle --- epicyon-profile.css | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/epicyon-profile.css b/epicyon-profile.css index a75b76c17..03215e7b5 100644 --- a/epicyon-profile.css +++ b/epicyon-profile.css @@ -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;