diff --git a/daemon.py b/daemon.py index e24141991..07cb308e0 100644 --- a/daemon.py +++ b/daemon.py @@ -675,6 +675,7 @@ class PubServer(BaseHTTPRequestHandler): location = None conversation_id = None buy_url = '' + chat_url = '' city = get_spoofed_city(self.server.city, self.server.base_dir, nickname, self.server.domain) @@ -715,7 +716,8 @@ class PubServer(BaseHTTPRequestHandler): self.server.dm_license_url, self.server.content_license_url, '', languages_understood, False, - self.server.translate, buy_url) + self.server.translate, buy_url, + chat_url) if message_json: # NOTE: content and contentMap are not required, but we will keep # them in there so that the post does not get filtered out by @@ -21249,6 +21251,10 @@ class PubServer(BaseHTTPRequestHandler): if fields.get('buyUrl'): buy_url = fields['buyUrl'] + chat_url = '' + if fields.get('chatUrl'): + chat_url = fields['chatUrl'] + if post_type == 'newpost': if not fields.get('pinToProfile'): pin_to_profile = False @@ -21313,7 +21319,8 @@ class PubServer(BaseHTTPRequestHandler): self.server.content_license_url, media_license_url, media_creator, languages_understood, - self.server.translate, buy_url) + self.server.translate, buy_url, + chat_url) if message_json: if edited_postid: recent_posts_cache = self.server.recent_posts_cache @@ -21468,7 +21475,8 @@ class PubServer(BaseHTTPRequestHandler): self.server.content_license_url, media_license_url, media_creator, languages_understood, - self.server.translate, buy_url) + self.server.translate, buy_url, + chat_url) if message_json: if fields['schedulePost']: return 1 @@ -21660,7 +21668,8 @@ class PubServer(BaseHTTPRequestHandler): self.server.content_license_url, media_license_url, media_creator, languages_understood, - self.server.translate, buy_url) + self.server.translate, buy_url, + chat_url) if message_json: if edited_postid: recent_posts_cache = self.server.recent_posts_cache @@ -21787,7 +21796,7 @@ class PubServer(BaseHTTPRequestHandler): media_creator, languages_understood, self.server.translate, - buy_url) + buy_url, chat_url) if message_json: if edited_postid: recent_posts_cache = self.server.recent_posts_cache @@ -21927,7 +21936,7 @@ class PubServer(BaseHTTPRequestHandler): languages_understood, reply_is_chat, self.server.translate, - buy_url) + buy_url, chat_url) if message_json: print('DEBUG: posting DM edited_postid ' + str(edited_postid)) @@ -22059,7 +22068,7 @@ class PubServer(BaseHTTPRequestHandler): media_creator, languages_understood, False, self.server.translate, - buy_url) + buy_url, chat_url) if message_json: if fields['schedulePost']: return 1 diff --git a/desktop_client.py b/desktop_client.py index 24c3bb295..67175b4bb 100644 --- a/desktop_client.py +++ b/desktop_client.py @@ -530,6 +530,7 @@ def _desktop_reply_to_post(session, post_id: str, event_end_time = None location = None buy_url = '' + chat_url = '' video_transcript = None _say_command(say_str, say_str, screenreader, system_language, espeak) if send_post_via_server(signing_priv_key_pem, __version__, @@ -545,7 +546,8 @@ def _desktop_reply_to_post(session, post_id: str, low_bandwidth, content_license_url, media_license_url, media_creator, event_date, event_time, event_end_time, location, - translate, buy_url, debug, post_id, post_id, + translate, buy_url, chat_url, + debug, post_id, post_id, conversation_id, subject) == 0: say_str = 'Reply sent' else: @@ -609,6 +611,7 @@ def _desktop_new_post(session, event_end_time = None location = None buy_url = '' + chat_url = '' video_transcript = None _say_command(say_str, say_str, screenreader, system_language, espeak) if send_post_via_server(signing_priv_key_pem, __version__, @@ -623,7 +626,7 @@ def _desktop_new_post(session, low_bandwidth, content_license_url, media_license_url, media_creator, event_date, event_time, event_end_time, location, - translate, buy_url, debug, None, None, + translate, buy_url, chat_url, debug, None, None, conversation_id, subject) == 0: say_str = 'Post sent' else: @@ -1360,6 +1363,7 @@ def _desktop_new_dm_base(session, to_handle: str, event_end_time = None location = None buy_url = '' + chat_url = '' video_transcript = None say_str = 'Sending' @@ -1376,7 +1380,7 @@ def _desktop_new_dm_base(session, to_handle: str, low_bandwidth, content_license_url, media_license_url, media_creator, event_date, event_time, event_end_time, location, - translate, buy_url, debug, None, None, + translate, buy_url, chat_url, debug, None, None, conversation_id, subject) == 0: say_str = 'Direct message sent' else: diff --git a/epicyon.py b/epicyon.py index 8e0302aa1..5f47d71df 100644 --- a/epicyon.py +++ b/epicyon.py @@ -153,6 +153,9 @@ def _command_options() -> None: parser.add_argument('--eventLocation', type=str, default=None, help='Location for an event when sending a c2s post') + parser.add_argument('--chatUrl', type=str, + default=None, + help='Chat link attachment on a post') parser.add_argument('--buyUrl', type=str, default=None, help='Link for buying something') @@ -1759,7 +1762,7 @@ def _command_options() -> None: argb.media_license_url, argb.media_creator, argb.eventDate, argb.eventTime, argb.eventEndTime, argb.eventLocation, translate, argb.buyUrl, - argb.debug, + argb.chatUrl, argb.debug, reply_to, reply_to, argb.conversationId, subject) for _ in range(10): # TODO detect send success/fail @@ -3489,6 +3492,7 @@ def _command_options() -> None: languages_understood = [argb.language] translate = {} buy_url = '' + chat_url = '' test_video_transcript = '' create_public_post(base_dir, nickname, domain, port, http_prefix, @@ -3506,7 +3510,7 @@ def _command_options() -> None: test_is_article, argb.language, conversation_id, low_bandwidth, argb.content_license_url, argb.media_license_url, argb.media_creator, - languages_understood, translate, buy_url) + languages_understood, translate, buy_url, chat_url) create_public_post(base_dir, nickname, domain, port, http_prefix, "Zoiks!!!", test_save_to_file, @@ -3522,7 +3526,7 @@ def _command_options() -> None: test_is_article, argb.language, conversation_id, low_bandwidth, argb.content_license_url, argb.media_license_url, argb.media_creator, - languages_understood, translate, buy_url) + languages_understood, translate, buy_url, chat_url) create_public_post(base_dir, nickname, domain, port, http_prefix, "Hey scoob we need like a hundred more #milkshakes", test_save_to_file, @@ -3538,7 +3542,7 @@ def _command_options() -> None: test_is_article, argb.language, conversation_id, low_bandwidth, argb.content_license_url, argb.media_license_url, argb.media_creator, - languages_understood, translate, buy_url) + languages_understood, translate, buy_url, chat_url) create_public_post(base_dir, nickname, domain, port, http_prefix, "Getting kinda spooky around here", test_save_to_file, @@ -3554,7 +3558,7 @@ def _command_options() -> None: test_is_article, argb.language, conversation_id, low_bandwidth, argb.content_license_url, argb.media_license_url, argb.media_creator, - languages_understood, translate, buy_url) + languages_understood, translate, buy_url, chat_url) 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", @@ -3571,7 +3575,7 @@ def _command_options() -> None: test_is_article, argb.language, conversation_id, low_bandwidth, argb.content_license_url, argb.media_license_url, argb.media_creator, - languages_understood, translate, buy_url) + languages_understood, translate, buy_url, chat_url) create_public_post(base_dir, nickname, domain, port, http_prefix, "man these centralized sites are like the worst!", test_save_to_file, @@ -3587,7 +3591,7 @@ def _command_options() -> None: test_is_article, argb.language, conversation_id, low_bandwidth, argb.content_license_url, argb.media_license_url, argb.media_creator, - languages_understood, translate, buy_url) + languages_understood, translate, buy_url, chat_url) create_public_post(base_dir, nickname, domain, port, http_prefix, "another mystery solved #test", test_save_to_file, @@ -3603,7 +3607,7 @@ def _command_options() -> None: test_is_article, argb.language, conversation_id, low_bandwidth, argb.content_license_url, argb.media_license_url, argb.media_creator, - languages_understood, translate, buy_url) + languages_understood, translate, buy_url, chat_url) create_public_post(base_dir, nickname, domain, port, http_prefix, "let's go bowling", test_save_to_file, @@ -3619,7 +3623,7 @@ def _command_options() -> None: test_is_article, argb.language, conversation_id, low_bandwidth, argb.content_license_url, argb.media_license_url, argb.media_creator, - languages_understood, translate, buy_url) + languages_understood, translate, buy_url, chat_url) 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 77c1491dd..cfed7aa74 100644 --- a/inbox.py +++ b/inbox.py @@ -3889,6 +3889,7 @@ def _bounce_dm(sender_post_id: str, session, http_prefix: str, conversation_id = None low_bandwidth = False buy_url = '' + chat_url = '' post_json_object = \ create_direct_message_post(base_dir, nickname, domain, port, http_prefix, content, @@ -3903,7 +3904,7 @@ def _bounce_dm(sender_post_id: str, session, http_prefix: str, low_bandwidth, dm_license_url, dm_license_url, '', languages_understood, bounce_is_chat, - translate, buy_url) + translate, buy_url, chat_url) if not post_json_object: print('WARN: unable to create bounce message to ' + sending_handle) return False diff --git a/newsdaemon.py b/newsdaemon.py index b699db534..aebee455f 100644 --- a/newsdaemon.py +++ b/newsdaemon.py @@ -640,6 +640,7 @@ def _convert_rss_to_activitypub(base_dir: str, http_prefix: str, conversation_id = None languages_understood = [system_language] buy_url = '' + chat_url = '' blog = create_news_post(base_dir, domain, port, http_prefix, rss_description, @@ -651,7 +652,7 @@ def _convert_rss_to_activitypub(base_dir: str, http_prefix: str, content_license_url, media_license_url, media_creator, languages_understood, translate, - buy_url) + buy_url, chat_url) if not blog: continue diff --git a/posts.py b/posts.py index 560dfdb48..3d7a638ae 100644 --- a/posts.py +++ b/posts.py @@ -1188,6 +1188,26 @@ def _attach_buy_link(post_json_object: {}, }) +def _attach_chat_link(post_json_object: {}, + chat_url: str, translate: {}) -> None: + """Attaches a chat link + """ + if not chat_url: + return + if '://' not in chat_url: + return + if ' ' in chat_url or '<' in chat_url: + return + if 'attachment' not in post_json_object: + post_json_object['attachment'] = [] + post_json_object['attachment'].append({ + "type": "Link", + "name": "Chat", + "href": chat_url, + "rel": "discussion" + }) + + def _create_post_s2s(base_dir: str, nickname: str, domain: str, port: int, http_prefix: str, content: str, status_number: str, published: str, new_post_id: str, post_context: {}, @@ -1201,7 +1221,7 @@ def _create_post_s2s(base_dir: str, nickname: str, domain: str, port: int, conversation_id: str, low_bandwidth: bool, content_license_url: str, media_license_url: str, media_creator: str, - buy_url: str, translate: {}) -> {}: + buy_url: str, chat_url: str, translate: {}) -> {}: """Creates a new server-to-server post """ actor_url = local_actor_url(http_prefix, nickname, domain) @@ -1268,6 +1288,7 @@ def _create_post_s2s(base_dir: str, nickname: str, domain: str, port: int, media_license_url, media_creator, system_language) _attach_post_license(new_post['object'], content_license_url) _attach_buy_link(new_post['object'], buy_url, translate) + _attach_chat_link(new_post['object'], chat_url, translate) return new_post @@ -1283,7 +1304,8 @@ def _create_post_c2s(base_dir: str, nickname: str, domain: str, port: int, in_reply_to_atom_uri: str, system_language: str, conversation_id: str, low_bandwidth: str, content_license_url: str, media_license_url: str, - media_creator: str, buy_url: str, translate: {}) -> {}: + media_creator: str, buy_url: str, chat_url: str, + translate: {}) -> {}: """Creates a new client-to-server post """ domain_full = get_full_domain(domain, port) @@ -1341,6 +1363,7 @@ def _create_post_c2s(base_dir: str, nickname: str, domain: str, port: int, system_language) _attach_post_license(new_post, content_license_url) _attach_buy_link(new_post, buy_url, translate) + _attach_chat_link(new_post, chat_url, translate) return new_post @@ -1561,7 +1584,7 @@ def _create_post_base(base_dir: str, content_license_url: str, media_license_url: str, media_creator: str, languages_understood: [], translate: {}, - buy_url: str) -> {}: + buy_url: str, chat_url: str) -> {}: """Creates a message """ content = remove_invalid_chars(content) @@ -1723,7 +1746,8 @@ def _create_post_base(base_dir: str, in_reply_to_atom_uri, system_language, conversation_id, low_bandwidth, content_license_url, media_license_url, - media_creator, buy_url, translate) + media_creator, buy_url, chat_url, + translate) else: new_post = \ _create_post_c2s(base_dir, nickname, domain, port, @@ -1738,7 +1762,8 @@ def _create_post_base(base_dir: str, in_reply_to_atom_uri, system_language, conversation_id, low_bandwidth, content_license_url, media_license_url, - media_creator, buy_url, translate) + media_creator, buy_url, chat_url, + translate) _create_post_mentions(cc_url, new_post, to_recipients, tags) @@ -1981,7 +2006,7 @@ def create_public_post(base_dir: str, content_license_url: str, media_license_url: str, media_creator: str, languages_understood: [], translate: {}, - buy_url: str) -> {}: + buy_url: str, chat_url: str) -> {}: """Public post """ domain_full = get_full_domain(domain, port) @@ -2016,7 +2041,8 @@ def create_public_post(base_dir: str, conversation_id, low_bandwidth, content_license_url, media_license_url, media_creator, - languages_understood, translate, buy_url) + languages_understood, translate, buy_url, + chat_url) def _append_citations_to_blog_post(base_dir: str, @@ -2063,7 +2089,7 @@ def create_blog_post(base_dir: str, content_license_url: str, media_license_url: str, media_creator: str, languages_understood: [], translate: {}, - buy_url: str) -> {}: + buy_url: str, chat_url: str) -> {}: blog_json = \ create_public_post(base_dir, nickname, domain, port, http_prefix, @@ -2077,7 +2103,7 @@ def create_blog_post(base_dir: str, True, system_language, conversation_id, low_bandwidth, content_license_url, media_license_url, media_creator, - languages_understood, translate, buy_url) + languages_understood, translate, buy_url, chat_url) if '/@/' not in blog_json['object']['url']: blog_json['object']['url'] = \ blog_json['object']['url'].replace('/@', '/users/') @@ -2096,7 +2122,7 @@ def create_news_post(base_dir: str, content_license_url: str, media_license_url: str, media_creator: str, languages_understood: [], translate: {}, - buy_url: str) -> {}: + buy_url: str, chat_url: str) -> {}: client_to_server = False in_reply_to = None in_reply_to_atom_uri = None @@ -2118,7 +2144,7 @@ def create_news_post(base_dir: str, True, system_language, conversation_id, low_bandwidth, content_license_url, media_license_url, media_creator, - languages_understood, translate, buy_url) + languages_understood, translate, buy_url, chat_url) blog['object']['type'] = 'Article' return blog @@ -2141,6 +2167,7 @@ def create_question_post(base_dir: str, domain_full = get_full_domain(domain, port) local_actor = local_actor_url(http_prefix, nickname, domain_full) buy_url = '' + chat_url = '' message_json = \ _create_post_base(base_dir, nickname, domain, port, 'https://www.w3.org/ns/activitystreams#Public', @@ -2155,7 +2182,8 @@ def create_question_post(base_dir: str, None, None, None, None, None, system_language, None, low_bandwidth, content_license_url, media_license_url, media_creator, - languages_understood, translate, buy_url) + languages_understood, translate, buy_url, + chat_url) message_json['object']['type'] = 'Question' message_json['object']['oneOf'] = [] message_json['object']['votersCount'] = 0 @@ -2193,7 +2221,7 @@ def create_unlisted_post(base_dir: str, content_license_url: str, media_license_url: str, media_creator: str, languages_understood: [], translate: {}, - buy_url: str) -> {}: + buy_url: str, chat_url: str) -> {}: """Unlisted post. This has the #Public and followers links inverted. """ domain_full = get_full_domain(domain, port) @@ -2214,7 +2242,8 @@ def create_unlisted_post(base_dir: str, conversation_id, low_bandwidth, content_license_url, media_license_url, media_creator, - languages_understood, translate, buy_url) + languages_understood, translate, + buy_url, chat_url) def create_followers_only_post(base_dir: str, @@ -2234,7 +2263,8 @@ def create_followers_only_post(base_dir: str, content_license_url: str, media_license_url: str, media_creator: str, languages_understood: [], - translate: {}, buy_url: str) -> {}: + translate: {}, buy_url: str, + chat_url: str) -> {}: """Followers only post """ domain_full = get_full_domain(domain, port) @@ -2253,7 +2283,8 @@ def create_followers_only_post(base_dir: str, conversation_id, low_bandwidth, content_license_url, media_license_url, media_creator, - languages_understood, translate, buy_url) + languages_understood, translate, + buy_url, chat_url) def get_mentioned_people(base_dir: str, http_prefix: str, @@ -2312,7 +2343,7 @@ def create_direct_message_post(base_dir: str, media_license_url: str, media_creator: str, languages_understood: [], dm_is_chat: bool, translate: {}, - buy_url: str) -> {}: + buy_url: str, chat_url: str) -> {}: """Direct Message post """ content = resolve_petnames(base_dir, nickname, domain, content) @@ -2339,7 +2370,7 @@ def create_direct_message_post(base_dir: str, conversation_id, low_bandwidth, content_license_url, media_license_url, media_creator, - languages_understood, translate, buy_url) + languages_understood, translate, buy_url, chat_url) # mentioned recipients go into To rather than Cc message_json['to'] = message_json['object']['cc'] message_json['object']['to'] = message_json['to'] @@ -2427,6 +2458,7 @@ def create_report_post(base_dir: str, post_cc = None post_json_object = None buy_url = '' + chat_url = '' for to_url in post_to: # who is this report going to? to_nickname = to_url.split('/users/')[1] @@ -2444,7 +2476,8 @@ def create_report_post(base_dir: str, None, None, None, None, None, system_language, None, low_bandwidth, content_license_url, media_license_url, media_creator, - languages_understood, translate, buy_url) + languages_understood, translate, + buy_url, chat_url) if not post_json_object: continue @@ -2570,7 +2603,7 @@ def send_post(signing_priv_key_pem: str, project_version: str, shared_item_federation_tokens: {}, low_bandwidth: bool, content_license_url: str, media_license_url: str, media_creator: str, - translate: {}, buy_url: str, + translate: {}, buy_url: str, chat_url: str, debug: bool = False, in_reply_to: str = None, in_reply_to_atom_uri: str = None, subject: str = None) -> int: """Post to another inbox. Used by unit tests. @@ -2640,7 +2673,7 @@ def send_post(signing_priv_key_pem: str, project_version: str, content_license_url, media_license_url, media_creator, languages_understood, - translate, buy_url) + translate, buy_url, chat_url) # get the senders private key private_key_pem = get_person_key(nickname, domain, base_dir, 'private') @@ -2738,7 +2771,8 @@ def send_post_via_server(signing_priv_key_pem: str, project_version: str, content_license_url: str, media_license_url: str, media_creator: str, event_date: str, event_time: str, event_end_time: str, - location: str, translate: {}, buy_url: str, + location: str, translate: {}, + buy_url: str, chat_url: str, debug: bool = False, in_reply_to: str = None, in_reply_to_atom_uri: str = None, @@ -2832,7 +2866,7 @@ def send_post_via_server(signing_priv_key_pem: str, project_version: str, content_license_url, media_license_url, media_creator, languages_understood, - translate, buy_url) + translate, buy_url, chat_url) auth_header = create_basic_auth_header(from_nickname, password) diff --git a/tests.py b/tests.py index 278f42738..9f5ee2da3 100644 --- a/tests.py +++ b/tests.py @@ -785,6 +785,7 @@ def create_server_alice(path: str, domain: str, port: int, media_license_url = 'https://creativecommons.org/licenses/by-nc/4.0' media_creator = 'Mr Blobby' buy_url = '' + chat_url = '' test_video_transcript = '' create_public_post(path, nickname, domain, port, http_prefix, "No wise fish would go anywhere without a porpoise", @@ -802,7 +803,7 @@ def create_server_alice(path: str, domain: str, port: int, test_is_article, system_language, conversation_id, low_bandwidth, content_license_url, media_license_url, media_creator, - languages_understood, translate, buy_url) + languages_understood, translate, buy_url, chat_url) create_public_post(path, nickname, domain, port, http_prefix, "Curiouser and curiouser!", test_save_to_file, @@ -819,7 +820,7 @@ def create_server_alice(path: str, domain: str, port: int, test_is_article, system_language, conversation_id, low_bandwidth, content_license_url, media_license_url, media_creator, - languages_understood, translate, buy_url) + languages_understood, translate, buy_url, chat_url) 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", @@ -837,7 +838,7 @@ def create_server_alice(path: str, domain: str, port: int, test_is_article, system_language, conversation_id, low_bandwidth, content_license_url, media_license_url, media_creator, - languages_understood, translate, buy_url) + languages_understood, translate, buy_url, chat_url) regenerate_index_for_box(path, nickname, domain, 'outbox') global TEST_SERVER_ALICE_RUNNING TEST_SERVER_ALICE_RUNNING = True @@ -959,6 +960,7 @@ def create_server_bob(path: str, domain: str, port: int, media_creator = 'Hamster' translate = {} buy_url = '' + chat_url = '' test_video_transcript = '' create_public_post(path, nickname, domain, port, http_prefix, "It's your life, live it your way.", @@ -976,7 +978,7 @@ def create_server_bob(path: str, domain: str, port: int, test_is_article, system_language, conversation_id, low_bandwidth, content_license_url, media_license_url, media_creator, - languages_understood, translate, buy_url) + languages_understood, translate, buy_url, chat_url) create_public_post(path, nickname, domain, port, http_prefix, "One of the things I've realised is that " + "I am very simple", @@ -994,7 +996,7 @@ def create_server_bob(path: str, domain: str, port: int, test_is_article, system_language, conversation_id, low_bandwidth, content_license_url, media_license_url, media_creator, - languages_understood, translate, buy_url) + languages_understood, translate, buy_url, chat_url) create_public_post(path, nickname, domain, port, http_prefix, "Quantum physics is a bit of a passion of mine", test_save_to_file, @@ -1011,7 +1013,7 @@ def create_server_bob(path: str, domain: str, port: int, test_is_article, system_language, conversation_id, low_bandwidth, content_license_url, media_license_url, media_creator, - languages_understood, translate, buy_url) + languages_understood, translate, buy_url, chat_url) regenerate_index_for_box(path, nickname, domain, 'outbox') global TEST_SERVER_BOB_RUNNING TEST_SERVER_BOB_RUNNING = True @@ -1354,6 +1356,7 @@ def test_post_message_between_servers(base_dir: str) -> None: signing_priv_key_pem = None translate = {} buy_url = '' + chat_url = '' send_result = \ send_post(signing_priv_key_pem, __version__, session_alice, alice_dir, 'alice', alice_domain, alice_port, @@ -1370,7 +1373,7 @@ def test_post_message_between_servers(base_dir: str) -> None: alice_shared_items_federated_domains, alice_shared_item_federation_tokens, low_bandwidth, content_license_url, media_license_url, media_creator, - translate, buy_url, + translate, buy_url, chat_url, in_reply_to, in_reply_to_atom_uri, subject) print('send_result: ' + str(send_result)) @@ -1733,6 +1736,7 @@ def test_follow_between_servers(base_dir: str) -> None: signing_priv_key_pem = None translate = {} buy_url = '' + chat_url = '' video_transcript = None send_result = \ send_post(signing_priv_key_pem, __version__, @@ -1747,7 +1751,7 @@ def test_follow_between_servers(base_dir: str) -> None: alice_shared_items_federated_domains, alice_shared_item_federation_tokens, low_bandwidth, content_license_url, media_license_url, media_creator, - translate, buy_url, + translate, buy_url, chat_url, in_reply_to, in_reply_to_atom_uri, subject) print('send_result: ' + str(send_result)) @@ -2090,8 +2094,8 @@ def test_shared_items_federation(base_dir: str) -> None: assert offers_json print('Offers collection:') pprint(offers_json) - assert isinstance(offers_json, list) - assert len(offers_json) >= 1 + assert isinstance(offers_json, dict) + assert len(offers_json['orderedItems']) >= 1 wanted_json = \ get_wanted_via_server(session_bob, 'bob', bob_password, @@ -2100,8 +2104,8 @@ def test_shared_items_federation(base_dir: str) -> None: signing_priv_key_pem) print('Wanted collection:') pprint(wanted_json) - assert isinstance(wanted_json, list) - assert len(wanted_json) == 0 + assert isinstance(wanted_json, dict) + assert len(wanted_json['orderedItems']) == 0 print('\n\n*********************************************************') print('Alice sends a message to Bob') @@ -2126,6 +2130,7 @@ def test_shared_items_federation(base_dir: str) -> None: signing_priv_key_pem = None translate = {} buy_url = '' + chat_url = '' video_transcript = None send_result = \ send_post(signing_priv_key_pem, __version__, @@ -2140,7 +2145,7 @@ def test_shared_items_federation(base_dir: str) -> None: alice_shared_items_federated_domains, alice_shared_item_federation_tokens, low_bandwidth, content_license_url, media_license_url, media_creator, - translate, buy_url, True, + translate, buy_url, chat_url, True, in_reply_to, in_reply_to_atom_uri, subject) print('send_result: ' + str(send_result)) @@ -2561,6 +2566,7 @@ def test_group_follow(base_dir: str) -> None: translate = {} buy_url = '' + chat_url = '' video_transcript = None send_result = \ send_post(signing_priv_key_pem, __version__, @@ -2575,7 +2581,7 @@ def test_group_follow(base_dir: str) -> None: alice_shared_items_federated_domains, alice_shared_item_federation_tokens, low_bandwidth, content_license_url, media_license_url, media_creator, - translate, buy_url, + translate, buy_url, chat_url, in_reply_to, in_reply_to_atom_uri, subject) print('send_result: ' + str(send_result)) @@ -2956,6 +2962,7 @@ def _test_create_person_account(base_dir: str): "Politicians will threaten to withdraw funding if you do " + \ "anything which challenges middle class sensibilities or incomes." buy_url = '' + chat_url = '' test_post_json = \ create_public_post(base_dir, nickname, domain, port, http_prefix, content, save_to_file, @@ -2969,7 +2976,7 @@ def _test_create_person_account(base_dir: str): test_is_article, system_language, conversation_id, low_bandwidth, content_license_url, media_license_url, media_creator, - languages_understood, translate, buy_url) + languages_understood, translate, buy_url, chat_url) assert test_post_json assert test_post_json.get('object') assert test_post_json['object']['content'] @@ -2996,7 +3003,7 @@ def _test_create_person_account(base_dir: str): test_is_article, system_language, conversation_id, low_bandwidth, content_license_url, media_license_url, media_creator, - languages_understood, translate, buy_url) + languages_understood, translate, buy_url, chat_url) assert test_post_json assert test_post_json.get('object') assert test_post_json['object']['content'] @@ -3200,6 +3207,7 @@ def test_client_to_server(base_dir: str): location = "Kinshasa" translate = {} buy_url = '' + chat_url = '' video_transcript = None send_result = \ send_post_via_server(signing_priv_key_pem, __version__, @@ -3215,7 +3223,7 @@ def test_client_to_server(base_dir: str): low_bandwidth, content_license_url, media_license_url, media_creator, event_date, event_time, event_end_time, location, - translate, buy_url, True, None, None, + translate, buy_url, chat_url, True, None, None, conversation_id, None) print('send_result: ' + str(send_result)) @@ -4822,6 +4830,7 @@ def _test_reply_to_public_post(base_dir: str) -> None: media_creator = 'Skeletor' translate = {} buy_url = '' + chat_url = '' video_transcript = '' reply = \ create_public_post(base_dir, nickname, domain, port, http_prefix, @@ -4837,7 +4846,7 @@ def _test_reply_to_public_post(base_dir: str) -> None: test_is_article, system_language, conversation_id, low_bandwidth, content_license_url, media_license_url, media_creator, - languages_understood, translate, buy_url) + languages_understood, translate, buy_url, chat_url) # print(str(reply)) expected_str = \ '
' + \
@@ -5777,6 +5786,7 @@ def _test_links_within_post(base_dir: str) -> None:
media_creator = 'Dr No'
translate = {}
buy_url = ''
+ chat_url = ''
video_transcript = ''
post_json_object = \
@@ -5792,7 +5802,7 @@ def _test_links_within_post(base_dir: str) -> None:
test_is_article, system_language, conversation_id,
low_bandwidth, content_license_url,
media_license_url, media_creator,
- languages_understood, translate, buy_url)
+ languages_understood, translate, buy_url, chat_url)
expected_str = \
' This is a test post with links.
' + \
@@ -5837,7 +5847,7 @@ def _test_links_within_post(base_dir: str) -> None:
test_is_article, system_language, conversation_id,
low_bandwidth, content_license_url,
media_license_url, media_creator,
- languages_understood, translate, buy_url)
+ languages_understood, translate, buy_url, chat_url)
assert post_json_object['object']['content'] == content
assert post_json_object['object']['contentMap'][system_language] == content
@@ -6905,6 +6915,7 @@ def _test_can_replyto(base_dir: str) -> None:
media_creator = 'The Penguin'
translate = {}
buy_url = ''
+ chat_url = ''
video_transcript = ''
post_json_object = \
@@ -6920,7 +6931,7 @@ def _test_can_replyto(base_dir: str) -> None:
test_is_article, system_language, conversation_id,
low_bandwidth, content_license_url,
media_license_url, media_creator,
- languages_understood, translate, buy_url)
+ languages_understood, translate, buy_url, chat_url)
# set the date on the post
curr_date_str = "2021-09-08T20:45:00Z"
post_json_object['published'] = curr_date_str
diff --git a/translations/ar.json b/translations/ar.json
index 7c97ac4e6..6f9cfeb7d 100644
--- a/translations/ar.json
+++ b/translations/ar.json
@@ -627,5 +627,6 @@
"Only allow replies from followers": "السماح فقط بالردود من المتابعين",
"Only allow replies from mutuals": "السماح فقط بالردود من المتبادلين",
"Reason": "سبب",
- "Chat": "محادثة"
+ "Chat": "محادثة",
+ "Chat link": "رابط الدردشة"
}
diff --git a/translations/bn.json b/translations/bn.json
index d480d32b9..187a90a43 100644
--- a/translations/bn.json
+++ b/translations/bn.json
@@ -627,5 +627,6 @@
"Only allow replies from followers": "শুধুমাত্র অনুসরণকারীদের কাছ থেকে উত্তরের অনুমতি দিন",
"Only allow replies from mutuals": "শুধুমাত্র মিউচুয়াল থেকে উত্তরের অনুমতি দিন",
"Reason": "কারণ",
- "Chat": "চ্যাট"
+ "Chat": "চ্যাট",
+ "Chat link": "চ্যাট লিঙ্ক"
}
diff --git a/translations/ca.json b/translations/ca.json
index 41f978219..796fd4c39 100644
--- a/translations/ca.json
+++ b/translations/ca.json
@@ -627,5 +627,6 @@
"Only allow replies from followers": "Només permet respostes dels seguidors",
"Only allow replies from mutuals": "Només permet respostes de mútues",
"Reason": "Raó",
- "Chat": "Xatejar"
+ "Chat": "Xatejar",
+ "Chat link": "Enllaç de xat"
}
diff --git a/translations/cy.json b/translations/cy.json
index 9121ba61e..b2087d932 100644
--- a/translations/cy.json
+++ b/translations/cy.json
@@ -627,5 +627,6 @@
"Only allow replies from followers": "Caniatewch atebion gan ddilynwyr yn unig",
"Only allow replies from mutuals": "Caniatewch atebion gan gwmnïau cydfuddiannol yn unig",
"Reason": "Rheswm",
- "Chat": "Sgwrsio"
+ "Chat": "Sgwrsio",
+ "Chat link": "Dolen sgwrs"
}
diff --git a/translations/de.json b/translations/de.json
index b6f15ef28..b2de6cbae 100644
--- a/translations/de.json
+++ b/translations/de.json
@@ -627,5 +627,6 @@
"Only allow replies from followers": "Erlauben Sie nur Antworten von Followern",
"Only allow replies from mutuals": "Erlauben Sie nur Antworten von Gegenseitigkeitsgesellschaften",
"Reason": "Grund",
- "Chat": "Plaudern"
+ "Chat": "Plaudern",
+ "Chat link": "Chat-Link"
}
diff --git a/translations/el.json b/translations/el.json
index b00a59958..4af632f77 100644
--- a/translations/el.json
+++ b/translations/el.json
@@ -627,5 +627,6 @@
"Only allow replies from followers": "Επιτρέπονται μόνο οι απαντήσεις από τους ακόλουθους",
"Only allow replies from mutuals": "Επιτρέπονται μόνο απαντήσεις από αμοιβαία μέλη",
"Reason": "Λόγος",
- "Chat": "Κουβέντα"
+ "Chat": "Κουβέντα",
+ "Chat link": "Σύνδεσμος συνομιλίας"
}
diff --git a/translations/en.json b/translations/en.json
index 31c5b29e2..32d6acf31 100644
--- a/translations/en.json
+++ b/translations/en.json
@@ -627,5 +627,6 @@
"Only allow replies from followers": "Only allow replies from followers",
"Only allow replies from mutuals": "Only allow replies from mutuals",
"Reason": "Reason",
- "Chat": "Chat"
+ "Chat": "Chat",
+ "Chat link": "Chat link"
}
diff --git a/translations/es.json b/translations/es.json
index 1ee3483a8..d0dde7332 100644
--- a/translations/es.json
+++ b/translations/es.json
@@ -627,5 +627,6 @@
"Only allow replies from followers": "Permitir solo respuestas de seguidores",
"Only allow replies from mutuals": "Permitir solo respuestas de mutuas",
"Reason": "Razón",
- "Chat": "Charlar"
+ "Chat": "Charlar",
+ "Chat link": "Enlace de chat"
}
diff --git a/translations/fa.json b/translations/fa.json
index f71e9b7ef..cf154bfd7 100644
--- a/translations/fa.json
+++ b/translations/fa.json
@@ -627,5 +627,6 @@
"Only allow replies from followers": "فقط اجازه پاسخ از طرفداران را بدهید",
"Only allow replies from mutuals": "فقط اجازه پاسخ از طرف متقابل را بدهید",
"Reason": "دلیل",
- "Chat": "چت کنید"
+ "Chat": "چت کنید",
+ "Chat link": "لینک چت"
}
diff --git a/translations/fr.json b/translations/fr.json
index d6d9a957a..c96142703 100644
--- a/translations/fr.json
+++ b/translations/fr.json
@@ -627,5 +627,6 @@
"Only allow replies from followers": "Autoriser uniquement les réponses des abonnés",
"Only allow replies from mutuals": "Autoriser uniquement les réponses des mutuelles",
"Reason": "Raison",
- "Chat": "Discuter"
+ "Chat": "Discuter",
+ "Chat link": "Lien de discussion"
}
diff --git a/translations/ga.json b/translations/ga.json
index dd93fe34d..a8f21d372 100644
--- a/translations/ga.json
+++ b/translations/ga.json
@@ -627,5 +627,6 @@
"Only allow replies from followers": "Ná ceadaigh ach freagraí ó leantóirí",
"Only allow replies from mutuals": "Ná ceadaigh ach freagraí ó chomhlachtaí frithpháirteacha",
"Reason": "Cúis",
- "Chat": "Comhrá"
+ "Chat": "Comhrá",
+ "Chat link": "Nasc comhrá"
}
diff --git a/translations/hi.json b/translations/hi.json
index 16e0a83d7..3b7de7772 100644
--- a/translations/hi.json
+++ b/translations/hi.json
@@ -627,5 +627,6 @@
"Only allow replies from followers": "केवल अनुयायियों के उत्तरों की अनुमति दें",
"Only allow replies from mutuals": "केवल पारस्परिक उत्तरों की अनुमति दें",
"Reason": "कारण",
- "Chat": "बात करना"
+ "Chat": "बात करना",
+ "Chat link": "चैट लिंक"
}
diff --git a/translations/it.json b/translations/it.json
index f5fe87966..e09e31c61 100644
--- a/translations/it.json
+++ b/translations/it.json
@@ -627,5 +627,6 @@
"Only allow replies from followers": "Consenti solo risposte dai follower",
"Only allow replies from mutuals": "Consenti solo risposte da mutue",
"Reason": "Motivo",
- "Chat": "Chiacchierata"
+ "Chat": "Chiacchierata",
+ "Chat link": "Collegamento alla chat"
}
diff --git a/translations/ja.json b/translations/ja.json
index f22e829e5..7728ebe0f 100644
--- a/translations/ja.json
+++ b/translations/ja.json
@@ -627,5 +627,6 @@
"Only allow replies from followers": "フォロワーからの返信のみを許可する",
"Only allow replies from mutuals": "相互からの返信のみを許可する",
"Reason": "理由",
- "Chat": "チャット"
+ "Chat": "チャット",
+ "Chat link": "チャットリンク"
}
diff --git a/translations/ko.json b/translations/ko.json
index 193314877..cfc5b4b7d 100644
--- a/translations/ko.json
+++ b/translations/ko.json
@@ -627,5 +627,6 @@
"Only allow replies from followers": "팔로어의 답글만 허용",
"Only allow replies from mutuals": "상호 간의 답장만 허용",
"Reason": "이유",
- "Chat": "채팅"
+ "Chat": "채팅",
+ "Chat link": "채팅 링크"
}
diff --git a/translations/ku.json b/translations/ku.json
index 2ff58fa29..653c25511 100644
--- a/translations/ku.json
+++ b/translations/ku.json
@@ -627,5 +627,6 @@
"Only allow replies from followers": "Tenê destûr bidin bersivên ji şagirtan",
"Only allow replies from mutuals": "Tenê destûr bidin bersivên ji hevdu",
"Reason": "Semed",
- "Chat": "Galgalkirin"
+ "Chat": "Galgalkirin",
+ "Chat link": "Lînka chatê"
}
diff --git a/translations/nl.json b/translations/nl.json
index b2eb47ccc..d5b5d8340 100644
--- a/translations/nl.json
+++ b/translations/nl.json
@@ -627,5 +627,6 @@
"Only allow replies from followers": "Sta alleen reacties van volgers toe",
"Only allow replies from mutuals": "Sta alleen reacties van onderlinge maatschappijen toe",
"Reason": "Reden",
- "Chat": "Chatten"
+ "Chat": "Chatten",
+ "Chat link": "Chat-link"
}
diff --git a/translations/oc.json b/translations/oc.json
index ea500567d..df8326cfa 100644
--- a/translations/oc.json
+++ b/translations/oc.json
@@ -623,5 +623,6 @@
"Only allow replies from followers": "Only allow replies from followers",
"Only allow replies from mutuals": "Only allow replies from mutuals",
"Reason": "Reason",
- "Chat": "Chat"
+ "Chat": "Chat",
+ "Chat link": "Chat link"
}
diff --git a/translations/pl.json b/translations/pl.json
index b9ef6b778..ec23cd6b8 100644
--- a/translations/pl.json
+++ b/translations/pl.json
@@ -627,5 +627,6 @@
"Only allow replies from followers": "Zezwalaj tylko na odpowiedzi od obserwujących",
"Only allow replies from mutuals": "Zezwalaj tylko na odpowiedzi od towarzystw wzajemnych",
"Reason": "Powód",
- "Chat": "Czat"
+ "Chat": "Czat",
+ "Chat link": "Link do czatu"
}
diff --git a/translations/pt.json b/translations/pt.json
index 8b8d0a3ba..a6a5406e0 100644
--- a/translations/pt.json
+++ b/translations/pt.json
@@ -627,5 +627,6 @@
"Only allow replies from followers": "Permitir apenas respostas de seguidores",
"Only allow replies from mutuals": "Permitir apenas respostas de mútuos",
"Reason": "Razão",
- "Chat": "Bater papo"
+ "Chat": "Bater papo",
+ "Chat link": "Link de bate-papo"
}
diff --git a/translations/ru.json b/translations/ru.json
index ceea4ccc1..eb858c7bc 100644
--- a/translations/ru.json
+++ b/translations/ru.json
@@ -627,5 +627,6 @@
"Only allow replies from followers": "Разрешить ответы только от подписчиков",
"Only allow replies from mutuals": "Разрешить ответы только от взаимных",
"Reason": "Причина",
- "Chat": "Чат"
+ "Chat": "Чат",
+ "Chat link": "Ссылка на чат"
}
diff --git a/translations/sw.json b/translations/sw.json
index 6e85c42f9..9ac64326f 100644
--- a/translations/sw.json
+++ b/translations/sw.json
@@ -627,5 +627,6 @@
"Only allow replies from followers": "Ruhusu tu majibu kutoka kwa wafuasi",
"Only allow replies from mutuals": "Ruhusu tu majibu kutoka kwa pande zote mbili",
"Reason": "Sababu",
- "Chat": "Soga"
+ "Chat": "Soga",
+ "Chat link": "Kiungo cha gumzo"
}
diff --git a/translations/tr.json b/translations/tr.json
index 6067620e3..934635e66 100644
--- a/translations/tr.json
+++ b/translations/tr.json
@@ -627,5 +627,6 @@
"Only allow replies from followers": "Yalnızca takipçilerden gelen yanıtlara izin ver",
"Only allow replies from mutuals": "Yalnızca ortaklardan gelen yanıtlara izin ver",
"Reason": "Sebep",
- "Chat": "Sohbet"
+ "Chat": "Sohbet",
+ "Chat link": "Sohbet bağlantısı"
}
diff --git a/translations/uk.json b/translations/uk.json
index 5d8fbc8b4..ae0bb7f47 100644
--- a/translations/uk.json
+++ b/translations/uk.json
@@ -627,5 +627,6 @@
"Only allow replies from followers": "Дозволити відповіді лише від підписників",
"Only allow replies from mutuals": "Дозволити відповіді лише від взаємних клієнтів",
"Reason": "Причина",
- "Chat": "Чат"
+ "Chat": "Чат",
+ "Chat link": "Посилання на чат"
}
diff --git a/translations/yi.json b/translations/yi.json
index ea6833cc1..381e89edc 100644
--- a/translations/yi.json
+++ b/translations/yi.json
@@ -627,5 +627,6 @@
"Only allow replies from followers": "נאָר לאָזן ענטפֿערס פון אנהענגערס",
"Only allow replies from mutuals": "לאָזן בלויז ענטפֿערס פון מיוטשואַלז",
"Reason": "סיבה",
- "Chat": "שמועסן"
+ "Chat": "שמועסן",
+ "Chat link": "שמועס לינק"
}
diff --git a/translations/zh.json b/translations/zh.json
index e0fc1cd73..8f6e46d8c 100644
--- a/translations/zh.json
+++ b/translations/zh.json
@@ -627,5 +627,6 @@
"Only allow replies from followers": "只允许关注者回复",
"Only allow replies from mutuals": "只允许来自相互的回复",
"Reason": "原因",
- "Chat": "聊天"
+ "Chat": "聊天",
+ "Chat link": "聊天链接"
}
diff --git a/webapp_create_post.py b/webapp_create_post.py
index f4ab9ae0d..8e5ce2178 100644
--- a/webapp_create_post.py
+++ b/webapp_create_post.py
@@ -798,6 +798,9 @@ def html_new_post(edit_post_params: {},
buy_link_str = translate['Buy link']
replies_section += edit_text_field(buy_link_str, 'buyUrl',
default_buy_site, 'https://...')
+ chat_link_str = '💬 ' + translate['Chat link']
+ replies_section += edit_text_field(chat_link_str, 'chatUrl',
+ '', 'https://...')
replies_section += '\n'
date_and_location = \