Content labels on new post creation

main
bashrc 2026-08-21 21:35:43 +01:00
parent a6299e61ac
commit 99daa27fd6
11 changed files with 192 additions and 63 deletions

View File

@ -2101,6 +2101,7 @@ def _command_options() -> None:
argb.eventCategory = '' argb.eventCategory = ''
print('Sending post to ' + argb.sendto) print('Sending post to ' + argb.sendto)
labels_str: str = ''
send_post_via_server(signing_priv_key_pem, __version__, send_post_via_server(signing_priv_key_pem, __version__,
base_dir, session, argb.nickname, argb.password, base_dir, session, argb.nickname, argb.password,
domain, port, domain, port,
@ -2118,7 +2119,8 @@ def _command_options() -> None:
argb.media_license_url, argb.media_creator, argb.media_license_url, argb.media_creator,
argb.eventDate, argb.eventTime, argb.eventEndTime, argb.eventDate, argb.eventTime, argb.eventEndTime,
argb.eventCategory, argb.eventCategory,
argb.eventLocation, translate, argb.buyUrl, argb.eventLocation, translate,
labels_str, argb.buyUrl,
argb.chatUrl, auto_cw_cache, argb.debug, argb.chatUrl, auto_cw_cache, argb.debug,
reply_to, reply_to, argb.conversationId, reply_to, reply_to, argb.conversationId,
argb.convthreadId, subject, searchable_by, argb.convthreadId, subject, searchable_by,
@ -4013,6 +4015,7 @@ def _command_options() -> None:
low_bandwidth: bool = False low_bandwidth: bool = False
languages_understood = [argb.language] languages_understood = [argb.language]
translate = {} translate = {}
labels_str: str = ''
buy_url: str = '' buy_url: str = ''
chat_url: str = '' chat_url: str = ''
auto_cw_cache = {} auto_cw_cache = {}
@ -4038,7 +4041,8 @@ def _command_options() -> None:
convthread_id, convthread_id,
low_bandwidth, argb.content_license_url, low_bandwidth, argb.content_license_url,
argb.media_license_url, argb.media_creator, argb.media_license_url, argb.media_creator,
languages_understood, translate, buy_url, chat_url, languages_understood, translate,
labels_str, buy_url, chat_url,
auto_cw_cache, searchable_by, curr_session, debug) auto_cw_cache, searchable_by, curr_session, debug)
create_public_post(base_dir, nickname, domain, port, http_prefix, create_public_post(base_dir, nickname, domain, port, http_prefix,
"Zoiks!!!", "Zoiks!!!",
@ -4058,7 +4062,8 @@ def _command_options() -> None:
convthread_id, convthread_id,
low_bandwidth, argb.content_license_url, low_bandwidth, argb.content_license_url,
argb.media_license_url, argb.media_creator, argb.media_license_url, argb.media_creator,
languages_understood, translate, buy_url, chat_url, languages_understood, translate,
labels_str, buy_url, chat_url,
auto_cw_cache, searchable_by, curr_session, debug) auto_cw_cache, searchable_by, curr_session, debug)
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",
@ -4078,7 +4083,8 @@ def _command_options() -> None:
convthread_id, convthread_id,
low_bandwidth, argb.content_license_url, low_bandwidth, argb.content_license_url,
argb.media_license_url, argb.media_creator, argb.media_license_url, argb.media_creator,
languages_understood, translate, buy_url, chat_url, languages_understood, translate,
labels_str, buy_url, chat_url,
auto_cw_cache, searchable_by, curr_session, debug) auto_cw_cache, searchable_by, curr_session, debug)
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",
@ -4098,7 +4104,8 @@ def _command_options() -> None:
convthread_id, convthread_id,
low_bandwidth, argb.content_license_url, low_bandwidth, argb.content_license_url,
argb.media_license_url, argb.media_creator, argb.media_license_url, argb.media_creator,
languages_understood, translate, buy_url, chat_url, languages_understood, translate,
labels_str, buy_url, chat_url,
auto_cw_cache, searchable_by, curr_session, debug) auto_cw_cache, searchable_by, curr_session, debug)
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" +
@ -4119,7 +4126,8 @@ def _command_options() -> None:
convthread_id, convthread_id,
low_bandwidth, argb.content_license_url, low_bandwidth, argb.content_license_url,
argb.media_license_url, argb.media_creator, argb.media_license_url, argb.media_creator,
languages_understood, translate, buy_url, chat_url, languages_understood, translate,
labels_str, buy_url, chat_url,
auto_cw_cache, searchable_by, curr_session, debug) auto_cw_cache, searchable_by, curr_session, debug)
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!",
@ -4139,7 +4147,8 @@ def _command_options() -> None:
convthread_id, convthread_id,
low_bandwidth, argb.content_license_url, low_bandwidth, argb.content_license_url,
argb.media_license_url, argb.media_creator, argb.media_license_url, argb.media_creator,
languages_understood, translate, buy_url, chat_url, languages_understood, translate,
labels_str, buy_url, chat_url,
auto_cw_cache, searchable_by, curr_session, debug) auto_cw_cache, searchable_by, curr_session, debug)
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",
@ -4159,7 +4168,8 @@ def _command_options() -> None:
convthread_id, convthread_id,
low_bandwidth, argb.content_license_url, low_bandwidth, argb.content_license_url,
argb.media_license_url, argb.media_creator, argb.media_license_url, argb.media_creator,
languages_understood, translate, buy_url, chat_url, languages_understood, translate,
labels_str, buy_url, chat_url,
auto_cw_cache, searchable_by, curr_session, debug) auto_cw_cache, searchable_by, curr_session, debug)
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",
@ -4179,7 +4189,8 @@ def _command_options() -> None:
convthread_id, convthread_id,
low_bandwidth, argb.content_license_url, low_bandwidth, argb.content_license_url,
argb.media_license_url, argb.media_creator, argb.media_license_url, argb.media_creator,
languages_understood, translate, buy_url, chat_url, languages_understood, translate,
labels_str, buy_url, chat_url,
auto_cw_cache, searchable_by, curr_session, debug) auto_cw_cache, searchable_by, curr_session, debug)
domain_full = domain + ':' + str(port) domain_full = domain + ':' + str(port)
clear_follows(base_dir, nickname, domain, 'following.txt') clear_follows(base_dir, nickname, domain, 'following.txt')

View File

