Add arguments for media license

merge-requests/30/head
Bob Mottram 2023-01-22 23:47:13 +00:00
parent 6ed1d3166e
commit bdde4450c1
7 changed files with 130 additions and 23 deletions

View File

@ -705,6 +705,7 @@ class PubServer(BaseHTTPRequestHandler):
conversation_id,
self.server.low_bandwidth,
self.server.content_license_url,
self.server.content_license_url,
languages_understood, False,
self.server.translate, buy_url)
if message_json:
@ -20795,6 +20796,9 @@ class PubServer(BaseHTTPRequestHandler):
self.server.domain_full,
self.server.person_cache)
media_license_url = self.server.content_license_url
if fields.get('mediaLicense'):
media_license_url = fields['mediaLicense']
message_json = \
create_public_post(self.server.base_dir,
nickname,
@ -20817,6 +20821,7 @@ class PubServer(BaseHTTPRequestHandler):
conversation_id,
self.server.low_bandwidth,
self.server.content_license_url,
media_license_url,
languages_understood,
self.server.translate, buy_url)
if message_json:
@ -20936,6 +20941,9 @@ class PubServer(BaseHTTPRequestHandler):
nickname,
self.server.domain_full,
self.server.person_cache)
media_license_url = self.server.content_license_url
if fields.get('mediaLicense'):
media_license_url = fields['mediaLicense']
message_json = \
create_blog_post(self.server.base_dir, nickname,
self.server.domain, self.server.port,
@ -20957,6 +20965,7 @@ class PubServer(BaseHTTPRequestHandler):
conversation_id,
self.server.low_bandwidth,
self.server.content_license_url,
media_license_url,
languages_understood,
self.server.translate, buy_url)
if message_json:
@ -21101,7 +21110,9 @@ class PubServer(BaseHTTPRequestHandler):
nickname,
self.server.domain_full,
self.server.person_cache)
media_license_url = self.server.content_license_url
if fields.get('mediaLicense'):
media_license_url = fields['mediaLicense']
message_json = \
create_unlisted_post(self.server.base_dir,
nickname,
@ -21125,6 +21136,7 @@ class PubServer(BaseHTTPRequestHandler):
conversation_id,
self.server.low_bandwidth,
self.server.content_license_url,
media_license_url,
languages_understood,
self.server.translate, buy_url)
if message_json:
@ -21211,6 +21223,9 @@ class PubServer(BaseHTTPRequestHandler):
nickname,
self.server.domain_full,
self.server.person_cache)
media_license_url = self.server.content_license_url
if fields.get('mediaLicense'):
media_license_url = fields['mediaLicense']
message_json = \
create_followers_only_post(self.server.base_dir,
nickname,
@ -21236,6 +21251,7 @@ class PubServer(BaseHTTPRequestHandler):
conversation_id,
self.server.low_bandwidth,
self.server.content_license_url,
media_license_url,
languages_understood,
self.server.translate,
buy_url)
@ -21331,6 +21347,9 @@ class PubServer(BaseHTTPRequestHandler):
if fields.get('replychatmsg'):
reply_is_chat = fields['replychatmsg']
media_license_url = content_license_url
if fields.get('mediaLicense'):
media_license_url = fields['mediaLicense']
message_json = \
create_direct_message_post(self.server.base_dir,
nickname,
@ -21359,6 +21378,7 @@ class PubServer(BaseHTTPRequestHandler):
conversation_id,
self.server.low_bandwidth,
content_license_url,
media_license_url,
languages_understood,
reply_is_chat,
self.server.translate,
@ -21453,6 +21473,9 @@ class PubServer(BaseHTTPRequestHandler):
nickname,
self.server.domain_full,
self.server.person_cache)
media_license_url = self.server.content_license_url
if fields.get('mediaLicense'):
media_license_url = fields['mediaLicense']
message_json = \
create_direct_message_post(self.server.base_dir,
nickname,
@ -21477,6 +21500,7 @@ class PubServer(BaseHTTPRequestHandler):
conversation_id,
self.server.low_bandwidth,
self.server.content_license_url,
media_license_url,
languages_understood,
False, self.server.translate,
buy_url)
@ -21559,6 +21583,9 @@ class PubServer(BaseHTTPRequestHandler):
nickname,
self.server.domain_full,
self.server.person_cache)
media_license_url = self.server.content_license_url
if fields.get('mediaLicense'):
media_license_url = fields['mediaLicense']
message_json = \
create_report_post(self.server.base_dir,
nickname,
@ -21573,6 +21600,7 @@ class PubServer(BaseHTTPRequestHandler):
fields['languagesDropdown'],
self.server.low_bandwidth,
self.server.content_license_url,
media_license_url,
languages_understood,
self.server.translate)
if message_json:
@ -21609,6 +21637,9 @@ class PubServer(BaseHTTPRequestHandler):
nickname,
self.server.domain_full,
self.server.person_cache)
media_license_url = self.server.content_license_url
if fields.get('mediaLicense'):
media_license_url = fields['mediaLicense']
message_json = \
create_question_post(self.server.base_dir,
nickname,
@ -21626,6 +21657,7 @@ class PubServer(BaseHTTPRequestHandler):
fields['languagesDropdown'],
self.server.low_bandwidth,
self.server.content_license_url,
media_license_url,
languages_understood,
self.server.translate)
if message_json:

