mirror of https://gitlab.com/bashrc2/epicyon
Adding searchableBy attribute
parent
c266172ec1
commit
8a07b8d924
|
@ -151,6 +151,8 @@ def _receive_new_post_process_newpost(self, fields: {},
|
|||
video_transcript = ''
|
||||
if fields.get('videoTranscript'):
|
||||
video_transcript = fields['videoTranscript']
|
||||
# TODO specify search
|
||||
searchable_by = []
|
||||
message_json = \
|
||||
create_public_post(base_dir, nickname, domain,
|
||||
port,
|
||||
|
@ -176,7 +178,7 @@ def _receive_new_post_process_newpost(self, fields: {},
|
|||
languages_understood,
|
||||
translate, buy_url,
|
||||
chat_url,
|
||||
auto_cw_cache)
|
||||
auto_cw_cache, searchable_by)
|
||||
if message_json:
|
||||
if edited_postid:
|
||||
update_edited_post(base_dir, nickname, domain,
|
||||
|
@ -309,6 +311,8 @@ def _receive_new_post_process_newblog(self, fields: {},
|
|||
video_transcript = ''
|
||||
if fields.get('videoTranscript'):
|
||||
video_transcript = fields['videoTranscript']
|
||||
# TODO searchable status
|
||||
searchable_by = []
|
||||
message_json = \
|
||||
create_blog_post(base_dir, nickname,
|
||||
domain, port, http_prefix,
|
||||
|
@ -330,7 +334,8 @@ def _receive_new_post_process_newblog(self, fields: {},
|
|||
content_license_url,
|
||||
media_license_url, media_creator,
|
||||
languages_understood,
|
||||
translate, buy_url, chat_url)
|
||||
translate, buy_url, chat_url,
|
||||
searchable_by)
|
||||
if message_json:
|
||||
if fields['schedulePost']:
|
||||
return NEW_POST_SUCCESS
|
||||
|
@ -700,6 +705,8 @@ def _receive_new_post_process_newfollowers(self, fields: {},
|
|||
video_transcript = ''
|
||||
if fields.get('videoTranscript'):
|
||||
video_transcript = fields['videoTranscript']
|
||||
# TODO searchable status
|
||||
searchable_by = []
|
||||
message_json = \
|
||||
create_followers_only_post(base_dir, nickname, domain,
|
||||
port, http_prefix,
|
||||
|
@ -728,7 +735,8 @@ def _receive_new_post_process_newfollowers(self, fields: {},
|
|||
languages_understood,
|
||||
translate,
|
||||
buy_url, chat_url,
|
||||
auto_cw_cache)
|
||||
auto_cw_cache,
|
||||
searchable_by)
|
||||
if message_json:
|
||||
if edited_postid:
|
||||
update_edited_post(base_dir,
|
||||
|
@ -1342,6 +1350,8 @@ def _receive_new_post_process_newreading(self, fields: {},
|
|||
city = get_spoofed_city(city, base_dir,
|
||||
nickname, domain)
|
||||
msg_str = fields['readingupdatetype']
|
||||
# TODO searchable status
|
||||
searchable_by = []
|
||||
# reading status
|
||||
message_json = \
|
||||
create_reading_post(base_dir, nickname, domain,
|
||||
|
@ -1369,7 +1379,8 @@ def _receive_new_post_process_newreading(self, fields: {},
|
|||
languages_understood,
|
||||
translate, buy_url,
|
||||
chat_url,
|
||||
auto_cw_cache)
|
||||
auto_cw_cache,
|
||||
searchable_by)
|
||||
if message_json:
|
||||
if edited_postid:
|
||||
update_edited_post(base_dir, nickname, domain,
|
||||
|
|
|
@ -576,6 +576,8 @@ def _desktop_reply_to_post(session, post_id: str,
|
|||
chat_url = ''
|
||||
video_transcript = None
|
||||
auto_cw_cache = {}
|
||||
# TODO searchable status
|
||||
searchable_by = []
|
||||
_say_command(say_str, say_str, screenreader, system_language, espeak)
|
||||
if send_post_via_server(signing_priv_key_pem, __version__,
|
||||
base_dir, session, nickname, password,
|
||||
|
@ -592,7 +594,8 @@ def _desktop_reply_to_post(session, post_id: str,
|
|||
event_date, event_time, event_end_time, location,
|
||||
translate, buy_url, chat_url, auto_cw_cache,
|
||||
debug, post_id, post_id,
|
||||
conversation_id, convthread_id, subject) == 0:
|
||||
conversation_id, convthread_id, subject,
|
||||
searchable_by) == 0:
|
||||
say_str = translate['Sent']
|
||||
else:
|
||||
say_str = translate['Post failed']
|
||||
|
@ -659,6 +662,8 @@ def _desktop_new_post(session,
|
|||
chat_url = ''
|
||||
video_transcript = None
|
||||
auto_cw_cache = {}
|
||||
# TODO searchable status
|
||||
searchable_by = []
|
||||
_say_command(say_str, say_str, screenreader, system_language, espeak)
|
||||
if send_post_via_server(signing_priv_key_pem, __version__,
|
||||
base_dir, session, nickname, password,
|
||||
|
@ -674,7 +679,8 @@ def _desktop_new_post(session,
|
|||
event_date, event_time, event_end_time, location,
|
||||
translate, buy_url, chat_url, auto_cw_cache,
|
||||
debug, None, None,
|
||||
conversation_id, convthread_id, subject) == 0:
|
||||
conversation_id, convthread_id, subject,
|
||||
searchable_by) == 0:
|
||||
say_str = translate['Sent']
|
||||
else:
|
||||
say_str = translate['Post failed']
|
||||
|
@ -1476,6 +1482,8 @@ def _desktop_new_dm_base(session, to_handle: str,
|
|||
|
||||
say_str = 'Sending'
|
||||
auto_cw_cache = {}
|
||||
# TODO searchable status
|
||||
searchable_by = []
|
||||
_say_command(say_str, say_str, screenreader, system_language, espeak)
|
||||
if send_post_via_server(signing_priv_key_pem, __version__,
|
||||
base_dir, session, nickname, password,
|
||||
|
@ -1491,7 +1499,8 @@ def _desktop_new_dm_base(session, to_handle: str,
|
|||
event_date, event_time, event_end_time, location,
|
||||
translate, buy_url, chat_url, auto_cw_cache,
|
||||
debug, None, None,
|
||||
conversation_id, convthread_id, subject) == 0:
|
||||
conversation_id, convthread_id, subject,
|
||||
searchable_by) == 0:
|
||||
say_str = translate['Sent']
|
||||
else:
|
||||
say_str = translate['Post failed']
|
||||
|
|
21
epicyon.py
21
epicyon.py
|
@ -1852,6 +1852,8 @@ def _command_options() -> None:
|
|||
translate = {}
|
||||
video_transcript = None
|
||||
auto_cw_cache = {}
|
||||
# TODO searchable status
|
||||
searchable_by = []
|
||||
|
||||
print('Sending post to ' + argb.sendto)
|
||||
send_post_via_server(signing_priv_key_pem, __version__,
|
||||
|
@ -1871,7 +1873,7 @@ def _command_options() -> None:
|
|||
argb.eventLocation, translate, argb.buyUrl,
|
||||
argb.chatUrl, auto_cw_cache, argb.debug,
|
||||
reply_to, reply_to, argb.conversationId,
|
||||
argb.convthreadId, subject)
|
||||
argb.convthreadId, subject, searchable_by)
|
||||
for _ in range(10):
|
||||
# TODO detect send success/fail
|
||||
time.sleep(1)
|
||||
|
@ -3648,6 +3650,7 @@ def _command_options() -> None:
|
|||
chat_url = ''
|
||||
auto_cw_cache = {}
|
||||
test_video_transcript = ''
|
||||
searchable_by = []
|
||||
|
||||
create_public_post(base_dir, nickname, domain, port, http_prefix,
|
||||
"like this is totally just a #test man",
|
||||
|
@ -3666,7 +3669,7 @@ def _command_options() -> None:
|
|||
low_bandwidth, argb.content_license_url,
|
||||
argb.media_license_url, argb.media_creator,
|
||||
languages_understood, translate, buy_url, chat_url,
|
||||
auto_cw_cache)
|
||||
auto_cw_cache, searchable_by)
|
||||
create_public_post(base_dir, nickname, domain, port, http_prefix,
|
||||
"Zoiks!!!",
|
||||
test_save_to_file,
|
||||
|
@ -3684,7 +3687,7 @@ def _command_options() -> None:
|
|||
low_bandwidth, argb.content_license_url,
|
||||
argb.media_license_url, argb.media_creator,
|
||||
languages_understood, translate, buy_url, chat_url,
|
||||
auto_cw_cache)
|
||||
auto_cw_cache, searchable_by)
|
||||
create_public_post(base_dir, nickname, domain, port, http_prefix,
|
||||
"Hey scoob we need like a hundred more #milkshakes",
|
||||
test_save_to_file,
|
||||
|
@ -3702,7 +3705,7 @@ def _command_options() -> None:
|
|||
low_bandwidth, argb.content_license_url,
|
||||
argb.media_license_url, argb.media_creator,
|
||||
languages_understood, translate, buy_url, chat_url,
|
||||
auto_cw_cache)
|
||||
auto_cw_cache, searchable_by)
|
||||
create_public_post(base_dir, nickname, domain, port, http_prefix,
|
||||
"Getting kinda spooky around here",
|
||||
test_save_to_file,
|
||||
|
@ -3720,7 +3723,7 @@ def _command_options() -> None:
|
|||
low_bandwidth, argb.content_license_url,
|
||||
argb.media_license_url, argb.media_creator,
|
||||
languages_understood, translate, buy_url, chat_url,
|
||||
auto_cw_cache)
|
||||
auto_cw_cache, searchable_by)
|
||||
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",
|
||||
|
@ -3739,7 +3742,7 @@ def _command_options() -> None:
|
|||
low_bandwidth, argb.content_license_url,
|
||||
argb.media_license_url, argb.media_creator,
|
||||
languages_understood, translate, buy_url, chat_url,
|
||||
auto_cw_cache)
|
||||
auto_cw_cache, searchable_by)
|
||||
create_public_post(base_dir, nickname, domain, port, http_prefix,
|
||||
"man these centralized sites are like the worst!",
|
||||
test_save_to_file,
|
||||
|
@ -3757,7 +3760,7 @@ def _command_options() -> None:
|
|||
low_bandwidth, argb.content_license_url,
|
||||
argb.media_license_url, argb.media_creator,
|
||||
languages_understood, translate, buy_url, chat_url,
|
||||
auto_cw_cache)
|
||||
auto_cw_cache, searchable_by)
|
||||
create_public_post(base_dir, nickname, domain, port, http_prefix,
|
||||
"another mystery solved #test",
|
||||
test_save_to_file,
|
||||
|
@ -3775,7 +3778,7 @@ def _command_options() -> None:
|
|||
low_bandwidth, argb.content_license_url,
|
||||
argb.media_license_url, argb.media_creator,
|
||||
languages_understood, translate, buy_url, chat_url,
|
||||
auto_cw_cache)
|
||||
auto_cw_cache, searchable_by)
|
||||
create_public_post(base_dir, nickname, domain, port, http_prefix,
|
||||
"let's go bowling",
|
||||
test_save_to_file,
|
||||
|
@ -3793,7 +3796,7 @@ def _command_options() -> None:
|
|||
low_bandwidth, argb.content_license_url,
|
||||
argb.media_license_url, argb.media_creator,
|
||||
languages_understood, translate, buy_url, chat_url,
|
||||
auto_cw_cache)
|
||||
auto_cw_cache, searchable_by)
|
||||
domain_full = domain + ':' + str(port)
|
||||
clear_follows(base_dir, nickname, domain, 'following.txt')
|
||||
follow_person(base_dir, nickname, domain, 'maxboardroom', domain_full,
|
||||
|
|
67
posts.py
67
posts.py
|
@ -1270,7 +1270,8 @@ def _create_post_s2s(base_dir: str, nickname: str, domain: str, port: int,
|
|||
conversation_id: str, convthread_id: str,
|
||||
low_bandwidth: bool, content_license_url: str,
|
||||
media_license_url: str, media_creator: str,
|
||||
buy_url: str, chat_url: str, translate: {}) -> {}:
|
||||
buy_url: str, chat_url: str, translate: {},
|
||||
searchable_by: []) -> {}:
|
||||
"""Creates a new server-to-server post
|
||||
"""
|
||||
actor_url = local_actor_url(http_prefix, nickname, domain)
|
||||
|
@ -1342,7 +1343,8 @@ def _create_post_s2s(base_dir: str, nickname: str, domain: str, port: int,
|
|||
'items': []
|
||||
}
|
||||
},
|
||||
"crawlable": False
|
||||
"crawlable": False,
|
||||
"searchableBy": searchable_by
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1403,7 +1405,7 @@ def _create_post_c2s(base_dir: str, nickname: str, domain: str, port: int,
|
|||
low_bandwidth: str,
|
||||
content_license_url: str, media_license_url: str,
|
||||
media_creator: str, buy_url: str, chat_url: str,
|
||||
translate: {}) -> {}:
|
||||
translate: {}, searchable_by: []) -> {}:
|
||||
"""Creates a new client-to-server post
|
||||
"""
|
||||
domain_full = get_full_domain(domain, port)
|
||||
|
@ -1465,7 +1467,8 @@ def _create_post_c2s(base_dir: str, nickname: str, domain: str, port: int,
|
|||
'items': []
|
||||
}
|
||||
},
|
||||
"crawlable": False
|
||||
"crawlable": False,
|
||||
"searchableBy": searchable_by
|
||||
}
|
||||
|
||||
# is this a root post of a conversation?
|
||||
|
@ -1741,7 +1744,8 @@ def _create_post_base(base_dir: str,
|
|||
media_license_url: str, media_creator: str,
|
||||
languages_understood: [], translate: {},
|
||||
buy_url: str, chat_url: str,
|
||||
auto_cw_cache: {}) -> {}:
|
||||
auto_cw_cache: {},
|
||||
searchable_by: []) -> {}:
|
||||
"""Creates a message
|
||||
"""
|
||||
content = remove_invalid_chars(content)
|
||||
|
@ -1905,7 +1909,7 @@ def _create_post_base(base_dir: str,
|
|||
conversation_id, convthread_id, low_bandwidth,
|
||||
content_license_url, media_license_url,
|
||||
media_creator, buy_url, chat_url,
|
||||
translate)
|
||||
translate, searchable_by)
|
||||
else:
|
||||
new_post = \
|
||||
_create_post_c2s(base_dir, nickname, domain, port,
|
||||
|
@ -1921,7 +1925,7 @@ def _create_post_base(base_dir: str,
|
|||
conversation_id, convthread_id, low_bandwidth,
|
||||
content_license_url, media_license_url,
|
||||
media_creator, buy_url, chat_url,
|
||||
translate)
|
||||
translate, searchable_by)
|
||||
|
||||
_create_post_mentions(cc_url, new_post, to_recipients, tags)
|
||||
|
||||
|
@ -2184,7 +2188,8 @@ def create_public_post(base_dir: str,
|
|||
media_license_url: str, media_creator: str,
|
||||
languages_understood: [], translate: {},
|
||||
buy_url: str, chat_url: str,
|
||||
auto_cw_cache: {}) -> {}:
|
||||
auto_cw_cache: {},
|
||||
searchable_by: []) -> {}:
|
||||
"""Public post
|
||||
"""
|
||||
domain_full = get_full_domain(domain, port)
|
||||
|
@ -2220,7 +2225,7 @@ def create_public_post(base_dir: str,
|
|||
content_license_url,
|
||||
media_license_url, media_creator,
|
||||
languages_understood, translate, buy_url,
|
||||
chat_url, auto_cw_cache)
|
||||
chat_url, auto_cw_cache, searchable_by)
|
||||
|
||||
|
||||
def create_reading_post(base_dir: str,
|
||||
|
@ -2242,7 +2247,8 @@ def create_reading_post(base_dir: str,
|
|||
media_license_url: str, media_creator: str,
|
||||
languages_understood: [], translate: {},
|
||||
buy_url: str, chat_url: str,
|
||||
auto_cw_cache: {}) -> {}:
|
||||
auto_cw_cache: {},
|
||||
searchable_by: []) -> {}:
|
||||
""" reading status post
|
||||
"""
|
||||
content = ''
|
||||
|
@ -2282,7 +2288,8 @@ def create_reading_post(base_dir: str,
|
|||
content_license_url,
|
||||
media_license_url, media_creator,
|
||||
languages_understood, translate,
|
||||
buy_url, chat_url, auto_cw_cache)
|
||||
buy_url, chat_url, auto_cw_cache,
|
||||
searchable_by)
|
||||
if post_json_object:
|
||||
post_json_object['object']['tag'] = [{
|
||||
'href': book_url,
|
||||
|
@ -2341,7 +2348,8 @@ def create_blog_post(base_dir: str,
|
|||
low_bandwidth: bool, content_license_url: str,
|
||||
media_license_url: str, media_creator: str,
|
||||
languages_understood: [], translate: {},
|
||||
buy_url: str, chat_url: str) -> {}:
|
||||
buy_url: str, chat_url: str,
|
||||
searchable_by: []) -> {}:
|
||||
auto_cw_cache = {}
|
||||
blog_json = \
|
||||
create_public_post(base_dir,
|
||||
|
@ -2358,7 +2366,7 @@ def create_blog_post(base_dir: str,
|
|||
low_bandwidth, content_license_url,
|
||||
media_license_url, media_creator,
|
||||
languages_understood, translate, buy_url, chat_url,
|
||||
auto_cw_cache)
|
||||
auto_cw_cache, searchable_by)
|
||||
url_str = get_url_from_post(blog_json['object']['url'])
|
||||
obj_url = remove_html(url_str)
|
||||
if '/@/' not in obj_url:
|
||||
|
@ -2388,6 +2396,7 @@ def create_news_post(base_dir: str,
|
|||
event_time = None
|
||||
event_end_time = None
|
||||
location = None
|
||||
searchable_by = "https://www.w3.org/ns/activitystreams#Public"
|
||||
blog = \
|
||||
create_public_post(base_dir,
|
||||
'news', domain, port, http_prefix,
|
||||
|
@ -2403,7 +2412,7 @@ def create_news_post(base_dir: str,
|
|||
low_bandwidth, content_license_url,
|
||||
media_license_url, media_creator,
|
||||
languages_understood, translate, buy_url, chat_url,
|
||||
auto_cw_cache)
|
||||
auto_cw_cache, searchable_by)
|
||||
blog['object']['type'] = 'Article'
|
||||
return blog
|
||||
|
||||
|
@ -2438,6 +2447,7 @@ def create_question_post(base_dir: str,
|
|||
anonymous_participation_enabled = event_status = ticket_url = None
|
||||
conversation_id = None
|
||||
convthread_id = None
|
||||
searchable_by = []
|
||||
message_json = \
|
||||
_create_post_base(base_dir, nickname, domain, port,
|
||||
'https://www.w3.org/ns/activitystreams#Public',
|
||||
|
@ -2459,7 +2469,7 @@ def create_question_post(base_dir: str,
|
|||
content_license_url,
|
||||
media_license_url, media_creator,
|
||||
languages_understood, translate, buy_url,
|
||||
chat_url, auto_cw_cache)
|
||||
chat_url, auto_cw_cache, searchable_by)
|
||||
message_json['object']['type'] = 'Question'
|
||||
message_json['object']['oneOf'] = []
|
||||
message_json['object']['votersCount'] = 0
|
||||
|
@ -2511,6 +2521,7 @@ def create_unlisted_post(base_dir: str,
|
|||
anonymous_participation_enabled = None
|
||||
event_status = None
|
||||
ticket_url = None
|
||||
searchable_by = []
|
||||
return _create_post_base(base_dir, nickname, domain, port,
|
||||
local_actor + '/followers',
|
||||
'https://www.w3.org/ns/activitystreams#Public',
|
||||
|
@ -2533,7 +2544,8 @@ def create_unlisted_post(base_dir: str,
|
|||
content_license_url,
|
||||
media_license_url, media_creator,
|
||||
languages_understood, translate,
|
||||
buy_url, chat_url, auto_cw_cache)
|
||||
buy_url, chat_url, auto_cw_cache,
|
||||
searchable_by)
|
||||
|
||||
|
||||
def create_followers_only_post(base_dir: str,
|
||||
|
@ -2555,7 +2567,8 @@ def create_followers_only_post(base_dir: str,
|
|||
languages_understood: [],
|
||||
translate: {}, buy_url: str,
|
||||
chat_url: str,
|
||||
auto_cw_cache: {}) -> {}:
|
||||
auto_cw_cache: {},
|
||||
searchable_by: []) -> {}:
|
||||
"""Followers only post
|
||||
"""
|
||||
domain_full = get_full_domain(domain, port)
|
||||
|
@ -2587,7 +2600,8 @@ def create_followers_only_post(base_dir: str,
|
|||
content_license_url,
|
||||
media_license_url, media_creator,
|
||||
languages_understood, translate,
|
||||
buy_url, chat_url, auto_cw_cache)
|
||||
buy_url, chat_url, auto_cw_cache,
|
||||
searchable_by)
|
||||
|
||||
|
||||
def get_mentioned_people(base_dir: str, http_prefix: str,
|
||||
|
@ -2667,6 +2681,7 @@ def create_direct_message_post(base_dir: str,
|
|||
anonymous_participation_enabled = None
|
||||
event_status = None
|
||||
ticket_url = None
|
||||
searchable_by = []
|
||||
message_json = \
|
||||
_create_post_base(base_dir, nickname, domain, port,
|
||||
post_to, post_cc,
|
||||
|
@ -2687,7 +2702,7 @@ def create_direct_message_post(base_dir: str,
|
|||
content_license_url,
|
||||
media_license_url, media_creator,
|
||||
languages_understood, translate, buy_url, chat_url,
|
||||
auto_cw_cache)
|
||||
auto_cw_cache, searchable_by)
|
||||
# mentioned recipients go into To rather than Cc
|
||||
message_json['to'] = message_json['object']['cc']
|
||||
if not isinstance(message_json['to'], list):
|
||||
|
@ -2801,6 +2816,7 @@ def create_report_post(base_dir: str,
|
|||
ticket_url = None
|
||||
conversation_id = None
|
||||
convthread_id = None
|
||||
searchable_by = []
|
||||
for to_url in post_to:
|
||||
# who is this report going to?
|
||||
to_nickname = to_url.split('/users/')[1]
|
||||
|
@ -2825,7 +2841,8 @@ def create_report_post(base_dir: str,
|
|||
content_license_url,
|
||||
media_license_url, media_creator,
|
||||
languages_understood, translate,
|
||||
buy_url, chat_url, auto_cw_cache)
|
||||
buy_url, chat_url, auto_cw_cache,
|
||||
searchable_by)
|
||||
if not post_json_object:
|
||||
continue
|
||||
|
||||
|
@ -3050,7 +3067,8 @@ def send_post(signing_priv_key_pem: str, project_version: str,
|
|||
translate: {}, buy_url: str, chat_url: str,
|
||||
auto_cw_cache: {},
|
||||
debug: bool, in_reply_to: str,
|
||||
in_reply_to_atom_uri: str, subject: str) -> int:
|
||||
in_reply_to_atom_uri: str, subject: str,
|
||||
searchable_by: []) -> int:
|
||||
"""Post to another inbox. Used by unit tests.
|
||||
"""
|
||||
with_digest = True
|
||||
|
@ -3137,7 +3155,7 @@ def send_post(signing_priv_key_pem: str, project_version: str,
|
|||
media_license_url, media_creator,
|
||||
languages_understood,
|
||||
translate, buy_url, chat_url,
|
||||
auto_cw_cache)
|
||||
auto_cw_cache, searchable_by)
|
||||
|
||||
# get the senders private key
|
||||
private_key_pem = get_person_key(nickname, domain, base_dir,
|
||||
|
@ -3259,7 +3277,7 @@ def send_post_via_server(signing_priv_key_pem: str, project_version: str,
|
|||
debug: bool, in_reply_to: str,
|
||||
in_reply_to_atom_uri: str,
|
||||
conversation_id: str, convthread_id: str,
|
||||
subject: str) -> int:
|
||||
subject: str, searchable_by: []) -> int:
|
||||
"""Send a post via a proxy (c2s)
|
||||
"""
|
||||
if not session:
|
||||
|
@ -3358,7 +3376,8 @@ 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, chat_url, auto_cw_cache)
|
||||
translate, buy_url, chat_url, auto_cw_cache,
|
||||
searchable_by)
|
||||
|
||||
auth_header = create_basic_auth_header(from_nickname, password)
|
||||
|
||||
|
|
51
tests.py
51
tests.py
|
@ -808,6 +808,7 @@ def create_server_alice(path: str, domain: str, port: int,
|
|||
chat_url = ''
|
||||
auto_cw_cache = {}
|
||||
test_video_transcript = ''
|
||||
searchable_by = []
|
||||
create_public_post(path, nickname, domain, port, http_prefix,
|
||||
"No wise fish would go anywhere without a porpoise",
|
||||
test_save_to_file,
|
||||
|
@ -826,7 +827,7 @@ def create_server_alice(path: str, domain: str, port: int,
|
|||
low_bandwidth, content_license_url,
|
||||
media_license_url, media_creator,
|
||||
languages_understood, translate, buy_url, chat_url,
|
||||
auto_cw_cache)
|
||||
auto_cw_cache, searchable_by)
|
||||
create_public_post(path, nickname, domain, port, http_prefix,
|
||||
"Curiouser and curiouser!",
|
||||
test_save_to_file,
|
||||
|
@ -845,7 +846,7 @@ def create_server_alice(path: str, domain: str, port: int,
|
|||
low_bandwidth, content_license_url,
|
||||
media_license_url, media_creator,
|
||||
languages_understood, translate, buy_url, chat_url,
|
||||
auto_cw_cache)
|
||||
auto_cw_cache, searchable_by)
|
||||
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",
|
||||
|
@ -865,7 +866,7 @@ def create_server_alice(path: str, domain: str, port: int,
|
|||
low_bandwidth, content_license_url,
|
||||
media_license_url, media_creator,
|
||||
languages_understood, translate, buy_url, chat_url,
|
||||
auto_cw_cache)
|
||||
auto_cw_cache, searchable_by)
|
||||
regenerate_index_for_box(path, nickname, domain, 'outbox')
|
||||
global TEST_SERVER_ALICE_RUNNING
|
||||
TEST_SERVER_ALICE_RUNNING = True
|
||||
|
@ -1003,6 +1004,7 @@ def create_server_bob(path: str, domain: str, port: int,
|
|||
chat_url = ''
|
||||
auto_cw_cache = {}
|
||||
test_video_transcript = ''
|
||||
searchable_by = []
|
||||
create_public_post(path, nickname, domain, port, http_prefix,
|
||||
"It's your life, live it your way.",
|
||||
test_save_to_file,
|
||||
|
@ -1021,7 +1023,7 @@ def create_server_bob(path: str, domain: str, port: int,
|
|||
low_bandwidth, content_license_url,
|
||||
media_license_url, media_creator,
|
||||
languages_understood, translate, buy_url, chat_url,
|
||||
auto_cw_cache)
|
||||
auto_cw_cache, searchable_by)
|
||||
create_public_post(path, nickname, domain, port, http_prefix,
|
||||
"One of the things I've realised is that " +
|
||||
"I am very simple",
|
||||
|
@ -1041,7 +1043,7 @@ def create_server_bob(path: str, domain: str, port: int,
|
|||
low_bandwidth, content_license_url,
|
||||
media_license_url, media_creator,
|
||||
languages_understood, translate, buy_url, chat_url,
|
||||
auto_cw_cache)
|
||||
auto_cw_cache, searchable_by)
|
||||
create_public_post(path, nickname, domain, port, http_prefix,
|
||||
"Quantum physics is a bit of a passion of mine",
|
||||
test_save_to_file,
|
||||
|
@ -1060,7 +1062,7 @@ def create_server_bob(path: str, domain: str, port: int,
|
|||
low_bandwidth, content_license_url,
|
||||
media_license_url, media_creator,
|
||||
languages_understood, translate, buy_url, chat_url,
|
||||
auto_cw_cache)
|
||||
auto_cw_cache, searchable_by)
|
||||
regenerate_index_for_box(path, nickname, domain, 'outbox')
|
||||
global TEST_SERVER_BOB_RUNNING
|
||||
TEST_SERVER_BOB_RUNNING = True
|
||||
|
@ -1467,6 +1469,7 @@ def test_post_message_between_servers(base_dir: str) -> None:
|
|||
buy_url = ''
|
||||
chat_url = ''
|
||||
auto_cw_cache = {}
|
||||
searchable_by = []
|
||||
send_result = \
|
||||
send_post(signing_priv_key_pem, __version__,
|
||||
session_alice, alice_dir, 'alice', alice_domain, alice_port,
|
||||
|
@ -1484,7 +1487,8 @@ def test_post_message_between_servers(base_dir: str) -> None:
|
|||
alice_shared_item_federation_tokens, low_bandwidth,
|
||||
content_license_url, media_license_url, media_creator,
|
||||
translate, buy_url, chat_url, auto_cw_cache, True,
|
||||
in_reply_to, in_reply_to_atom_uri, subject)
|
||||
in_reply_to, in_reply_to_atom_uri, subject,
|
||||
searchable_by)
|
||||
print('send_result: ' + str(send_result))
|
||||
|
||||
queue_path = data_dir(bob_dir) + '/bob@' + bob_domain + '/queue'
|
||||
|
@ -1864,6 +1868,7 @@ def test_follow_between_servers(base_dir: str) -> None:
|
|||
chat_url = ''
|
||||
video_transcript = None
|
||||
auto_cw_cache = {}
|
||||
searchable_by = []
|
||||
send_result = \
|
||||
send_post(signing_priv_key_pem, __version__,
|
||||
session_alice, alice_dir, 'alice', alice_domain, alice_port,
|
||||
|
@ -1878,7 +1883,8 @@ def test_follow_between_servers(base_dir: str) -> None:
|
|||
alice_shared_item_federation_tokens, low_bandwidth,
|
||||
content_license_url, media_license_url, media_creator,
|
||||
translate, buy_url, chat_url, auto_cw_cache, True,
|
||||
in_reply_to, in_reply_to_atom_uri, subject)
|
||||
in_reply_to, in_reply_to_atom_uri, subject,
|
||||
searchable_by)
|
||||
print('send_result: ' + str(send_result))
|
||||
|
||||
queue_path = data_dir(bob_dir) + '/bob@' + bob_domain + '/queue'
|
||||
|
@ -2263,6 +2269,7 @@ def test_shared_items_federation(base_dir: str) -> None:
|
|||
chat_url = ''
|
||||
video_transcript = None
|
||||
auto_cw_cache = {}
|
||||
searchable_by = []
|
||||
send_result = \
|
||||
send_post(signing_priv_key_pem, __version__,
|
||||
session_alice, alice_dir, 'alice', alice_domain, alice_port,
|
||||
|
@ -2277,7 +2284,8 @@ def test_shared_items_federation(base_dir: str) -> None:
|
|||
alice_shared_item_federation_tokens, low_bandwidth,
|
||||
content_license_url, media_license_url, media_creator,
|
||||
translate, buy_url, chat_url, auto_cw_cache, True,
|
||||
in_reply_to, in_reply_to_atom_uri, subject)
|
||||
in_reply_to, in_reply_to_atom_uri, subject,
|
||||
searchable_by)
|
||||
print('send_result: ' + str(send_result))
|
||||
|
||||
queue_path = data_dir(bob_dir) + '/bob@' + bob_domain + '/queue'
|
||||
|
@ -2704,6 +2712,7 @@ def test_group_follow(base_dir: str) -> None:
|
|||
chat_url = ''
|
||||
video_transcript = None
|
||||
auto_cw_cache = {}
|
||||
searchable_by = []
|
||||
send_result = \
|
||||
send_post(signing_priv_key_pem, __version__,
|
||||
session_alice, alice_dir, 'alice', alice_domain, alice_port,
|
||||
|
@ -2718,7 +2727,8 @@ def test_group_follow(base_dir: str) -> None:
|
|||
alice_shared_item_federation_tokens, low_bandwidth,
|
||||
content_license_url, media_license_url, media_creator,
|
||||
translate, buy_url, chat_url, auto_cw_cache, True,
|
||||
in_reply_to, in_reply_to_atom_uri, subject)
|
||||
in_reply_to, in_reply_to_atom_uri, subject,
|
||||
searchable_by)
|
||||
print('send_result: ' + str(send_result))
|
||||
|
||||
for _ in range(20):
|
||||
|
@ -3102,6 +3112,7 @@ def _test_create_person_account(base_dir: str):
|
|||
buy_url = ''
|
||||
chat_url = ''
|
||||
auto_cw_cache = {}
|
||||
searchable_by = []
|
||||
test_post_json = \
|
||||
create_public_post(base_dir, nickname, domain, port, http_prefix,
|
||||
content, save_to_file,
|
||||
|
@ -3117,7 +3128,7 @@ def _test_create_person_account(base_dir: str):
|
|||
low_bandwidth, content_license_url,
|
||||
media_license_url, media_creator,
|
||||
languages_understood, translate, buy_url, chat_url,
|
||||
auto_cw_cache)
|
||||
auto_cw_cache, searchable_by)
|
||||
assert test_post_json
|
||||
assert test_post_json.get('object')
|
||||
assert test_post_json['object']['content']
|
||||
|
@ -3146,7 +3157,7 @@ def _test_create_person_account(base_dir: str):
|
|||
low_bandwidth, content_license_url,
|
||||
media_license_url, media_creator,
|
||||
languages_understood, translate, buy_url, chat_url,
|
||||
auto_cw_cache)
|
||||
auto_cw_cache, searchable_by)
|
||||
assert test_post_json
|
||||
assert test_post_json.get('object')
|
||||
assert test_post_json['object']['content']
|
||||
|
@ -3355,6 +3366,7 @@ def test_client_to_server(base_dir: str):
|
|||
chat_url = ''
|
||||
video_transcript = None
|
||||
auto_cw_cache = {}
|
||||
searchable_by = []
|
||||
send_result = \
|
||||
send_post_via_server(signing_priv_key_pem, __version__,
|
||||
alice_dir, session_alice, 'alice', password,
|
||||
|
@ -3371,7 +3383,7 @@ def test_client_to_server(base_dir: str):
|
|||
event_date, event_time, event_end_time, location,
|
||||
translate, buy_url, chat_url, auto_cw_cache,
|
||||
True, None, None, conversation_id, convthread_id,
|
||||
None)
|
||||
None, searchable_by)
|
||||
print('send_result: ' + str(send_result))
|
||||
|
||||
for _ in range(30):
|
||||
|
@ -5005,6 +5017,7 @@ def _test_reply_to_public_post(base_dir: str) -> None:
|
|||
chat_url = ''
|
||||
auto_cw_cache = {}
|
||||
video_transcript = ''
|
||||
searchable_by = []
|
||||
reply = \
|
||||
create_public_post(base_dir, nickname, domain, port, http_prefix,
|
||||
content, save_to_file,
|
||||
|
@ -5021,7 +5034,7 @@ def _test_reply_to_public_post(base_dir: str) -> None:
|
|||
low_bandwidth, content_license_url,
|
||||
media_license_url, media_creator,
|
||||
languages_understood, translate, buy_url, chat_url,
|
||||
auto_cw_cache)
|
||||
auto_cw_cache, searchable_by)
|
||||
# print(str(reply))
|
||||
expected_str = \
|
||||
'<p><span class=\"h-card\">' + \
|
||||
|
@ -6051,6 +6064,7 @@ def _test_links_within_post(base_dir: str) -> None:
|
|||
chat_url = ''
|
||||
auto_cw_cache = {}
|
||||
video_transcript = ''
|
||||
searchable_by = []
|
||||
|
||||
post_json_object = \
|
||||
create_public_post(base_dir, nickname, domain, port, http_prefix,
|
||||
|
@ -6067,7 +6081,7 @@ def _test_links_within_post(base_dir: str) -> None:
|
|||
low_bandwidth, content_license_url,
|
||||
media_license_url, media_creator,
|
||||
languages_understood, translate, buy_url, chat_url,
|
||||
auto_cw_cache)
|
||||
auto_cw_cache, searchable_by)
|
||||
|
||||
expected_str = \
|
||||
'<p>This is a test post with links.<br><br>' + \
|
||||
|
@ -6114,7 +6128,7 @@ def _test_links_within_post(base_dir: str) -> None:
|
|||
low_bandwidth, content_license_url,
|
||||
media_license_url, media_creator,
|
||||
languages_understood, translate, buy_url, chat_url,
|
||||
auto_cw_cache)
|
||||
auto_cw_cache, searchable_by)
|
||||
assert post_json_object['object']['content'] == content
|
||||
assert post_json_object['object']['contentMap'][system_language] == content
|
||||
|
||||
|
@ -6139,7 +6153,7 @@ def _test_links_within_post(base_dir: str) -> None:
|
|||
low_bandwidth, content_license_url,
|
||||
media_license_url, media_creator,
|
||||
languages_understood, translate, buy_url, chat_url,
|
||||
auto_cw_cache)
|
||||
auto_cw_cache, searchable_by)
|
||||
if post_json_object['object']['content'] != content:
|
||||
print('content1: ' + post_json_object['object']['content'])
|
||||
print('content2: ' + content)
|
||||
|
@ -7241,6 +7255,7 @@ def _test_can_replyto(base_dir: str) -> None:
|
|||
chat_url = ''
|
||||
auto_cw_cache = {}
|
||||
video_transcript = ''
|
||||
searchable_by = []
|
||||
|
||||
post_json_object = \
|
||||
create_public_post(base_dir, nickname, domain, port, http_prefix,
|
||||
|
@ -7257,7 +7272,7 @@ def _test_can_replyto(base_dir: str) -> None:
|
|||
low_bandwidth, content_license_url,
|
||||
media_license_url, media_creator,
|
||||
languages_understood, translate, buy_url, chat_url,
|
||||
auto_cw_cache)
|
||||
auto_cw_cache, searchable_by)
|
||||
# set the date on the post
|
||||
curr_date_str = "2021-09-08T20:45:00Z"
|
||||
post_json_object['published'] = curr_date_str
|
||||
|
|
Loading…
Reference in New Issue