Add media creator for attachments

main
Bob Mottram 2023-01-23 11:33:07 +00:00
parent 858a1f7193
commit d9143403fe
8 changed files with 134 additions and 77 deletions

View File

@ -705,7 +705,7 @@ class PubServer(BaseHTTPRequestHandler):
conversation_id,
self.server.low_bandwidth,
self.server.content_license_url,
self.server.content_license_url,
self.server.content_license_url, '',
languages_understood, False,
self.server.translate, buy_url)
if message_json:
@ -20802,6 +20802,9 @@ class PubServer(BaseHTTPRequestHandler):
if '://' not in media_license_url:
media_license_url = \
license_link_from_name(media_license_url)
media_creator = ''
if fields.get('mediaCreator'):
media_creator = fields['mediaCreator']
message_json = \
create_public_post(self.server.base_dir,
nickname,
@ -20824,7 +20827,7 @@ class PubServer(BaseHTTPRequestHandler):
conversation_id,
self.server.low_bandwidth,
self.server.content_license_url,
media_license_url,
media_license_url, media_creator,
languages_understood,
self.server.translate, buy_url)
if message_json:
@ -20950,6 +20953,9 @@ class PubServer(BaseHTTPRequestHandler):
if '://' not in media_license_url:
media_license_url = \
license_link_from_name(media_license_url)
media_creator = ''
if fields.get('mediaCreator'):
media_creator = fields['mediaCreator']
message_json = \
create_blog_post(self.server.base_dir, nickname,
self.server.domain, self.server.port,
@ -20971,7 +20977,7 @@ class PubServer(BaseHTTPRequestHandler):
conversation_id,
self.server.low_bandwidth,
self.server.content_license_url,
media_license_url,
media_license_url, media_creator,
languages_understood,
self.server.translate, buy_url)
if message_json:
@ -21064,6 +21070,9 @@ class PubServer(BaseHTTPRequestHandler):
if '://' not in license_url:
license_url = \
license_link_from_name(license_url)
creator = ''
if fields.get('mediaCreator'):
creator = fields['mediaCreator']
post_json_object['object'] = \
attach_media(self.server.base_dir,
self.server.http_prefix,
@ -21076,7 +21085,7 @@ class PubServer(BaseHTTPRequestHandler):
img_description,
city,
self.server.low_bandwidth,
license_url)
license_url, creator)
replace_you_tube(post_json_object,
self.server.yt_replace_domain,
@ -21125,6 +21134,9 @@ class PubServer(BaseHTTPRequestHandler):
if '://' not in media_license_url:
media_license_url = \
license_link_from_name(media_license_url)
media_creator = ''
if fields.get('mediaCreator'):
media_creator = fields['mediaCreator']
message_json = \
create_unlisted_post(self.server.base_dir,
nickname,
@ -21148,7 +21160,7 @@ class PubServer(BaseHTTPRequestHandler):
conversation_id,
self.server.low_bandwidth,
self.server.content_license_url,
media_license_url,
media_license_url, media_creator,
languages_understood,
self.server.translate, buy_url)
if message_json:
@ -21241,6 +21253,9 @@ class PubServer(BaseHTTPRequestHandler):
if '://' not in media_license_url:
media_license_url = \
license_link_from_name(media_license_url)
media_creator = ''
if fields.get('mediaCreator'):
media_creator = fields['mediaCreator']
message_json = \
create_followers_only_post(self.server.base_dir,
nickname,
@ -21267,6 +21282,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.low_bandwidth,
self.server.content_license_url,
media_license_url,
media_creator,
languages_understood,
self.server.translate,
buy_url)
@ -21368,6 +21384,9 @@ class PubServer(BaseHTTPRequestHandler):
if '://' not in media_license_url:
media_license_url = \
license_link_from_name(media_license_url)
media_creator = ''
if fields.get('mediaCreator'):
media_creator = fields['mediaCreator']
message_json = \
create_direct_message_post(self.server.base_dir,
nickname,
@ -21397,6 +21416,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.low_bandwidth,
content_license_url,
media_license_url,
media_creator,
languages_understood,
reply_is_chat,
self.server.translate,
@ -21497,6 +21517,9 @@ class PubServer(BaseHTTPRequestHandler):
if '://' not in media_license_url:
media_license_url = \
license_link_from_name(media_license_url)
media_creator = ''
if fields.get('mediaCreator'):
media_creator = fields['mediaCreator']
message_json = \
create_direct_message_post(self.server.base_dir,
nickname,
@ -21522,6 +21545,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.low_bandwidth,
self.server.content_license_url,
media_license_url,
media_creator,
languages_understood,
False, self.server.translate,
buy_url)
@ -21610,6 +21634,9 @@ class PubServer(BaseHTTPRequestHandler):
if '://' not in media_license_url:
media_license_url = \
license_link_from_name(media_license_url)
media_creator = ''
if fields.get('mediaCreator'):
media_creator = fields['mediaCreator']
message_json = \
create_report_post(self.server.base_dir,
nickname,
@ -21624,7 +21651,7 @@ class PubServer(BaseHTTPRequestHandler):
fields['languagesDropdown'],
self.server.low_bandwidth,
self.server.content_license_url,
media_license_url,
media_license_url, media_creator,
languages_understood,
self.server.translate)
if message_json:
@ -21667,6 +21694,9 @@ class PubServer(BaseHTTPRequestHandler):
if '://' not in media_license_url:
media_license_url = \
license_link_from_name(media_license_url)
media_creator = ''
if fields.get('mediaCreator'):
media_creator = fields['mediaCreator']
message_json = \
create_question_post(self.server.base_dir,
nickname,
@ -21684,7 +21714,7 @@ class PubServer(BaseHTTPRequestHandler):
fields['languagesDropdown'],
self.server.low_bandwidth,
self.server.content_license_url,
media_license_url,
media_license_url, media_creator,
languages_understood,
self.server.translate)
if message_json:

View File

@ -480,7 +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,
media_license_url: str, media_creator: str,
signing_priv_key_pem: str,
translate: {}) -> None:
"""Use the desktop client to send a reply to the most recent post
@ -541,7 +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,
media_license_url, media_creator,
event_date, event_time, event_end_time, location,
translate, buy_url, debug, post_id, post_id,
conversation_id, subject) == 0:
@ -560,7 +560,7 @@ def _desktop_new_post(session,
languages_understood: [],
espeak, low_bandwidth: bool,
content_license_url: str,
media_license_url: str,
media_license_url: str, media_creator: str,
signing_priv_key_pem: str,
translate: {}) -> None:
"""Use the desktop client to create a new post
@ -618,7 +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,
media_license_url, media_creator,
event_date, event_time, event_end_time, location,
translate, buy_url, debug, None, None,
conversation_id, subject) == 0:
@ -1228,7 +1228,7 @@ def _desktop_new_dm(session, to_handle: str,
languages_understood: [],
espeak, low_bandwidth: bool,
content_license_url: str,
media_license_url: str,
media_license_url: str, media_creator: str,
signing_priv_key_pem: str,
translate: {}) -> None:
"""Use the desktop client to create a new direct message
@ -1254,7 +1254,7 @@ def _desktop_new_dm(session, to_handle: str,
languages_understood,
espeak, low_bandwidth,
content_license_url,
media_license_url,
media_license_url, media_creator,
signing_priv_key_pem, translate)
@ -1267,7 +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,
media_license_url: str, media_creator: str,
signing_priv_key_pem: str,
translate: {}) -> None:
"""Use the desktop client to create a new direct message
@ -1368,7 +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,
media_license_url, media_creator,
event_date, event_time, event_end_time, location,
translate, buy_url, debug, None, None,
conversation_id, subject) == 0:
@ -1456,6 +1456,7 @@ def run_desktop_client(base_dir: str, proxy_type: str, http_prefix: str,
content_license_url = 'https://creativecommons.org/licenses/by-nc/4.0'
media_license_url = 'https://creativecommons.org/licenses/by-nc/4.0'
media_creator = ''
blocked_cache = {}
languages_understood = []
@ -1863,6 +1864,7 @@ def run_desktop_client(base_dir: str, proxy_type: str, http_prefix: str,
low_bandwidth,
content_license_url,
media_license_url,
media_creator,
signing_priv_key_pem,
translate)
refresh_timeline = True
@ -1901,7 +1903,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,
media_license_url, media_creator,
signing_priv_key_pem, translate)
refresh_timeline = True
else:
@ -1915,7 +1917,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,
media_license_url, media_creator,
signing_priv_key_pem, translate)
refresh_timeline = True
print('')