View File

@ -480,6 +480,7 @@ def _desktop_reply_to_post(session, post_id: str,
espeak, conversation_id: str,
low_bandwidth: bool,
content_license_url: str,
media_license_url: str,
signing_priv_key_pem: str,
translate: {}) -> None:
"""Use the desktop client to send a reply to the most recent post
@ -540,6 +541,7 @@ def _desktop_reply_to_post(session, post_id: str,
cached_webfingers, person_cache, is_article,
system_language, languages_understood,
low_bandwidth, content_license_url,
media_license_url,
event_date, event_time, event_end_time, location,
translate, buy_url, debug, post_id, post_id,
conversation_id, subject) == 0:
@ -558,6 +560,7 @@ def _desktop_new_post(session,
languages_understood: [],
espeak, low_bandwidth: bool,
content_license_url: str,
media_license_url: str,
signing_priv_key_pem: str,
translate: {}) -> None:
"""Use the desktop client to create a new post
@ -615,6 +618,7 @@ def _desktop_new_post(session,
cached_webfingers, person_cache, is_article,
system_language, languages_understood,
low_bandwidth, content_license_url,
media_license_url,
event_date, event_time, event_end_time, location,
translate, buy_url, debug, None, None,
conversation_id, subject) == 0:
@ -1224,6 +1228,7 @@ def _desktop_new_dm(session, to_handle: str,
languages_understood: [],
espeak, low_bandwidth: bool,
content_license_url: str,
media_license_url: str,
signing_priv_key_pem: str,
translate: {}) -> None:
"""Use the desktop client to create a new direct message
@ -1249,6 +1254,7 @@ def _desktop_new_dm(session, to_handle: str,
languages_understood,
espeak, low_bandwidth,
content_license_url,
media_license_url,
signing_priv_key_pem, translate)
@ -1261,6 +1267,7 @@ def _desktop_new_dm_base(session, to_handle: str,
languages_understood: [],
espeak, low_bandwidth: bool,
content_license_url: str,
media_license_url: str,
signing_priv_key_pem: str,
translate: {}) -> None:
"""Use the desktop client to create a new direct message
@ -1361,6 +1368,7 @@ def _desktop_new_dm_base(session, to_handle: str,
cached_webfingers, person_cache, is_article,
system_language, languages_understood,
low_bandwidth, content_license_url,
media_license_url,
event_date, event_time, event_end_time, location,
translate, buy_url, debug, None, None,
conversation_id, subject) == 0:
@ -1447,6 +1455,7 @@ def run_desktop_client(base_dir: str, proxy_type: str, http_prefix: str,
signing_priv_key_pem = None
content_license_url = 'https://creativecommons.org/licenses/by-nc/4.0'
media_license_url = 'https://creativecommons.org/licenses/by-nc/4.0'
blocked_cache = {}
languages_understood = []
@ -1853,6 +1862,7 @@ def run_desktop_client(base_dir: str, proxy_type: str, http_prefix: str,
espeak, conversation_id,
low_bandwidth,
content_license_url,
media_license_url,
signing_priv_key_pem,
translate)
refresh_timeline = True
@ -1891,6 +1901,7 @@ def run_desktop_client(base_dir: str, proxy_type: str, http_prefix: str,
languages_understood,
espeak, low_bandwidth,
content_license_url,
media_license_url,
signing_priv_key_pem, translate)
refresh_timeline = True
else:
@ -1904,6 +1915,7 @@ def run_desktop_client(base_dir: str, proxy_type: str, http_prefix: str,
languages_understood,
espeak, low_bandwidth,
content_license_url,
media_license_url,
signing_priv_key_pem, translate)
refresh_timeline = True
print('')

View File

@ -157,6 +157,10 @@ def _command_options() -> None:
'licenses/by-nc/4.0',
help='Url of the license used for the ' +
'instance content')
parser.add_argument('--media_license_url', type=str,
default='https://creativecommons.org/' +
'licenses/by-nc/4.0',
help='Url of the license used for attached media')
parser.add_argument('--import_emoji', type=str,
default='',
help='Import emoji dict from the given filename')
@ -1704,6 +1708,7 @@ def _command_options() -> None:
argb.language, languages_understood,
argb.low_bandwidth,
argb.content_license_url,
argb.media_license_url,
argb.eventDate, argb.eventTime, argb.eventEndTime,
argb.eventLocation, translate, argb.buyUrl,
argb.debug,
@ -3393,6 +3398,7 @@ def _command_options() -> None:
test_event_end_time, test_location,
test_is_article, argb.language, conversation_id,
low_bandwidth, argb.content_license_url,
argb.media_license_url,
languages_understood, translate, buy_url)
create_public_post(base_dir, nickname, domain, port, http_prefix,
"Zoiks!!!",
@ -3407,6 +3413,7 @@ def _command_options() -> None:
test_event_end_time, test_location,
test_is_article, argb.language, conversation_id,
low_bandwidth, argb.content_license_url,
argb.media_license_url,
languages_understood, translate, buy_url)
create_public_post(base_dir, nickname, domain, port, http_prefix,
"Hey scoob we need like a hundred more #milkshakes",
@ -3421,6 +3428,7 @@ def _command_options() -> None:
test_event_end_time, test_location,
test_is_article, argb.language, conversation_id,
low_bandwidth, argb.content_license_url,
argb.media_license_url,
languages_understood, translate, buy_url)
create_public_post(base_dir, nickname, domain, port, http_prefix,
"Getting kinda spooky around here",
@ -3435,6 +3443,7 @@ def _command_options() -> None:
test_event_end_time, test_location,
test_is_article, argb.language, conversation_id,
low_bandwidth, argb.content_license_url,
argb.media_license_url,
languages_understood, translate, buy_url)
create_public_post(base_dir, nickname, domain, port, http_prefix,
"And they would have gotten away with it too" +
@ -3450,6 +3459,7 @@ def _command_options() -> None:
test_event_end_time, test_location,
test_is_article, argb.language, conversation_id,
low_bandwidth, argb.content_license_url,
argb.media_license_url,
languages_understood, translate, buy_url)
create_public_post(base_dir, nickname, domain, port, http_prefix,
"man these centralized sites are like the worst!",
@ -3464,6 +3474,7 @@ def _command_options() -> None:
test_event_end_time, test_location,
test_is_article, argb.language, conversation_id,
low_bandwidth, argb.content_license_url,
argb.media_license_url,
languages_understood, translate, buy_url)
create_public_post(base_dir, nickname, domain, port, http_prefix,
"another mystery solved #test",
@ -3478,6 +3489,7 @@ def _command_options() -> None:
test_event_end_time, test_location,
test_is_article, argb.language, conversation_id,
low_bandwidth, argb.content_license_url,
argb.media_license_url,
languages_understood, translate, buy_url)
create_public_post(base_dir, nickname, domain, port, http_prefix,
"let's go bowling",
@ -3492,6 +3504,7 @@ def _command_options() -> None:
test_event_end_time, test_location,
test_is_article, argb.language, conversation_id,
low_bandwidth, argb.content_license_url,
argb.media_license_url,
languages_understood, translate, buy_url)
domain_full = domain + ':' + str(port)
clear_follows(base_dir, nickname, domain)