@ -145,3 +145,36 @@ def set_actor_content_labels(actor_json: {}, labels: str) -> None:
'value': labels 'value': labels
} }
actor_json['attachment'].append(labels_dict) actor_json['attachment'].append(labels_dict)
def set_post_content_labels(post_json_object: {}, labels: str) -> None:
"""Sets a string containing comma separated content labels
within the given post
"""
if not labels:
return
labels = remove_html(labels)
obj = post_json_object
if has_object_dict(post_json_object):
obj = post_json_object['object']
if 'tag' not in obj:
obj['tag'] = []
for tag_dict in obj['tag']:
if 'name' not in tag_dict:
continue
if not isinstance(tag_dict['name'], str):
continue
if tag_dict['name'] == 'Labels':
tag_dict['value'] = labels
return
labels_dict = {
'type': 'PropertyValue',
'name': 'Labels',
'value': labels
}
obj['attachment'].append(labels_dict)

View File

@ -231,6 +231,7 @@ def _send_reply_to_question(self, base_dir: str,
location = None location = None
conversation_id = None conversation_id = None
convthread_id = None convthread_id = None
labels_str: str = ''
buy_url: str = '' buy_url: str = ''
chat_url: str = '' chat_url: str = ''
city = get_spoofed_city(city_name, base_dir, nickname, domain) city = get_spoofed_city(city_name, base_dir, nickname, domain)
@ -269,7 +270,7 @@ def _send_reply_to_question(self, base_dir: str,
dm_license_url, dm_license_url,
content_license_url, '', content_license_url, '',
languages_understood, False, languages_understood, False,
translate, buy_url, translate, labels_str, buy_url,
chat_url, chat_url,
auto_cw_cache, curr_session) auto_cw_cache, curr_session)
if message_json: if message_json:

View File

