diff --git a/daemon.py b/daemon.py index c3ed83122..1db4edd6f 100644 --- a/daemon.py +++ b/daemon.py @@ -519,7 +519,8 @@ class PubServer(BaseHTTPRequestHandler): self.server.system_language, conversation_id, self.server.low_bandwidth, - self.server.content_license_url) + self.server.content_license_url, + self.server.languages_understood) if message_json: # name field contains the answer message_json['object']['name'] = answer @@ -16831,7 +16832,8 @@ class PubServer(BaseHTTPRequestHandler): self.server.system_language, conversation_id, self.server.low_bandwidth, - self.server.content_license_url) + self.server.content_license_url, + self.server.languages_understood) if message_json: if fields['schedulePost']: return 1 @@ -16917,7 +16919,8 @@ class PubServer(BaseHTTPRequestHandler): self.server.system_language, conversation_id, self.server.low_bandwidth, - self.server.content_license_url) + self.server.content_license_url, + self.server.languages_understood) if message_json: if fields['schedulePost']: return 1 @@ -17070,7 +17073,8 @@ class PubServer(BaseHTTPRequestHandler): self.server.system_language, conversation_id, self.server.low_bandwidth, - self.server.content_license_url) + self.server.content_license_url, + self.server.languages_understood) if message_json: if fields['schedulePost']: return 1 @@ -17100,6 +17104,7 @@ class PubServer(BaseHTTPRequestHandler): conversation_id = fields['conversationId'] mentions_message = mentions_str + fields['message'] + languages_understood = self.server.languages_understood message_json = \ create_followers_only_post(self.server.base_dir, nickname, @@ -17123,7 +17128,8 @@ class PubServer(BaseHTTPRequestHandler): self.server.system_language, conversation_id, self.server.low_bandwidth, - self.server.content_license_url) + self.server.content_license_url, + languages_understood) if message_json: if fields['schedulePost']: return 1 @@ -17156,6 +17162,8 @@ class PubServer(BaseHTTPRequestHandler): conversation_id = fields['conversationId'] content_license_url = self.server.content_license_url + languages_understood = self.server.languages_understood + message_json = \ create_direct_message_post(self.server.base_dir, nickname, @@ -17183,7 +17191,8 @@ class PubServer(BaseHTTPRequestHandler): self.server.system_language, conversation_id, self.server.low_bandwidth, - content_license_url) + content_license_url, + languages_understood) if message_json: if fields['schedulePost']: return 1 @@ -17217,6 +17226,7 @@ class PubServer(BaseHTTPRequestHandler): comments_enabled = False conversation_id = None mentions_message = mentions_str + fields['message'] + languages_understood = self.server.languages_understood message_json = \ create_direct_message_post(self.server.base_dir, nickname, @@ -17239,7 +17249,8 @@ class PubServer(BaseHTTPRequestHandler): self.server.system_language, conversation_id, self.server.low_bandwidth, - self.server.content_license_url) + self.server.content_license_url, + languages_understood) if message_json: if fields['schedulePost']: return 1 @@ -17275,7 +17286,8 @@ class PubServer(BaseHTTPRequestHandler): self.server.debug, fields['subject'], self.server.system_language, self.server.low_bandwidth, - self.server.content_license_url) + self.server.content_license_url, + self.server.languages_understood) if message_json: if self._post_to_outbox(message_json, self.server.project_version, @@ -17316,7 +17328,8 @@ class PubServer(BaseHTTPRequestHandler): int_duration, self.server.system_language, self.server.low_bandwidth, - self.server.content_license_url) + self.server.content_license_url, + self.server.languages_understood) if message_json: if self.server.debug: print('DEBUG: new Question') diff --git a/desktop_client.py b/desktop_client.py index ca0fb9108..e502b71dd 100644 --- a/desktop_client.py +++ b/desktop_client.py @@ -418,6 +418,7 @@ def _desktop_reply_to_post(session, post_id: str, cached_webfingers: {}, person_cache: {}, debug: bool, subject: str, screenreader: str, system_language: str, + languages_understood: [], espeak, conversation_id: str, low_bandwidth: bool, content_license_url: str, @@ -474,8 +475,8 @@ def _desktop_reply_to_post(session, post_id: str, comments_enabled, attach, media_type, attached_image_description, city, cached_webfingers, person_cache, is_article, - system_language, low_bandwidth, - content_license_url, + system_language, languages_understood, + low_bandwidth, content_license_url, debug, post_id, post_id, conversation_id, subject) == 0: say_str = 'Reply sent' @@ -490,6 +491,7 @@ def _desktop_new_post(session, cached_webfingers: {}, person_cache: {}, debug: bool, screenreader: str, system_language: str, + languages_understood: [], espeak, low_bandwidth: bool, content_license_url: str, signing_priv_key_pem: str) -> None: @@ -542,8 +544,8 @@ def _desktop_new_post(session, comments_enabled, attach, media_type, attached_image_description, city, cached_webfingers, person_cache, is_article, - system_language, low_bandwidth, - content_license_url, + system_language, languages_understood, + low_bandwidth, content_license_url, debug, None, None, conversation_id, subject) == 0: say_str = 'Post sent' @@ -1137,6 +1139,7 @@ def _desktop_new_dm(session, to_handle: str, cached_webfingers: {}, person_cache: {}, debug: bool, screenreader: str, system_language: str, + languages_understood: [], espeak, low_bandwidth: bool, content_license_url: str, signing_priv_key_pem: str) -> None: @@ -1154,23 +1157,25 @@ def _desktop_new_dm(session, to_handle: str, for handle in handles_list: handle = handle.strip() - _desktop_new_d_mbase(session, handle, + _desktop_new_dm_base(session, handle, base_dir, nickname, password, domain, port, http_prefix, cached_webfingers, person_cache, debug, screenreader, system_language, + languages_understood, espeak, low_bandwidth, content_license_url, signing_priv_key_pem) -def _desktop_new_d_mbase(session, to_handle: str, +def _desktop_new_dm_base(session, to_handle: str, base_dir: str, nickname: str, password: str, domain: str, port: int, http_prefix: str, cached_webfingers: {}, person_cache: {}, debug: bool, screenreader: str, system_language: str, + languages_understood: [], espeak, low_bandwidth: bool, content_license_url: str, signing_priv_key_pem: str) -> None: @@ -1265,8 +1270,8 @@ def _desktop_new_d_mbase(session, to_handle: str, comments_enabled, attach, media_type, attached_image_description, city, cached_webfingers, person_cache, is_article, - system_language, low_bandwidth, - content_license_url, + system_language, languages_understood, + low_bandwidth, content_license_url, debug, None, None, conversation_id, subject) == 0: say_str = 'Direct message sent' @@ -1344,6 +1349,7 @@ def run_desktop_client(base_dir: str, proxy_type: str, http_prefix: str, content_license_url = 'https://creativecommons.org/licenses/by/4.0' blocked_cache = {} + languages_understood = [system_language] indent = ' ' if show_new_posts: @@ -1748,6 +1754,7 @@ def run_desktop_client(base_dir: str, proxy_type: str, http_prefix: str, cached_webfingers, person_cache, debug, subject, screenreader, system_language, + languages_understood, espeak, conversation_id, low_bandwidth, content_license_url, @@ -1785,6 +1792,7 @@ def run_desktop_client(base_dir: str, proxy_type: str, http_prefix: str, cached_webfingers, person_cache, debug, screenreader, system_language, + languages_understood, espeak, low_bandwidth, content_license_url, signing_priv_key_pem) @@ -1797,6 +1805,7 @@ def run_desktop_client(base_dir: str, proxy_type: str, http_prefix: str, cached_webfingers, person_cache, debug, screenreader, system_language, + languages_understood, espeak, low_bandwidth, content_license_url, signing_priv_key_pem) diff --git a/epicyon.py b/epicyon.py index 4cf35b9c9..4b2e57dbd 100644 --- a/epicyon.py +++ b/epicyon.py @@ -1323,6 +1323,7 @@ if args.message: signing_priv_key_pem = None if args.secure_mode: signing_priv_key_pem = get_instance_actor_key(base_dir, domain) + languages_understood = [args.language] print('Sending post to ' + args.sendto) send_post_via_server(signing_priv_key_pem, __version__, @@ -1333,7 +1334,8 @@ if args.message: args.commentsEnabled, attach, media_type, attached_image_description, city, cached_webfingers, person_cache, is_article, - args.language, args.low_bandwidth, + args.language, languages_understood, + args.low_bandwidth, args.content_license_url, args.debug, reply_to, reply_to, args.conversationId, subject) for i in range(10): @@ -2886,6 +2888,7 @@ if args.testdata: test_is_article = False conversation_id = None low_bandwidth = False + languages_understood = [args.language] create_public_post(base_dir, nickname, domain, port, http_prefix, "like this is totally just a #test man", @@ -2899,7 +2902,8 @@ if args.testdata: test_subject, test_schedule_post, test_event_date, test_event_time, test_location, test_is_article, args.language, conversation_id, - low_bandwidth, args.content_license_url) + low_bandwidth, args.content_license_url, + languages_understood) create_public_post(base_dir, nickname, domain, port, http_prefix, "Zoiks!!!", test_followers_only, @@ -2912,7 +2916,8 @@ if args.testdata: test_subject, test_schedule_post, test_event_date, test_event_time, test_location, test_is_article, args.language, conversation_id, - low_bandwidth, args.content_license_url) + low_bandwidth, args.content_license_url, + languages_understood) create_public_post(base_dir, nickname, domain, port, http_prefix, "Hey scoob we need like a hundred more #milkshakes", test_followers_only, @@ -2925,7 +2930,8 @@ if args.testdata: test_subject, test_schedule_post, test_event_date, test_event_time, test_location, test_is_article, args.language, conversation_id, - low_bandwidth, args.content_license_url) + low_bandwidth, args.content_license_url, + languages_understood) create_public_post(base_dir, nickname, domain, port, http_prefix, "Getting kinda spooky around here", test_followers_only, @@ -2938,7 +2944,8 @@ if args.testdata: test_subject, test_schedule_post, test_event_date, test_event_time, test_location, test_is_article, args.language, conversation_id, - low_bandwidth, args.content_license_url) + low_bandwidth, args.content_license_url, + languages_understood) create_public_post(base_dir, nickname, domain, port, http_prefix, "And they would have gotten away with it too" + "if it wasn't for those pesky hackers", @@ -2952,7 +2959,8 @@ if args.testdata: test_subject, test_schedule_post, test_event_date, test_event_time, test_location, test_is_article, args.language, conversation_id, - low_bandwidth, args.content_license_url) + low_bandwidth, args.content_license_url, + languages_understood) create_public_post(base_dir, nickname, domain, port, http_prefix, "man these centralized sites are like the worst!", test_followers_only, @@ -2965,7 +2973,8 @@ if args.testdata: test_subject, test_schedule_post, test_event_date, test_event_time, test_location, test_is_article, args.language, conversation_id, - low_bandwidth, args.content_license_url) + low_bandwidth, args.content_license_url, + languages_understood) create_public_post(base_dir, nickname, domain, port, http_prefix, "another mystery solved #test", test_followers_only, @@ -2978,7 +2987,8 @@ if args.testdata: test_subject, test_schedule_post, test_event_date, test_event_time, test_location, test_is_article, args.language, conversation_id, - low_bandwidth, args.content_license_url) + low_bandwidth, args.content_license_url, + languages_understood) create_public_post(base_dir, nickname, domain, port, http_prefix, "let's go bowling", test_followers_only, @@ -2991,7 +3001,8 @@ if args.testdata: test_subject, test_schedule_post, test_event_date, test_event_time, test_location, test_is_article, args.language, conversation_id, - low_bandwidth, args.content_license_url) + low_bandwidth, args.content_license_url, + languages_understood) domain_full = domain + ':' + str(port) clear_follows(base_dir, nickname, domain) follow_person(base_dir, nickname, domain, 'maxboardroom', domain_full, diff --git a/inbox.py b/inbox.py index 51692f5e0..ba8daf129 100644 --- a/inbox.py +++ b/inbox.py @@ -2825,7 +2825,8 @@ def _bounce_dm(senderPostId: str, session, http_prefix: str, translate: {}, debug: bool, last_bounce_message: [], system_language: str, signing_priv_key_pem: str, - content_license_url: str) -> bool: + content_license_url: str, + languages_understood: []) -> bool: """Sends a bounce message back to the sending handle if a DM has been rejected """ @@ -2886,7 +2887,8 @@ def _bounce_dm(senderPostId: str, session, http_prefix: str, event_date, event_time, location, system_language, conversation_id, low_bandwidth, - content_license_url) + content_license_url, + languages_understood) if not post_json_object: print('WARN: unable to create bounce message to ' + sending_handle) return False @@ -2913,7 +2915,8 @@ def _is_valid_dm(base_dir: str, nickname: str, domain: str, port: int, last_bounce_message: [], handle: str, system_language: str, signing_priv_key_pem: str, - content_license_url: str) -> bool: + content_license_url: str, + languages_understood: []) -> bool: """Is the given message a valid DM? """ if nickname == 'inbox': @@ -2994,7 +2997,8 @@ def _is_valid_dm(base_dir: str, nickname: str, domain: str, port: int, last_bounce_message, system_language, signing_priv_key_pem, - content_license_url) + content_license_url, + languages_understood) return False # dm index will be updated @@ -3233,7 +3237,8 @@ def _inbox_after_initial(recent_posts_cache: {}, max_recent_posts: int, signing_priv_key_pem: str, default_reply_interval_hrs: int, cw_lists: {}, lists_enabled: str, - content_license_url: str) -> bool: + content_license_url: str, + languages_understood: []) -> bool: """ Anything which needs to be done after initial checks have passed """ actor = key_id @@ -3516,7 +3521,8 @@ def _inbox_after_initial(recent_posts_cache: {}, max_recent_posts: int, last_bounce_message, handle, system_language, signing_priv_key_pem, - content_license_url): + content_license_url, + languages_understood): return False # get the actor being replied to @@ -4530,6 +4536,7 @@ def run_inbox_queue(recent_posts_cache: {}, max_recent_posts: int, for handle, _ in recipients_dict.items(): destination = \ queue_json['destination'].replace(inbox_handle, handle) + languages_understood = [system_language] _inbox_after_initial(recent_posts_cache, max_recent_posts, session, key_id, handle, @@ -4558,7 +4565,8 @@ def run_inbox_queue(recent_posts_cache: {}, max_recent_posts: int, signing_priv_key_pem, default_reply_interval_hrs, cw_lists, lists_enabled, - content_license_url) + content_license_url, + languages_understood) if debug: pprint(queue_json['post']) print('Queue: Queue post accepted') diff --git a/newsdaemon.py b/newsdaemon.py index 7233eab66..9397ff5de 100644 --- a/newsdaemon.py +++ b/newsdaemon.py @@ -641,6 +641,7 @@ def _convert_rss_to_activitypub(base_dir: str, http_prefix: str, image_description = None city = 'London, England' conversation_id = None + languages_understood = [system_language] blog = create_news_post(base_dir, domain, port, http_prefix, rss_description, @@ -649,7 +650,8 @@ def _convert_rss_to_activitypub(base_dir: str, http_prefix: str, image_description, city, rss_title, system_language, conversation_id, low_bandwidth, - content_license_url) + content_license_url, + languages_understood) if not blog: continue diff --git a/posts.py b/posts.py index fc0018ecb..4cb6abf95 100644 --- a/posts.py +++ b/posts.py @@ -32,6 +32,7 @@ from webfinger import webfinger_handle from httpsig import create_signed_header from siteactive import site_is_active from languages import understood_post_language +from utils import get_summary_from_post from utils import get_user_paths from utils import invalid_ciphertext from utils import has_object_stringType @@ -1054,7 +1055,9 @@ def _add_auto_cw(base_dir: str, nickname: str, domain: str, def _create_post_cw_from_reply(base_dir: str, nickname: str, domain: str, in_reply_to: str, - sensitive: bool, summary: str) -> (bool, str): + sensitive: bool, summary: str, + system_language: str, + languages_understood: []) -> (bool, str): """If this is a reply and the original post has a CW then use the same CW """ @@ -1072,7 +1075,11 @@ def _create_post_cw_from_reply(base_dir: str, nickname: str, domain: str, if reply_to_json['object']['sensitive']: sensitive = True if reply_to_json['object'].get('summary'): - summary = reply_to_json['object']['summary'] + summary = \ + get_summary_from_post(reply_to_json, + system_language, + languages_understood) + return sensitive, summary @@ -1399,7 +1406,8 @@ def _create_post_base(base_dir: str, event_status: str, ticket_url: str, system_language: str, conversation_id: str, low_bandwidth: bool, - content_license_url: str) -> {}: + content_license_url: str, + languages_understood: []) -> {}: """Creates a message """ content = remove_invalid_chars(content) @@ -1486,7 +1494,8 @@ def _create_post_base(base_dir: str, sensitive, summary = \ _create_post_cw_from_reply(base_dir, nickname, domain, - in_reply_to, sensitive, summary) + in_reply_to, sensitive, summary, + system_language, languages_understood) event_date_str = \ _create_post_place_and_time(event_date, end_date, @@ -1791,7 +1800,8 @@ def create_public_post(base_dir: str, is_article: bool, system_language: str, conversation_id: str, low_bandwidth: bool, - content_license_url: str) -> {}: + content_license_url: str, + languages_understood: []) -> {}: """Public post """ domain_full = get_full_domain(domain, port) @@ -1825,7 +1835,8 @@ def create_public_post(base_dir: str, anonymous_participation_enabled, event_status, ticket_url, system_language, conversation_id, low_bandwidth, - content_license_url) + content_license_url, + languages_understood) def _append_citations_to_blog_post(base_dir: str, @@ -1869,7 +1880,8 @@ def create_blog_post(base_dir: str, event_date: str, event_time: str, location: str, system_language: str, conversation_id: str, low_bandwidth: bool, - content_license_url: str) -> {}: + content_license_url: str, + languages_understood: []) -> {}: blog_json = \ create_public_post(base_dir, nickname, domain, port, http_prefix, @@ -1881,7 +1893,8 @@ def create_blog_post(base_dir: str, schedule_post, event_date, event_time, location, True, system_language, conversation_id, - low_bandwidth, content_license_url) + low_bandwidth, content_license_url, + languages_understood) blog_json['object']['url'] = \ blog_json['object']['url'].replace('/@', '/users/') _append_citations_to_blog_post(base_dir, nickname, domain, blog_json) @@ -1896,7 +1909,8 @@ def create_news_post(base_dir: str, image_description: str, city: str, subject: str, system_language: str, conversation_id: str, low_bandwidth: bool, - content_license_url: str) -> {}: + content_license_url: str, + languages_understood: []) -> {}: client_to_server = False in_reply_to = None in_reply_to_atom_uri = None @@ -1915,7 +1929,8 @@ def create_news_post(base_dir: str, schedule_post, event_date, event_time, location, True, system_language, conversation_id, - low_bandwidth, content_license_url) + low_bandwidth, content_license_url, + languages_understood) blog['object']['type'] = 'Article' return blog @@ -1930,7 +1945,8 @@ def create_question_post(base_dir: str, image_description: str, city: str, subject: str, durationDays: int, system_language: str, low_bandwidth: bool, - content_license_url: str) -> {}: + content_license_url: str, + languages_understood: []) -> {}: """Question post with multiple choice options """ domain_full = get_full_domain(domain, port) @@ -1947,7 +1963,8 @@ def create_question_post(base_dir: str, False, None, None, None, None, None, None, None, None, None, None, None, None, None, system_language, - None, low_bandwidth, content_license_url) + None, low_bandwidth, content_license_url, + languages_understood) message_json['object']['type'] = 'Question' message_json['object']['oneOf'] = [] message_json['object']['votersCount'] = 0 @@ -1982,7 +1999,8 @@ def create_unlisted_post(base_dir: str, event_date: str, event_time: str, location: str, system_language: str, conversation_id: str, low_bandwidth: bool, - content_license_url: str) -> {}: + content_license_url: str, + languages_understood: []) -> {}: """Unlisted post. This has the #Public and followers links inverted. """ domain_full = get_full_domain(domain, port) @@ -2001,7 +2019,7 @@ def create_unlisted_post(base_dir: str, None, None, None, None, None, None, None, None, None, None, system_language, conversation_id, low_bandwidth, - content_license_url) + content_license_url, languages_understood) def create_followers_only_post(base_dir: str, @@ -2018,7 +2036,8 @@ def create_followers_only_post(base_dir: str, event_date: str, event_time: str, location: str, system_language: str, conversation_id: str, low_bandwidth: bool, - content_license_url: str) -> {}: + content_license_url: str, + languages_understood: []) -> {}: """Followers only post """ domain_full = get_full_domain(domain, port) @@ -2036,7 +2055,7 @@ def create_followers_only_post(base_dir: str, None, None, None, None, None, None, None, None, None, None, system_language, conversation_id, low_bandwidth, - content_license_url) + content_license_url, languages_understood) def get_mentioned_people(base_dir: str, http_prefix: str, @@ -2090,7 +2109,8 @@ def create_direct_message_post(base_dir: str, event_date: str, event_time: str, location: str, system_language: str, conversation_id: str, low_bandwidth: bool, - content_license_url: str) -> {}: + content_license_url: str, + languages_understood: []) -> {}: """Direct Message post """ content = resolve_petnames(base_dir, nickname, domain, content) @@ -2115,7 +2135,7 @@ def create_direct_message_post(base_dir: str, None, None, None, None, None, None, None, None, None, None, system_language, conversation_id, low_bandwidth, - content_license_url) + content_license_url, languages_understood) # mentioned recipients go into To rather than Cc message_json['to'] = message_json['object']['cc'] message_json['object']['to'] = message_json['to'] @@ -2136,7 +2156,8 @@ def create_report_post(base_dir: str, image_description: str, city: str, debug: bool, subject: str, system_language: str, low_bandwidth: bool, - content_license_url: str) -> {}: + content_license_url: str, + languages_understood: []) -> {}: """Send a report to moderators """ domain_full = get_full_domain(domain, port) @@ -2212,7 +2233,8 @@ def create_report_post(base_dir: str, False, None, None, None, None, None, None, None, None, None, None, None, None, None, system_language, - None, low_bandwidth, content_license_url) + None, low_bandwidth, content_license_url, + languages_understood) if not post_json_object: continue @@ -2306,6 +2328,7 @@ def send_post(signing_priv_key_pem: str, project_version: str, federation_list: [], send_threads: [], post_log: [], cached_webfingers: {}, person_cache: {}, is_article: bool, system_language: str, + languages_understood: [], shared_items_federated_domains: [], shared_item_federation_tokens: {}, low_bandwidth: bool, content_license_url: str, @@ -2375,7 +2398,7 @@ def send_post(signing_priv_key_pem: str, project_version: str, None, None, None, None, None, None, None, None, system_language, conversation_id, low_bandwidth, - content_license_url) + content_license_url, languages_understood) # get the senders private key private_key_pem = _get_person_key(nickname, domain, base_dir, 'private') @@ -2457,6 +2480,7 @@ def send_post_via_server(signing_priv_key_pem: str, project_version: str, image_description: str, city: str, cached_webfingers: {}, person_cache: {}, is_article: bool, system_language: str, + languages_understood: [], low_bandwidth: bool, content_license_url: str, debug: bool = False, @@ -2547,7 +2571,7 @@ def send_post_via_server(signing_priv_key_pem: str, project_version: str, None, None, None, None, None, None, None, None, system_language, conversation_id, low_bandwidth, - content_license_url) + content_license_url, languages_understood) auth_header = create_basic_auth_header(from_nickname, password) diff --git a/tests.py b/tests.py index 3df4f5c56..bfc89fbd5 100644 --- a/tests.py +++ b/tests.py @@ -703,6 +703,7 @@ def create_server_alice(path: str, domain: str, port: int, os.chdir(path) shared_items_federated_domains = [] system_language = 'en' + languages_understood = [system_language] nickname = 'alice' http_prefix = 'http' proxy_type = None @@ -760,7 +761,8 @@ def create_server_alice(path: str, domain: str, port: int, test_subject, test_schedule_post, test_event_date, test_event_time, test_location, test_is_article, system_language, conversation_id, - low_bandwidth, content_license_url) + low_bandwidth, content_license_url, + languages_understood) create_public_post(path, nickname, domain, port, http_prefix, "Curiouser and curiouser!", test_followers_only, @@ -774,7 +776,8 @@ def create_server_alice(path: str, domain: str, port: int, test_subject, test_schedule_post, test_event_date, test_event_time, test_location, test_is_article, system_language, conversation_id, - low_bandwidth, content_license_url) + low_bandwidth, content_license_url, + languages_understood) create_public_post(path, nickname, domain, port, http_prefix, "In the gardens of memory, in the palace " + "of dreams, that is where you and I shall meet", @@ -789,7 +792,8 @@ def create_server_alice(path: str, domain: str, port: int, test_subject, test_schedule_post, test_event_date, test_event_time, test_location, test_is_article, system_language, conversation_id, - low_bandwidth, content_license_url) + low_bandwidth, content_license_url, + languages_understood) regenerate_index_for_box(path, nickname, domain, 'outbox') global TEST_SERVER_ALICE_RUNNING TEST_SERVER_ALICE_RUNNING = True @@ -853,6 +857,7 @@ def create_server_bob(path: str, domain: str, port: int, os.chdir(path) shared_items_federated_domains = [] system_language = 'en' + languages_understood = [system_language] nickname = 'bob' http_prefix = 'http' proxy_type = None @@ -909,7 +914,8 @@ def create_server_bob(path: str, domain: str, port: int, test_subject, test_schedule_post, test_event_date, test_event_time, test_location, test_is_article, system_language, conversation_id, - low_bandwidth, content_license_url) + low_bandwidth, content_license_url, + languages_understood) create_public_post(path, nickname, domain, port, http_prefix, "One of the things I've realised is that " + "I am very simple", @@ -924,7 +930,8 @@ def create_server_bob(path: str, domain: str, port: int, test_subject, test_schedule_post, test_event_date, test_event_time, test_location, test_is_article, system_language, conversation_id, - low_bandwidth, content_license_url) + low_bandwidth, content_license_url, + languages_understood) create_public_post(path, nickname, domain, port, http_prefix, "Quantum physics is a bit of a passion of mine", test_followers_only, @@ -938,7 +945,8 @@ def create_server_bob(path: str, domain: str, port: int, test_subject, test_schedule_post, test_event_date, test_event_time, test_location, test_is_article, system_language, conversation_id, - low_bandwidth, content_license_url) + low_bandwidth, content_license_url, + languages_understood) regenerate_index_for_box(path, nickname, domain, 'outbox') global TEST_SERVER_BOB_RUNNING TEST_SERVER_BOB_RUNNING = True @@ -1154,6 +1162,7 @@ def test_post_message_between_servers(base_dir: str) -> None: TEST_SERVER_BOB_RUNNING = False system_language = 'en' + languages_understood = [system_language] http_prefix = 'http' proxy_type = None content_license_url = 'https://creativecommons.org/licenses/by/4.0' @@ -1258,6 +1267,7 @@ def test_post_message_between_servers(base_dir: str) -> None: attached_image_description, city, federation_list, alice_send_threads, alice_post_log, alice_cached_webfingers, alice_person_cache, is_article, system_language, + languages_understood, alice_shared_items_federated_domains, alice_shared_item_federation_tokens, low_bandwidth, content_license_url, @@ -1478,6 +1488,7 @@ def test_follow_between_servers(base_dir: str) -> None: TEST_SERVER_BOB_RUNNING = False system_language = 'en' + languages_understood = [system_language] http_prefix = 'http' proxy_type = None federation_list = [] @@ -1620,6 +1631,7 @@ def test_follow_between_servers(base_dir: str) -> None: None, None, None, city, federation_list, alice_send_threads, alice_post_log, alice_cached_webfingers, alice_person_cache, is_article, system_language, + languages_understood, alice_shared_items_federated_domains, alice_shared_item_federation_tokens, low_bandwidth, content_license_url, @@ -1668,6 +1680,7 @@ def test_shared_items_federation(base_dir: str) -> None: TEST_SERVER_BOB_RUNNING = False system_language = 'en' + languages_understood = [system_language] http_prefix = 'http' proxy_type = None federation_list = [] @@ -1980,6 +1993,7 @@ def test_shared_items_federation(base_dir: str) -> None: None, None, None, city, federation_list, alice_send_threads, alice_post_log, alice_cached_webfingers, alice_person_cache, is_article, system_language, + languages_understood, alice_shared_items_federated_domains, alice_shared_item_federation_tokens, low_bandwidth, content_license_url, True, @@ -2078,6 +2092,7 @@ def test_group_follow(base_dir: str) -> None: global TEST_SERVER_BOB_RUNNING global TEST_SERVER_GROUP_RUNNING system_language = 'en' + languages_understood = [system_language] TEST_SERVER_ALICE_RUNNING = False TEST_SERVER_BOB_RUNNING = False TEST_SERVER_GROUP_RUNNING = False @@ -2405,6 +2420,7 @@ def test_group_follow(base_dir: str) -> None: None, None, None, city, federation_list, alice_send_threads, alice_post_log, alice_cached_webfingers, alice_person_cache, is_article, system_language, + languages_understood, alice_shared_items_federated_domains, alice_shared_item_federation_tokens, low_bandwidth, content_license_url, @@ -2730,6 +2746,7 @@ def _test_follows(base_dir: str) -> None: def _test_create_person_account(base_dir: str): print('test_create_person_account') system_language = 'en' + languages_understood = [system_language] curr_dir = base_dir nickname = 'test382' domain = 'badgerdomain.com' @@ -2782,7 +2799,8 @@ def _test_create_person_account(base_dir: str): test_subject, test_schedule_post, test_event_date, test_event_time, test_location, test_is_article, system_language, conversation_id, - low_bandwidth, content_license_url) + low_bandwidth, content_license_url, + languages_understood) os.chdir(curr_dir) shutil.rmtree(base_dir, ignore_errors=False, onerror=None) @@ -2850,6 +2868,7 @@ def test_client_to_server(base_dir: str): TEST_SERVER_BOB_RUNNING = False system_language = 'en' + languages_understood = [system_language] http_prefix = 'http' proxy_type = None federation_list = [] @@ -2962,8 +2981,8 @@ def test_client_to_server(base_dir: str): attached_image_filename, media_type, attached_image_description, city, cached_webfingers, person_cache, is_article, - system_language, low_bandwidth, - content_license_url, + system_language, languages_understood, + low_bandwidth, content_license_url, True, None, None, conversation_id, None) print('send_result: ' + str(send_result)) @@ -4303,6 +4322,7 @@ def _test_mentioned_people(base_dir: str) -> None: def _test_reply_to_public_post(base_dir: str) -> None: system_language = 'en' + languages_understood = [system_language] nickname = 'test7492362' domain = 'other.site' port = 443 @@ -4339,7 +4359,8 @@ def _test_reply_to_public_post(base_dir: str) -> None: test_subject, test_schedule_post, test_event_date, test_event_time, test_location, test_is_article, system_language, conversation_id, - low_bandwidth, content_license_url) + low_bandwidth, content_license_url, + languages_understood) # print(str(reply)) assert reply['object']['content'] == \ '