View File

@ -3781,7 +3781,7 @@ def _bounce_dm(sender_post_id: str, session, http_prefix: str,
event_date, event_time, event_end_time,
location, system_language, conversation_id,
low_bandwidth,
content_license_url,
content_license_url, content_license_url,
languages_understood, bounce_is_chat,
translate, buy_url)
if not post_json_object:

View File

@ -547,7 +547,8 @@ def _convert_rss_to_activitypub(base_dir: str, http_prefix: str,
allow_local_network_access: bool,
system_language: str,
low_bandwidth: bool,
content_license_url: str) -> None:
content_license_url: str,
media_license_url: str) -> None:
"""Converts rss items in a newswire into posts
"""
if not newswire:
@ -646,6 +647,7 @@ def _convert_rss_to_activitypub(base_dir: str, http_prefix: str,
rss_title, system_language,
conversation_id, low_bandwidth,
content_license_url,
media_license_url,
languages_understood, translate,
buy_url)
if not blog:
@ -836,6 +838,7 @@ def run_newswire_daemon(base_dir: str, httpd,
httpd.allow_local_network_access,
httpd.system_language,
httpd.low_bandwidth,
httpd.content_license_url,
httpd.content_license_url)
print('Newswire feed converted to ActivityPub')

View File

@ -1143,8 +1143,9 @@ def _create_post_s2s(base_dir: str, nickname: str, domain: str, port: int,
post_object_type: str, summary: str,
in_reply_to_atom_uri: str, system_language: str,
conversation_id: str, low_bandwidth: bool,
content_license_url: str, buy_url: str,
translate: {}) -> {}:
content_license_url: str,
media_license_url: str,
buy_url: str, translate: {}) -> {}:
"""Creates a new server-to-server post
"""
actor_url = local_actor_url(http_prefix, nickname, domain)
@ -1206,7 +1207,7 @@ def _create_post_s2s(base_dir: str, nickname: str, domain: str, port: int,
attach_media(base_dir, http_prefix, nickname, domain, port,
new_post['object'], attach_image_filename,
media_type, image_description, city, low_bandwidth,
content_license_url)
media_license_url)
_attach_post_license(new_post['object'], content_license_url)
_attach_buy_link(new_post['object'], buy_url, translate)
return new_post
@ -1222,8 +1223,8 @@ def _create_post_c2s(base_dir: str, nickname: str, domain: str, port: int,
post_object_type: str, summary: str,
in_reply_to_atom_uri: str, system_language: str,
conversation_id: str, low_bandwidth: str,
content_license_url: str, buy_url: str,
translate: {}) -> {}:
content_license_url: str, media_license_url: str,
buy_url: str, translate: {}) -> {}:
"""Creates a new client-to-server post
"""
domain_full = get_full_domain(domain, port)
@ -1275,7 +1276,7 @@ def _create_post_c2s(base_dir: str, nickname: str, domain: str, port: int,
attach_media(base_dir, http_prefix, nickname, domain, port,
new_post, attach_image_filename,
media_type, image_description, city, low_bandwidth,
content_license_url)
media_license_url)
_attach_post_license(new_post, content_license_url)
_attach_buy_link(new_post, buy_url, translate)
return new_post
@ -1486,6 +1487,7 @@ def _create_post_base(base_dir: str,
system_language: str,
conversation_id: str, low_bandwidth: bool,
content_license_url: str,
media_license_url: str,
languages_understood: [], translate: {},
buy_url: str) -> {}:
"""Creates a message
@ -1645,7 +1647,8 @@ def _create_post_base(base_dir: str,
post_object_type, summary,
in_reply_to_atom_uri, system_language,
conversation_id, low_bandwidth,
content_license_url, buy_url, translate)
content_license_url, media_license_url,
buy_url, translate)
else:
new_post = \
_create_post_c2s(base_dir, nickname, domain, port,
@ -1658,7 +1661,8 @@ def _create_post_base(base_dir: str,
post_object_type, summary,
in_reply_to_atom_uri, system_language,
conversation_id, low_bandwidth,
content_license_url, buy_url, translate)
content_license_url, media_license_url,
buy_url, translate)
_create_post_mentions(cc_url, new_post, to_recipients, tags)
@ -1899,6 +1903,7 @@ def create_public_post(base_dir: str,
location: str, is_article: bool, system_language: str,
conversation_id: str, low_bandwidth: bool,
content_license_url: str,
media_license_url: str,
languages_understood: [], translate: {},
buy_url: str) -> {}:
"""Public post
@ -1934,6 +1939,7 @@ def create_public_post(base_dir: str,
event_status, ticket_url, system_language,
conversation_id, low_bandwidth,
content_license_url,
media_license_url,
languages_understood, translate, buy_url)
@ -1979,6 +1985,7 @@ def create_blog_post(base_dir: str,
location: str, system_language: str,
conversation_id: str, low_bandwidth: bool,
content_license_url: str,
media_license_url: str,
languages_understood: [], translate: {},
buy_url: str) -> {}:
blog_json = \
@ -1993,6 +2000,7 @@ def create_blog_post(base_dir: str,
event_date, event_time, event_end_time, location,
True, system_language, conversation_id,
low_bandwidth, content_license_url,
media_license_url,
languages_understood, translate, buy_url)
blog_json['object']['url'] = \
blog_json['object']['url'].replace('/@', '/users/')
@ -2009,6 +2017,7 @@ def create_news_post(base_dir: str,
subject: str, system_language: str,
conversation_id: str, low_bandwidth: bool,
content_license_url: str,
media_license_url: str,
languages_understood: [], translate: {},
buy_url: str) -> {}:
client_to_server = False
@ -2031,6 +2040,7 @@ def create_news_post(base_dir: str,
event_date, event_time, event_end_time, location,
True, system_language, conversation_id,
low_bandwidth, content_license_url,
media_license_url,
languages_understood, translate, buy_url)
blog['object']['type'] = 'Article'
return blog
@ -2047,6 +2057,7 @@ def create_question_post(base_dir: str,
subject: str, duration_days: int,
system_language: str, low_bandwidth: bool,
content_license_url: str,
media_license_url: str,
languages_understood: [], translate: {}) -> {}:
"""Question post with multiple choice options
"""
@ -2066,6 +2077,7 @@ def create_question_post(base_dir: str,
None, None, None,
None, None, None, None, None, system_language,
None, low_bandwidth, content_license_url,
media_license_url,
languages_understood, translate, buy_url)
message_json['object']['type'] = 'Question'
message_json['object']['oneOf'] = []
@ -2101,6 +2113,7 @@ def create_unlisted_post(base_dir: str,
location: str, system_language: str,
conversation_id: str, low_bandwidth: bool,
content_license_url: str,
media_license_url: str,
languages_understood: [], translate: {},
buy_url: str) -> {}:
"""Unlisted post. This has the #Public and followers links inverted.
@ -2121,8 +2134,8 @@ def create_unlisted_post(base_dir: str,
None, None, None, event_date, event_end_time,
None, None, None, None, None, system_language,
conversation_id, low_bandwidth,
content_license_url, languages_understood,
translate, buy_url)
content_license_url, media_license_url,
languages_understood, translate, buy_url)
def create_followers_only_post(base_dir: str,
@ -2140,6 +2153,7 @@ def create_followers_only_post(base_dir: str,
location: str, system_language: str,
conversation_id: str, low_bandwidth: bool,
content_license_url: str,
media_license_url: str,
languages_understood: [],
translate: {}, buy_url: str) -> {}:
"""Followers only post
@ -2158,8 +2172,8 @@ def create_followers_only_post(base_dir: str,
None, None, None, event_date, event_end_time,
None, None, None, None, None, system_language,
conversation_id, low_bandwidth,
content_license_url, languages_understood,
translate, buy_url)
content_license_url, media_license_url,
languages_understood, translate, buy_url)
def get_mentioned_people(base_dir: str, http_prefix: str,
@ -2215,6 +2229,7 @@ def create_direct_message_post(base_dir: str,
location: str, system_language: str,
conversation_id: str, low_bandwidth: bool,
content_license_url: str,
media_license_url: str,
languages_understood: [],
dm_is_chat: bool, translate: {},
buy_url: str) -> {}:
@ -2242,8 +2257,8 @@ def create_direct_message_post(base_dir: str,
None, None, None, event_date, event_end_time,
None, None, None, None, None, system_language,
conversation_id, low_bandwidth,
content_license_url, languages_understood,
translate, buy_url)
content_license_url, media_license_url,
languages_understood, translate, buy_url)
# mentioned recipients go into To rather than Cc
message_json['to'] = message_json['object']['cc']
message_json['object']['to'] = message_json['to']
@ -2267,6 +2282,7 @@ def create_report_post(base_dir: str,
debug: bool, subject: str, system_language: str,
low_bandwidth: bool,
content_license_url: str,
media_license_url: str,
languages_understood: [], translate: {}) -> {}:
"""Send a report to moderators
"""
@ -2346,6 +2362,7 @@ def create_report_post(base_dir: str,
None, None, None,
None, None, None, None, None, system_language,
None, low_bandwidth, content_license_url,
media_license_url,
languages_understood, translate, buy_url)
if not post_json_object:
continue
@ -2471,6 +2488,7 @@ def send_post(signing_priv_key_pem: str, project_version: str,
shared_items_federated_domains: [],
shared_item_federation_tokens: {},
low_bandwidth: bool, content_license_url: str,
media_license_url: str,
translate: {}, buy_url: str,
debug: bool = False, in_reply_to: str = None,
in_reply_to_atom_uri: str = None, subject: str = None) -> int:
@ -2538,7 +2556,8 @@ def send_post(signing_priv_key_pem: str, project_version: str,
None, None, None,
None, None, None, None, None, system_language,
conversation_id, low_bandwidth,
content_license_url, languages_understood,
content_license_url, media_license_url,
languages_understood,
translate, buy_url)
# get the senders private key
@ -2635,6 +2654,7 @@ def send_post_via_server(signing_priv_key_pem: str, project_version: str,
languages_understood: [],
low_bandwidth: bool,
content_license_url: str,
media_license_url: str,
event_date: str, event_time: str, event_end_time: str,
location: str, translate: {}, buy_url: str,
debug: bool = False,
@ -2727,7 +2747,8 @@ def send_post_via_server(signing_priv_key_pem: str, project_version: str,
None, None, None, event_date, event_end_time,
None, None, None, None, None, system_language,
conversation_id, low_bandwidth,
content_license_url, languages_understood,
content_license_url, media_license_url,
languages_understood,
translate, buy_url)
auth_header = create_basic_auth_header(from_nickname, password)

View File

@ -774,6 +774,7 @@ def create_server_alice(path: str, domain: str, port: int,
conversation_id = None
translate = {}
content_license_url = 'https://creativecommons.org/licenses/by-nc/4.0'
media_license_url = 'https://creativecommons.org/licenses/by-nc/4.0'
buy_url = ''
create_public_post(path, nickname, domain, port, http_prefix,
"No wise fish would go anywhere without a porpoise",
@ -789,6 +790,7 @@ def create_server_alice(path: str, domain: str, port: int,
test_event_end_time, test_location,
test_is_article, system_language, conversation_id,
low_bandwidth, content_license_url,
media_license_url,
languages_understood, translate, buy_url)
create_public_post(path, nickname, domain, port, http_prefix,
"Curiouser and curiouser!",
@ -804,6 +806,7 @@ def create_server_alice(path: str, domain: str, port: int,
test_event_end_time, test_location,
test_is_article, system_language, conversation_id,
low_bandwidth, content_license_url,
media_license_url,
languages_understood, translate, buy_url)
create_public_post(path, nickname, domain, port, http_prefix,
"In the gardens of memory, in the palace " +
@ -820,6 +823,7 @@ def create_server_alice(path: str, domain: str, port: int,
test_event_end_time, test_location,
test_is_article, system_language, conversation_id,
low_bandwidth, content_license_url,
media_license_url,
languages_understood, translate, buy_url)
regenerate_index_for_box(path, nickname, domain, 'outbox')
global TEST_SERVER_ALICE_RUNNING
@ -938,6 +942,7 @@ def create_server_bob(path: str, domain: str, port: int,
test_is_article = False
conversation_id = None
content_license_url = 'https://creativecommons.org/licenses/by-nc/4.0'
media_license_url = 'https://creativecommons.org/licenses/by-nc/4.0'
translate = {}
buy_url = ''
create_public_post(path, nickname, domain, port, http_prefix,
@ -954,6 +959,7 @@ def create_server_bob(path: str, domain: str, port: int,
test_event_end_time, test_location,
test_is_article, system_language, conversation_id,
low_bandwidth, content_license_url,
media_license_url,
languages_understood, translate, buy_url)
create_public_post(path, nickname, domain, port, http_prefix,
"One of the things I've realised is that " +
@ -970,6 +976,7 @@ def create_server_bob(path: str, domain: str, port: int,
test_event_end_time, test_location,
test_is_article, system_language, conversation_id,
low_bandwidth, content_license_url,
media_license_url,
languages_understood, translate, buy_url)
create_public_post(path, nickname, domain, port, http_prefix,
"Quantum physics is a bit of a passion of mine",
@ -985,6 +992,7 @@ def create_server_bob(path: str, domain: str, port: int,
test_event_end_time, test_location,
test_is_article, system_language, conversation_id,
low_bandwidth, content_license_url,
media_license_url,
languages_understood, translate, buy_url)
regenerate_index_for_box(path, nickname, domain, 'outbox')
global TEST_SERVER_BOB_RUNNING
@ -1235,6 +1243,7 @@ def test_post_message_between_servers(base_dir: str) -> None:
http_prefix = 'http'
proxy_type = None
content_license_url = 'https://creativecommons.org/licenses/by-nc/4.0'
media_license_url = 'https://creativecommons.org/licenses/by-nc/4.0'
if os.path.isdir(base_dir + '/.tests'):
shutil.rmtree(base_dir + '/.tests', ignore_errors=False, onerror=None)
@ -1339,7 +1348,8 @@ def test_post_message_between_servers(base_dir: str) -> None:
languages_understood,
alice_shared_items_federated_domains,
alice_shared_item_federation_tokens, low_bandwidth,
content_license_url, translate, buy_url,
content_license_url, media_license_url,
translate, buy_url,
in_reply_to, in_reply_to_atom_uri, subject)
print('send_result: ' + str(send_result))
@ -1568,6 +1578,7 @@ def test_follow_between_servers(base_dir: str) -> None:
proxy_type = None
federation_list = []
content_license_url = 'https://creativecommons.org/licenses/by-nc/4.0'
media_license_url = 'https://creativecommons.org/licenses/by-nc/4.0'
if os.path.isdir(base_dir + '/.tests'):
shutil.rmtree(base_dir + '/.tests', ignore_errors=False, onerror=None)
@ -1712,7 +1723,7 @@ def test_follow_between_servers(base_dir: str) -> None:
languages_understood,
alice_shared_items_federated_domains,
alice_shared_item_federation_tokens, low_bandwidth,
content_license_url, translate, buy_url,
content_license_url, media_license_url, translate, buy_url,
in_reply_to, in_reply_to_atom_uri, subject)
print('send_result: ' + str(send_result))
@ -1763,6 +1774,7 @@ def test_shared_items_federation(base_dir: str) -> None:
proxy_type = None
federation_list = []
content_license_url = 'https://creativecommons.org/licenses/by-nc/4.0'
media_license_url = 'https://creativecommons.org/licenses/by-nc/4.0'
if os.path.isdir(base_dir + '/.tests'):
shutil.rmtree(base_dir + '/.tests', ignore_errors=False, onerror=None)
@ -2080,7 +2092,8 @@ def test_shared_items_federation(base_dir: str) -> None:
languages_understood,
alice_shared_items_federated_domains,
alice_shared_item_federation_tokens, low_bandwidth,
content_license_url, translate, buy_url, True,
content_license_url, media_license_url,
translate, buy_url, True,
in_reply_to, in_reply_to_atom_uri, subject)
print('send_result: ' + str(send_result))
@ -2186,6 +2199,7 @@ def test_group_follow(base_dir: str) -> None:
proxy_type = None
federation_list = []
content_license_url = 'https://creativecommons.org/licenses/by-nc/4.0'
media_license_url = 'https://creativecommons.org/licenses/by-nc/4.0'
if os.path.isdir(base_dir + '/.tests'):
shutil.rmtree(base_dir + '/.tests', ignore_errors=False, onerror=None)
@ -2511,7 +2525,7 @@ def test_group_follow(base_dir: str) -> None:
languages_understood,
alice_shared_items_federated_domains,
alice_shared_item_federation_tokens, low_bandwidth,
content_license_url, translate, buy_url,
content_license_url, media_license_url, translate, buy_url,
in_reply_to, in_reply_to_atom_uri, subject)
print('send_result: ' + str(send_result))
@ -2881,6 +2895,7 @@ def _test_create_person_account(base_dir: str):
low_bandwidth = True
translate = {}
content_license_url = 'https://creativecommons.org/licenses/by-nc/4.0'
media_license_url = 'https://creativecommons.org/licenses/by-nc/4.0'
content = \
"If your \"independent organization\" is government funded...\n\n" + \
"(yawn)\n\n...then it's not really independent.\n\n" + \
@ -2899,6 +2914,7 @@ def _test_create_person_account(base_dir: str):
test_event_end_time, test_location,
test_is_article, system_language, conversation_id,
low_bandwidth, content_license_url,
media_license_url,
languages_understood, translate, buy_url)
assert test_post_json
assert test_post_json.get('object')
@ -2925,6 +2941,7 @@ def _test_create_person_account(base_dir: str):
test_event_end_time, test_location,
test_is_article, system_language, conversation_id,
low_bandwidth, content_license_url,
media_license_url,
languages_understood, translate, buy_url)
assert test_post_json
assert test_post_json.get('object')
@ -3005,6 +3022,7 @@ def test_client_to_server(base_dir: str):
global TEST_SERVER_ALICE_RUNNING
global TEST_SERVER_BOB_RUNNING
content_license_url = 'https://creativecommons.org/licenses/by-nc/4.0'
media_license_url = 'https://creativecommons.org/licenses/by-nc/4.0'
TEST_SERVER_ALICE_RUNNING = False
TEST_SERVER_BOB_RUNNING = False
@ -3138,6 +3156,7 @@ def test_client_to_server(base_dir: str):
cached_webfingers, person_cache, is_article,
system_language, languages_understood,
low_bandwidth, content_license_url,
media_license_url,
event_date, event_time, event_end_time, location,
translate, buy_url, True, None, None,
conversation_id, None)
@ -4738,6 +4757,7 @@ def _test_reply_to_public_post(base_dir: str) -> None:
conversation_id = None
low_bandwidth = True
content_license_url = 'https://creativecommons.org/licenses/by-nc/4.0'
media_license_url = 'https://creativecommons.org/licenses/by-nc/4.0'
translate = {}
buy_url = ''
reply = \
@ -4752,6 +4772,7 @@ def _test_reply_to_public_post(base_dir: str) -> None:
test_event_end_time, test_location,
test_is_article, system_language, conversation_id,
low_bandwidth, content_license_url,
media_license_url,
languages_understood, translate, buy_url)
# print(str(reply))
expected_str = \
@ -5689,6 +5710,7 @@ def _test_links_within_post(base_dir: str) -> None:
conversation_id = None
low_bandwidth = True
content_license_url = 'https://creativecommons.org/licenses/by-nc/4.0'
media_license_url = 'https://creativecommons.org/licenses/by-nc/4.0'
translate = {}
buy_url = ''
@ -5704,6 +5726,7 @@ def _test_links_within_post(base_dir: str) -> None:
test_event_end_time, test_location,
test_is_article, system_language, conversation_id,
low_bandwidth, content_license_url,
media_license_url,
languages_understood, translate, buy_url)
expected_str = \
@ -5748,6 +5771,7 @@ def _test_links_within_post(base_dir: str) -> None:
test_event_end_time, test_location,
test_is_article, system_language, conversation_id,
low_bandwidth, content_license_url,
media_license_url,
languages_understood, translate, buy_url)
assert post_json_object['object']['content'] == content
assert post_json_object['object']['contentMap'][system_language] == content
@ -6799,6 +6823,7 @@ def _test_can_replyto(base_dir: str) -> None:
conversation_id = None
low_bandwidth = True
content_license_url = 'https://creativecommons.org/licenses/by-nc/4.0'
media_license_url = 'https://creativecommons.org/licenses/by-nc/4.0'
translate = {}
buy_url = ''
@ -6814,6 +6839,7 @@ def _test_can_replyto(base_dir: str) -> None:
test_event_end_time, test_location,
test_is_article, system_language, conversation_id,
low_bandwidth, content_license_url,
media_license_url,
languages_understood, translate, buy_url)
# set the date on the post
curr_date_str = "2021-09-08T20:45:00Z"