View File

@ -161,6 +161,8 @@ def _command_options() -> None:
default='https://creativecommons.org/' +
'licenses/by-nc/4.0',
help='Url of the license used for attached media')
parser.add_argument('--media_creator', type=str, default='',
help="Attached media creator's name")
parser.add_argument('--import_emoji', type=str,
default='',
help='Import emoji dict from the given filename')
@ -1708,7 +1710,7 @@ def _command_options() -> None:
argb.language, languages_understood,
argb.low_bandwidth,
argb.content_license_url,
argb.media_license_url,
argb.media_license_url, argb.media_creator,
argb.eventDate, argb.eventTime, argb.eventEndTime,
argb.eventLocation, translate, argb.buyUrl,
argb.debug,
@ -3398,7 +3400,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,
argb.media_license_url, argb.media_creator,
languages_understood, translate, buy_url)
create_public_post(base_dir, nickname, domain, port, http_prefix,
"Zoiks!!!",
@ -3413,7 +3415,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,
argb.media_license_url, argb.media_creator,
languages_understood, translate, buy_url)
create_public_post(base_dir, nickname, domain, port, http_prefix,
"Hey scoob we need like a hundred more #milkshakes",
@ -3428,7 +3430,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,
argb.media_license_url, argb.media_creator,
languages_understood, translate, buy_url)
create_public_post(base_dir, nickname, domain, port, http_prefix,
"Getting kinda spooky around here",
@ -3443,7 +3445,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,
argb.media_license_url, argb.media_creator,
languages_understood, translate, buy_url)
create_public_post(base_dir, nickname, domain, port, http_prefix,
"And they would have gotten away with it too" +
@ -3459,7 +3461,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,
argb.media_license_url, argb.media_creator,
languages_understood, translate, buy_url)
create_public_post(base_dir, nickname, domain, port, http_prefix,
"man these centralized sites are like the worst!",
@ -3474,7 +3476,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,
argb.media_license_url, argb.media_creator,
languages_understood, translate, buy_url)
create_public_post(base_dir, nickname, domain, port, http_prefix,
"another mystery solved #test",
@ -3489,7 +3491,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,
argb.media_license_url, argb.media_creator,
languages_understood, translate, buy_url)
create_public_post(base_dir, nickname, domain, port, http_prefix,
"let's go bowling",
@ -3504,7 +3506,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,
argb.media_license_url, argb.media_creator,
languages_understood, translate, buy_url)
domain_full = domain + ':' + str(port)
clear_follows(base_dir, nickname, domain)