' + \ @@ -5106,6 +5127,7 @@ def _test_functions(): def _test_links_within_post(base_dir: str) -> None: print('test_links_within_post') system_language = 'en' + languages_understood = [system_language] nickname = 'test27636' domain = 'rando.site' port = 443 @@ -5142,7 +5164,8 @@ def _test_links_within_post(base_dir: str) -> None: test_subject, test_schedule_post, test_event_date, test_event_time, test_location, test_is_article, system_language, conversation_id, - low_bandwidth, content_license_url) + low_bandwidth, content_license_url, + languages_understood) assert post_json_object['object']['content'] == \ '

This is a test post with links.

' + \ @@ -5179,7 +5202,8 @@ def _test_links_within_post(base_dir: str) -> None: test_subject, test_schedule_post, test_event_date, test_event_time, test_location, test_is_article, system_language, conversation_id, - low_bandwidth, content_license_url) + low_bandwidth, content_license_url, + languages_understood) assert post_json_object['object']['content'] == content assert post_json_object['object']['contentMap'][system_language] == content @@ -6100,6 +6124,7 @@ def _translate_ontology(base_dir: str) -> None: def _test_can_replyto(base_dir: str) -> None: print('test_can_reply_to') system_language = 'en' + languages_understood = [system_language] nickname = 'test27637' domain = 'rando.site' port = 443 @@ -6136,7 +6161,8 @@ def _test_can_replyto(base_dir: str) -> None: test_subject, test_schedule_post, test_event_date, test_event_time, test_location, test_is_article, system_language, conversation_id, - low_bandwidth, content_license_url) + low_bandwidth, content_license_url, + languages_understood) # set the date on the post curr_date_str = "2021-09-08T20:45:00Z" post_json_object['published'] = curr_date_str