diff --git a/announce.py b/announce.py index c2434826c..0f2daeba8 100644 --- a/announce.py +++ b/announce.py @@ -150,7 +150,8 @@ def create_announce(session, base_dir: str, federation_list: [], signing_priv_key_pem: str, curr_domain: str, onion_domain: str, i2p_domain: str, - sites_unavailable: []) -> {}: + sites_unavailable: [], + system_language: str) -> {}: """Creates an announce message Typically to_url will be https://www.w3.org/ns/activitystreams#Public and cc_url might be a specific person favorited or repeated and the @@ -215,7 +216,8 @@ def create_announce(session, base_dir: str, federation_list: [], debug, project_version, None, group_account, signing_priv_key_pem, 639633, curr_domain, onion_domain, i2p_domain, - extra_headers, sites_unavailable) + extra_headers, sites_unavailable, + system_language) return new_announce @@ -229,7 +231,8 @@ def announce_public(session, base_dir: str, federation_list: [], signing_priv_key_pem: str, curr_domain: str, onion_domain: str, i2p_domain: str, - sites_unavailable: []) -> {}: + sites_unavailable: [], + system_language: str) -> {}: """Makes a public announcement """ from_domain = get_full_domain(domain, port) @@ -245,7 +248,8 @@ def announce_public(session, base_dir: str, federation_list: [], debug, project_version, signing_priv_key_pem, curr_domain, onion_domain, i2p_domain, - sites_unavailable) + sites_unavailable, + system_language) def send_announce_via_server(base_dir: str, session, @@ -254,7 +258,8 @@ def send_announce_via_server(base_dir: str, session, http_prefix: str, repeat_object_url: str, cached_webfingers: {}, person_cache: {}, debug: bool, project_version: str, - signing_priv_key_pem: str) -> {}: + signing_priv_key_pem: str, + system_language: str) -> {}: """Creates an announce message via c2s """ if not session: @@ -308,7 +313,8 @@ def send_announce_via_server(base_dir: str, session, person_cache, project_version, http_prefix, from_nickname, from_domain, - post_to_box, 73528) + post_to_box, 73528, + system_language) if not inbox_url: if debug: @@ -345,7 +351,8 @@ def send_undo_announce_via_server(base_dir: str, session, domain: str, port: int, http_prefix: str, cached_webfingers: {}, person_cache: {}, debug: bool, project_version: str, - signing_priv_key_pem: str) -> {}: + signing_priv_key_pem: str, + system_language: str) -> {}: """Undo an announce message via c2s """ if not session: @@ -391,7 +398,8 @@ def send_undo_announce_via_server(base_dir: str, session, person_cache, project_version, http_prefix, nickname, domain, - post_to_box, 73528) + post_to_box, 73528, + system_language) if not inbox_url: if debug: diff --git a/availability.py b/availability.py index eb1bb97ce..59a507a67 100644 --- a/availability.py +++ b/availability.py @@ -87,7 +87,8 @@ def send_availability_via_server(base_dir: str, session, status: str, cached_webfingers: {}, person_cache: {}, debug: bool, project_version: str, - signing_priv_key_pem: str) -> {}: + signing_priv_key_pem: str, + system_language: str) -> {}: """Sets the availability for a person via c2s """ if not session: @@ -133,7 +134,8 @@ def send_availability_via_server(base_dir: str, session, base_dir, session, wf_request, person_cache, project_version, http_prefix, nickname, - domain, post_to_box, 57262) + domain, post_to_box, 57262, + system_language) if not inbox_url: if debug: diff --git a/bookmarks.py b/bookmarks.py index be7f6ddf0..f786a6a21 100644 --- a/bookmarks.py +++ b/bookmarks.py @@ -381,7 +381,8 @@ def send_bookmark_via_server(base_dir: str, session, http_prefix: str, bookmark_url: str, cached_webfingers: {}, person_cache: {}, debug: bool, project_version: str, - signing_priv_key_pem: str) -> {}: + signing_priv_key_pem: str, + system_language: str) -> {}: """Creates a bookmark via c2s """ if not session: @@ -433,7 +434,8 @@ def send_bookmark_via_server(base_dir: str, session, person_cache, project_version, http_prefix, nickname, domain, - post_to_box, 58391) + post_to_box, 58391, + system_language) if not inbox_url: if debug: @@ -472,7 +474,8 @@ def send_undo_bookmark_via_server(base_dir: str, session, http_prefix: str, bookmark_url: str, cached_webfingers: {}, person_cache: {}, debug: bool, project_version: str, - signing_priv_key_pem: str) -> {}: + signing_priv_key_pem: str, + system_language: str) -> {}: """Removes a bookmark via c2s """ if not session: @@ -524,7 +527,8 @@ def send_undo_bookmark_via_server(base_dir: str, session, person_cache, project_version, http_prefix, nickname, domain, - post_to_box, 52594) + post_to_box, 52594, + system_language) if not inbox_url: if debug: diff --git a/daemon.py b/daemon.py index 458b9d03d..b9696bbba 100644 --- a/daemon.py +++ b/daemon.py @@ -4408,7 +4408,8 @@ class PubServer(BaseHTTPRequestHandler): self.server.domain, self.server.onion_domain, self.server.i2p_domain, - self.server.sites_unavailable) + self.server.sites_unavailable, + self.server.system_language) if '&submitUnblock=' in follow_confirm_params: blocking_actor = \ @@ -10023,7 +10024,8 @@ class PubServer(BaseHTTPRequestHandler): self.server.signing_priv_key_pem, self.server.domain, onion_domain, - i2p_domain, sites_unavailable) + i2p_domain, sites_unavailable, + self.server.system_language) announce_filename = None if announce_json: # save the announce straight to the outbox @@ -10319,7 +10321,8 @@ class PubServer(BaseHTTPRequestHandler): signing_priv_key_pem, proxy_type, followers_sync_cache, - self.server.sites_unavailable) + self.server.sites_unavailable, + self.server.system_language) origin_path_str_absolute = \ http_prefix + '://' + domain_full + origin_path_str if calling_domain.endswith('.onion') and onion_domain: @@ -10481,7 +10484,8 @@ class PubServer(BaseHTTPRequestHandler): self.server.project_version, self.server.signing_priv_key_pem, self.server.followers_sync_cache, - self.server.sites_unavailable) + self.server.sites_unavailable, + self.server.system_language) origin_path_str_absolute = \ http_prefix + '://' + domain_full + origin_path_str if calling_domain.endswith('.onion') and onion_domain: diff --git a/delete.py b/delete.py index fd1c2aa25..e95dde4b5 100644 --- a/delete.py +++ b/delete.py @@ -32,7 +32,8 @@ def send_delete_via_server(base_dir: str, session, http_prefix: str, delete_object_url: str, cached_webfingers: {}, person_cache: {}, debug: bool, project_version: str, - signing_priv_key_pem: str) -> {}: + signing_priv_key_pem: str, + system_language: str) -> {}: """Creates a delete request message via c2s """ if not session: @@ -80,7 +81,8 @@ def send_delete_via_server(base_dir: str, session, wf_request, person_cache, project_version, http_prefix, from_nickname, - from_domain, post_to_box, 53036) + from_domain, post_to_box, 53036, + system_language) if not inbox_url: if debug: diff --git a/desktop_client.py b/desktop_client.py index fc67a2535..d415d3b84 100644 --- a/desktop_client.py +++ b/desktop_client.py @@ -1590,7 +1590,8 @@ def run_desktop_client(base_dir: str, proxy_type: str, http_prefix: str, domain, port, http_prefix, cached_webfingers, person_cache, debug, False, - signing_priv_key_pem) + signing_priv_key_pem, + system_language) say_str = indent + 'PGP public key uploaded' _say_command(say_str, say_str, screenreader, system_language, espeak) @@ -1980,7 +1981,8 @@ def run_desktop_client(base_dir: str, proxy_type: str, http_prefix: str, post_json_object['id'], cached_webfingers, person_cache, False, __version__, - signing_priv_key_pem) + signing_priv_key_pem, + system_language) refresh_timeline = True print('') elif (command_str == 'undo mute' or @@ -2025,7 +2027,8 @@ def run_desktop_client(base_dir: str, proxy_type: str, http_prefix: str, cached_webfingers, person_cache, False, __version__, - signing_priv_key_pem) + signing_priv_key_pem, + system_language) refresh_timeline = True print('') elif (command_str == 'mute' or @@ -2060,7 +2063,8 @@ def run_desktop_client(base_dir: str, proxy_type: str, http_prefix: str, post_json_object['id'], cached_webfingers, person_cache, False, __version__, - signing_priv_key_pem) + signing_priv_key_pem, + system_language) refresh_timeline = True print('') elif (command_str == 'undo bookmark' or @@ -2107,7 +2111,8 @@ def run_desktop_client(base_dir: str, proxy_type: str, http_prefix: str, cached_webfingers, person_cache, False, __version__, - signing_priv_key_pem) + signing_priv_key_pem, + system_language) refresh_timeline = True print('') elif (command_str == 'bookmark' or @@ -2142,7 +2147,8 @@ def run_desktop_client(base_dir: str, proxy_type: str, http_prefix: str, cached_webfingers, person_cache, False, __version__, - signing_priv_key_pem) + signing_priv_key_pem, + system_language) refresh_timeline = True print('') elif (command_str.startswith('undo block ') or @@ -2183,7 +2189,8 @@ def run_desktop_client(base_dir: str, proxy_type: str, http_prefix: str, cached_webfingers, person_cache, False, __version__, - sign_priv_key_pem) + sign_priv_key_pem, + system_language) refresh_timeline = True print('') elif command_str.startswith('block '): @@ -2233,7 +2240,8 @@ def run_desktop_client(base_dir: str, proxy_type: str, http_prefix: str, cached_webfingers, person_cache, False, __version__, - signing_priv_key_pem) + signing_priv_key_pem, + system_language) refresh_timeline = True print('') elif command_str in ('unlike', 'undo like'): @@ -2266,7 +2274,8 @@ def run_desktop_client(base_dir: str, proxy_type: str, http_prefix: str, cached_webfingers, person_cache, False, __version__, - signing_priv_key_pem) + signing_priv_key_pem, + system_language) refresh_timeline = True print('') elif (command_str.startswith('announce') or @@ -2318,7 +2327,8 @@ def run_desktop_client(base_dir: str, proxy_type: str, http_prefix: str, cached_webfingers, person_cache, True, __version__, - signing_priv_key_pem) + signing_priv_key_pem, + system_language) refresh_timeline = True print('') elif (command_str.startswith('unannounce') or @@ -2357,7 +2367,8 @@ def run_desktop_client(base_dir: str, proxy_type: str, http_prefix: str, cached_webfingers, person_cache, True, __version__, - signing_priv_key_pem) + signing_priv_key_pem, + system_language) refresh_timeline = True print('') elif (command_str == 'follow requests' or @@ -2458,7 +2469,8 @@ def run_desktop_client(base_dir: str, proxy_type: str, http_prefix: str, cached_webfingers, person_cache, debug, __version__, - signing_priv_key_pem) + signing_priv_key_pem, + system_language) else: if follow_handle: say_str = follow_handle + ' is not valid' @@ -2494,7 +2506,8 @@ def run_desktop_client(base_dir: str, proxy_type: str, http_prefix: str, cached_webfingers, person_cache, debug, __version__, - signing_priv_key_pem) + signing_priv_key_pem, + system_language) else: say_str = follow_handle + ' is not valid' _say_command(say_str, say_str, @@ -2740,7 +2753,8 @@ def run_desktop_client(base_dir: str, proxy_type: str, http_prefix: str, cached_webfingers, person_cache, False, __version__, - signing_priv_key_pem) + signing_priv_key_pem, + system_language) refresh_timeline = True print('') diff --git a/epicyon.py b/epicyon.py index 64d488ee2..e015b73b6 100644 --- a/epicyon.py +++ b/epicyon.py @@ -1622,6 +1622,7 @@ def _command_options() -> None: session_i2p = create_session('i2p') followers_sync_cache = {} sites_unavailable = [] + system_language = argb.language manual_approve_follow_request(session, session_onion, session_i2p, onion_domain, i2p_domain, base_dir, http_prefix, @@ -1633,7 +1634,7 @@ def _command_options() -> None: debug, __version__, signing_priv_key_pem, proxy_type, followers_sync_cache, - sites_unavailable) + sites_unavailable, system_language) sys.exit() if argb.deny: @@ -1667,6 +1668,7 @@ def _command_options() -> None: session_i2p = create_session('i2p') followers_sync_cache = {} sites_unavailable = [] + system_language = argb.language manual_deny_follow_request(session, session_onion, session_i2p, onion_domain, i2p_domain, base_dir, http_prefix, @@ -1678,7 +1680,8 @@ def _command_options() -> None: debug, __version__, signing_priv_key_pem, followers_sync_cache, - sites_unavailable) + sites_unavailable, + system_language) sys.exit() if argb.followerspending: @@ -1882,6 +1885,7 @@ def _command_options() -> None: signing_priv_key_pem = None if argb.secure_mode: signing_priv_key_pem = get_instance_actor_key(base_dir, domain) + system_language = argb.language print('Sending announce/repeat of ' + argb.announce) send_announce_via_server(base_dir, session, @@ -1889,7 +1893,8 @@ def _command_options() -> None: domain, port, http_prefix, argb.announce, cached_webfingers, person_cache, - True, __version__, signing_priv_key_pem) + True, __version__, signing_priv_key_pem, + system_language) for _ in range(10): # TODO detect send success/fail time.sleep(1) @@ -1988,6 +1993,7 @@ def _command_options() -> None: signing_priv_key_pem = None if argb.secure_mode: signing_priv_key_pem = get_instance_actor_key(base_dir, domain) + system_language = argb.language print('Sending shared item: ' + argb.itemName) send_share_via_server(base_dir, session, @@ -2005,7 +2011,8 @@ def _command_options() -> None: cached_webfingers, person_cache, debug, __version__, argb.itemPrice, argb.itemCurrency, - signing_priv_key_pem) + signing_priv_key_pem, + system_language) for _ in range(10): # TODO detect send success/fail time.sleep(1) @@ -2031,6 +2038,7 @@ def _command_options() -> None: signing_priv_key_pem = None if argb.secure_mode: signing_priv_key_pem = get_instance_actor_key(base_dir, domain) + system_language = argb.language print('Sending undo of shared item: ' + argb.undoItemName) send_undo_share_via_server(base_dir, session, @@ -2039,7 +2047,8 @@ def _command_options() -> None: http_prefix, argb.undoItemName, cached_webfingers, person_cache, - debug, __version__, signing_priv_key_pem) + debug, __version__, signing_priv_key_pem, + system_language) for _ in range(10): # TODO detect send success/fail time.sleep(1) @@ -2094,6 +2103,7 @@ def _command_options() -> None: signing_priv_key_pem = None if argb.secure_mode: signing_priv_key_pem = get_instance_actor_key(base_dir, domain) + system_language = argb.language print('Sending wanted item: ' + argb.wantedItemName) send_wanted_via_server(base_dir, session, @@ -2111,7 +2121,8 @@ def _command_options() -> None: cached_webfingers, person_cache, debug, __version__, argb.itemPrice, argb.itemCurrency, - signing_priv_key_pem) + signing_priv_key_pem, + system_language) for _ in range(10): # TODO detect send success/fail time.sleep(1) @@ -2137,6 +2148,7 @@ def _command_options() -> None: signing_priv_key_pem = None if argb.secure_mode: signing_priv_key_pem = get_instance_actor_key(base_dir, domain) + system_language = argb.language print('Sending undo of wanted item: ' + argb.undoWantedItemName) send_undo_wanted_via_server(base_dir, session, @@ -2145,7 +2157,8 @@ def _command_options() -> None: http_prefix, argb.undoWantedItemName, cached_webfingers, person_cache, - debug, __version__, signing_priv_key_pem) + debug, __version__, signing_priv_key_pem, + system_language) for _ in range(10): # TODO detect send success/fail time.sleep(1) @@ -2171,6 +2184,7 @@ def _command_options() -> None: signing_priv_key_pem = None if argb.secure_mode: signing_priv_key_pem = get_instance_actor_key(base_dir, domain) + system_language = argb.language print('Sending like of ' + argb.like) send_like_via_server(base_dir, session, @@ -2178,7 +2192,8 @@ def _command_options() -> None: domain, port, http_prefix, argb.like, cached_webfingers, person_cache, - True, __version__, signing_priv_key_pem) + True, __version__, signing_priv_key_pem, + system_language) for _ in range(10): # TODO detect send success/fail time.sleep(1) @@ -2210,6 +2225,7 @@ def _command_options() -> None: signing_priv_key_pem = None if argb.secure_mode: signing_priv_key_pem = get_instance_actor_key(base_dir, domain) + system_language = argb.language print('Sending emoji reaction ' + argb.emoji + ' to ' + argb.react) send_reaction_via_server(base_dir, session, @@ -2217,7 +2233,8 @@ def _command_options() -> None: domain, port, http_prefix, argb.react, argb.emoji, cached_webfingers, person_cache, - True, __version__, signing_priv_key_pem) + True, __version__, signing_priv_key_pem, + system_language) for _ in range(10): # TODO detect send success/fail time.sleep(1) @@ -2243,6 +2260,7 @@ def _command_options() -> None: signing_priv_key_pem = None if argb.secure_mode: signing_priv_key_pem = get_instance_actor_key(base_dir, domain) + system_language = argb.language print('Sending undo like of ' + argb.undolike) send_undo_like_via_server(base_dir, session, @@ -2251,7 +2269,8 @@ def _command_options() -> None: http_prefix, argb.undolike, cached_webfingers, person_cache, True, __version__, - signing_priv_key_pem) + signing_priv_key_pem, + system_language) for _ in range(10): # TODO detect send success/fail time.sleep(1) @@ -2283,6 +2302,7 @@ def _command_options() -> None: signing_priv_key_pem = None if argb.secure_mode: signing_priv_key_pem = get_instance_actor_key(base_dir, domain) + system_language = argb.language print('Sending undo emoji reaction ' + argb.emoji + ' to ' + argb.react) @@ -2292,7 +2312,8 @@ def _command_options() -> None: http_prefix, argb.undoreact, argb.emoji, cached_webfingers, person_cache, True, __version__, - signing_priv_key_pem) + signing_priv_key_pem, + system_language) for _ in range(10): # TODO detect send success/fail time.sleep(1) @@ -2318,6 +2339,7 @@ def _command_options() -> None: signing_priv_key_pem = None if argb.secure_mode: signing_priv_key_pem = get_instance_actor_key(base_dir, domain) + system_language = argb.language print('Sending bookmark of ' + argb.bookmark) send_bookmark_via_server(base_dir, session, @@ -2326,7 +2348,8 @@ def _command_options() -> None: http_prefix, argb.bookmark, cached_webfingers, person_cache, True, __version__, - signing_priv_key_pem) + signing_priv_key_pem, + system_language) for _ in range(10): # TODO detect send success/fail time.sleep(1) @@ -2352,6 +2375,7 @@ def _command_options() -> None: signing_priv_key_pem = None if argb.secure_mode: signing_priv_key_pem = get_instance_actor_key(base_dir, domain) + system_language = argb.language print('Sending undo bookmark of ' + argb.unbookmark) send_undo_bookmark_via_server(base_dir, session, @@ -2359,7 +2383,8 @@ def _command_options() -> None: domain, port, http_prefix, argb.unbookmark, cached_webfingers, person_cache, - True, __version__, signing_priv_key_pem) + True, __version__, signing_priv_key_pem, + system_language) for _ in range(10): # TODO detect send success/fail time.sleep(1) @@ -2385,6 +2410,7 @@ def _command_options() -> None: signing_priv_key_pem = None if argb.secure_mode: signing_priv_key_pem = get_instance_actor_key(base_dir, domain) + system_language = argb.language print('Sending delete request of ' + argb.delete) send_delete_via_server(base_dir, session, @@ -2392,7 +2418,8 @@ def _command_options() -> None: domain, port, http_prefix, argb.delete, cached_webfingers, person_cache, - True, __version__, signing_priv_key_pem) + True, __version__, signing_priv_key_pem, + system_language) for _ in range(10): # TODO detect send success/fail time.sleep(1) @@ -2433,6 +2460,7 @@ def _command_options() -> None: signing_priv_key_pem = None if argb.secure_mode: signing_priv_key_pem = get_instance_actor_key(base_dir, domain) + system_language = argb.language send_follow_request_via_server(base_dir, session, argb.nickname, argb.password, @@ -2441,7 +2469,8 @@ def _command_options() -> None: follow_port, follow_http_prefix, cached_webfingers, person_cache, debug, __version__, - signing_priv_key_pem) + signing_priv_key_pem, + system_language) for _ in range(20): time.sleep(1) # TODO some method to know if it worked @@ -2483,6 +2512,7 @@ def _command_options() -> None: signing_priv_key_pem = None if argb.secure_mode: signing_priv_key_pem = get_instance_actor_key(base_dir, domain) + system_language = argb.language send_unfollow_request_via_server(base_dir, session, argb.nickname, argb.password, @@ -2491,7 +2521,8 @@ def _command_options() -> None: follow_port, follow_http_prefix, cached_webfingers, person_cache, debug, __version__, - signing_priv_key_pem) + signing_priv_key_pem, + system_language) for _ in range(20): time.sleep(1) # TODO some method to know if it worked @@ -3150,6 +3181,7 @@ def _command_options() -> None: signing_priv_key_pem = None if argb.secure_mode: signing_priv_key_pem = get_instance_actor_key(base_dir, domain) + system_language = argb.language print('Sending ' + argb.skill + ' skill level ' + str(argb.skillLevelPercent) + ' for ' + nickname) @@ -3159,7 +3191,8 @@ def _command_options() -> None: http_prefix, argb.skill, argb.skillLevelPercent, cached_webfingers, person_cache, - True, __version__, signing_priv_key_pem) + True, __version__, signing_priv_key_pem, + system_language) for i in range(10): # TODO detect send success/fail time.sleep(1) @@ -3185,6 +3218,7 @@ def _command_options() -> None: signing_priv_key_pem = None if argb.secure_mode: signing_priv_key_pem = get_instance_actor_key(base_dir, domain) + system_language = argb.language print('Sending availability status of ' + nickname + ' as ' + argb.availability) @@ -3193,7 +3227,8 @@ def _command_options() -> None: domain, port, http_prefix, argb.availability, cached_webfingers, person_cache, - True, __version__, signing_priv_key_pem) + True, __version__, signing_priv_key_pem, + system_language) for i in range(10): # TODO detect send success/fail time.sleep(1) @@ -3300,13 +3335,15 @@ def _command_options() -> None: signing_priv_key_pem = None if argb.secure_mode: signing_priv_key_pem = get_instance_actor_key(base_dir, domain) + system_language = argb.language print('Sending block of ' + argb.block) send_block_via_server(base_dir, session, nickname, argb.password, domain, port, http_prefix, argb.block, cached_webfingers, person_cache, - True, __version__, signing_priv_key_pem) + True, __version__, signing_priv_key_pem, + system_language) for i in range(10): # TODO detect send success/fail time.sleep(1) @@ -3332,13 +3369,15 @@ def _command_options() -> None: signing_priv_key_pem = None if argb.secure_mode: signing_priv_key_pem = get_instance_actor_key(base_dir, domain) + system_language = argb.language print('Sending mute of ' + argb.mute) send_mute_via_server(base_dir, session, nickname, argb.password, domain, port, http_prefix, argb.mute, cached_webfingers, person_cache, - True, __version__, signing_priv_key_pem) + True, __version__, signing_priv_key_pem, + system_language) for i in range(10): # TODO detect send success/fail time.sleep(1) @@ -3364,13 +3403,15 @@ def _command_options() -> None: signing_priv_key_pem = None if argb.secure_mode: signing_priv_key_pem = get_instance_actor_key(base_dir, domain) + system_language = argb.language print('Sending undo mute of ' + argb.unmute) send_undo_mute_via_server(base_dir, session, nickname, argb.password, domain, port, http_prefix, argb.unmute, cached_webfingers, person_cache, - True, __version__, signing_priv_key_pem) + True, __version__, signing_priv_key_pem, + system_language) for i in range(10): # TODO detect send success/fail time.sleep(1) @@ -3408,13 +3449,15 @@ def _command_options() -> None: signing_priv_key_pem = None if argb.secure_mode: signing_priv_key_pem = get_instance_actor_key(base_dir, domain) + system_language = argb.language print('Sending undo block of ' + argb.unblock) send_undo_block_via_server(base_dir, session, nickname, argb.password, domain, port, http_prefix, argb.unblock, cached_webfingers, person_cache, - True, __version__, signing_priv_key_pem) + True, __version__, signing_priv_key_pem, + system_language) for i in range(10): # TODO detect send success/fail time.sleep(1) diff --git a/follow.py b/follow.py index 6ea551ae0..a86012732 100644 --- a/follow.py +++ b/follow.py @@ -764,7 +764,8 @@ def followed_account_accepts(session, base_dir: str, http_prefix: str, curr_domain: str, onion_domain: str, i2p_domain: str, followers_sync_cache: {}, - sites_unavailable: []): + sites_unavailable: [], + system_language: str): """The person receiving a follow request accepts the new follower and sends back an Accept activity """ @@ -819,7 +820,8 @@ def followed_account_accepts(session, base_dir: str, http_prefix: str, person_cache, debug, project_version, None, group_account, signing_priv_key_pem, 7856837, curr_domain, onion_domain, i2p_domain, - extra_headers, sites_unavailable) + extra_headers, sites_unavailable, + system_language) def followed_account_rejects(session, session_onion, session_i2p, @@ -834,7 +836,8 @@ def followed_account_rejects(session, session_onion, session_i2p, debug: bool, project_version: str, signing_priv_key_pem: str, followers_sync_cache: {}, - sites_unavailable: []): + sites_unavailable: [], + system_language: str): """The person receiving a follow request rejects the new follower and sends back a Reject activity """ @@ -903,7 +906,8 @@ def followed_account_rejects(session, session_onion, session_i2p, group_account, signing_priv_key_pem, 6393063, domain, onion_domain, i2p_domain, - extra_headers, sites_unavailable) + extra_headers, sites_unavailable, + system_language) def send_follow_request(session, base_dir: str, @@ -919,7 +923,8 @@ def send_follow_request(session, base_dir: str, project_version: str, signing_priv_key_pem: str, curr_domain: str, onion_domain: str, i2p_domain: str, - sites_unavailable: []) -> {}: + sites_unavailable: [], + system_language: str) -> {}: """Gets the json object for sending a follow request """ if not signing_priv_key_pem: @@ -1003,7 +1008,8 @@ def send_follow_request(session, base_dir: str, debug, project_version, None, group_account, signing_priv_key_pem, 8234389, curr_domain, onion_domain, i2p_domain, - extra_headers, sites_unavailable) + extra_headers, sites_unavailable, + system_language) return new_follow_json @@ -1016,7 +1022,8 @@ def send_follow_request_via_server(base_dir: str, session, http_prefix: str, cached_webfingers: {}, person_cache: {}, debug: bool, project_version: str, - signing_priv_key_pem: str) -> {}: + signing_priv_key_pem: str, + system_language: str) -> {}: """Creates a follow request via c2s """ if not session: @@ -1067,7 +1074,8 @@ def send_follow_request_via_server(base_dir: str, session, person_cache, project_version, http_prefix, from_nickname, - from_domain, post_to_box, 52025) + from_domain, post_to_box, 52025, + system_language) if not inbox_url: if debug: @@ -1108,7 +1116,8 @@ def send_unfollow_request_via_server(base_dir: str, session, http_prefix: str, cached_webfingers: {}, person_cache: {}, debug: bool, project_version: str, - signing_priv_key_pem: str) -> {}: + signing_priv_key_pem: str, + system_language: str) -> {}: """Creates a unfollow request via c2s """ if not session: @@ -1165,7 +1174,7 @@ def send_unfollow_request_via_server(base_dir: str, session, project_version, http_prefix, from_nickname, from_domain, post_to_box, - 76536) + 76536, system_language) if not inbox_url: if debug: diff --git a/importFollowing.py b/importFollowing.py index 847aa9661..9848983f3 100644 --- a/importFollowing.py +++ b/importFollowing.py @@ -171,7 +171,8 @@ def _update_import_following(base_dir: str, httpd.domain, httpd.onion_domain, httpd.i2p_domain, - httpd.sites_unavailable) + httpd.sites_unavailable, + httpd.system_language) # remove the followed handle from the import list following_str = following_str.replace(orig_line + '\n', '') diff --git a/inbox.py b/inbox.py index bf69fa2d3..d8ee8ad3a 100644 --- a/inbox.py +++ b/inbox.py @@ -1714,7 +1714,8 @@ def _receive_move_activity(session, base_dir: str, onion_domain: str, i2p_domain: str, sites_unavailable: [], - blocked_cache: []) -> bool: + blocked_cache: [], + system_language: str) -> bool: """Receives a move activity within the POST section of HTTPServer https://codeberg.org/fediverse/fep/src/branch/main/fep/7628/fep-7628.md """ @@ -1801,7 +1802,8 @@ def _receive_move_activity(session, base_dir: str, domain, onion_domain, i2p_domain, - sites_unavailable) + sites_unavailable, + system_language) return True @@ -3820,7 +3822,8 @@ def _send_to_group_members(server, session, session_onion, session_i2p, curr_domain: str, onion_domain: str, i2p_domain: str, signing_priv_key_pem: str, - sites_unavailable: []) -> None: + sites_unavailable: [], + system_language: str) -> None: """When a post arrives for a group send it out to the group members """ if debug: @@ -3877,7 +3880,7 @@ def _send_to_group_members(server, session, session_onion, session_i2p, person_cache, cached_webfingers, debug, __version__, signing_priv_key_pem, curr_domain, onion_domain, i2p_domain, - sites_unavailable) + sites_unavailable, system_language) send_to_followers_thread(server, session, session_onion, session_i2p, base_dir, nickname, domain, @@ -3889,7 +3892,7 @@ def _send_to_group_members(server, session, session_onion, session_i2p, shared_items_federated_domains, shared_item_federation_tokens, signing_priv_key_pem, - sites_unavailable) + sites_unavailable, system_language) def _inbox_update_calendar(base_dir: str, handle: str, @@ -4104,7 +4107,7 @@ def _bounce_dm(sender_post_id: str, session, http_prefix: str, person_cache, debug, __version__, None, group_account, signing_priv_key_pem, 7238634, curr_domain, onion_domain, i2p_domain, - extra_headers, sites_unavailable) + extra_headers, sites_unavailable, system_language) return True @@ -4341,7 +4344,7 @@ def _receive_question_vote(server, base_dir: str, nickname: str, domain: str, shared_items_federated_domains, shared_item_federation_tokens, signing_priv_key_pem, - sites_unavailable) + sites_unavailable, system_language) def _create_reply_notification_file(base_dir: str, nickname: str, domain: str, @@ -5217,7 +5220,8 @@ def _inbox_after_initial(server, inbox_start_time, person_cache, debug, domain, onion_domain, i2p_domain, signing_priv_key_pem, - sites_unavailable) + sites_unavailable, + system_language) fitness_performance(inbox_start_time, server.fitness, 'INBOX', '_send_to_group_members', @@ -5759,7 +5763,8 @@ def _receive_follow_request(session, session_onion, session_i2p, debug, project_version, True, signing_priv_key_pem, this_domain, onion_domain, i2p_domain, - followers_sync_cache, sites_unavailable) + followers_sync_cache, sites_unavailable, + system_language) def run_inbox_queue(server, @@ -6252,7 +6257,8 @@ def run_inbox_queue(server, onion_domain, i2p_domain, server.sites_unavailable, - server.blocked_cache): + server.blocked_cache, + server.system_language): if debug: print('Queue: _receive_move_activity ' + key_id) if os.path.isfile(queue_filename): diff --git a/like.py b/like.py index 49bec1805..b7510bbd0 100644 --- a/like.py +++ b/like.py @@ -80,7 +80,8 @@ def _create_like(recent_posts_cache: {}, signing_priv_key_pem: str, curr_domain: str, onion_domain: str, i2p_domain: str, - sites_unavailable: []) -> {}: + sites_unavailable: [], + system_language: str) -> {}: """Creates a like actor is the person doing the liking 'to' might be a specific person (actor) whose post was liked @@ -148,7 +149,8 @@ def _create_like(recent_posts_cache: {}, debug, project_version, None, group_account, signing_priv_key_pem, 7367374, curr_domain, onion_domain, i2p_domain, - extra_headers, sites_unavailable) + extra_headers, sites_unavailable, + system_language) return new_like_json @@ -164,7 +166,8 @@ def like_post(recent_posts_cache: {}, debug: bool, project_version: str, signing_priv_key_pem: str, curr_domain: str, onion_domain: str, i2p_domain: str, - sites_unavailable: []) -> {}: + sites_unavailable: [], + system_language: str) -> {}: """Likes a given status post. This is only used by unit tests """ like_domain = get_full_domain(like_domain, like_port) @@ -181,7 +184,7 @@ def like_post(recent_posts_cache: {}, cached_webfingers, debug, project_version, signing_priv_key_pem, curr_domain, onion_domain, i2p_domain, - sites_unavailable) + sites_unavailable, system_language) def send_like_via_server(base_dir: str, session, @@ -190,7 +193,8 @@ def send_like_via_server(base_dir: str, session, http_prefix: str, like_url: str, cached_webfingers: {}, person_cache: {}, debug: bool, project_version: str, - signing_priv_key_pem: str) -> {}: + signing_priv_key_pem: str, + system_language: str) -> {}: """Creates a like via c2s """ if not session: @@ -235,7 +239,8 @@ def send_like_via_server(base_dir: str, session, person_cache, project_version, http_prefix, from_nickname, from_domain, - post_to_box, 72873) + post_to_box, 72873, + system_language) if not inbox_url: if debug: @@ -273,7 +278,8 @@ def send_undo_like_via_server(base_dir: str, session, http_prefix: str, like_url: str, cached_webfingers: {}, person_cache: {}, debug: bool, project_version: str, - signing_priv_key_pem: str) -> {}: + signing_priv_key_pem: str, + system_language: str) -> {}: """Undo a like via c2s """ if not session: @@ -323,7 +329,7 @@ def send_undo_like_via_server(base_dir: str, session, person_cache, project_version, http_prefix, from_nickname, from_domain, post_to_box, - 72625) + 72625, system_language) if not inbox_url: if debug: diff --git a/manualapprove.py b/manualapprove.py index abb73f7a0..e3174cbf6 100644 --- a/manualapprove.py +++ b/manualapprove.py @@ -36,7 +36,8 @@ def manual_deny_follow_request(session, session_onion, session_i2p, project_version: str, signing_priv_key_pem: str, followers_sync_cache: {}, - sites_unavailable: []) -> None: + sites_unavailable: [], + system_language: str) -> None: """Manually deny a follow request """ accounts_dir = acct_dir(base_dir, nickname, domain) @@ -78,7 +79,8 @@ def manual_deny_follow_request(session, session_onion, session_i2p, debug, project_version, signing_priv_key_pem, followers_sync_cache, - sites_unavailable) + sites_unavailable, + system_language) print('Follow request from ' + deny_handle + ' was denied.') @@ -95,7 +97,8 @@ def manual_deny_follow_request_thread(session, session_onion, session_i2p, project_version: str, signing_priv_key_pem: str, followers_sync_cache: {}, - sites_unavailable: []) -> None: + sites_unavailable: [], + system_language: str) -> None: """Manually deny a follow request, within a thread so that the user interface doesn't lag """ @@ -114,7 +117,8 @@ def manual_deny_follow_request_thread(session, session_onion, session_i2p, project_version, signing_priv_key_pem, followers_sync_cache, - sites_unavailable), daemon=True) + sites_unavailable, + system_language), daemon=True) begin_thread(thr, 'manual_deny_follow_request_thread') send_threads.append(thr) @@ -154,7 +158,8 @@ def manual_approve_follow_request(session, session_onion, session_i2p, signing_priv_key_pem: str, proxy_type: str, followers_sync_cache: {}, - sites_unavailable: []) -> None: + sites_unavailable: [], + system_language: str) -> None: """Manually approve a follow request """ handle = nickname + '@' + domain @@ -291,7 +296,8 @@ def manual_approve_follow_request(session, session_onion, session_i2p, onion_domain, i2p_domain, followers_sync_cache, - sites_unavailable) + sites_unavailable, + system_language) update_approved_followers = True else: # this isn't the approved follow so it will remain @@ -365,7 +371,8 @@ def manual_approve_follow_request_thread(session, session_onion, session_i2p, signing_priv_key_pem: str, proxy_type: str, followers_sync_cache: {}, - sites_unavailable: []) -> None: + sites_unavailable: [], + system_language: str) -> None: """Manually approve a follow request, in a thread so as not to cause the UI to lag """ @@ -385,6 +392,7 @@ def manual_approve_follow_request_thread(session, session_onion, session_i2p, signing_priv_key_pem, proxy_type, followers_sync_cache, - sites_unavailable), daemon=True) + sites_unavailable, + system_language), daemon=True) begin_thread(thr, 'manual_approve_follow_request_thread') send_threads.append(thr) diff --git a/outbox.py b/outbox.py index 821f78b33..ce2bc8951 100644 --- a/outbox.py +++ b/outbox.py @@ -664,7 +664,8 @@ def post_message_to_outbox(session, translate: {}, shared_items_federated_domains, shared_item_federation_tokens, signing_priv_key_pem, - sites_unavailable) + sites_unavailable, + system_language) followers_threads.append(followers_thread) if debug: @@ -799,6 +800,7 @@ def post_message_to_outbox(session, translate: {}, signing_priv_key_pem, proxy_type, server.followers_sync_cache, - server.sites_unavailable) + server.sites_unavailable, + server.system_language) followers_threads.append(named_addresses_thread) return True diff --git a/pgp.py b/pgp.py index 19d6c9bd2..3b7f7ea25 100644 --- a/pgp.py +++ b/pgp.py @@ -542,7 +542,8 @@ def pgp_public_key_upload(base_dir: str, session, http_prefix: str, cached_webfingers: {}, person_cache: {}, debug: bool, test: str, - signing_priv_key_pem: str) -> {}: + signing_priv_key_pem: str, + system_language: str) -> {}: if debug: print('pgp_public_key_upload') @@ -664,7 +665,8 @@ def pgp_public_key_upload(base_dir: str, session, base_dir, session, wf_request, person_cache, __version__, http_prefix, nickname, - domain, post_to_box, 35725) + domain, post_to_box, 35725, + system_language) if not inbox_url: if debug: diff --git a/posts.py b/posts.py index e4f7622a3..a74a0e345 100644 --- a/posts.py +++ b/posts.py @@ -332,7 +332,9 @@ def get_person_box(signing_priv_key_pem: str, origin_domain: str, project_version: str, http_prefix: str, nickname: str, domain: str, box_name: str = 'inbox', - source_id=0) -> (str, str, str, str, str, str, str, bool): + source_id: int = 0, + system_language: str = 'en') -> (str, str, str, str, str, + str, str, bool): debug = False profile_str = 'https://www.w3.org/ns/activitystreams' as_header = { @@ -414,6 +416,19 @@ def get_person_box(signing_priv_key_pem: str, origin_domain: str, # have they moved? if person_json.get('movedTo'): display_name += ' ⌂' + if person_json.get('nameMap'): + if isinstance(person_json['nameMap'], dict): + if system_language in person_json['nameMap']: + display_name = person_json['nameMap'][system_language] + if dangerous_markup(display_name, False, []): + display_name = '*ADVERSARY*' + elif is_filtered(base_dir, + nickname, domain, + display_name, 'en'): + display_name = '*FILTERED*' + # have they moved? + if person_json.get('movedTo'): + display_name += ' ⌂' store_person_in_cache(base_dir, person_url, person_json, person_cache, True) @@ -2818,7 +2833,7 @@ def send_post(signing_priv_key_pem: str, project_version: str, person_cache, project_version, http_prefix, nickname, domain, post_to_box, - 72533) + 72533, system_language) if not inbox_url: return 3 @@ -2995,7 +3010,7 @@ def send_post_via_server(signing_priv_key_pem: str, project_version: str, project_version, http_prefix, from_nickname, from_domain_full, post_to_box, - 82796) + 82796, system_language) if not inbox_url: if debug: print('DEBUG: post no ' + post_to_box + @@ -3158,7 +3173,8 @@ def send_signed_json(post_json_object: {}, session, base_dir: str, signing_priv_key_pem: str, source_id: int, curr_domain: str, onion_domain: str, i2p_domain: str, - extra_headers: {}, sites_unavailable: []) -> int: + extra_headers: {}, sites_unavailable: [], + system_language: str) -> int: """Sends a signed json object to an inbox/outbox """ if debug: @@ -3234,7 +3250,7 @@ def send_signed_json(post_json_object: {}, session, base_dir: str, person_cache, project_version, http_prefix, nickname, domain, post_to_box, - source_id) + source_id, system_language) print("send_signed_json inbox_url: " + str(inbox_url)) print("send_signed_json to_person_id: " + str(to_person_id)) @@ -3477,7 +3493,8 @@ def _send_to_named_addresses(server, session, session_onion, session_i2p, signing_priv_key_pem: str, proxy_type: str, followers_sync_cache: {}, - sites_unavailable: []) -> None: + sites_unavailable: [], + system_language: str) -> None: """sends a post to the specific named addresses in to/cc """ if not session: @@ -3674,7 +3691,8 @@ def _send_to_named_addresses(server, session, session_onion, session_i2p, shared_items_token, group_account, signing_priv_key_pem, 34436782, domain, onion_domain, i2p_domain, - extra_headers, sites_unavailable) + extra_headers, sites_unavailable, + system_language) def send_to_named_addresses_thread(server, session, session_onion, session_i2p, @@ -3691,7 +3709,8 @@ def send_to_named_addresses_thread(server, session, session_onion, session_i2p, signing_priv_key_pem: str, proxy_type: str, followers_sync_cache: {}, - sites_unavailable: []): + sites_unavailable: [], + system_language: str): """Returns a thread used to send a post to named addresses """ print('THREAD: _send_to_named_addresses') @@ -3710,7 +3729,8 @@ def send_to_named_addresses_thread(server, session, session_onion, session_i2p, signing_priv_key_pem, proxy_type, followers_sync_cache, - sites_unavailable), daemon=True) + sites_unavailable, + system_language), daemon=True) if not begin_thread(send_thread, 'send_to_named_addresses_thread'): print('WARN: socket error while starting ' + 'thread to send to named addresses.') @@ -3763,7 +3783,8 @@ def send_to_followers(server, session, session_onion, session_i2p, shared_items_federated_domains: [], shared_item_federation_tokens: {}, signing_priv_key_pem: str, - sites_unavailable: []) -> None: + sites_unavailable: [], + system_language: str) -> None: """sends a post to the followers of the given nickname """ print('send_to_followers') @@ -3935,7 +3956,8 @@ def send_to_followers(server, session, session_onion, session_i2p, shared_items_token, group_account, signing_priv_key_pem, 639342, domain, onion_domain, i2p_domain, - extra_headers, sites_unavailable) + extra_headers, sites_unavailable, + system_language) else: # randomize the order of handles, so that we are not # favoring any particular account in terms of its delivery time @@ -3969,7 +3991,8 @@ def send_to_followers(server, session, session_onion, session_i2p, shared_items_token, group_account, signing_priv_key_pem, 634219, domain, onion_domain, i2p_domain, - extra_headers, sites_unavailable) + extra_headers, sites_unavailable, + system_language) time.sleep(4) @@ -3993,7 +4016,8 @@ def send_to_followers_thread(server, session, session_onion, session_i2p, shared_items_federated_domains: [], shared_item_federation_tokens: {}, signing_priv_key_pem: str, - sites_unavailable: []): + sites_unavailable: [], + system_language: str): """Returns a thread used to send a post to followers """ print('THREAD: send_to_followers') @@ -4010,7 +4034,8 @@ def send_to_followers_thread(server, session, session_onion, session_i2p, shared_items_federated_domains, shared_item_federation_tokens, signing_priv_key_pem, - sites_unavailable), daemon=True) + sites_unavailable, + system_language), daemon=True) if not begin_thread(send_thread, 'send_to_followers_thread'): print('WARN: error while starting ' + 'thread to send to followers.') @@ -5181,7 +5206,7 @@ def get_public_posts_of_person(base_dir: str, nickname: str, domain: str, person_cache, project_version, http_prefix, nickname, domain, 'outbox', - 62524) + 62524, system_language) if debug: print('Actor url: ' + str(person_id)) if not person_id: @@ -5232,7 +5257,7 @@ def get_public_post_domains(session, base_dir: str, nickname: str, domain: str, person_cache, project_version, http_prefix, nickname, domain, 'outbox', - 92522) + 92522, system_language) post_domains = \ get_post_domains(session, person_url, 64, debug, project_version, http_prefix, domain, @@ -5323,7 +5348,7 @@ def get_public_post_info(session, base_dir: str, nickname: str, domain: str, person_cache, project_version, http_prefix, nickname, domain, 'outbox', - 13863) + 13863, system_language) max_posts = 64 post_domains = \ get_post_domains(session, person_url, max_posts, debug, @@ -5921,7 +5946,8 @@ def send_block_via_server(base_dir: str, session, http_prefix: str, blocked_url: str, cached_webfingers: {}, person_cache: {}, debug: bool, project_version: str, - signing_priv_key_pem: str) -> {}: + signing_priv_key_pem: str, + system_language: str) -> {}: """Creates a block via c2s """ if not session: @@ -5970,7 +5996,8 @@ def send_block_via_server(base_dir: str, session, person_cache, project_version, http_prefix, from_nickname, - from_domain, post_to_box, 72652) + from_domain, post_to_box, 72652, + system_language) if not inbox_url: if debug: @@ -6007,7 +6034,8 @@ def send_mute_via_server(base_dir: str, session, http_prefix: str, muted_url: str, cached_webfingers: {}, person_cache: {}, debug: bool, project_version: str, - signing_priv_key_pem: str) -> {}: + signing_priv_key_pem: str, + system_language: str) -> {}: """Creates a mute via c2s """ if not session: @@ -6052,7 +6080,8 @@ def send_mute_via_server(base_dir: str, session, person_cache, project_version, http_prefix, from_nickname, - from_domain, post_to_box, 72652) + from_domain, post_to_box, 72652, + system_language) if not inbox_url: if debug: @@ -6088,7 +6117,8 @@ def send_undo_mute_via_server(base_dir: str, session, http_prefix: str, muted_url: str, cached_webfingers: {}, person_cache: {}, debug: bool, project_version: str, - signing_priv_key_pem: str) -> {}: + signing_priv_key_pem: str, + system_language: str) -> {}: """Undoes a mute via c2s """ if not session: @@ -6138,7 +6168,8 @@ def send_undo_mute_via_server(base_dir: str, session, person_cache, project_version, http_prefix, from_nickname, - from_domain, post_to_box, 72652) + from_domain, post_to_box, 72652, + system_language) if not inbox_url: if debug: @@ -6175,7 +6206,8 @@ def send_undo_block_via_server(base_dir: str, session, http_prefix: str, blocked_url: str, cached_webfingers: {}, person_cache: {}, debug: bool, project_version: str, - signing_priv_key_pem: str) -> {}: + signing_priv_key_pem: str, + system_language: str) -> {}: """Creates a block via c2s """ if not session: @@ -6228,7 +6260,8 @@ def send_undo_block_via_server(base_dir: str, session, person_cache, project_version, http_prefix, from_nickname, - from_domain, post_to_box, 53892) + from_domain, post_to_box, 53892, + system_language) if not inbox_url: if debug: diff --git a/reaction.py b/reaction.py index 3013a311c..18d375874 100644 --- a/reaction.py +++ b/reaction.py @@ -74,7 +74,8 @@ def _reactionpost(recent_posts_cache: {}, signing_priv_key_pem: str, curr_domain: str, onion_domain: str, i2p_domain: str, - sites_unavailable: []) -> {}: + sites_unavailable: [], + system_language: str) -> {}: """Creates an emoji reaction actor is the person doing the reacting 'to' might be a specific person (actor) whose post was reaction @@ -149,7 +150,8 @@ def _reactionpost(recent_posts_cache: {}, debug, project_version, None, group_account, signing_priv_key_pem, 7165392, curr_domain, onion_domain, i2p_domain, - extra_headers, sites_unavailable) + extra_headers, sites_unavailable, + system_language) return new_reaction_json @@ -166,7 +168,7 @@ def reaction_post(recent_posts_cache: {}, debug: bool, project_version: str, signing_priv_key_pem: str, curr_domain: str, onion_domain: str, i2p_domain: str, - sites_unavailable: []) -> {}: + sites_unavailable: [], system_language: str) -> {}: """Adds a reaction to a given status post. This is only used by unit tests """ reaction_domain = get_full_domain(reaction_domain, reaction_port) @@ -184,7 +186,7 @@ def reaction_post(recent_posts_cache: {}, cached_webfingers, debug, project_version, signing_priv_key_pem, curr_domain, onion_domain, i2p_domain, - sites_unavailable) + sites_unavailable, system_language) def send_reaction_via_server(base_dir: str, session, @@ -194,7 +196,8 @@ def send_reaction_via_server(base_dir: str, session, emoji_content: str, cached_webfingers: {}, person_cache: {}, debug: bool, project_version: str, - signing_priv_key_pem: str) -> {}: + signing_priv_key_pem: str, + system_language: str) -> {}: """Creates a reaction via c2s """ if not session: @@ -244,7 +247,8 @@ def send_reaction_via_server(base_dir: str, session, person_cache, project_version, http_prefix, from_nickname, from_domain, - post_to_box, 72873) + post_to_box, 72873, + system_language) if not inbox_url: if debug: @@ -284,7 +288,8 @@ def send_undo_reaction_via_server(base_dir: str, session, emoji_content: str, cached_webfingers: {}, person_cache: {}, debug: bool, project_version: str, - signing_priv_key_pem: str) -> {}: + signing_priv_key_pem: str, + system_language: str) -> {}: """Undo a reaction via c2s """ if not session: @@ -335,7 +340,7 @@ def send_undo_reaction_via_server(base_dir: str, session, person_cache, project_version, http_prefix, from_nickname, from_domain, post_to_box, - 72625) + 72625, system_language) if not inbox_url: if debug: diff --git a/shares.py b/shares.py index 1d9cde363..a8e3c7c88 100644 --- a/shares.py +++ b/shares.py @@ -603,7 +603,8 @@ def send_share_via_server(base_dir, session, cached_webfingers: {}, person_cache: {}, debug: bool, project_version: str, item_price: str, item_currency: str, - signing_priv_key_pem: str) -> {}: + signing_priv_key_pem: str, + system_language: str) -> {}: """Creates an item share via c2s """ if not session: @@ -675,7 +676,7 @@ def send_share_via_server(base_dir, session, person_cache, project_version, http_prefix, from_nickname, from_domain, post_to_box, - 83653) + 83653, system_language) if not inbox_url: if debug: @@ -724,7 +725,8 @@ def send_undo_share_via_server(base_dir: str, session, http_prefix: str, display_name: str, cached_webfingers: {}, person_cache: {}, debug: bool, project_version: str, - signing_priv_key_pem: str) -> {}: + signing_priv_key_pem: str, + system_language: str) -> {}: """Undoes a share via c2s """ if not session: @@ -779,7 +781,7 @@ def send_undo_share_via_server(base_dir: str, session, person_cache, project_version, http_prefix, from_nickname, from_domain, post_to_box, - 12663) + 12663, system_language) if not inbox_url: if debug: @@ -823,7 +825,8 @@ def send_wanted_via_server(base_dir, session, cached_webfingers: {}, person_cache: {}, debug: bool, project_version: str, item_max_price: str, item_currency: str, - signing_priv_key_pem: str) -> {}: + signing_priv_key_pem: str, + system_language: str) -> {}: """Creates a wanted item via c2s """ if not session: @@ -896,7 +899,7 @@ def send_wanted_via_server(base_dir, session, person_cache, project_version, http_prefix, from_nickname, from_domain, post_to_box, - 23653) + 23653, system_language) if not inbox_url: if debug: @@ -945,7 +948,8 @@ def send_undo_wanted_via_server(base_dir: str, session, http_prefix: str, display_name: str, cached_webfingers: {}, person_cache: {}, debug: bool, project_version: str, - signing_priv_key_pem: str) -> {}: + signing_priv_key_pem: str, + system_language: str) -> {}: """Undoes a wanted item via c2s """ if not session: @@ -1000,7 +1004,7 @@ def send_undo_wanted_via_server(base_dir: str, session, person_cache, project_version, http_prefix, from_nickname, from_domain, post_to_box, - 12693) + 12693, system_language) if not inbox_url: if debug: diff --git a/skills.py b/skills.py index 5442a5a55..da2eeb806 100644 --- a/skills.py +++ b/skills.py @@ -180,7 +180,8 @@ def send_skill_via_server(base_dir: str, session, nickname: str, password: str, skill: str, skill_level_percent: int, cached_webfingers: {}, person_cache: {}, debug: bool, project_version: str, - signing_priv_key_pem: str) -> {}: + signing_priv_key_pem: str, + system_language: str) -> {}: """Sets a skill for a person via c2s """ if not session: @@ -233,7 +234,8 @@ def send_skill_via_server(base_dir: str, session, nickname: str, password: str, base_dir, session, wf_request, person_cache, project_version, http_prefix, nickname, domain, - post_to_box, 76121) + post_to_box, 76121, + system_language) if not inbox_url: if debug: diff --git a/socnet.py b/socnet.py index 2ef878613..f47cc1492 100644 --- a/socnet.py +++ b/socnet.py @@ -67,7 +67,7 @@ def instances_graph(base_dir: str, handles: str, person_cache, project_version, http_prefix, nickname, domain, 'outbox', - 27261) + 27261, system_language) word_frequency = {} post_domains = \ get_post_domains(session, person_url, 64, debug, diff --git a/tests.py b/tests.py index 0ce5538af..7f780e4ec 100644 --- a/tests.py +++ b/tests.py @@ -1508,7 +1508,8 @@ def test_post_message_between_servers(base_dir: str) -> None: status_number, False, bob_send_threads, bob_post_log, bob_person_cache, bob_cached_webfingers, True, __version__, signing_priv_key_pem, - bob_domain, None, None, sites_unavailable) + bob_domain, None, None, sites_unavailable, + system_language) for _ in range(20): if text_in_file('likes', outbox_post_filename): @@ -1532,7 +1533,8 @@ def test_post_message_between_servers(base_dir: str) -> None: False, bob_send_threads, bob_post_log, bob_person_cache, bob_cached_webfingers, True, __version__, signing_priv_key_pem, - bob_domain, None, None, sites_unavailable) + bob_domain, None, None, sites_unavailable, + system_language) for _ in range(20): if text_in_file('reactions', outbox_post_filename): @@ -1570,7 +1572,8 @@ def test_post_message_between_servers(base_dir: str) -> None: False, bob_send_threads, bob_post_log, bob_person_cache, bob_cached_webfingers, True, __version__, signing_priv_key_pem, - bob_domain, None, None, sites_unavailable) + bob_domain, None, None, sites_unavailable, + system_language) announce_message_arrived = False outbox_message_arrived = False for _ in range(20): @@ -1719,7 +1722,8 @@ def test_follow_between_servers(base_dir: str) -> None: alice_send_threads, alice_post_log, alice_cached_webfingers, alice_person_cache, True, __version__, signing_priv_key_pem, - alice_domain, None, None, sites_unavailable) + alice_domain, None, None, sites_unavailable, + system_language) print('send_result: ' + str(send_result)) for _ in range(16): @@ -1950,7 +1954,8 @@ def test_shared_items_federation(base_dir: str) -> None: alice_send_threads, alice_post_log, alice_cached_webfingers, alice_person_cache, True, __version__, signing_priv_key_pem, - alice_domain, None, None, sites_unavailable) + alice_domain, None, None, sites_unavailable, + system_language) print('send_result: ' + str(send_result)) for _ in range(16): @@ -2025,7 +2030,7 @@ def test_shared_items_federation(base_dir: str) -> None: bob_cached_webfingers, bob_person_cache, True, __version__, shared_item_price, shared_item_currency, - signing_priv_key_pem) + signing_priv_key_pem, system_language) assert share_json assert isinstance(share_json, dict) shared_item_name = 'Epicyon T-shirt' @@ -2051,7 +2056,7 @@ def test_shared_items_federation(base_dir: str) -> None: bob_cached_webfingers, bob_person_cache, True, __version__, shared_item_price, shared_item_currency, - signing_priv_key_pem) + signing_priv_key_pem, system_language) assert share_json assert isinstance(share_json, dict) shared_item_name = 'Soldering iron' @@ -2077,7 +2082,7 @@ def test_shared_items_federation(base_dir: str) -> None: bob_cached_webfingers, bob_person_cache, True, __version__, shared_item_price, shared_item_currency, - signing_priv_key_pem) + signing_priv_key_pem, system_language) assert share_json assert isinstance(share_json, dict) @@ -2434,7 +2439,8 @@ def test_group_follow(base_dir: str) -> None: alice_send_threads, alice_post_log, alice_cached_webfingers, alice_person_cache, True, __version__, signing_priv_key_pem, - alice_domain, None, None, sites_unavailable) + alice_domain, None, None, sites_unavailable, + system_language) print('send_result: ' + str(send_result)) alice_following_filename = \ @@ -2513,7 +2519,8 @@ def test_group_follow(base_dir: str) -> None: bob_send_threads, bob_post_log, bob_cached_webfingers, bob_person_cache, True, __version__, signing_priv_key_pem, - bob_domain, None, None, sites_unavailable) + bob_domain, None, None, sites_unavailable, + system_language) print('send_result: ' + str(send_result)) bob_following_filename = \ @@ -3328,7 +3335,8 @@ def test_client_to_server(base_dir: str): 'bob', bob_domain, bob_port, http_prefix, cached_webfingers, person_cache, - True, __version__, signing_priv_key_pem) + True, __version__, signing_priv_key_pem, + system_language) alice_petnames_filename = alice_dir + '/accounts/' + \ 'alice@' + alice_domain + '/petnames.txt' alice_following_filename = \ @@ -3369,7 +3377,8 @@ def test_client_to_server(base_dir: str): 'alice', alice_domain, alice_port, http_prefix, cached_webfingers, person_cache, - True, __version__, signing_priv_key_pem) + True, __version__, signing_priv_key_pem, + system_language) for _ in range(20): if os.path.isfile(alice_dir + '/accounts/alice@' + alice_domain + '/followers.txt'): @@ -3458,7 +3467,8 @@ def test_client_to_server(base_dir: str): bob_domain, bob_port, http_prefix, outbox_post_id, cached_webfingers, person_cache, - True, __version__, signing_priv_key_pem) + True, __version__, signing_priv_key_pem, + system_language) for _ in range(20): if os.path.isdir(outbox_path) and os.path.isdir(inbox_path): if len([name for name in os.listdir(outbox_path) @@ -3488,7 +3498,8 @@ def test_client_to_server(base_dir: str): bob_domain, bob_port, http_prefix, outbox_post_id, '😃', cached_webfingers, person_cache, - True, __version__, signing_priv_key_pem) + True, __version__, signing_priv_key_pem, + system_language) for _ in range(20): if os.path.isdir(outbox_path) and os.path.isdir(inbox_path): if len([name for name in os.listdir(outbox_path) @@ -3535,7 +3546,8 @@ def test_client_to_server(base_dir: str): http_prefix, outbox_post_id, cached_webfingers, person_cache, True, __version__, - signing_priv_key_pem) + signing_priv_key_pem, + system_language) for _ in range(30): if os.path.isdir(outbox_path) and os.path.isdir(inbox_path): if len([name for name in os.listdir(outbox_path) @@ -3575,7 +3587,8 @@ def test_client_to_server(base_dir: str): alice_domain, alice_port, http_prefix, outbox_post_id, cached_webfingers, person_cache, - True, __version__, signing_priv_key_pem) + True, __version__, signing_priv_key_pem, + system_language) for _ in range(30): if os.path.isdir(inbox_path): test = len([name for name in os.listdir(inbox_path) @@ -3606,7 +3619,8 @@ def test_client_to_server(base_dir: str): 'bob', bob_domain, bob_port, http_prefix, cached_webfingers, person_cache, - True, __version__, signing_priv_key_pem) + True, __version__, signing_priv_key_pem, + system_language) for _ in range(10): test_str = 'alice@' + alice_domain + ':' + str(alice_port) if not text_in_file(test_str, bob_followers_filename): @@ -6218,6 +6232,7 @@ def test_update_actor(base_dir: str): http_prefix = 'http' proxy_type = None federation_list = [] + system_language = 'en' if os.path.isdir(base_dir + '/.tests'): shutil.rmtree(base_dir + '/.tests', @@ -6299,7 +6314,8 @@ def test_update_actor(base_dir: str): alice_domain, alice_port, http_prefix, cached_webfingers, person_cache, - True, pub_key, signing_priv_key_pem) + True, pub_key, signing_priv_key_pem, + system_language) print('actor update result: ' + str(actor_update)) assert actor_update diff --git a/webapp_post.py b/webapp_post.py index e532cdfc9..fe79f43f6 100644 --- a/webapp_post.py +++ b/webapp_post.py @@ -2120,7 +2120,8 @@ def individual_post_as_html(signing_priv_key_pem: str, project_version, http_prefix, nickname, domain, - 'outbox', 72367) + 'outbox', 72367, + system_language) _log_post_timing(enable_timing_log, post_start_time, '6') diff --git a/webapp_profile.py b/webapp_profile.py index 71f7e269a..fe492e169 100644 --- a/webapp_profile.py +++ b/webapp_profile.py @@ -1420,7 +1420,8 @@ def html_profile(signing_priv_key_pem: str, max_items_per_page, dormant_months, debug, signing_priv_key_pem, - sites_unavailable) + sites_unavailable, + system_language) if show_moved_accounts and selected == 'moved': profile_str += \ _html_profile_following(translate, base_dir, http_prefix, @@ -1434,7 +1435,8 @@ def html_profile(signing_priv_key_pem: str, max_items_per_page, dormant_months, debug, signing_priv_key_pem, - sites_unavailable) + sites_unavailable, + system_language) if selected == 'followers': profile_str += \ _html_profile_following(translate, base_dir, http_prefix, @@ -1445,7 +1447,8 @@ def html_profile(signing_priv_key_pem: str, project_version, ["block"], selected, users_path, page_number, max_items_per_page, dormant_months, debug, - signing_priv_key_pem, sites_unavailable) + signing_priv_key_pem, sites_unavailable, + system_language) if authorized and selected == 'inactive': profile_str += \ _html_profile_following(translate, base_dir, http_prefix, @@ -1456,7 +1459,8 @@ def html_profile(signing_priv_key_pem: str, project_version, ["block"], selected, users_path, page_number, max_items_per_page, dormant_months, debug, - signing_priv_key_pem, sites_unavailable) + signing_priv_key_pem, sites_unavailable, + system_language) if not is_group: if selected == 'roles': profile_str += \ @@ -1588,7 +1592,8 @@ def _html_profile_following(translate: {}, base_dir: str, http_prefix: str, max_items_per_page: int, dormant_months: int, debug: bool, signing_priv_key_pem: str, - sites_unavailable: []) -> str: + sites_unavailable: [], + system_language: str) -> str: """Shows following on the profile screen """ profile_str = '' @@ -1631,7 +1636,7 @@ def _html_profile_following(translate: {}, base_dir: str, http_prefix: str, authorized, nickname, http_prefix, project_version, dormant, offline, - debug, buttons) + debug, system_language, buttons) if authorized and max_items_per_page and page_number: if len(following_json['orderedItems']) >= max_items_per_page: @@ -3149,6 +3154,7 @@ def _individual_follow_as_html(signing_priv_key_pem: str, dormant: bool, offline: bool, debug: bool, + system_language: str, buttons=[]) -> str: """An individual follow entry on the profile screen """ @@ -3187,7 +3193,8 @@ def _individual_follow_as_html(signing_priv_key_pem: str, project_version, http_prefix, follow_url_nickname, - domain, 'outbox', 43036) + domain, 'outbox', 43036, + system_language) if avatar_url2: avatar_url = avatar_url2