View File

@ -3780,8 +3780,8 @@ def _bounce_dm(sender_post_id: str, session, http_prefix: str,
subject, debug, schedule_post,
event_date, event_time, event_end_time,
location, system_language, conversation_id,
low_bandwidth,
content_license_url, content_license_url,
low_bandwidth, content_license_url,
content_license_url, '',
languages_understood, bounce_is_chat,
translate, buy_url)
if not post_json_object:

View File

@ -554,7 +554,8 @@ def attach_media(base_dir: str, http_prefix: str,
post_json: {}, image_filename: str,
media_type: str, description: str,
city: str, low_bandwidth: bool,
content_license_url: str) -> {}:
content_license_url: str,
creator: str) -> {}:
"""Attaches media to a json object post
The description can be None
"""
@ -599,12 +600,15 @@ def attach_media(base_dir: str, http_prefix: str,
'type': 'Document',
'url': http_prefix + '://' + domain + '/' + media_path
}
if content_license_url:
if content_license_url or creator:
attachment_json['@context'] = [
'https://www.w3.org/ns/activitystreams',
{'schema': 'https://schema.org#'}
]
if content_license_url:
attachment_json['schema:license'] = content_license_url
if creator:
attachment_json['schema:creator'] = creator
if media_type.startswith('image/'):
attachment_json['blurhash'] = _get_blur_hash()
# find the dimensions of the image and add them as metadata

View File