@ -90,6 +90,7 @@ def _receive_new_post_process_newpost(self, fields: {},
attachment_media_type: str, attachment_media_type: str,
low_bandwidth: bool, low_bandwidth: bool,
translate: {}, translate: {},
labels_str: str,
buy_url: str, buy_url: str,
chat_url: str, chat_url: str,
auto_cw_cache: {}, auto_cw_cache: {},
@ -203,8 +204,8 @@ def _receive_new_post_process_newpost(self, fields: {},
content_license_url, content_license_url,
media_license_url, media_creator, media_license_url, media_creator,
languages_understood, languages_understood,
translate, buy_url, translate, labels_str,
chat_url, buy_url, chat_url,
auto_cw_cache, auto_cw_cache,
fields['searchableByDropdown'], fields['searchableByDropdown'],
curr_session, debug) curr_session, debug)
@ -294,6 +295,7 @@ def _receive_new_post_process_newblog(self, fields: {},
filename: str, filename: str,
attachment_media_type: str, attachment_media_type: str,
low_bandwidth: bool, low_bandwidth: bool,
labels_str: str,
buy_url: str, chat_url: str, buy_url: str, chat_url: str,
project_version: str, curr_session, project_version: str, curr_session,
proxy_type: str, max_replies: int, proxy_type: str, max_replies: int,
@ -386,7 +388,7 @@ def _receive_new_post_process_newblog(self, fields: {},
content_license_url, content_license_url,
media_license_url, media_creator, media_license_url, media_creator,
languages_understood, languages_understood,
translate, buy_url, chat_url, translate, labels_str, buy_url, chat_url,
fields['searchableByDropdown'], fields['searchableByDropdown'],
curr_session, debug) curr_session, debug)
if message_json: if message_json:
@ -543,7 +545,9 @@ def _receive_new_post_process_newunlisted(self, fields: {},
filename: str, filename: str,
attachment_media_type: str, attachment_media_type: str,
low_bandwidth: bool, low_bandwidth: bool,
translate: {}, buy_url: str, translate: {},
labels_str: str,
buy_url: str,
chat_url: str, chat_url: str,
auto_cw_cache: {}, auto_cw_cache: {},
edited_postid: str, edited_postid: str,
@ -642,7 +646,7 @@ def _receive_new_post_process_newunlisted(self, fields: {},
content_license_url, content_license_url,
media_license_url, media_creator, media_license_url, media_creator,
languages_understood, languages_understood,
translate, buy_url, translate, labels_str, buy_url,
chat_url, chat_url,
auto_cw_cache, curr_session, debug) auto_cw_cache, curr_session, debug)
if message_json: if message_json:
@ -720,6 +724,7 @@ def _receive_new_post_process_newfollowers(self, fields: {},
attachment_media_type: str, attachment_media_type: str,
low_bandwidth: bool, low_bandwidth: bool,
translate: {}, translate: {},
labels_str: str,
buy_url: str, chat_url: str, buy_url: str, chat_url: str,
auto_cw_cache: {}, auto_cw_cache: {},
edited_postid: str, edited_postid: str,
@ -825,7 +830,7 @@ def _receive_new_post_process_newfollowers(self, fields: {},
media_license_url, media_license_url,
media_creator, media_creator,
languages_understood, languages_understood,
translate, translate, labels_str,
buy_url, chat_url, buy_url, chat_url,
auto_cw_cache, auto_cw_cache,
fields['searchableByDropdown'], fields['searchableByDropdown'],
@ -906,7 +911,7 @@ def _receive_new_post_process_newdm(self, fields: {},
attachment_media_type: str, attachment_media_type: str,
low_bandwidth: bool, low_bandwidth: bool,
dm_license_url: str, dm_license_url: str,
translate: {}, translate: {}, labels_str: str,
buy_url: str, chat_url: str, buy_url: str, chat_url: str,
auto_cw_cache: {}, auto_cw_cache: {},
edited_postid: str, edited_postid: str,
@ -1021,7 +1026,7 @@ def _receive_new_post_process_newdm(self, fields: {},
media_creator, media_creator,
languages_understood, languages_understood,
reply_is_chat, reply_is_chat,
translate, translate, labels_str,
buy_url, chat_url, buy_url, chat_url,
auto_cw_cache, curr_session) auto_cw_cache, curr_session)
if message_json: if message_json:
@ -1101,6 +1106,7 @@ def _receive_new_post_process_newreminder(self, fields: {}, nickname: str,
low_bandwidth: bool, low_bandwidth: bool,
dm_license_url: str, dm_license_url: str,
translate: {}, translate: {},
labels_str: str,
buy_url: str, chat_url: str, buy_url: str, chat_url: str,
auto_cw_cache: {}, auto_cw_cache: {},
edited_postid: str, edited_postid: str,
@ -1198,6 +1204,7 @@ def _receive_new_post_process_newreminder(self, fields: {}, nickname: str,
media_creator, media_creator,
languages_understood, languages_understood,
False, translate, False, translate,
labels_str,
buy_url, chat_url, buy_url, chat_url,
auto_cw_cache, curr_session) auto_cw_cache, curr_session)
if message_json: if message_json:
@ -1451,7 +1458,9 @@ def _receive_new_post_process_newreading(self, fields: {},
filename: str, filename: str,
attachment_media_type: str, attachment_media_type: str,
low_bandwidth: bool, low_bandwidth: bool,
translate: {}, buy_url: str, translate: {},
labels_str: str,
buy_url: str,
chat_url: str, chat_url: str,
auto_cw_cache: {}, auto_cw_cache: {},
edited_published: str, edited_published: str,
@ -1569,7 +1578,7 @@ def _receive_new_post_process_newreading(self, fields: {},
content_license_url, content_license_url,
media_license_url, media_creator, media_license_url, media_creator,
languages_understood, languages_understood,
translate, buy_url, translate, labels_str, buy_url,
chat_url, chat_url,
auto_cw_cache, auto_cw_cache,
fields['searchableByDropdown'], fields['searchableByDropdown'],
@ -2160,6 +2169,10 @@ def _receive_new_post_process(self, post_type: str, path: str, headers: {},
'EX: unable to write ditherImage ' + 'EX: unable to write ditherImage ' +
dither_filename) dither_filename)
labels_str: str = ''
if fields.get('postContentLabels'):
labels_str = fields['postContentLabels']
buy_url: str = '' buy_url: str = ''
if fields.get('buyUrl'): if fields.get('buyUrl'):
buy_url = fields['buyUrl'] buy_url = fields['buyUrl']
@ -2183,6 +2196,7 @@ def _receive_new_post_process(self, post_type: str, path: str, headers: {},
attachment_media_type, attachment_media_type,
low_bandwidth, low_bandwidth,
translate, translate,
labels_str,
buy_url, buy_url,
chat_url, chat_url,
auto_cw_cache, auto_cw_cache,
@ -2234,7 +2248,7 @@ def _receive_new_post_process(self, post_type: str, path: str, headers: {},
apply_dithering, apply_dithering,
filename, filename,
attachment_media_type, attachment_media_type,
low_bandwidth, low_bandwidth, labels_str,
buy_url, chat_url, buy_url, chat_url,
project_version, curr_session, project_version, curr_session,
proxy_type, max_replies, debug) proxy_type, max_replies, debug)
@ -2267,7 +2281,7 @@ def _receive_new_post_process(self, post_type: str, path: str, headers: {},
filename, filename,
attachment_media_type, attachment_media_type,
low_bandwidth, low_bandwidth,
translate, buy_url, translate, labels_str, buy_url,
chat_url, chat_url,
auto_cw_cache, auto_cw_cache,
edited_postid, edited_postid,
@ -2318,7 +2332,7 @@ def _receive_new_post_process(self, post_type: str, path: str, headers: {},
filename, filename,
attachment_media_type, attachment_media_type,
low_bandwidth, low_bandwidth,
translate, translate, labels_str,
buy_url, chat_url, buy_url, chat_url,
auto_cw_cache, auto_cw_cache,
edited_postid, edited_postid,
@ -2368,7 +2382,7 @@ def _receive_new_post_process(self, post_type: str, path: str, headers: {},
attachment_media_type, attachment_media_type,
low_bandwidth, low_bandwidth,
dm_license_url, dm_license_url,
translate, translate, labels_str,
buy_url, chat_url, buy_url, chat_url,
auto_cw_cache, auto_cw_cache,
edited_postid, edited_postid,
@ -2418,7 +2432,7 @@ def _receive_new_post_process(self, post_type: str, path: str, headers: {},
attachment_media_type, attachment_media_type,
low_bandwidth, low_bandwidth,
dm_license_url, dm_license_url,
translate, translate, labels_str,
buy_url, chat_url, buy_url, chat_url,
auto_cw_cache, auto_cw_cache,
edited_postid, edited_postid,
@ -2496,8 +2510,8 @@ def _receive_new_post_process(self, post_type: str, path: str, headers: {},
filename, filename,
attachment_media_type, attachment_media_type,
low_bandwidth, low_bandwidth,
translate, buy_url, translate, labels_str,
chat_url, buy_url, chat_url,
auto_cw_cache, auto_cw_cache,
edited_published, edited_published,
edited_postid, edited_postid,

View File

@ -566,6 +566,7 @@ def _desktop_reply_to_post(session, post_id: str,
event_end_time = None event_end_time = None
event_category: str = '' event_category: str = ''
location = None location = None
labels_str: str = ''
buy_url: str = '' buy_url: str = ''
chat_url: str = '' chat_url: str = ''
video_transcript = None video_transcript = None
@ -588,7 +589,8 @@ def _desktop_reply_to_post(session, post_id: str,
media_license_url, media_creator, media_license_url, media_creator,
event_date, event_time, event_end_time, event_date, event_time, event_end_time,
event_category, location, event_category, location,
translate, buy_url, chat_url, auto_cw_cache, translate, labels_str, buy_url,
chat_url, auto_cw_cache,
debug, post_id, post_id, debug, post_id, post_id,
conversation_id, convthread_id, subject, conversation_id, convthread_id, subject,
searchable_by, mitm_servers) == 0: searchable_by, mitm_servers) == 0:
@ -657,6 +659,7 @@ def _desktop_new_post(session,
event_end_time = None event_end_time = None
event_category: str = '' event_category: str = ''
location = None location = None
labels_str: str = ''
buy_url: str = '' buy_url: str = ''
chat_url: str = '' chat_url: str = ''
video_transcript = None video_transcript = None
@ -678,7 +681,8 @@ def _desktop_new_post(session,
media_license_url, media_creator, media_license_url, media_creator,
event_date, event_time, event_end_time, event_date, event_time, event_end_time,
event_category, location, event_category, location,
translate, buy_url, chat_url, auto_cw_cache, translate, labels_str, buy_url,
chat_url, auto_cw_cache,
debug, None, None, debug, None, None,
conversation_id, convthread_id, subject, conversation_id, convthread_id, subject,
searchable_by, mitm_servers) == 0: searchable_by, mitm_servers) == 0:
@ -1501,6 +1505,7 @@ def _desktop_new_dm_base(session, to_handle: str,
event_end_time = None event_end_time = None
event_category: str = '' event_category: str = ''
location = None location = None
labels_str: str = ''
buy_url: str = '' buy_url: str = ''
chat_url: str = '' chat_url: str = ''
video_transcript = None video_transcript = None
@ -1524,7 +1529,8 @@ def _desktop_new_dm_base(session, to_handle: str,
media_license_url, media_creator, media_license_url, media_creator,
event_date, event_time, event_end_time, event_date, event_time, event_end_time,
event_category, location, event_category, location,
translate, buy_url, chat_url, auto_cw_cache, translate, labels_str, buy_url,
chat_url, auto_cw_cache,
debug, None, None, debug, None, None,
conversation_id, convthread_id, subject, conversation_id, convthread_id, subject,
searchable_by, mitm_servers) == 0: searchable_by, mitm_servers) == 0:

View File

@ -1461,6 +1461,7 @@ def _bounce_dm(sender_post_id: str, session, http_prefix: str,
conversation_id = None conversation_id = None
convthread_id = None convthread_id = None
low_bandwidth: bool = False low_bandwidth: bool = False
labels_str: str = ''
buy_url: str = '' buy_url: str = ''
chat_url: str = '' chat_url: str = ''
auto_cw_cache = {} auto_cw_cache = {}
@ -1481,7 +1482,7 @@ def _bounce_dm(sender_post_id: str, session, http_prefix: str,
low_bandwidth, dm_license_url, low_bandwidth, dm_license_url,
dm_license_url, '', dm_license_url, '',
languages_understood, bounce_is_chat, languages_understood, bounce_is_chat,
translate, buy_url, chat_url, translate, labels_str, buy_url, chat_url,
auto_cw_cache, session) auto_cw_cache, session)
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)

View File

@ -646,6 +646,7 @@ def _convert_rss_to_activitypub(base_dir: str, http_prefix: str,
conversation_id = None conversation_id = None
convthread_id = None convthread_id = None
languages_understood = [system_language] languages_understood = [system_language]
labels_str = ''
buy_url = '' buy_url = ''
chat_url = '' chat_url = ''
blog = create_news_post(base_dir, blog = create_news_post(base_dir,
@ -659,6 +660,7 @@ def _convert_rss_to_activitypub(base_dir: str, http_prefix: str,
content_license_url, content_license_url,
media_license_url, media_creator, media_license_url, media_creator,
languages_understood, translate, languages_understood, translate,
labels_str,
buy_url, chat_url, session, debug) buy_url, chat_url, session, debug)
if not blog: if not blog:
continue continue

View File

@ -155,6 +155,7 @@ from src.data import move_file
from src.data import is_a_file from src.data import is_a_file
from src.data import is_a_dir from src.data import is_a_dir
from src.data import makedir from src.data import makedir
from src.content_labels import set_post_content_labels
def convert_post_content_to_html(message_json: {}) -> None: def convert_post_content_to_html(message_json: {}) -> None:
@ -1249,6 +1250,7 @@ def _create_post_s2s(base_dir: str, nickname: str, domain: str, port: int,
conversation_id: str, convthread_id: str, conversation_id: str, convthread_id: str,
low_bandwidth: bool, content_license_url: str, low_bandwidth: bool, content_license_url: str,
media_license_url: str, media_creator: str, media_license_url: str, media_creator: str,
labels_str: str,
buy_url: str, chat_url: str, translate: {}, buy_url: str, chat_url: str, translate: {},
searchable_by: [], searchable_by: [],
automatic_quote_approval: str, automatic_quote_approval: str,
@ -1418,6 +1420,7 @@ def _create_post_s2s(base_dir: str, nickname: str, domain: str, port: int,
_attach_post_license(new_post['object'], content_license_url) _attach_post_license(new_post['object'], content_license_url)
_attach_buy_link(new_post['object'], buy_url, translate) _attach_buy_link(new_post['object'], buy_url, translate)
_attach_chat_link(new_post['object'], chat_url) _attach_chat_link(new_post['object'], chat_url)
set_post_content_labels(new_post, labels_str)
return new_post return new_post
@ -1435,7 +1438,8 @@ def _create_post_c2s(base_dir: str, nickname: str, domain: str, port: int,
conversation_id: str, convthread_id: str, conversation_id: str, convthread_id: str,
low_bandwidth: str, low_bandwidth: str,
content_license_url: str, media_license_url: str, content_license_url: str, media_license_url: str,
media_creator: str, buy_url: str, chat_url: str, media_creator: str, labels_str: str,
buy_url: str, chat_url: str,
translate: {}, searchable_by: [], translate: {}, searchable_by: [],
automatic_quote_approval: str, automatic_quote_approval: str,
session, debug: bool) -> {}: session, debug: bool) -> {}:
@ -1593,6 +1597,7 @@ def _create_post_c2s(base_dir: str, nickname: str, domain: str, port: int,
_attach_post_license(new_post, content_license_url) _attach_post_license(new_post, content_license_url)
_attach_buy_link(new_post, buy_url, translate) _attach_buy_link(new_post, buy_url, translate)
_attach_chat_link(new_post, chat_url) _attach_chat_link(new_post, chat_url)
set_post_content_labels(new_post, labels_str)
return new_post return new_post
@ -1849,7 +1854,7 @@ def create_post_base(base_dir: str,
low_bandwidth: bool, content_license_url: str, low_bandwidth: bool, content_license_url: str,
media_license_url: str, media_creator: str, media_license_url: str, media_creator: str,
languages_understood: [], translate: {}, languages_understood: [], translate: {},
buy_url: str, chat_url: str, labels_str: str, buy_url: str, chat_url: str,
auto_cw_cache: {}, auto_cw_cache: {},
searchable_by: [], searchable_by: [],
session, session,
@ -2041,7 +2046,7 @@ def create_post_base(base_dir: str,
in_reply_to_atom_uri, system_language, in_reply_to_atom_uri, system_language,
conversation_id, convthread_id, low_bandwidth, conversation_id, convthread_id, low_bandwidth,
content_license_url, media_license_url, content_license_url, media_license_url,
media_creator, buy_url, chat_url, media_creator, labels_str, buy_url, chat_url,
translate, searchable_by_list, translate, searchable_by_list,
automatic_quote_approval, automatic_quote_approval,
session, debug) session, debug)
@ -2060,7 +2065,7 @@ def create_post_base(base_dir: str,
in_reply_to_atom_uri, system_language, in_reply_to_atom_uri, system_language,
conversation_id, convthread_id, low_bandwidth, conversation_id, convthread_id, low_bandwidth,
content_license_url, media_license_url, content_license_url, media_license_url,
media_creator, buy_url, chat_url, media_creator, labels_str, buy_url, chat_url,
translate, searchable_by_list, translate, searchable_by_list,
automatic_quote_approval, automatic_quote_approval,
session, debug) session, debug)
@ -2316,6 +2321,7 @@ def create_public_post(base_dir: str,
low_bandwidth: bool, content_license_url: str, low_bandwidth: bool, content_license_url: str,
media_license_url: str, media_creator: str, media_license_url: str, media_creator: str,
languages_understood: [], translate: {}, languages_understood: [], translate: {},
labels_str: str,
buy_url: str, chat_url: str, buy_url: str, chat_url: str,
auto_cw_cache: {}, auto_cw_cache: {},
searchable_by: [], searchable_by: [],
@ -2357,7 +2363,8 @@ def create_public_post(base_dir: str,
conversation_id, convthread_id, low_bandwidth, conversation_id, convthread_id, low_bandwidth,
content_license_url, content_license_url,
media_license_url, media_creator, media_license_url, media_creator,
languages_understood, translate, buy_url, languages_understood, translate,
labels_str, buy_url,
chat_url, auto_cw_cache, searchable_by, chat_url, auto_cw_cache, searchable_by,
session, automatic_quote_approval, debug) session, automatic_quote_approval, debug)
@ -2382,6 +2389,7 @@ def create_reading_post(base_dir: str,
low_bandwidth: bool, content_license_url: str, low_bandwidth: bool, content_license_url: str,
media_license_url: str, media_creator: str, media_license_url: str, media_creator: str,
languages_understood: [], translate: {}, languages_understood: [], translate: {},
labels_str: str,
buy_url: str, chat_url: str, buy_url: str, chat_url: str,
auto_cw_cache: {}, auto_cw_cache: {},
searchable_by: [], session, debug: bool) -> {}: searchable_by: [], session, debug: bool) -> {}:
@ -2426,6 +2434,7 @@ def create_reading_post(base_dir: str,
content_license_url, content_license_url,
media_license_url, media_creator, media_license_url, media_creator,
languages_understood, translate, languages_understood, translate,
labels_str,
buy_url, chat_url, auto_cw_cache, buy_url, chat_url, auto_cw_cache,
searchable_by, session, debug) searchable_by, session, debug)
if post_json_object: if post_json_object:
@ -2487,6 +2496,7 @@ def create_blog_post(base_dir: str,
low_bandwidth: bool, content_license_url: str, low_bandwidth: bool, content_license_url: str,
media_license_url: str, media_creator: str, media_license_url: str, media_creator: str,
languages_understood: [], translate: {}, languages_understood: [], translate: {},
labels_str: str,
buy_url: str, chat_url: str, buy_url: str, chat_url: str,
searchable_by: [], session, debug: bool) -> {}: searchable_by: [], session, debug: bool) -> {}:
auto_cw_cache = {} auto_cw_cache = {}
@ -2506,7 +2516,8 @@ def create_blog_post(base_dir: str,
conversation_id, convthread_id, conversation_id, convthread_id,
low_bandwidth, content_license_url, low_bandwidth, content_license_url,
media_license_url, media_creator, media_license_url, media_creator,
languages_understood, translate, buy_url, chat_url, languages_understood, translate,
labels_str, buy_url, chat_url,
auto_cw_cache, searchable_by, session, debug) auto_cw_cache, searchable_by, session, debug)
url_str = get_url_from_post(blog_json['object']['url']) url_str = get_url_from_post(blog_json['object']['url'])
obj_url = remove_html(url_str) obj_url = remove_html(url_str)
@ -2528,7 +2539,7 @@ def create_news_post(base_dir: str,
low_bandwidth: bool, content_license_url: str, low_bandwidth: bool, content_license_url: str,
media_license_url: str, media_creator: str, media_license_url: str, media_creator: str,
languages_understood: [], translate: {}, languages_understood: [], translate: {},
buy_url: str, chat_url: str, session, labels_str: str, buy_url: str, chat_url: str, session,
debug: bool) -> {}: debug: bool) -> {}:
auto_cw_cache = {} auto_cw_cache = {}
client_to_server: bool = False client_to_server: bool = False
@ -2556,7 +2567,8 @@ def create_news_post(base_dir: str,
conversation_id, convthread_id, conversation_id, convthread_id,
low_bandwidth, content_license_url, low_bandwidth, content_license_url,
media_license_url, media_creator, media_license_url, media_creator,
languages_understood, translate, buy_url, chat_url, languages_understood, translate,
labels_str, buy_url, chat_url,
auto_cw_cache, searchable_by, session, debug) auto_cw_cache, searchable_by, session, debug)
blog['object']['type'] = 'Article' blog['object']['type'] = 'Article'
return blog return blog
@ -2582,6 +2594,7 @@ def create_question_post(base_dir: str,
""" """
domain_full = get_full_domain(domain, port) domain_full = get_full_domain(domain, port)
local_actor = local_actor_url(http_prefix, nickname, domain_full) local_actor = local_actor_url(http_prefix, nickname, domain_full)
labels_str = ''
buy_url = '' buy_url = ''
chat_url = '' chat_url = ''
is_moderation_report: bool = False is_moderation_report: bool = False
@ -2617,7 +2630,8 @@ def create_question_post(base_dir: str,
conversation_id, convthread_id, low_bandwidth, conversation_id, convthread_id, low_bandwidth,
content_license_url, content_license_url,
media_license_url, media_creator, media_license_url, media_creator,
languages_understood, translate, buy_url, languages_understood, translate,
labels_str, buy_url,
chat_url, auto_cw_cache, searchable_by, chat_url, auto_cw_cache, searchable_by,
session, automatic_quote_approval, debug) session, automatic_quote_approval, debug)
message_json['object']['type'] = 'Question' message_json['object']['type'] = 'Question'
@ -2659,6 +2673,7 @@ def create_unlisted_post(base_dir: str,
low_bandwidth: bool, content_license_url: str, low_bandwidth: bool, content_license_url: str,
media_license_url: str, media_creator: str, media_license_url: str, media_creator: str,
languages_understood: [], translate: {}, languages_understood: [], translate: {},
labels_str: str,
buy_url: str, chat_url: str, buy_url: str, chat_url: str,
auto_cw_cache: {}, session, debug: bool) -> {}: auto_cw_cache: {}, session, debug: bool) -> {}:
"""Unlisted post. This has the #Public and followers links inverted. """Unlisted post. This has the #Public and followers links inverted.
@ -2699,6 +2714,7 @@ def create_unlisted_post(base_dir: str,
content_license_url, content_license_url,
media_license_url, media_creator, media_license_url, media_creator,
languages_understood, translate, languages_understood, translate,
labels_str,
buy_url, chat_url, auto_cw_cache, buy_url, chat_url, auto_cw_cache,
searchable_by, session, searchable_by, session,
automatic_quote_approval, debug) automatic_quote_approval, debug)
@ -2723,7 +2739,7 @@ def create_followers_only_post(base_dir: str,
low_bandwidth: bool, content_license_url: str, low_bandwidth: bool, content_license_url: str,
media_license_url: str, media_creator: str, media_license_url: str, media_creator: str,
languages_understood: [], languages_understood: [],
translate: {}, buy_url: str, translate: {}, labels_str: str, buy_url: str,
chat_url: str, chat_url: str,
auto_cw_cache: {}, auto_cw_cache: {},
searchable_by: [], session, searchable_by: [], session,
@ -2761,6 +2777,7 @@ def create_followers_only_post(base_dir: str,
content_license_url, content_license_url,
media_license_url, media_creator, media_license_url, media_creator,
languages_understood, translate, languages_understood, translate,
labels_str,
buy_url, chat_url, auto_cw_cache, buy_url, chat_url, auto_cw_cache,
searchable_by, session, searchable_by, session,
automatic_quote_approval, debug) automatic_quote_approval, debug)
@ -2824,6 +2841,7 @@ def create_direct_message_post(base_dir: str,
media_license_url: str, media_creator: str, media_license_url: str, media_creator: str,
languages_understood: [], languages_understood: [],
dm_is_chat: bool, translate: {}, dm_is_chat: bool, translate: {},
labels_str: str,
buy_url: str, chat_url: str, buy_url: str, chat_url: str,
auto_cw_cache: {}, session) -> {}: auto_cw_cache: {}, session) -> {}:
"""Direct Message post """Direct Message post
@ -2869,7 +2887,8 @@ def create_direct_message_post(base_dir: str,
conversation_id, convthread_id, low_bandwidth, conversation_id, convthread_id, low_bandwidth,
content_license_url, content_license_url,
media_license_url, media_creator, media_license_url, media_creator,
languages_understood, translate, buy_url, chat_url, languages_understood, translate,
labels_str, buy_url, chat_url,
auto_cw_cache, searchable_by, session, auto_cw_cache, searchable_by, session,
automatic_quote_approval, debug) automatic_quote_approval, debug)
# mentioned recipients go into To rather than Cc # mentioned recipients go into To rather than Cc
@ -2964,6 +2983,7 @@ def create_report_post(base_dir: str,
post_to = moderators_list post_to = moderators_list
post_cc = None post_cc = None
post_json_object = None post_json_object = None
labels_str = ''
buy_url = '' buy_url = ''
chat_url = '' chat_url = ''
is_moderation_report = True is_moderation_report = True
@ -3015,6 +3035,7 @@ def create_report_post(base_dir: str,
content_license_url, content_license_url,
media_license_url, media_creator, media_license_url, media_creator,
languages_understood, translate, languages_understood, translate,
labels_str,
buy_url, chat_url, auto_cw_cache, buy_url, chat_url, auto_cw_cache,
searchable_by, session, searchable_by, session,
automatic_quote_approval, debug) automatic_quote_approval, debug)
@ -3218,7 +3239,8 @@ def send_post(signing_priv_key_pem: str, project_version: str,
shared_item_federation_tokens: {}, shared_item_federation_tokens: {},
low_bandwidth: bool, content_license_url: str, low_bandwidth: bool, content_license_url: str,
media_license_url: str, media_creator: str, media_license_url: str, media_creator: str,
translate: {}, buy_url: str, chat_url: str, translate: {}, labels_str: str,
buy_url: str, chat_url: str,
auto_cw_cache: {}, auto_cw_cache: {},
debug: bool, in_reply_to: str, debug: bool, in_reply_to: str,
in_reply_to_atom_uri: str, subject: str, in_reply_to_atom_uri: str, subject: str,
@ -3315,7 +3337,7 @@ def send_post(signing_priv_key_pem: str, project_version: str,
content_license_url, content_license_url,
media_license_url, media_creator, media_license_url, media_creator,
languages_understood, languages_understood,
translate, buy_url, chat_url, translate, labels_str, buy_url, chat_url,
auto_cw_cache, searchable_by, session, auto_cw_cache, searchable_by, session,
automatic_quote_approval, debug) automatic_quote_approval, debug)

