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