@ -548,7 +548,8 @@ def _convert_rss_to_activitypub(base_dir: str, http_prefix: str,
system_language: str,
low_bandwidth: bool,
content_license_url: str,
media_license_url: str) -> None:
media_license_url: str,
media_creator: str) -> None:
"""Converts rss items in a newswire into posts
"""
if not newswire:
@ -647,7 +648,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,
media_license_url, media_creator,
languages_understood, translate,
buy_url)
if not blog:
@ -839,7 +840,7 @@ def run_newswire_daemon(base_dir: str, httpd,
httpd.system_language,
httpd.low_bandwidth,
httpd.content_license_url,
httpd.content_license_url)
httpd.content_license_url, '')
print('Newswire feed converted to ActivityPub')
if httpd.max_news_posts > 0:

View File

@ -1144,7 +1144,7 @@ def _create_post_s2s(base_dir: str, nickname: str, domain: str, port: int,
in_reply_to_atom_uri: str, system_language: str,
conversation_id: str, low_bandwidth: bool,
content_license_url: str,
media_license_url: str,
media_license_url: str, media_creator: str,
buy_url: str, translate: {}) -> {}:
"""Creates a new server-to-server post
"""
@ -1207,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,
media_license_url)
media_license_url, media_creator)
_attach_post_license(new_post['object'], content_license_url)
_attach_buy_link(new_post['object'], buy_url, translate)
return new_post
@ -1224,7 +1224,7 @@ def _create_post_c2s(base_dir: str, nickname: str, domain: str, port: int,
in_reply_to_atom_uri: str, system_language: str,
conversation_id: str, low_bandwidth: str,
content_license_url: str, media_license_url: str,
buy_url: str, translate: {}) -> {}:
media_creator: str, buy_url: str, translate: {}) -> {}:
"""Creates a new client-to-server post
"""
domain_full = get_full_domain(domain, port)
@ -1276,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,
media_license_url)
media_license_url, media_creator)
_attach_post_license(new_post, content_license_url)
_attach_buy_link(new_post, buy_url, translate)
return new_post
@ -1487,7 +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,
media_license_url: str, media_creator: str,
languages_understood: [], translate: {},
buy_url: str) -> {}:
"""Creates a message
@ -1648,7 +1648,7 @@ def _create_post_base(base_dir: str,
in_reply_to_atom_uri, system_language,
conversation_id, low_bandwidth,
content_license_url, media_license_url,
buy_url, translate)
media_creator, buy_url, translate)
else:
new_post = \
_create_post_c2s(base_dir, nickname, domain, port,
@ -1662,7 +1662,7 @@ def _create_post_base(base_dir: str,
in_reply_to_atom_uri, system_language,
conversation_id, low_bandwidth,
content_license_url, media_license_url,
buy_url, translate)
media_creator, buy_url, translate)
_create_post_mentions(cc_url, new_post, to_recipients, tags)
@ -1903,7 +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,
media_license_url: str, media_creator: str,
languages_understood: [], translate: {},
buy_url: str) -> {}:
"""Public post
@ -1939,7 +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,
media_license_url, media_creator,
languages_understood, translate, buy_url)
@ -1985,7 +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,
media_license_url: str, media_creator: str,
languages_understood: [], translate: {},
buy_url: str) -> {}:
blog_json = \
@ -2000,7 +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,
media_license_url, media_creator,
languages_understood, translate, buy_url)
blog_json['object']['url'] = \
blog_json['object']['url'].replace('/@', '/users/')
@ -2017,7 +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,
media_license_url: str, media_creator: str,
languages_understood: [], translate: {},
buy_url: str) -> {}:
client_to_server = False
@ -2040,7 +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,
media_license_url, media_creator,
languages_understood, translate, buy_url)
blog['object']['type'] = 'Article'
return blog
@ -2057,7 +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,
media_license_url: str, media_creator: str,
languages_understood: [], translate: {}) -> {}:
"""Question post with multiple choice options
"""
@ -2077,7 +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,
media_license_url, media_creator,
languages_understood, translate, buy_url)
message_json['object']['type'] = 'Question'
message_json['object']['oneOf'] = []
@ -2113,7 +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,
media_license_url: str, media_creator: str,
languages_understood: [], translate: {},
buy_url: str) -> {}:
"""Unlisted post. This has the #Public and followers links inverted.
@ -2134,7 +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, media_license_url,
content_license_url,
media_license_url, media_creator,
languages_understood, translate, buy_url)
@ -2153,7 +2154,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,
media_license_url: str, media_creator: str,
languages_understood: [],
translate: {}, buy_url: str) -> {}:
"""Followers only post
@ -2172,7 +2173,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, media_license_url,
content_license_url,
media_license_url, media_creator,
languages_understood, translate, buy_url)
@ -2229,7 +2231,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,
media_license_url: str, media_creator: str,
languages_understood: [],
dm_is_chat: bool, translate: {},
buy_url: str) -> {}:
@ -2257,7 +2259,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, media_license_url,
content_license_url,
media_license_url, media_creator,
languages_understood, translate, buy_url)
# mentioned recipients go into To rather than Cc
message_json['to'] = message_json['object']['cc']
@ -2282,7 +2285,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,
media_license_url: str, media_creator: str,
languages_understood: [], translate: {}) -> {}:
"""Send a report to moderators
"""
@ -2362,7 +2365,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,
media_license_url, media_creator,
languages_understood, translate, buy_url)
if not post_json_object:
continue
@ -2488,7 +2491,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,
media_license_url: str, media_creator: str,
translate: {}, buy_url: str,
debug: bool = False, in_reply_to: str = None,
in_reply_to_atom_uri: str = None, subject: str = None) -> int:
@ -2556,7 +2559,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, media_license_url,
content_license_url,
media_license_url, media_creator,
languages_understood,
translate, buy_url)
@ -2654,7 +2658,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,
media_license_url: str, media_creator: str,
event_date: str, event_time: str, event_end_time: str,
location: str, translate: {}, buy_url: str,
debug: bool = False,
@ -2747,7 +2751,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, media_license_url,
content_license_url,
media_license_url, media_creator,
languages_understood,
translate, buy_url)