View File

@ -40,6 +40,7 @@ def send_post_via_server(signing_priv_key_pem: str, project_version: str,
event_date: str, event_time: str, event_end_time: str, event_date: str, event_time: str, event_end_time: str,
event_category: str, event_category: str,
location: str, translate: {}, location: str, translate: {},
labels_str: str,
buy_url: str, chat_url: str, auto_cw_cache: {}, buy_url: str, chat_url: str, auto_cw_cache: {},
debug: bool, in_reply_to: str, debug: bool, in_reply_to: str,
in_reply_to_atom_uri: str, in_reply_to_atom_uri: str,
@ -151,7 +152,8 @@ def send_post_via_server(signing_priv_key_pem: str, project_version: str,
content_license_url, content_license_url,
media_license_url, media_creator, media_license_url, media_creator,
languages_understood, languages_understood,
translate, buy_url, chat_url, auto_cw_cache, translate, labels_str, buy_url,
chat_url, auto_cw_cache,
searchable_by, session, searchable_by, session,
automatic_quote_approval, debug) automatic_quote_approval, debug)

View File

@ -861,6 +861,7 @@ def create_server_alice(path: str, domain: str, port: int,
media_license_url: str = \ media_license_url: str = \
'https://creativecommons.org/licenses/by-nc/4.0' 'https://creativecommons.org/licenses/by-nc/4.0'
media_creator: str = 'Mr Blobby' media_creator: str = 'Mr Blobby'
labels_str: str = ''
buy_url: str = '' buy_url: str = ''
chat_url: str = '' chat_url: str = ''
auto_cw_cache: dict = {} auto_cw_cache: dict = {}
@ -887,7 +888,8 @@ def create_server_alice(path: str, domain: str, port: int,
convthread_id, convthread_id,
low_bandwidth, content_license_url, low_bandwidth, content_license_url,
media_license_url, media_creator, media_license_url, media_creator,
languages_understood, translate, buy_url, chat_url, languages_understood, translate,
labels_str, buy_url, chat_url,
auto_cw_cache, searchable_by, session, debug) auto_cw_cache, searchable_by, session, debug)
create_public_post(path, nickname, domain, port, http_prefix, create_public_post(path, nickname, domain, port, http_prefix,
"Curiouser and curiouser!", "Curiouser and curiouser!",
@ -908,7 +910,8 @@ def create_server_alice(path: str, domain: str, port: int,
convthread_id, convthread_id,
low_bandwidth, content_license_url, low_bandwidth, content_license_url,
media_license_url, media_creator, media_license_url, media_creator,
languages_understood, translate, buy_url, chat_url, languages_understood, translate,
labels_str, buy_url, chat_url,
auto_cw_cache, searchable_by, session, debug) auto_cw_cache, searchable_by, session, debug)
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 " +
@ -930,7 +933,8 @@ def create_server_alice(path: str, domain: str, port: int,
convthread_id, convthread_id,
low_bandwidth, content_license_url, low_bandwidth, content_license_url,
media_license_url, media_creator, media_license_url, media_creator,
languages_understood, translate, buy_url, chat_url, languages_understood, translate,
labels_str, buy_url, chat_url,
auto_cw_cache, searchable_by, session, debug) auto_cw_cache, searchable_by, session, debug)
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
@ -1074,6 +1078,7 @@ def create_server_bob(path: str, domain: str, port: int,
'https://creativecommons.org/licenses/by-nc/4.0' 'https://creativecommons.org/licenses/by-nc/4.0'
media_creator: str = 'Hamster' media_creator: str = 'Hamster'
translate: dict = {} translate: dict = {}
labels_str: str = ''
buy_url: str = '' buy_url: str = ''
chat_url: str = '' chat_url: str = ''
auto_cw_cache: dict = {} auto_cw_cache: dict = {}
@ -1100,7 +1105,8 @@ def create_server_bob(path: str, domain: str, port: int,
convthread_id, convthread_id,
low_bandwidth, content_license_url, low_bandwidth, content_license_url,
media_license_url, media_creator, media_license_url, media_creator,
languages_understood, translate, buy_url, chat_url, languages_understood, translate,
labels_str, buy_url, chat_url,
auto_cw_cache, searchable_by, session, debug) auto_cw_cache, searchable_by, session, debug)
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 " +
@ -1122,7 +1128,8 @@ def create_server_bob(path: str, domain: str, port: int,
convthread_id, convthread_id,
low_bandwidth, content_license_url, low_bandwidth, content_license_url,
media_license_url, media_creator, media_license_url, media_creator,
languages_understood, translate, buy_url, chat_url, languages_understood, translate,
labels_str, buy_url, chat_url,
auto_cw_cache, searchable_by, session, debug) auto_cw_cache, searchable_by, session, debug)
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",
@ -1143,7 +1150,8 @@ def create_server_bob(path: str, domain: str, port: int,
convthread_id, convthread_id,
low_bandwidth, content_license_url, low_bandwidth, content_license_url,
media_license_url, media_creator, media_license_url, media_creator,
languages_understood, translate, buy_url, chat_url, languages_understood, translate,
labels_str, buy_url, chat_url,
auto_cw_cache, searchable_by, session, debug) auto_cw_cache, searchable_by, session, debug)
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
@ -1567,6 +1575,7 @@ def test_post_message_between_servers(base_dir: str) -> None:
low_bandwidth: bool = False low_bandwidth: bool = False
signing_priv_key_pem = None signing_priv_key_pem = None
translate: dict = {} translate: dict = {}
labels_str = ''
buy_url: str = '' buy_url: str = ''
chat_url: str = '' chat_url: str = ''
auto_cw_cache: dict = {} auto_cw_cache: dict = {}
@ -1591,7 +1600,8 @@ def test_post_message_between_servers(base_dir: str) -> None:
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, media_license_url, media_creator, content_license_url, media_license_url, media_creator,
translate, buy_url, chat_url, auto_cw_cache, True, translate, labels_str, buy_url,
chat_url, auto_cw_cache, True,
in_reply_to, in_reply_to_atom_uri, subject, in_reply_to, in_reply_to_atom_uri, subject,
searchable_by, mitm_servers) searchable_by, mitm_servers)
print('send_result: ' + str(send_result)) print('send_result: ' + str(send_result))
@ -1974,6 +1984,7 @@ def test_follow_between_servers(base_dir: str) -> None:
low_bandwidth: bool = False low_bandwidth: bool = False
signing_priv_key_pem = None signing_priv_key_pem = None
translate: dict = {} translate: dict = {}
labels_str: str = ''
buy_url: str = '' buy_url: str = ''
chat_url: str = '' chat_url: str = ''
video_transcript = None video_transcript = None
@ -2000,7 +2011,8 @@ def test_follow_between_servers(base_dir: str) -> None:
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, media_license_url, media_creator, content_license_url, media_license_url, media_creator,
translate, buy_url, chat_url, auto_cw_cache, True, translate, labels_str, buy_url,
chat_url, auto_cw_cache, True,
in_reply_to, in_reply_to_atom_uri, subject, in_reply_to, in_reply_to_atom_uri, subject,
searchable_by, mitm_servers) searchable_by, mitm_servers)
print('send_result: ' + str(send_result)) print('send_result: ' + str(send_result))
@ -2401,6 +2413,7 @@ def test_shared_items_federation(base_dir: str) -> None:
low_bandwidth: bool = False low_bandwidth: bool = False
signing_priv_key_pem = None signing_priv_key_pem = None
translate: dict = {} translate: dict = {}
labels_str: str = ''
buy_url: str = '' buy_url: str = ''
chat_url: str = '' chat_url: str = ''
video_transcript = None video_transcript = None
@ -2427,7 +2440,8 @@ def test_shared_items_federation(base_dir: str) -> None:
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, media_license_url, media_creator, content_license_url, media_license_url, media_creator,
translate, buy_url, chat_url, auto_cw_cache, True, translate, labels_str, buy_url,
chat_url, auto_cw_cache, True,
in_reply_to, in_reply_to_atom_uri, subject, in_reply_to, in_reply_to_atom_uri, subject,
searchable_by, mitm_servers) searchable_by, mitm_servers)
print('send_result: ' + str(send_result)) print('send_result: ' + str(send_result))
@ -2862,6 +2876,7 @@ def test_group_follow(base_dir: str) -> None:
if os.path.isfile(os.path.join(outbox_path, name))]) if os.path.isfile(os.path.join(outbox_path, name))])
translate = {} translate = {}
labels_str = ''
buy_url = '' buy_url = ''
chat_url = '' chat_url = ''
video_transcript = None video_transcript = None
@ -2888,7 +2903,8 @@ def test_group_follow(base_dir: str) -> None:
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, media_license_url, media_creator, content_license_url, media_license_url, media_creator,
translate, buy_url, chat_url, auto_cw_cache, True, translate, labels_str, buy_url,
chat_url, auto_cw_cache, True,
in_reply_to, in_reply_to_atom_uri, subject, in_reply_to, in_reply_to_atom_uri, subject,
searchable_by, mitm_servers) searchable_by, mitm_servers)
print('send_result: ' + str(send_result)) print('send_result: ' + str(send_result))
@ -3288,6 +3304,7 @@ def _test_create_person_account(base_dir: str):
"(yawn)\n\n...then it's not really independent.\n\n" + \ "(yawn)\n\n...then it's not really independent.\n\n" + \
"Politicians will threaten to withdraw funding if you do " + \ "Politicians will threaten to withdraw funding if you do " + \
"anything which challenges middle class sensibilities or incomes." "anything which challenges middle class sensibilities or incomes."
labels_str: str = ''
buy_url: str = '' buy_url: str = ''
chat_url: str = '' chat_url: str = ''
auto_cw_cache: dict = {} auto_cw_cache: dict = {}
@ -3310,7 +3327,8 @@ def _test_create_person_account(base_dir: str):
convthread_id, convthread_id,
low_bandwidth, content_license_url, low_bandwidth, content_license_url,
media_license_url, media_creator, media_license_url, media_creator,
languages_understood, translate, buy_url, chat_url, languages_understood, translate,
labels_str, buy_url, chat_url,
auto_cw_cache, searchable_by, session, debug) auto_cw_cache, searchable_by, session, debug)
assert test_post_json assert test_post_json
assert test_post_json.get('object') assert test_post_json.get('object')
@ -3341,7 +3359,8 @@ def _test_create_person_account(base_dir: str):
convthread_id, convthread_id,
low_bandwidth, content_license_url, low_bandwidth, content_license_url,
media_license_url, media_creator, media_license_url, media_creator,
languages_understood, translate, buy_url, chat_url, languages_understood, translate,
labels_str, buy_url, chat_url,
auto_cw_cache, searchable_by, session, debug) auto_cw_cache, searchable_by, session, debug)
assert test_post_json assert test_post_json
assert test_post_json.get('object') assert test_post_json.get('object')
@ -3549,6 +3568,7 @@ def test_client_to_server(base_dir: str):
event_category = '' event_category = ''
location = "Kinshasa" location = "Kinshasa"
translate = {} translate = {}
labels_str = ''
buy_url = '' buy_url = ''
chat_url = '' chat_url = ''
video_transcript = None video_transcript = None
@ -3573,7 +3593,8 @@ def test_client_to_server(base_dir: str):
media_license_url, media_creator, media_license_url, media_creator,
event_date, event_time, event_end_time, event_date, event_time, event_end_time,
event_category, location, event_category, location,
translate, buy_url, chat_url, auto_cw_cache, translate, labels_str, buy_url,
chat_url, auto_cw_cache,
True, None, None, conversation_id, convthread_id, True, None, None, conversation_id, convthread_id,
None, searchable_by, mitm_servers) None, searchable_by, mitm_servers)
print('send_result: ' + str(send_result)) print('send_result: ' + str(send_result))
@ -5456,6 +5477,7 @@ def _test_reply_to_public_post(base_dir: str) -> None:
'https://creativecommons.org/licenses/by-nc/4.0' 'https://creativecommons.org/licenses/by-nc/4.0'
media_creator: str = 'Skeletor' media_creator: str = 'Skeletor'
translate: dict = {} translate: dict = {}
labels_str: str = ''
buy_url: str = '' buy_url: str = ''
chat_url: str = '' chat_url: str = ''
auto_cw_cache: dict = {} auto_cw_cache: dict = {}
@ -5480,7 +5502,8 @@ def _test_reply_to_public_post(base_dir: str) -> None:
convthread_id, convthread_id,
low_bandwidth, content_license_url, low_bandwidth, content_license_url,
media_license_url, media_creator, media_license_url, media_creator,
languages_understood, translate, buy_url, chat_url, languages_understood, translate,
labels_str, buy_url, chat_url,
auto_cw_cache, searchable_by, session, debug) auto_cw_cache, searchable_by, session, debug)
# print(str(reply)) # print(str(reply))
expected_str = \ expected_str = \
@ -6571,6 +6594,7 @@ def _test_links_within_post(base_dir: str) -> None:
'https://creativecommons.org/licenses/by-nc/4.0' 'https://creativecommons.org/licenses/by-nc/4.0'
media_creator: str = 'Dr No' media_creator: str = 'Dr No'
translate: dict = {} translate: dict = {}
labels_str: str = ''
buy_url: str = '' buy_url: str = ''
chat_url: str = '' chat_url: str = ''
auto_cw_cache: dict = {} auto_cw_cache: dict = {}
@ -6595,7 +6619,8 @@ def _test_links_within_post(base_dir: str) -> None:
convthread_id, convthread_id,
low_bandwidth, content_license_url, low_bandwidth, content_license_url,
media_license_url, media_creator, media_license_url, media_creator,
languages_understood, translate, buy_url, chat_url, languages_understood, translate,
labels_str, buy_url, chat_url,
auto_cw_cache, searchable_by, session, debug) auto_cw_cache, searchable_by, session, debug)
expected_str = \ expected_str = \
@ -6653,7 +6678,8 @@ def _test_links_within_post(base_dir: str) -> None:
convthread_id, convthread_id,
low_bandwidth, content_license_url, low_bandwidth, content_license_url,
media_license_url, media_creator, media_license_url, media_creator,
languages_understood, translate, buy_url, chat_url, languages_understood, translate,
labels_str, buy_url, chat_url,
auto_cw_cache, searchable_by, session, debug) auto_cw_cache, searchable_by, session, debug)
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
@ -6680,7 +6706,8 @@ def _test_links_within_post(base_dir: str) -> None:
convthread_id, convthread_id,
low_bandwidth, content_license_url, low_bandwidth, content_license_url,
media_license_url, media_creator, media_license_url, media_creator,
languages_understood, translate, buy_url, chat_url, languages_understood, translate,
labels_str, buy_url, chat_url,
auto_cw_cache, searchable_by, session, debug) auto_cw_cache, searchable_by, session, debug)
if post_json_object['object']['content'] != content: if post_json_object['object']['content'] != content:
print('content1: ' + post_json_object['object']['content']) print('content1: ' + post_json_object['object']['content'])
@ -7783,6 +7810,7 @@ def _test_can_replyto(base_dir: str) -> None:
'https://creativecommons.org/licenses/by-nc/4.0' 'https://creativecommons.org/licenses/by-nc/4.0'
media_creator: str = 'The Penguin' media_creator: str = 'The Penguin'
translate: dict = {} translate: dict = {}
labels_str: str = ''
buy_url: str = '' buy_url: str = ''
chat_url: str = '' chat_url: str = ''
auto_cw_cache: dict = {} auto_cw_cache: dict = {}
@ -7807,7 +7835,8 @@ def _test_can_replyto(base_dir: str) -> None:
convthread_id, convthread_id,
low_bandwidth, content_license_url, low_bandwidth, content_license_url,
media_license_url, media_creator, media_license_url, media_creator,
languages_understood, translate, buy_url, chat_url, languages_understood, translate,
labels_str, buy_url, chat_url,
auto_cw_cache, searchable_by, session, debug) auto_cw_cache, searchable_by, session, debug)
# 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"

View File

@ -1041,11 +1041,19 @@ def html_new_post(edit_post_params: {},
replies_section += \ replies_section += \
searchable_by_dropdown + '</select>\n' searchable_by_dropdown + '</select>\n'
# content labels
labels_str = translate['Content labels']
replies_section += \
'<br>\n' + edit_text_field(labels_str, 'postContentLabels',
'', '1, 2, 3...')
# buy link # buy link
buy_link_str = translate['Buy link'] buy_link_str = translate['Buy link']
replies_section += \ replies_section += \
'<br>\n' + edit_text_field(buy_link_str, 'buyUrl', '<br>\n' + edit_text_field(buy_link_str, 'buyUrl',
default_buy_site, 'https://...') default_buy_site, 'https://...')
# chat link
chat_link_str = '💬 ' + translate['Chat link'] chat_link_str = '💬 ' + translate['Chat link']
replies_section += \ replies_section += \
'<br>\n' + edit_text_field(chat_link_str, 'chatUrl', '<br>\n' + edit_text_field(chat_link_str, 'chatUrl',