diff --git a/content.py b/content.py index c7e5a7b43..adfca5b48 100644 --- a/content.py +++ b/content.py @@ -324,7 +324,7 @@ def _save_custom_emoji(session, base_dir: str, emojiName: str, url: str, if not os.path.isdir(custom_emoji_dir): os.mkdir(custom_emoji_dir) emoji_image_filename = custom_emoji_dir + '/' + emojiName + '.' + ext - if not download_image(session, base_dir, url, + if not download_image(session, url, emoji_image_filename, debug, False): if debug: print('EX: custom emoji not downloaded ' + url) @@ -1573,7 +1573,7 @@ def import_emoji(base_dir: str, import_filename: str, session) -> None: emoji_image_filename = base_dir + '/emoji/' + tag + '.png' if os.path.isfile(emoji_image_filename): continue - if download_image(session, base_dir, url, + if download_image(session, url, emoji_image_filename, True, False): emoji_dict[tag] = tag added += 1 diff --git a/desktop_client.py b/desktop_client.py index 2de71cf0a..40c2e80f2 100644 --- a/desktop_client.py +++ b/desktop_client.py @@ -852,12 +852,10 @@ def _desktop_show_actor(base_dir: str, actor_json: {}, translate: {}, def _desktop_show_profile(session, nickname: str, domain: str, - http_prefix: str, base_dir: str, box_name: str, - page_number: int, index: int, box_json: {}, + base_dir: str, index: int, box_json: {}, system_language: str, screenreader: str, espeak, - translate: {}, your_actor: str, - post_json_object: {}, + translate: {}, post_json_object: {}, signing_priv_key_pem: str) -> {}: """Shows the profile of the actor for the given post Returns the actor json @@ -901,13 +899,10 @@ def _desktop_show_profile(session, nickname: str, domain: str, return actor_json -def _desktop_show_profile_from_handle(session, nickname: str, domain: str, - http_prefix: str, base_dir: str, - box_name: str, handle: str, - system_language: str, +def _desktop_show_profile_from_handle(session, domain: str, base_dir: str, + handle: str, system_language: str, screenreader: str, espeak, - translate: {}, your_actor: str, - post_json_object: {}, + translate: {}, signing_priv_key_pem: str) -> {}: """Shows the profile for a handle Returns the actor json @@ -985,9 +980,7 @@ def _desktop_show_box(indent: str, your_actor: str, box_name: str, box_json: {}, translate: {}, screenreader: str, system_language: str, espeak, - page_number: int, - new_replies: bool, - new_dms: bool) -> bool: + page_number: int) -> bool: """Shows online timeline """ number_width = 2 @@ -1429,8 +1422,6 @@ def run_desktop_client(base_dir: str, proxy_type: str, http_prefix: str, content = None cached_webfingers = {} person_cache = {} - new_replies_exist = False - new_dms_exist = False pgp_key_upload = False say_str = indent + 'Loading translations file' @@ -1502,12 +1493,9 @@ def run_desktop_client(base_dir: str, proxy_type: str, http_prefix: str, signing_priv_key_pem) else: inbox_json = box_json - new_dms_exist = False - new_replies_exist = False if inbox_json: _new_desktop_notifications(your_actor, inbox_json, notify_json) if notify_json.get('dmNotify'): - new_dms_exist = True if notify_json.get('dmNotifyChanged'): _desktop_notification(notification_type, "Epicyon", @@ -1515,7 +1503,6 @@ def run_desktop_client(base_dir: str, proxy_type: str, http_prefix: str, if notification_sounds: _play_notification_sound(dm_sound_filename, player) if notify_json.get('repliesNotify'): - new_replies_exist = True if notify_json.get('repliesNotifyChanged'): _desktop_notification(notification_type, "Epicyon", @@ -1532,9 +1519,7 @@ def run_desktop_client(base_dir: str, proxy_type: str, http_prefix: str, your_actor, curr_timeline, box_json, translate, None, system_language, espeak, - page_number, - new_replies_exist, - new_dms_exist) + page_number) desktop_shown = True prev_timeline_first_id = timeline_first_id else: @@ -1580,9 +1565,7 @@ def run_desktop_client(base_dir: str, proxy_type: str, http_prefix: str, your_actor, curr_timeline, box_json, translate, screenreader, system_language, espeak, - page_number, - new_replies_exist, new_dms_exist) - new_dms_exist = False + page_number) elif command_str.startswith('show rep'): page_number = 1 prev_timeline_first_id = '' @@ -1596,10 +1579,7 @@ def run_desktop_client(base_dir: str, proxy_type: str, http_prefix: str, your_actor, curr_timeline, box_json, translate, screenreader, system_language, espeak, - page_number, - new_replies_exist, new_dms_exist) - # Turn off the replies indicator - new_replies_exist = False + page_number) elif command_str.startswith('show b'): page_number = 1 prev_timeline_first_id = '' @@ -1613,10 +1593,7 @@ def run_desktop_client(base_dir: str, proxy_type: str, http_prefix: str, your_actor, curr_timeline, box_json, translate, screenreader, system_language, espeak, - page_number, - new_replies_exist, new_dms_exist) - # Turn off the replies indicator - new_replies_exist = False + page_number) elif (command_str.startswith('show sen') or command_str.startswith('show out')): page_number = 1 @@ -1631,8 +1608,7 @@ def run_desktop_client(base_dir: str, proxy_type: str, http_prefix: str, your_actor, curr_timeline, box_json, translate, screenreader, system_language, espeak, - page_number, - new_replies_exist, new_dms_exist) + page_number) elif (command_str == 'show' or command_str.startswith('show in') or command_str == 'clear'): page_number = 1 @@ -1656,8 +1632,7 @@ def run_desktop_client(base_dir: str, proxy_type: str, http_prefix: str, your_actor, curr_timeline, box_json, translate, screenreader, system_language, espeak, - page_number, - new_replies_exist, new_dms_exist) + page_number) elif (command_str.startswith('read ') or command_str.startswith('show ') or command_str == 'read' or @@ -1699,14 +1674,11 @@ def run_desktop_client(base_dir: str, proxy_type: str, http_prefix: str, if post_json_object: actor_json = \ _desktop_show_profile(session, nickname, domain, - http_prefix, base_dir, - curr_timeline, - page_number, post_index, + base_dir, post_index, box_json, system_language, screenreader, espeak, translate, - your_actor, post_json_object, signing_priv_key_pem) else: @@ -1718,16 +1690,12 @@ def run_desktop_client(base_dir: str, proxy_type: str, http_prefix: str, profile_handle = post_index_str _desktop_clear_screen() _desktop_show_banner() - _desktop_show_profile_from_handle(session, - nickname, domain, - http_prefix, base_dir, - curr_timeline, + _desktop_show_profile_from_handle(session, domain, + base_dir, profile_handle, system_language, screenreader, espeak, translate, - your_actor, - None, signing_priv_key_pem) say_str = 'Press Enter to continue...' say_str2 = _highlight_text(say_str) @@ -1742,12 +1710,10 @@ def run_desktop_client(base_dir: str, proxy_type: str, http_prefix: str, post_index = int(post_index_str) actor_json = \ _desktop_show_profile(session, nickname, domain, - http_prefix, base_dir, - curr_timeline, - page_number, post_index, + base_dir, post_index, box_json, system_language, screenreader, - espeak, translate, your_actor, + espeak, translate, None, signing_priv_key_pem) say_str = 'Press Enter to continue...' say_str2 = _highlight_text(say_str) @@ -2581,5 +2547,4 @@ def run_desktop_client(base_dir: str, proxy_type: str, http_prefix: str, your_actor, curr_timeline, box_json, translate, screenreader, system_language, - espeak, page_number, - new_replies_exist, new_dms_exist) + espeak, page_number) diff --git a/happening.py b/happening.py index 890c100e2..ad7bace4e 100644 --- a/happening.py +++ b/happening.py @@ -353,8 +353,7 @@ def _dav_encode_token(year: int, month_number: int, def _icalendar_day(base_dir: str, nickname: str, domain: str, - day_events: [], person_cache: {}, - http_prefix: str) -> str: + day_events: [], person_cache: {}) -> str: """Returns a day's events in icalendar format """ ical_str = '' @@ -478,7 +477,6 @@ def _icalendar_day(base_dir: str, nickname: str, domain: str, def get_todays_events_icalendar(base_dir: str, nickname: str, domain: str, year: int, month_number: int, day_number: int, person_cache: {}, - http_prefix: str, text_match: str, system_language: str) -> str: """Returns today's events in icalendar format """ @@ -503,8 +501,7 @@ def get_todays_events_icalendar(base_dir: str, nickname: str, domain: str, return ical_str ical_str += \ - _icalendar_day(base_dir, nickname, domain, day_events, person_cache, - http_prefix) + _icalendar_day(base_dir, nickname, domain, day_events, person_cache) ical_str += 'END:VCALENDAR\n' return ical_str @@ -514,7 +511,6 @@ def get_month_events_icalendar(base_dir: str, nickname: str, domain: str, year: int, month_number: int, person_cache: {}, - http_prefix: str, text_match: str) -> str: """Returns today's events in icalendar format """ @@ -537,8 +533,7 @@ def get_month_events_icalendar(base_dir: str, nickname: str, domain: str, day_events = month_events[str(day_of_month)] ical_str += \ _icalendar_day(base_dir, nickname, domain, - day_events, person_cache, - http_prefix) + day_events, person_cache) ical_str += 'END:VCALENDAR\n' return ical_str @@ -1098,7 +1093,7 @@ def dav_report_response(base_dir: str, nickname: str, domain: str, search_date.year, search_date.month, search_date.day, person_cache, - http_prefix, text_match, + text_match, system_language) events_href = \ http_prefix + '://' + domain_full + '/users/' + \ @@ -1132,7 +1127,6 @@ def dav_report_response(base_dir: str, nickname: str, domain: str, query_start_year, query_start_month, person_cache, - http_prefix, text_match) events_href = \ http_prefix + '://' + domain_full + '/users/' + \ @@ -1180,7 +1174,6 @@ def dav_report_response(base_dir: str, nickname: str, domain: str, nickname, domain, year, month, person_cache, - http_prefix, text_match) events_href = \ http_prefix + '://' + domain_full + '/users/' + \ @@ -1217,7 +1210,7 @@ def dav_report_response(base_dir: str, nickname: str, domain: str, get_todays_events_icalendar(base_dir, nickname, domain, search_date.year, search_date.month, search_date.day, person_cache, - http_prefix, text_match, + text_match, system_language) events_href = \ http_prefix + '://' + domain_full + '/users/' + \ diff --git a/img/logo.svg b/img/logo.svg new file mode 100644 index 000000000..5afa93189 --- /dev/null +++ b/img/logo.svg @@ -0,0 +1,484 @@ + + + + + + + + + + diff --git a/img/logo2048.png b/img/logo2048.png new file mode 100644 index 000000000..2ec977c5a Binary files /dev/null and b/img/logo2048.png differ diff --git a/inbox.py b/inbox.py index b89f87aee..cad9ebd37 100644 --- a/inbox.py +++ b/inbox.py @@ -186,7 +186,7 @@ def cache_svg_images(session, base_dir: str, http_prefix: str, if not test_image_filename: image_filename = \ base_dir + '/media/' + post_id + '_' + filename - if not download_image(session, base_dir, url, + if not download_image(session, url, image_filename, debug): continue else: @@ -884,9 +884,7 @@ def _inbox_post_recipients(base_dir: str, post_json_object: {}, return recipients_dict, recipients_dict_followers -def _receive_undo_follow(session, base_dir: str, http_prefix: str, - port: int, message_json: {}, - federation_list: [], +def _receive_undo_follow(base_dir: str, message_json: {}, debug: bool, domain: str, onion_domain: str, i2p_domain: str) -> bool: if not message_json['object'].get('actor'): @@ -947,12 +945,8 @@ def _receive_undo_follow(session, base_dir: str, http_prefix: str, return False -def _receive_undo(session, base_dir: str, http_prefix: str, - port: int, send_threads: [], post_log: [], - cached_webfingers: {}, person_cache: {}, - message_json: {}, federation_list: [], - debug: bool, domain: str, - onion_domain: str, i2p_domain: str) -> bool: +def _receive_undo(base_dir: str, message_json: {}, debug: bool, + domain: str, onion_domain: str, i2p_domain: str) -> bool: """Receives an undo request within the POST section of HTTPServer """ if not message_json['type'].startswith('Undo'): @@ -971,10 +965,8 @@ def _receive_undo(session, base_dir: str, http_prefix: str, return False if message_json['object']['type'] == 'Follow' or \ message_json['object']['type'] == 'Join': - return _receive_undo_follow(session, base_dir, http_prefix, - port, message_json, - federation_list, debug, - domain, onion_domain, i2p_domain) + return _receive_undo_follow(base_dir, message_json, + debug, domain, onion_domain, i2p_domain) return False @@ -1242,10 +1234,8 @@ def _receive_edit_to_post(recent_posts_cache: {}, message_json: {}, def _receive_update_activity(recent_posts_cache: {}, session, base_dir: str, http_prefix: str, domain: str, port: int, - send_threads: [], post_log: [], cached_webfingers: {}, person_cache: {}, message_json: {}, - federation_list: [], nickname: str, debug: bool, max_mentions: int, max_emoji: int, allow_local_network_access: bool, @@ -1332,11 +1322,11 @@ def _receive_update_activity(recent_posts_cache: {}, session, base_dir: str, def _receive_like(recent_posts_cache: {}, - session, handle: str, is_group: bool, base_dir: str, + session, handle: str, base_dir: str, http_prefix: str, domain: str, port: int, onion_domain: str, i2p_domain: str, - send_threads: [], post_log: [], cached_webfingers: {}, - person_cache: {}, message_json: {}, federation_list: [], + cached_webfingers: {}, + person_cache: {}, message_json: {}, debug: bool, signing_priv_key_pem: str, max_recent_posts: int, translate: {}, @@ -1394,7 +1384,7 @@ def _receive_like(recent_posts_cache: {}, handle_name, handle_dom, post_liked_id, like_actor): - _like_notify(base_dir, domain, onion_domain, handle, + _like_notify(base_dir, domain, onion_domain, i2p_domain, handle, like_actor, post_liked_id) update_likes_collection(recent_posts_cache, base_dir, post_filename, post_liked_id, like_actor, @@ -1462,10 +1452,10 @@ def _receive_like(recent_posts_cache: {}, def _receive_undo_like(recent_posts_cache: {}, - session, handle: str, is_group: bool, base_dir: str, + session, handle: str, base_dir: str, http_prefix: str, domain: str, port: int, - send_threads: [], post_log: [], cached_webfingers: {}, - person_cache: {}, message_json: {}, federation_list: [], + cached_webfingers: {}, + person_cache: {}, message_json: {}, debug: bool, signing_priv_key_pem: str, max_recent_posts: int, translate: {}, @@ -1581,11 +1571,11 @@ def _receive_undo_like(recent_posts_cache: {}, def _receive_reaction(recent_posts_cache: {}, - session, handle: str, is_group: bool, base_dir: str, + session, handle: str, base_dir: str, http_prefix: str, domain: str, port: int, onion_domain: str, - send_threads: [], post_log: [], cached_webfingers: {}, - person_cache: {}, message_json: {}, federation_list: [], + cached_webfingers: {}, + person_cache: {}, message_json: {}, debug: bool, signing_priv_key_pem: str, max_recent_posts: int, translate: {}, @@ -2686,7 +2676,7 @@ def _valid_post_content(base_dir: str, nickname: str, domain: str, message_json['object']['tag']) return False # check that the post is in a language suitable for this account - if not understood_post_language(base_dir, nickname, domain, + if not understood_post_language(base_dir, nickname, message_json, system_language, http_prefix, domain_full, person_cache): @@ -2850,7 +2840,8 @@ def _already_reacted(base_dir: str, nickname: str, domain: str, return False -def _like_notify(base_dir: str, domain: str, onion_domain: str, +def _like_notify(base_dir: str, domain: str, + onion_domain: str, i2p_domain: str, handle: str, actor: str, url: str) -> None: """Creates a notification that a like has arrived """ @@ -2861,9 +2852,13 @@ def _like_notify(base_dir: str, domain: str, onion_domain: str, # check that the liked post was by this handle nickname = handle.split('@')[0] if '/' + domain + '/users/' + nickname not in url: - if not onion_domain: - return - if '/' + onion_domain + '/users/' + nickname not in url: + if onion_domain: + if '/' + onion_domain + '/users/' + nickname not in url: + return + if i2p_domain: + if '/' + i2p_domain + '/users/' + nickname not in url: + return + if not i2p_domain and not onion_domain: return account_dir = base_dir + '/accounts/' + handle @@ -3012,8 +3007,7 @@ def _reply_notify(base_dir: str, handle: str, url: str) -> None: print('EX: unable to write ' + reply_file) -def _git_patch_notify(base_dir: str, handle: str, - subject: str, content: str, +def _git_patch_notify(base_dir: str, handle: str, subject: str, from_nickname: str, from_domain: str) -> None: """Creates a notification that a new git patch has arrived """ @@ -3051,7 +3045,6 @@ def _send_to_group_members(server, session, session_onion, session_i2p, send_threads: [], post_log: [], cached_webfingers: {}, person_cache: {}, debug: bool, - system_language: str, curr_domain: str, onion_domain: str, i2p_domain: str, signing_priv_key_pem: str) -> None: @@ -3238,7 +3231,7 @@ def _update_last_seen(base_dir: str, handle: str, actor: str) -> None: print('EX: unable to write ' + last_seen_filename) -def _bounce_dm(senderPostId: str, session, http_prefix: str, +def _bounce_dm(sender_post_id: str, session, http_prefix: str, base_dir: str, nickname: str, domain: str, port: int, sending_handle: str, federation_list: [], send_threads: [], post_log: [], @@ -3288,7 +3281,7 @@ def _bounce_dm(senderPostId: str, session, http_prefix: str, media_type = None image_description = '' city = 'London, England' - in_reply_to = remove_id_ending(senderPostId) + in_reply_to = remove_id_ending(sender_post_id) in_reply_to_atom_uri = None schedule_post = False event_date = None @@ -3646,8 +3639,7 @@ def _check_for_git_patches(base_dir: str, nickname: str, domain: str, json_obj['type'], json_obj['summary'], json_obj['content'], from_nickname, from_domain_full): - _git_patch_notify(base_dir, handle, - json_obj['summary'], json_obj['content'], + _git_patch_notify(base_dir, handle, json_obj['summary'], from_nickname, from_domain_full) return 1 if '[PATCH]' in json_obj['content']: @@ -3662,10 +3654,8 @@ def _inbox_after_initial(server, inbox_start_time, key_id: str, handle: str, message_json: {}, base_dir: str, http_prefix: str, send_threads: [], post_log: [], cached_webfingers: {}, person_cache: {}, - queue: [], domain: str, - onion_domain: str, i2p_domain: str, - port: int, proxy_type: str, - federation_list: [], debug: bool, + domain: str, onion_domain: str, i2p_domain: str, + port: int, federation_list: [], debug: bool, queue_filename: str, destination_filename: str, max_replies: int, allow_deletion: bool, max_mentions: int, max_emoji: int, translate: {}, @@ -3715,15 +3705,13 @@ def _inbox_after_initial(server, inbox_start_time, handle_name = handle.split('@')[0] if _receive_like(recent_posts_cache, - session, handle, is_group, + session, handle, base_dir, http_prefix, domain, port, onion_domain, i2p_domain, - send_threads, post_log, cached_webfingers, person_cache, message_json, - federation_list, debug, signing_priv_key_pem, max_recent_posts, translate, allow_deletion, @@ -3743,14 +3731,12 @@ def _inbox_after_initial(server, inbox_start_time, return False if _receive_undo_like(recent_posts_cache, - session, handle, is_group, + session, handle, base_dir, http_prefix, domain, port, - send_threads, post_log, cached_webfingers, person_cache, message_json, - federation_list, debug, signing_priv_key_pem, max_recent_posts, translate, allow_deletion, @@ -3770,15 +3756,13 @@ def _inbox_after_initial(server, inbox_start_time, return False if _receive_reaction(recent_posts_cache, - session, handle, is_group, + session, handle, base_dir, http_prefix, domain, port, onion_domain, - send_threads, post_log, cached_webfingers, person_cache, message_json, - federation_list, debug, signing_priv_key_pem, max_recent_posts, translate, allow_deletion, @@ -4346,8 +4330,7 @@ def _inbox_after_initial(server, inbox_start_time, http_prefix, federation_list, send_threads, post_log, cached_webfingers, - person_cache, - debug, system_language, + person_cache, debug, domain, onion_domain, i2p_domain, signing_priv_key_pem) fitness_performance(inbox_start_time, @@ -4422,7 +4405,7 @@ def _restore_queue_items(base_dir: str, queue: []) -> None: def run_inbox_queue_watchdog(project_version: str, httpd) -> None: """This tries to keep the inbox thread running even if it dies """ - print('THREAD: Starting inbox queue watchdog') + print('THREAD: Starting inbox queue watchdog ' + project_version) inbox_queue_original = httpd.thrInboxQueue.clone(run_inbox_queue) httpd.thrInboxQueue.start() while True: @@ -5089,17 +5072,14 @@ def run_inbox_queue(server, inbox_start_time = time.time() curr_session = session - curr_proxy_type = proxy_type if queue_json.get('actor'): if isinstance(queue_json['actor'], str): sender_domain, _ = get_domain_from_actor(queue_json['actor']) if sender_domain.endswith('.onion') and \ session_onion and proxy_type != 'tor': - curr_proxy_type = 'tor' curr_session = session_onion elif (sender_domain.endswith('.i2p') and session_i2p and proxy_type != 'i2p'): - curr_proxy_type = 'i2p' curr_session = session_i2p if debug and queue_json.get('actor'): @@ -5259,13 +5239,7 @@ def run_inbox_queue(server, # if queue_json['post'].get('id'): # queue_json['post']['id'] = queue_json['id'] - if _receive_undo(curr_session, - base_dir, http_prefix, port, - send_threads, post_log, - cached_webfingers, - person_cache, - queue_json['post'], - federation_list, + if _receive_undo(base_dir, queue_json['post'], debug, domain, onion_domain, i2p_domain): print('Queue: Undo accepted from ' + key_id) if os.path.isfile(queue_filename): @@ -5335,11 +5309,9 @@ def run_inbox_queue(server, if _receive_update_activity(recent_posts_cache, curr_session, base_dir, http_prefix, domain, port, - send_threads, post_log, cached_webfingers, person_cache, queue_json['post'], - federation_list, queue_json['postNickname'], debug, max_mentions, max_emoji, @@ -5460,11 +5432,9 @@ def run_inbox_queue(server, base_dir, http_prefix, send_threads, post_log, cached_webfingers, - person_cache, queue, - domain, + person_cache, domain, onion_domain, i2p_domain, - port, curr_proxy_type, - federation_list, + port, federation_list, debug, queue_filename, destination, max_replies, allow_deletion, diff --git a/languages.py b/languages.py index 7b4836692..4563cf8ab 100644 --- a/languages.py +++ b/languages.py @@ -99,7 +99,7 @@ def set_actor_languages(actor_json: {}, languages_str: str) -> None: actor_json['attachment'].append(new_languages) -def understood_post_language(base_dir: str, nickname: str, domain: str, +def understood_post_language(base_dir: str, nickname: str, message_json: {}, system_language: str, http_prefix: str, domain_full: str, person_cache: {}) -> bool: diff --git a/like.py b/like.py index 75814e882..ee19e461d 100644 --- a/like.py +++ b/like.py @@ -385,8 +385,7 @@ def outbox_like(recent_posts_cache: {}, def outbox_undo_like(recent_posts_cache: {}, - base_dir: str, http_prefix: str, - nickname: str, domain: str, port: int, + base_dir: str, nickname: str, domain: str, message_json: {}, debug: bool) -> None: """ When an undo like request is received by the outbox from c2s """ diff --git a/outbox.py b/outbox.py index bcd0a072f..878897a0c 100644 --- a/outbox.py +++ b/outbox.py @@ -580,8 +580,7 @@ def post_message_to_outbox(session, translate: {}, if debug: print('DEBUG: handle any undo like requests') outbox_undo_like(recent_posts_cache, - base_dir, http_prefix, - post_to_nickname, domain, port, + base_dir, post_to_nickname, domain, message_json, debug) if debug: diff --git a/posts.py b/posts.py index fb796e159..86ad51444 100644 --- a/posts.py +++ b/posts.py @@ -4998,7 +4998,7 @@ def download_announce(session, base_dir: str, http_prefix: str, base_dir, nickname, domain, post_id, recent_posts_cache) return None - if not understood_post_language(base_dir, nickname, domain, + if not understood_post_language(base_dir, nickname, announced_json, system_language, http_prefix, domain_full, person_cache): diff --git a/question.py b/question.py index 2e36efe36..04b7561c4 100644 --- a/question.py +++ b/question.py @@ -136,20 +136,20 @@ def question_update_votes(base_dir: str, nickname: str, domain: str, return question_json, question_post_filename -def is_question(postObjectJson: {}) -> bool: +def is_question(post_object_json: {}) -> bool: """ is the given post a question? """ - if postObjectJson['type'] != 'Create' and \ - postObjectJson['type'] != 'Update': + if post_object_json['type'] != 'Create' and \ + post_object_json['type'] != 'Update': return False - if not has_object_dict(postObjectJson): + if not has_object_dict(post_object_json): return False - if not postObjectJson['object'].get('type'): + if not post_object_json['object'].get('type'): return False - if postObjectJson['object']['type'] != 'Question': + if post_object_json['object']['type'] != 'Question': return False - if not postObjectJson['object'].get('oneOf'): + if not post_object_json['object'].get('oneOf'): return False - if not isinstance(postObjectJson['object']['oneOf'], list): + if not isinstance(post_object_json['object']['oneOf'], list): return False return True diff --git a/schedule.py b/schedule.py index 810474b08..d8fa45576 100644 --- a/schedule.py +++ b/schedule.py @@ -193,7 +193,7 @@ def run_post_schedule(base_dir: str, httpd, max_scheduled_posts: int): def run_post_schedule_watchdog(project_version: str, httpd) -> None: """This tries to keep the scheduled post thread running even if it dies """ - print('THREAD: Starting scheduled post watchdog') + print('THREAD: Starting scheduled post watchdog ' + project_version) post_schedule_original = \ httpd.thrPostSchedule.clone(run_post_schedule) httpd.thrPostSchedule.start() diff --git a/session.py b/session.py index 35fed4ab6..dfb072b55 100644 --- a/session.py +++ b/session.py @@ -465,7 +465,7 @@ def post_json(http_prefix: str, domain_full: str, return None -def post_json_string(session, post_jsonStr: str, +def post_json_string(session, post_json_str: str, federation_list: [], inbox_url: str, headers: {}, @@ -489,7 +489,7 @@ def post_json_string(session, post_jsonStr: str, try: post_result = \ - session.post(url=inbox_url, data=post_jsonStr, + session.post(url=inbox_url, data=post_json_str, headers=headers, timeout=timeout_sec) except requests.exceptions.RequestException as ex: if not quiet: @@ -500,7 +500,7 @@ def post_json_string(session, post_jsonStr: str, print('EX: connection was reset during post_json_string') if not quiet: print('EX: post_json_string failed ' + inbox_url + ' ' + - post_jsonStr + ' ' + str(headers)) + post_json_str + ' ' + str(headers)) return None, None, 0 except ValueError as ex: if not quiet: @@ -592,8 +592,7 @@ def _looks_like_url(url: str) -> bool: return True -def download_image(session, base_dir: str, url: str, - image_filename: str, debug: bool, +def download_image(session, url: str, image_filename: str, debug: bool, force: bool = False) -> bool: """Downloads an image with an expected mime type """ diff --git a/speaker.py b/speaker.py index 1cb5fcb7c..7b90bd949 100644 --- a/speaker.py +++ b/speaker.py @@ -320,8 +320,7 @@ def _ssml_header(system_language: str, box_name: str, summary: str) -> str: def _speaker_endpoint_ssml(display_name: str, summary: str, - content: str, image_description: str, - links: [], language: str, + content: str, language: str, gender: str, box_name: str) -> str: """Returns an SSML endpoint for the TTS speaker https://en.wikipedia.org/wiki/Speech_Synthesis_Markup_Language @@ -379,8 +378,6 @@ def get_ssml_box(base_dir: str, path: str, return _speaker_endpoint_ssml(speaker_json['name'], speaker_json['summary'], speaker_json['say'], - speaker_json['imageDescription'], - speaker_json['detectedLinks'], system_language, gender, box_name) @@ -411,7 +408,7 @@ def speakable_text(base_dir: str, content: str, translate: {}) -> (str, []): def _post_to_speaker_json(base_dir: str, http_prefix: str, - nickname: str, domain: str, domain_full: str, + nickname: str, domain_full: str, post_json_object: {}, person_cache: {}, translate: {}, announcing_actor: str, theme_name: str) -> {}: @@ -554,7 +551,7 @@ def update_speaker(base_dir: str, http_prefix: str, """ speaker_json = \ _post_to_speaker_json(base_dir, http_prefix, - nickname, domain, domain_full, + nickname, domain_full, post_json_object, person_cache, translate, announcing_actor, theme_name) @@ -581,8 +578,6 @@ def update_speaker(base_dir: str, http_prefix: str, _speaker_endpoint_ssml(speaker_json['name'], speaker_json['summary'], speaker_json['say'], - speaker_json['imageDescription'], - speaker_json['detectedLinks'], system_language, gender, box_name) try: diff --git a/tests.py b/tests.py index b1cb3618e..a42b3294c 100644 --- a/tests.py +++ b/tests.py @@ -3208,7 +3208,7 @@ def test_client_to_server(base_dir: str): http_prefix, cached_webfingers, person_cache, True, __version__, signing_priv_key_pem) - for _ in range(10): + for _ in range(20): if os.path.isfile(alice_dir + '/accounts/alice@' + alice_domain + '/followers.txt'): test_str = 'bob@' + bob_domain + ':' + str(bob_port) diff --git a/webapp_calendar.py b/webapp_calendar.py index 05128ed7f..45af8b33a 100644 --- a/webapp_calendar.py +++ b/webapp_calendar.py @@ -383,7 +383,6 @@ def html_calendar(person_cache: {}, css_cache: {}, translate: {}, year, month_number, day_number, person_cache, - http_prefix, text_match, system_language) day_events = None @@ -404,7 +403,7 @@ def html_calendar(person_cache: {}, css_cache: {}, translate: {}, if icalendar: return get_month_events_icalendar(base_dir, nickname, domain, year, month_number, person_cache, - http_prefix, text_match) + text_match) events = \ get_calendar_events(base_dir, nickname, domain, year, month_number,