View File

@ -775,6 +775,7 @@ def create_server_alice(path: str, domain: str, port: int,
translate = {}
content_license_url = 'https://creativecommons.org/licenses/by-nc/4.0'
media_license_url = 'https://creativecommons.org/licenses/by-nc/4.0'
media_creator = 'Mr Blobby'
buy_url = ''
create_public_post(path, nickname, domain, port, http_prefix,
"No wise fish would go anywhere without a porpoise",
@ -790,7 +791,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,
media_license_url, media_creator,
languages_understood, translate, buy_url)
create_public_post(path, nickname, domain, port, http_prefix,
"Curiouser and curiouser!",
@ -806,7 +807,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,
media_license_url, media_creator,
languages_understood, translate, buy_url)
create_public_post(path, nickname, domain, port, http_prefix,
"In the gardens of memory, in the palace " +
@ -823,7 +824,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,
media_license_url, media_creator,
languages_understood, translate, buy_url)
regenerate_index_for_box(path, nickname, domain, 'outbox')
global TEST_SERVER_ALICE_RUNNING
@ -943,6 +944,7 @@ def create_server_bob(path: str, domain: str, port: int,
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'
media_creator = 'Hamster'
translate = {}
buy_url = ''
create_public_post(path, nickname, domain, port, http_prefix,
@ -959,7 +961,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,
media_license_url, media_creator,
languages_understood, translate, buy_url)
create_public_post(path, nickname, domain, port, http_prefix,
"One of the things I've realised is that " +
@ -976,7 +978,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,
media_license_url, media_creator,
languages_understood, translate, buy_url)
create_public_post(path, nickname, domain, port, http_prefix,
"Quantum physics is a bit of a passion of mine",
@ -992,7 +994,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,
media_license_url, media_creator,
languages_understood, translate, buy_url)
regenerate_index_for_box(path, nickname, domain, 'outbox')
global TEST_SERVER_BOB_RUNNING
@ -1244,6 +1246,7 @@ def test_post_message_between_servers(base_dir: str) -> None:
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'
media_creator = 'Secret Squirrel'
if os.path.isdir(base_dir + '/.tests'):
shutil.rmtree(base_dir + '/.tests', ignore_errors=False, onerror=None)
@ -1348,7 +1351,7 @@ 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, media_license_url,
content_license_url, media_license_url, media_creator,
translate, buy_url,
in_reply_to, in_reply_to_atom_uri, subject)
print('send_result: ' + str(send_result))
@ -1579,6 +1582,7 @@ def test_follow_between_servers(base_dir: str) -> 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'
media_creator = 'Penfold'
if os.path.isdir(base_dir + '/.tests'):
shutil.rmtree(base_dir + '/.tests', ignore_errors=False, onerror=None)
@ -1723,7 +1727,8 @@ 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, media_license_url, translate, buy_url,
content_license_url, media_license_url, media_creator,
translate, buy_url,
in_reply_to, in_reply_to_atom_uri, subject)
print('send_result: ' + str(send_result))
@ -1775,6 +1780,7 @@ def test_shared_items_federation(base_dir: str) -> 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'
media_creator = 'Dr Drokk'
if os.path.isdir(base_dir + '/.tests'):
shutil.rmtree(base_dir + '/.tests', ignore_errors=False, onerror=None)
@ -2092,7 +2098,7 @@ 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, media_license_url,
content_license_url, media_license_url, media_creator,
translate, buy_url, True,
in_reply_to, in_reply_to_atom_uri, subject)
print('send_result: ' + str(send_result))
@ -2200,6 +2206,7 @@ def test_group_follow(base_dir: str) -> 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'
media_creator = 'Bumble'
if os.path.isdir(base_dir + '/.tests'):
shutil.rmtree(base_dir + '/.tests', ignore_errors=False, onerror=None)
@ -2525,7 +2532,8 @@ 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, media_license_url, translate, buy_url,
content_license_url, media_license_url, media_creator,
translate, buy_url,
in_reply_to, in_reply_to_atom_uri, subject)
print('send_result: ' + str(send_result))
@ -2896,6 +2904,7 @@ def _test_create_person_account(base_dir: str):
translate = {}
content_license_url = 'https://creativecommons.org/licenses/by-nc/4.0'
media_license_url = 'https://creativecommons.org/licenses/by-nc/4.0'
media_creator = 'Hissing Sid'
content = \
"If your \"independent organization\" is government funded...\n\n" + \
"(yawn)\n\n...then it's not really independent.\n\n" + \
@ -2914,7 +2923,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,
media_license_url, media_creator,
languages_understood, translate, buy_url)
assert test_post_json
assert test_post_json.get('object')
@ -2941,7 +2950,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,
media_license_url, media_creator,
languages_understood, translate, buy_url)
assert test_post_json
assert test_post_json.get('object')
@ -3023,6 +3032,7 @@ def test_client_to_server(base_dir: str):
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'
media_creator = 'King Tut'
TEST_SERVER_ALICE_RUNNING = False
TEST_SERVER_BOB_RUNNING = False
@ -3156,7 +3166,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,
media_license_url, media_creator,
event_date, event_time, event_end_time, location,
translate, buy_url, True, None, None,
conversation_id, None)
@ -4758,6 +4768,7 @@ def _test_reply_to_public_post(base_dir: str) -> 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'
media_creator = 'Skeletor'
translate = {}
buy_url = ''
reply = \
@ -4772,7 +4783,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,
media_license_url, media_creator,
languages_understood, translate, buy_url)
# print(str(reply))
expected_str = \
@ -5711,6 +5722,7 @@ def _test_links_within_post(base_dir: str) -> 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'
media_creator = 'Dr No'
translate = {}
buy_url = ''
@ -5726,7 +5738,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,
media_license_url, media_creator,
languages_understood, translate, buy_url)
expected_str = \
@ -5771,7 +5783,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,
media_license_url, media_creator,
languages_understood, translate, buy_url)
assert post_json_object['object']['content'] == content
assert post_json_object['object']['contentMap'][system_language] == content
@ -6824,6 +6836,7 @@ def _test_can_replyto(base_dir: str) -> 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'
media_creator = 'The Penguin'
translate = {}
buy_url = ''
@ -6839,7 +6852,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,
media_license_url, media_creator,
languages_understood, translate, buy_url)
# set the date on the post
curr_date_str = "2021-09-08T20:45:00Z"