Option to apply dithering to uploaded images

main
bashrc 2026-07-26 14:43:35 +01:00
parent 20765d4b0e
commit 67427f215f
39 changed files with 267 additions and 78 deletions

View File

@ -514,6 +514,11 @@ def _command_options() -> None:
type=str2bool, nargs='?', type=str2bool, nargs='?',
const=True, default=True, const=True, default=True,
help="Enable replies to a post") help="Enable replies to a post")
parser.add_argument("--ditherImage", "--dither",
dest='ditherImage',
type=str2bool, nargs='?',
const=True, default=False,
help="Whether to dither the attached image")
parser.add_argument("--dav", parser.add_argument("--dav",
dest='dav', dest='dav',
type=str2bool, nargs='?', type=str2bool, nargs='?',
@ -2093,7 +2098,9 @@ def _command_options() -> None:
domain, port, domain, port,
to_nickname, to_domain, to_port, cc_url, to_nickname, to_domain, to_port, cc_url,
http_prefix, send_message, http_prefix, send_message,
argb.commentsEnabled, attach, media_type, argb.commentsEnabled,
argb.ditherImage,
attach, media_type,
attached_image_description, attached_image_description,
video_transcript, city, video_transcript, city,
cached_webfingers, person_cache, is_article, cached_webfingers, person_cache, is_article,
@ -3949,9 +3956,10 @@ def _command_options() -> None:
delete_all_posts(base_dir, nickname, domain, 'inbox') delete_all_posts(base_dir, nickname, domain, 'inbox')
delete_all_posts(base_dir, nickname, domain, 'outbox') delete_all_posts(base_dir, nickname, domain, 'outbox')
test_save_to_file = True test_save_to_file: bool = True
test_c2s: bool = False test_c2s: bool = False
test_comments_enabled = True test_comments_enabled: bool = True
test_apply_dithering: bool = False
test_attach_image_filename = None test_attach_image_filename = None
test_media_type = None test_media_type = None
test_image_description = None test_image_description = None
@ -3983,6 +3991,7 @@ def _command_options() -> None:
test_save_to_file, test_save_to_file,
test_c2s, test_c2s,
test_comments_enabled, test_comments_enabled,
test_apply_dithering,
test_attach_image_filename, test_attach_image_filename,
test_media_type, test_image_description, test_media_type, test_image_description,
test_video_transcript, test_city, test_video_transcript, test_city,
@ -4002,6 +4011,7 @@ def _command_options() -> None:
test_save_to_file, test_save_to_file,
test_c2s, test_c2s,
test_comments_enabled, test_comments_enabled,
test_apply_dithering,
test_attach_image_filename, test_attach_image_filename,
test_media_type, test_image_description, test_media_type, test_image_description,
test_video_transcript, test_city, test_video_transcript, test_city,
@ -4021,6 +4031,7 @@ def _command_options() -> None:
test_save_to_file, test_save_to_file,
test_c2s, test_c2s,
test_comments_enabled, test_comments_enabled,
test_apply_dithering,
test_attach_image_filename, test_attach_image_filename,
test_media_type, test_image_description, test_media_type, test_image_description,
test_video_transcript, test_city, test_video_transcript, test_city,
@ -4040,6 +4051,7 @@ def _command_options() -> None:
test_save_to_file, test_save_to_file,
test_c2s, test_c2s,
test_comments_enabled, test_comments_enabled,
test_apply_dithering,
test_attach_image_filename, test_attach_image_filename,
test_media_type, test_image_description, test_media_type, test_image_description,
test_video_transcript, test_city, test_video_transcript, test_city,
@ -4060,6 +4072,7 @@ def _command_options() -> None:
test_save_to_file, test_save_to_file,
test_c2s, test_c2s,
test_comments_enabled, test_comments_enabled,
test_apply_dithering,
'img/logo.png', 'image/png', 'img/logo.png', 'image/png',
'Description of image', 'Description of image',
test_video_transcript, test_city, test_video_transcript, test_city,
@ -4079,6 +4092,7 @@ def _command_options() -> None:
test_save_to_file, test_save_to_file,
test_c2s, test_c2s,
test_comments_enabled, test_comments_enabled,
test_apply_dithering,
test_attach_image_filename, test_attach_image_filename,
test_media_type, test_image_description, test_media_type, test_image_description,
test_video_transcript, test_city, test_video_transcript, test_city,
@ -4098,6 +4112,7 @@ def _command_options() -> None:
test_save_to_file, test_save_to_file,
test_c2s, test_c2s,
test_comments_enabled, test_comments_enabled,
test_apply_dithering,
test_attach_image_filename, test_attach_image_filename,
test_media_type, test_image_description, test_media_type, test_image_description,
test_video_transcript, test_city, test_video_transcript, test_city,
@ -4117,6 +4132,7 @@ def _command_options() -> None:
test_save_to_file, test_save_to_file,
test_c2s, test_c2s,
test_comments_enabled, test_comments_enabled,
test_apply_dithering,
test_attach_image_filename, test_attach_image_filename,
test_media_type, test_image_description, test_media_type, test_image_description,
test_video_transcript, test_city, test_video_transcript, test_city,

View File

@ -214,7 +214,8 @@ def _send_reply_to_question(self, base_dir: str,
print('Voting on message ' + message_id) print('Voting on message ' + message_id)
print('Vote for: ' + answer) print('Vote for: ' + answer)
comments_enabled = True comments_enabled: bool = True
apply_dithering: bool = False
attach_image_filename = None attach_image_filename = None
media_type = None media_type = None
image_description = None image_description = None
@ -251,6 +252,7 @@ def _send_reply_to_question(self, base_dir: str,
mentions_str + ' ' + answer, mentions_str + ' ' + answer,
False, False, False, False,
comments_enabled, comments_enabled,
apply_dithering,
attach_image_filename, attach_image_filename,
media_type, image_description, media_type, image_description,
video_transcript, city, video_transcript, city,

View File

@ -84,6 +84,7 @@ def _receive_new_post_process_newpost(self, fields: {},
content_license_url: str, content_license_url: str,
mentions_str: str, mentions_str: str,
comments_enabled: bool, comments_enabled: bool,
apply_dithering: bool,
filename: str, filename: str,
attachment_media_type: str, attachment_media_type: str,
low_bandwidth: bool, low_bandwidth: bool,
@ -182,6 +183,7 @@ def _receive_new_post_process_newpost(self, fields: {},
http_prefix, http_prefix,
mentions_str + fields['message'], mentions_str + fields['message'],
False, False, comments_enabled, False, False, comments_enabled,
apply_dithering,
filename, attachment_media_type, filename, attachment_media_type,
fields['imageDescription'], fields['imageDescription'],
video_transcript, video_transcript,
@ -287,6 +289,7 @@ def _receive_new_post_process_newblog(self, fields: {},
http_prefix: str, person_cache: {}, http_prefix: str, person_cache: {},
content_license_url: str, content_license_url: str,
comments_enabled: bool, comments_enabled: bool,
apply_dithering: bool,
filename: str, filename: str,
attachment_media_type: str, attachment_media_type: str,
low_bandwidth: bool, low_bandwidth: bool,
@ -364,6 +367,7 @@ def _receive_new_post_process_newblog(self, fields: {},
domain, port, http_prefix, domain, port, http_prefix,
fields['message'], save_to_file, fields['message'], save_to_file,
client_to_server, comments_enabled, client_to_server, comments_enabled,
apply_dithering,
filename, attachment_media_type, filename, attachment_media_type,
fields['imageDescription'], fields['imageDescription'],
video_transcript, city, video_transcript, city,
@ -414,7 +418,8 @@ def _receive_new_post_process_editblog(self, fields: {},
attachment_media_type: str, attachment_media_type: str,
low_bandwidth: bool, low_bandwidth: bool,
yt_replace_domain: str, yt_replace_domain: str,
twitter_replacement_domain: str) -> int: twitter_replacement_domain: str,
apply_dithering: bool) -> int:
"""Edited blog post has been received and is then sent to the outbox """Edited blog post has been received and is then sent to the outbox
""" """
print('Edited blog post received') print('Edited blog post received')
@ -498,7 +503,7 @@ def _receive_new_post_process_editblog(self, fields: {},
city, low_bandwidth, city, low_bandwidth,
license_url, creator, license_url, creator,
fields['languagesDropdown'], fields['languagesDropdown'],
debug) debug, apply_dithering)
replace_you_tube(post_json_object, replace_you_tube(post_json_object,
yt_replace_domain, yt_replace_domain,
@ -533,6 +538,7 @@ def _receive_new_post_process_newunlisted(self, fields: {},
content_license_url: str, content_license_url: str,
port: int, mentions_str: str, port: int, mentions_str: str,
comments_enabled: bool, comments_enabled: bool,
apply_dithering: bool,
filename: str, filename: str,
attachment_media_type: str, attachment_media_type: str,
low_bandwidth: bool, low_bandwidth: bool,
@ -615,6 +621,7 @@ def _receive_new_post_process_newunlisted(self, fields: {},
mentions_str + fields['message'], mentions_str + fields['message'],
save_to_file, save_to_file,
client_to_server, comments_enabled, client_to_server, comments_enabled,
apply_dithering,
filename, attachment_media_type, filename, attachment_media_type,
fields['imageDescription'], fields['imageDescription'],
video_transcript, video_transcript,
@ -707,6 +714,7 @@ def _receive_new_post_process_newfollowers(self, fields: {},
person_cache: {}, person_cache: {},
content_license_url: str, content_license_url: str,
port: int, comments_enabled: bool, port: int, comments_enabled: bool,
apply_dithering: bool,
filename: str, filename: str,
attachment_media_type: str, attachment_media_type: str,
low_bandwidth: bool, low_bandwidth: bool,
@ -795,6 +803,7 @@ def _receive_new_post_process_newfollowers(self, fields: {},
save_to_file, save_to_file,
client_to_server, client_to_server,
comments_enabled, comments_enabled,
apply_dithering,
filename, attachment_media_type, filename, attachment_media_type,
fields['imageDescription'], fields['imageDescription'],
video_transcript, video_transcript,
@ -891,6 +900,7 @@ def _receive_new_post_process_newdm(self, fields: {},
person_cache: {}, person_cache: {},
content_license_url: str, content_license_url: str,
port: int, comments_enabled: str, port: int, comments_enabled: str,
apply_dithering: bool,
filename: str, filename: str,
attachment_media_type: str, attachment_media_type: str,
low_bandwidth: bool, low_bandwidth: bool,
@ -986,6 +996,7 @@ def _receive_new_post_process_newdm(self, fields: {},
save_to_file, save_to_file,
client_to_server, client_to_server,
comments_enabled, comments_enabled,
apply_dithering,
filename, filename,
attachment_media_type, attachment_media_type,
fields['imageDescription'], fields['imageDescription'],
@ -1135,6 +1146,7 @@ def _receive_new_post_process_newreminder(self, fields: {}, nickname: str,
save_to_file: bool = False save_to_file: bool = False
client_to_server: bool = False client_to_server: bool = False
comments_enabled: bool = False comments_enabled: bool = False
apply_dithering: bool = False
conversation_id = None conversation_id = None
convthread_id = None convthread_id = None
mentions_message = mentions_str + fields['message'] mentions_message = mentions_str + fields['message']
@ -1164,6 +1176,7 @@ def _receive_new_post_process_newreminder(self, fields: {}, nickname: str,
save_to_file, save_to_file,
client_to_server, client_to_server,
comments_enabled, comments_enabled,
apply_dithering,
filename, attachment_media_type, filename, attachment_media_type,
fields['imageDescription'], fields['imageDescription'],
video_transcript, video_transcript,
@ -1287,11 +1300,14 @@ def _receive_new_post_process_newreport(self, fields: {},
video_transcript: str = '' video_transcript: str = ''
if fields.get('videoTranscript'): if fields.get('videoTranscript'):
video_transcript = fields['videoTranscript'] video_transcript = fields['videoTranscript']
comments_enabled: bool = True
apply_dithering: bool = False
message_json = \ message_json = \
create_report_post(base_dir, nickname, domain, port, create_report_post(base_dir, nickname, domain, port,
http_prefix, http_prefix,
mentions_str + fields['message'], mentions_str + fields['message'],
False, False, True, False, False, comments_enabled,
apply_dithering,
filename, attachment_media_type, filename, attachment_media_type,
fields['imageDescription'], fields['imageDescription'],
video_transcript, video_transcript,
@ -1321,6 +1337,7 @@ def _receive_new_post_process_newquestion(self, fields: {},
content_license_url: str, content_license_url: str,
port: int, port: int,
comments_enabled: bool, comments_enabled: bool,
apply_dithering: bool,
filename: str, filename: str,
attachment_media_type: str, attachment_media_type: str,
low_bandwidth: bool, low_bandwidth: bool,
@ -1394,6 +1411,7 @@ def _receive_new_post_process_newquestion(self, fields: {},
fields['message'], q_options, fields['message'], q_options,
False, False, False, False,
comments_enabled, comments_enabled,
apply_dithering,
filename, attachment_media_type, filename, attachment_media_type,
fields['imageDescription'], fields['imageDescription'],
video_transcript, video_transcript,
@ -1428,6 +1446,7 @@ def _receive_new_post_process_newreading(self, fields: {},
domain: str, port: int, domain: str, port: int,
mentions_str: str, mentions_str: str,
comments_enabled: bool, comments_enabled: bool,
apply_dithering: bool,
filename: str, filename: str,
attachment_media_type: str, attachment_media_type: str,
low_bandwidth: bool, low_bandwidth: bool,
@ -1531,6 +1550,7 @@ def _receive_new_post_process_newreading(self, fields: {},
fields['bookurl'], fields['bookurl'],
book_rating, book_rating,
False, False, comments_enabled, False, False, comments_enabled,
apply_dithering,
filename, attachment_media_type, filename, attachment_media_type,
fields['imageDescription'], fields['imageDescription'],
video_transcript, video_transcript,
@ -2117,6 +2137,10 @@ def _receive_new_post_process(self, post_type: str, path: str, headers: {},
comments_enabled: bool = False comments_enabled: bool = False
else: else:
comments_enabled: bool = True comments_enabled: bool = True
if not fields.get('ditherImage'):
apply_dithering: bool = False
else:
apply_dithering: bool = True
buy_url: str = '' buy_url: str = ''
if fields.get('buyUrl'): if fields.get('buyUrl'):
@ -2136,6 +2160,7 @@ def _receive_new_post_process(self, post_type: str, path: str, headers: {},
content_license_url, content_license_url,
mentions_str, mentions_str,
comments_enabled, comments_enabled,
apply_dithering,
filename, filename,
attachment_media_type, attachment_media_type,
low_bandwidth, low_bandwidth,
@ -2187,7 +2212,9 @@ def _receive_new_post_process(self, post_type: str, path: str, headers: {},
cookie, calling_domain, cookie, calling_domain,
http_prefix, person_cache, http_prefix, person_cache,
content_license_url, content_license_url,
comments_enabled, filename, comments_enabled,
apply_dithering,
filename,
attachment_media_type, attachment_media_type,
low_bandwidth, low_bandwidth,
buy_url, chat_url, buy_url, chat_url,
@ -2205,7 +2232,8 @@ def _receive_new_post_process(self, post_type: str, path: str, headers: {},
attachment_media_type, attachment_media_type,
low_bandwidth, low_bandwidth,
yt_replace_domain, yt_replace_domain,
twitter_replacement_domain) twitter_replacement_domain,
apply_dithering)
if post_type == 'newunlisted': if post_type == 'newunlisted':
return _receive_new_post_process_newunlisted( return _receive_new_post_process_newunlisted(
self, fields, self, fields,
@ -2217,6 +2245,7 @@ def _receive_new_post_process(self, post_type: str, path: str, headers: {},
content_license_url, content_license_url,
port, mentions_str, port, mentions_str,
comments_enabled, comments_enabled,
apply_dithering,
filename, filename,
attachment_media_type, attachment_media_type,
low_bandwidth, low_bandwidth,
@ -2267,6 +2296,7 @@ def _receive_new_post_process(self, post_type: str, path: str, headers: {},
person_cache, person_cache,
content_license_url, content_license_url,
port, comments_enabled, port, comments_enabled,
apply_dithering,
filename, filename,
attachment_media_type, attachment_media_type,
low_bandwidth, low_bandwidth,
@ -2315,6 +2345,7 @@ def _receive_new_post_process(self, post_type: str, path: str, headers: {},
person_cache, person_cache,
content_license_url, content_license_url,
port, comments_enabled, port, comments_enabled,
apply_dithering,
filename, filename,
attachment_media_type, attachment_media_type,
low_bandwidth, low_bandwidth,
@ -2424,7 +2455,9 @@ def _receive_new_post_process(self, post_type: str, path: str, headers: {},
self, fields, city, base_dir, nickname, self, fields, city, base_dir, nickname,
domain, domain_full, http_prefix, domain, domain_full, http_prefix,
person_cache, content_license_url, person_cache, content_license_url,
port, comments_enabled, filename, port, comments_enabled,
apply_dithering,
filename,
attachment_media_type, attachment_media_type,
low_bandwidth, translate, auto_cw_cache, low_bandwidth, translate, auto_cw_cache,
debug, project_version, curr_session, debug, project_version, curr_session,
@ -2441,6 +2474,7 @@ def _receive_new_post_process(self, post_type: str, path: str, headers: {},
domain, port, domain, port,
mentions_str, mentions_str,
comments_enabled, comments_enabled,
apply_dithering,
filename, filename,
attachment_media_type, attachment_media_type,
low_bandwidth, low_bandwidth,

View File

@ -557,7 +557,8 @@ def _desktop_reply_to_post(session, post_id: str,
attached_image_description = None attached_image_description = None
is_article: bool = False is_article: bool = False
subject = None subject = None
comments_enabled = True comments_enabled: bool = True
apply_dithering: bool = False
city = 'London, England' city = 'London, England'
say_str = 'Sending reply' say_str = 'Sending reply'
event_date = None event_date = None
@ -577,7 +578,8 @@ def _desktop_reply_to_post(session, post_id: str,
domain, port, domain, port,
to_nickname, to_domain, to_port, cc_url, to_nickname, to_domain, to_port, cc_url,
http_prefix, reply_message, http_prefix, reply_message,
comments_enabled, attach, media_type, comments_enabled, apply_dithering,
attach, media_type,
attached_image_description, video_transcript, attached_image_description, video_transcript,
city, cached_webfingers, city, cached_webfingers,
person_cache, is_article, person_cache, is_article,
@ -646,7 +648,8 @@ def _desktop_new_post(session,
city = 'London, England' city = 'London, England'
is_article: bool = False is_article: bool = False
subject = None subject = None
comments_enabled = True comments_enabled: bool = True
apply_dithering: bool = False
subject = None subject = None
say_str = 'Sending' say_str = 'Sending'
event_date = None event_date = None
@ -666,7 +669,8 @@ def _desktop_new_post(session,
domain, port, domain, port,
None, '#Public', port, cc_url, None, '#Public', port, cc_url,
http_prefix, new_message, http_prefix, new_message,
comments_enabled, attach, media_type, comments_enabled, apply_dithering,
attach, media_type,
attached_image_description, video_transcript, city, attached_image_description, video_transcript, city,
cached_webfingers, person_cache, is_article, cached_webfingers, person_cache, is_article,
system_language, languages_understood, system_language, languages_understood,
@ -1450,7 +1454,8 @@ def _desktop_new_dm_base(session, to_handle: str,
city: str = 'London, England' city: str = 'London, England'
is_article: bool = False is_article: bool = False
subject = None subject = None
comments_enabled = True comments_enabled: bool = True
apply_dithering: bool = False
subject = None subject = None
# if there is a local PGP key then attempt to encrypt the DM # if there is a local PGP key then attempt to encrypt the DM
@ -1510,7 +1515,8 @@ def _desktop_new_dm_base(session, to_handle: str,
domain, port, domain, port,
to_nickname, to_domain, to_port, cc_url, to_nickname, to_domain, to_port, cc_url,
http_prefix, new_message, http_prefix, new_message,
comments_enabled, attach, media_type, comments_enabled, apply_dithering,
attach, media_type,
attached_image_description, video_transcript, city, attached_image_description, video_transcript, city,
cached_webfingers, person_cache, is_article, cached_webfingers, person_cache, is_article,
system_language, languages_understood, system_language, languages_understood,

View File

@ -1444,6 +1444,7 @@ def _bounce_dm(sender_post_id: str, session, http_prefix: str,
save_to_file: bool = False save_to_file: bool = False
client_to_server: bool = False client_to_server: bool = False
comments_enabled: bool = False comments_enabled: bool = False
apply_dithering: bool = False
attach_image_filename = None attach_image_filename = None
media_type = None media_type = None
image_description: str = '' image_description: str = ''
@ -1468,6 +1469,7 @@ def _bounce_dm(sender_post_id: str, session, http_prefix: str,
http_prefix, content, http_prefix, content,
save_to_file, client_to_server, save_to_file, client_to_server,
comments_enabled, comments_enabled,
apply_dithering,
attach_image_filename, media_type, attach_image_filename, media_type,
image_description, video_transcript, city, image_description, video_transcript, city,
in_reply_to, in_reply_to_atom_uri, in_reply_to, in_reply_to_atom_uri,

View File

@ -686,7 +686,8 @@ def attach_media(base_dir: str, http_prefix: str,
content_license_url: str, content_license_url: str,
creator: str, creator: str,
system_language: str, system_language: str,
debug: bool) -> {}: debug: bool,
apply_dithering: bool) -> {}:
"""Attaches media to a json object post """Attaches media to a json object post
The description can be None The description can be None
""" """
@ -766,7 +767,7 @@ def attach_media(base_dir: str, http_prefix: str,
if base_dir: if base_dir:
if media_type.startswith('image/'): if media_type.startswith('image/'):
if low_bandwidth: if low_bandwidth or apply_dithering:
convert_image_to_low_bandwidth(image_filename) convert_image_to_low_bandwidth(image_filename)
exif_json: list[dict] = [] exif_json: list[dict] = []
file_size_original: int = os.path.getsize(image_filename) file_size_original: int = os.path.getsize(image_filename)

View File

@ -637,6 +637,7 @@ def _convert_rss_to_activitypub(base_dir: str, http_prefix: str,
# consistent (it's based on the current time, not the # consistent (it's based on the current time, not the
# published time), so we change that later # published time), so we change that later
save_to_file: bool = False save_to_file: bool = False
apply_dithering: bool = False
attach_image_filename = None attach_image_filename = None
media_type = None media_type = None
image_description = None image_description = None
@ -650,7 +651,7 @@ def _convert_rss_to_activitypub(base_dir: str, http_prefix: str,
blog = create_news_post(base_dir, blog = create_news_post(base_dir,
domain, port, http_prefix, domain, port, http_prefix,
rss_description, rss_description,
save_to_file, save_to_file, apply_dithering,
attach_image_filename, media_type, attach_image_filename, media_type,
image_description, video_transcript, image_description, video_transcript,
city, rss_title, system_language, city, rss_title, system_language,

View File

@ -1240,6 +1240,7 @@ def _create_post_s2s(base_dir: str, nickname: str, domain: str, port: int,
published: str, new_post_id: str, post_context: {}, published: str, new_post_id: str, post_context: {},
to_recipients: [], to_cc: [], in_reply_to: str, to_recipients: [], to_cc: [], in_reply_to: str,
sensitive: bool, comments_enabled: bool, sensitive: bool, comments_enabled: bool,
apply_dithering: bool,
tags: [], attach_image_filename: str, tags: [], attach_image_filename: str,
media_type: str, image_description: str, media_type: str, image_description: str,
video_transcript: str, city: str, video_transcript: str, city: str,
@ -1410,7 +1411,7 @@ def _create_post_s2s(base_dir: str, nickname: str, domain: str, port: int,
media_type, image_description, video_transcript, media_type, image_description, video_transcript,
city, low_bandwidth, city, low_bandwidth,
media_license_url, media_creator, system_language, media_license_url, media_creator, system_language,
debug) debug, apply_dithering)
else: else:
if debug: if debug:
print('DEBUG: creating s2s post with no attached media') print('DEBUG: creating s2s post with no attached media')
@ -1425,6 +1426,7 @@ def _create_post_c2s(base_dir: str, nickname: str, domain: str, port: int,
published: str, new_post_id: str, post_context: {}, published: str, new_post_id: str, post_context: {},
to_recipients: [], to_cc: [], in_reply_to: str, to_recipients: [], to_cc: [], in_reply_to: str,
sensitive: bool, comments_enabled: bool, sensitive: bool, comments_enabled: bool,
apply_dithering: bool,
tags: [], attach_image_filename: str, tags: [], attach_image_filename: str,
media_type: str, image_description: str, media_type: str, image_description: str,
video_transcript: str, city: str, video_transcript: str, city: str,
@ -1584,7 +1586,7 @@ def _create_post_c2s(base_dir: str, nickname: str, domain: str, port: int,
media_type, image_description, video_transcript, media_type, image_description, video_transcript,
city, low_bandwidth, city, low_bandwidth,
media_license_url, media_creator, media_license_url, media_creator,
system_language, debug) system_language, debug, apply_dithering)
else: else:
if debug: if debug:
print('DEBUG: creating c2s post with no attached media') print('DEBUG: creating c2s post with no attached media')
@ -1823,6 +1825,7 @@ def create_post_base(base_dir: str,
to_url: str, cc_url: str, http_prefix: str, content: str, to_url: str, cc_url: str, http_prefix: str, content: str,
save_to_file: bool, save_to_file: bool,
client_to_server: bool, comments_enabled: bool, client_to_server: bool, comments_enabled: bool,
apply_dithering: bool,
attach_image_filename: str, attach_image_filename: str,
media_type: str, image_description: str, media_type: str, image_description: str,
video_transcript: str, city: str, video_transcript: str, city: str,
@ -2022,6 +2025,7 @@ def create_post_base(base_dir: str,
published, new_post_id, post_context, published, new_post_id, post_context,
to_recipients, to_cc, in_reply_to, to_recipients, to_cc, in_reply_to,
sensitive, comments_enabled, sensitive, comments_enabled,
apply_dithering,
tags, attach_image_filename, tags, attach_image_filename,
media_type, image_description, media_type, image_description,
video_transcript, city, video_transcript, city,
@ -2040,6 +2044,7 @@ def create_post_base(base_dir: str,
published, new_post_id, post_context, published, new_post_id, post_context,
to_recipients, to_cc, in_reply_to, to_recipients, to_cc, in_reply_to,
sensitive, comments_enabled, sensitive, comments_enabled,
apply_dithering,
tags, attach_image_filename, tags, attach_image_filename,
media_type, image_description, media_type, image_description,
video_transcript, city, video_transcript, city,
@ -2052,6 +2057,19 @@ def create_post_base(base_dir: str,
automatic_quote_approval, automatic_quote_approval,
session, debug) session, debug)
# update the image dithering flag
dither_filename = \
acct_dir(base_dir, nickname, domain) + '/.ditherImage'
if apply_dithering:
if not is_a_file(dither_filename):
save_string('.', dither_filename,
'EX: unable to save ditherImage flag ' +
dither_filename)
else:
if is_a_file(dither_filename):
erase_file(dither_filename,
'EX: unable to delete ' + dither_filename)
_create_post_mentions(cc_url, new_post, to_recipients, tags) _create_post_mentions(cc_url, new_post, to_recipients, tags)
_create_post_mod_report(base_dir, is_moderation_report, _create_post_mod_report(base_dir, is_moderation_report,
@ -2290,6 +2308,7 @@ def create_public_post(base_dir: str,
nickname: str, domain: str, port: int, http_prefix: str, nickname: str, domain: str, port: int, http_prefix: str,
content: str, save_to_file: bool, content: str, save_to_file: bool,
client_to_server: bool, comments_enabled: bool, client_to_server: bool, comments_enabled: bool,
apply_dithering: bool,
attach_image_filename: str, media_type: str, attach_image_filename: str, media_type: str,
image_description: str, video_transcript: str, image_description: str, video_transcript: str,
city: str, in_reply_to: str, city: str, in_reply_to: str,
@ -2328,6 +2347,7 @@ def create_public_post(base_dir: str,
local_actor + '/followers', local_actor + '/followers',
http_prefix, content, save_to_file, http_prefix, content, save_to_file,
client_to_server, comments_enabled, client_to_server, comments_enabled,
apply_dithering,
attach_image_filename, media_type, attach_image_filename, media_type,
image_description, video_transcript, city, image_description, video_transcript, city,
is_moderation_report, is_article, is_moderation_report, is_article,
@ -2354,6 +2374,7 @@ def create_reading_post(base_dir: str,
book_title: str, book_url: str, book_rating: float, book_title: str, book_url: str, book_rating: float,
save_to_file: bool, save_to_file: bool,
client_to_server: bool, comments_enabled: bool, client_to_server: bool, comments_enabled: bool,
apply_dithering: bool,
attach_image_filename: str, media_type: str, attach_image_filename: str, media_type: str,
image_description: str, video_transcript: str, image_description: str, video_transcript: str,
city: str, in_reply_to: str, city: str, in_reply_to: str,
@ -2397,6 +2418,7 @@ def create_reading_post(base_dir: str,
nickname, domain, port, http_prefix, nickname, domain, port, http_prefix,
content, save_to_file, content, save_to_file,
client_to_server, comments_enabled, client_to_server, comments_enabled,
apply_dithering,
attach_image_filename, media_type, attach_image_filename, media_type,
image_description, video_transcript, image_description, video_transcript,
city, in_reply_to, city, in_reply_to,
@ -2458,6 +2480,7 @@ def create_blog_post(base_dir: str,
nickname: str, domain: str, port: int, http_prefix: str, nickname: str, domain: str, port: int, http_prefix: str,
content: str, save_to_file: bool, content: str, save_to_file: bool,
client_to_server: bool, comments_enabled: bool, client_to_server: bool, comments_enabled: bool,
apply_dithering: bool,
attach_image_filename: str, media_type: str, attach_image_filename: str, media_type: str,
image_description: str, video_transcript: str, image_description: str, video_transcript: str,
city: str, in_reply_to: str, in_reply_to_atom_uri: str, city: str, in_reply_to: str, in_reply_to_atom_uri: str,
@ -2477,6 +2500,7 @@ def create_blog_post(base_dir: str,
nickname, domain, port, http_prefix, nickname, domain, port, http_prefix,
content, save_to_file, content, save_to_file,
client_to_server, comments_enabled, client_to_server, comments_enabled,
apply_dithering,
attach_image_filename, media_type, attach_image_filename, media_type,
image_description, video_transcript, city, image_description, video_transcript, city,
in_reply_to, in_reply_to_atom_uri, subject, in_reply_to, in_reply_to_atom_uri, subject,
@ -2501,6 +2525,7 @@ def create_blog_post(base_dir: str,
def create_news_post(base_dir: str, def create_news_post(base_dir: str,
domain: str, port: int, http_prefix: str, domain: str, port: int, http_prefix: str,
content: str, save_to_file: bool, content: str, save_to_file: bool,
apply_dithering: bool,
attach_image_filename: str, media_type: str, attach_image_filename: str, media_type: str,
image_description: str, video_transcript: str, city: str, image_description: str, video_transcript: str, city: str,
subject: str, system_language: str, subject: str, system_language: str,
@ -2525,7 +2550,7 @@ def create_news_post(base_dir: str,
create_public_post(base_dir, create_public_post(base_dir,
'news', domain, port, http_prefix, 'news', domain, port, http_prefix,
content, save_to_file, content, save_to_file,
client_to_server, False, client_to_server, False, apply_dithering,
attach_image_filename, media_type, attach_image_filename, media_type,
image_description, video_transcript, city, image_description, video_transcript, city,
in_reply_to, in_reply_to_atom_uri, subject, in_reply_to, in_reply_to_atom_uri, subject,
@ -2548,6 +2573,7 @@ def create_question_post(base_dir: str,
content: str, q_options: [], content: str, q_options: [],
save_to_file: bool, save_to_file: bool,
client_to_server: bool, comments_enabled: bool, client_to_server: bool, comments_enabled: bool,
apply_dithering: bool,
attach_image_filename: str, media_type: str, attach_image_filename: str, media_type: str,
image_description: str, video_transcript: str, image_description: str, video_transcript: str,
city: str, subject: str, duration_days: int, city: str, subject: str, duration_days: int,
@ -2581,6 +2607,7 @@ def create_question_post(base_dir: str,
local_actor + '/followers', local_actor + '/followers',
http_prefix, content, save_to_file, http_prefix, content, save_to_file,
client_to_server, comments_enabled, client_to_server, comments_enabled,
apply_dithering,
attach_image_filename, media_type, attach_image_filename, media_type,
image_description, video_transcript, city, image_description, video_transcript, city,
is_moderation_report, is_article, is_moderation_report, is_article,
@ -2624,6 +2651,7 @@ def create_unlisted_post(base_dir: str,
http_prefix: str, http_prefix: str,
content: str, save_to_file: bool, content: str, save_to_file: bool,
client_to_server: bool, comments_enabled: bool, client_to_server: bool, comments_enabled: bool,
apply_dithering: bool,
attach_image_filename: str, media_type: str, attach_image_filename: str, media_type: str,
image_description: str, video_transcript: str, image_description: str, video_transcript: str,
city: str, in_reply_to: str, city: str, in_reply_to: str,
@ -2657,6 +2685,7 @@ def create_unlisted_post(base_dir: str,
'https://www.w3.org/ns/activitystreams#Public', 'https://www.w3.org/ns/activitystreams#Public',
http_prefix, content, save_to_file, http_prefix, content, save_to_file,
client_to_server, comments_enabled, client_to_server, comments_enabled,
apply_dithering,
attach_image_filename, media_type, attach_image_filename, media_type,
image_description, video_transcript, city, image_description, video_transcript, city,
is_moderation_report, is_article, is_moderation_report, is_article,
@ -2685,6 +2714,7 @@ def create_followers_only_post(base_dir: str,
http_prefix: str, content: str, http_prefix: str, content: str,
save_to_file: bool, save_to_file: bool,
client_to_server: bool, comments_enabled: bool, client_to_server: bool, comments_enabled: bool,
apply_dithering: bool,
attach_image_filename: str, media_type: str, attach_image_filename: str, media_type: str,
image_description: str, video_transcript: str, image_description: str, video_transcript: str,
city: str, in_reply_to: str, city: str, in_reply_to: str,
@ -2720,6 +2750,7 @@ def create_followers_only_post(base_dir: str,
local_actor + '/followers', None, local_actor + '/followers', None,
http_prefix, content, save_to_file, http_prefix, content, save_to_file,
client_to_server, comments_enabled, client_to_server, comments_enabled,
apply_dithering,
attach_image_filename, media_type, attach_image_filename, media_type,
image_description, video_transcript, city, image_description, video_transcript, city,
is_moderation_report, is_article, is_moderation_report, is_article,
@ -2783,6 +2814,7 @@ def create_direct_message_post(base_dir: str,
http_prefix: str, content: str, http_prefix: str, content: str,
save_to_file: bool, client_to_server: bool, save_to_file: bool, client_to_server: bool,
comments_enabled: bool, comments_enabled: bool,
apply_dithering: bool,
attach_image_filename: str, media_type: str, attach_image_filename: str, media_type: str,
image_description: str, video_transcript: str, image_description: str, video_transcript: str,
city: str, in_reply_to: str, city: str, in_reply_to: str,
@ -2827,6 +2859,7 @@ def create_direct_message_post(base_dir: str,
post_to, post_cc, post_to, post_cc,
http_prefix, content, save_to_file, http_prefix, content, save_to_file,
client_to_server, comments_enabled, client_to_server, comments_enabled,
apply_dithering,
attach_image_filename, media_type, attach_image_filename, media_type,
image_description, video_transcript, city, image_description, video_transcript, city,
is_moderation_report, is_article, is_moderation_report, is_article,
@ -2864,6 +2897,7 @@ def create_report_post(base_dir: str,
nickname: str, domain: str, port: int, http_prefix: str, nickname: str, domain: str, port: int, http_prefix: str,
content: str, save_to_file: bool, content: str, save_to_file: bool,
client_to_server: bool, comments_enabled: bool, client_to_server: bool, comments_enabled: bool,
apply_dithering: bool,
attach_image_filename: str, media_type: str, attach_image_filename: str, media_type: str,
image_description: str, video_transcript: str, image_description: str, video_transcript: str,
city: str, debug: bool, subject: str, city: str, debug: bool, subject: str,
@ -2969,6 +3003,7 @@ def create_report_post(base_dir: str,
to_url, post_cc, to_url, post_cc,
http_prefix, content, save_to_file, http_prefix, content, save_to_file,
client_to_server, comments_enabled, client_to_server, comments_enabled,
apply_dithering,
attach_image_filename, media_type, attach_image_filename, media_type,
image_description, video_transcript, city, image_description, video_transcript, city,
is_moderation_report, is_article, is_moderation_report, is_article,
@ -3177,6 +3212,7 @@ def send_post(signing_priv_key_pem: str, project_version: str,
http_prefix: str, content: str, http_prefix: str, content: str,
save_to_file: bool, client_to_server: bool, save_to_file: bool, client_to_server: bool,
comments_enabled: bool, comments_enabled: bool,
apply_dithering: bool,
attach_image_filename: str, media_type: str, attach_image_filename: str, media_type: str,
image_description: str, video_transcript: str, city: str, image_description: str, video_transcript: str, city: str,
federation_list: [], send_threads: [], post_log: [], federation_list: [], send_threads: [], post_log: [],
@ -3266,6 +3302,7 @@ def send_post(signing_priv_key_pem: str, project_version: str,
to_person_id, cc_str, http_prefix, content, to_person_id, cc_str, http_prefix, content,
save_to_file, client_to_server, save_to_file, client_to_server,
comments_enabled, comments_enabled,
apply_dithering,
attach_image_filename, media_type, attach_image_filename, media_type,
image_description, video_transcript, city, image_description, video_transcript, city,
is_moderation_report, is_article, in_reply_to, is_moderation_report, is_article, in_reply_to,

View File

@ -28,6 +28,7 @@ def send_post_via_server(signing_priv_key_pem: str, project_version: str,
cc_str: str, cc_str: str,
http_prefix: str, content: str, http_prefix: str, content: str,
comments_enabled: bool, comments_enabled: bool,
apply_dithering: bool,
attach_image_filename: str, media_type: str, attach_image_filename: str, media_type: str,
image_description: str, video_transcript: str, image_description: str, video_transcript: str,
city: str, cached_webfingers: {}, person_cache: {}, city: str, cached_webfingers: {}, person_cache: {},
@ -133,7 +134,7 @@ def send_post_via_server(signing_priv_key_pem: str, project_version: str,
from_nickname, from_domain, from_port, from_nickname, from_domain, from_port,
to_person_id, cc_str, http_prefix, content, to_person_id, cc_str, http_prefix, content,
save_to_file, client_to_server, save_to_file, client_to_server,
comments_enabled, comments_enabled, apply_dithering,
attach_image_filename, media_type, attach_image_filename, media_type,
image_description, video_transcript, city, image_description, video_transcript, city,
is_moderation_report, is_article, in_reply_to, is_moderation_report, is_article, in_reply_to,

View File

@ -832,9 +832,10 @@ def create_server_alice(path: str, domain: str, port: int,
add_follower_of_person(path, nickname, domain, 'bob', bob_address, add_follower_of_person(path, nickname, domain, 'bob', bob_address,
federation_list, False, False) federation_list, False, False)
if has_posts: if has_posts:
test_save_to_file = True test_save_to_file: bool = True
client_to_server: bool = False client_to_server: bool = False
test_comments_enabled = True test_comments_enabled: bool = True
test_apply_dithering: bool = False
test_attach_image_filename = None test_attach_image_filename = None
test_media_type = None test_media_type = None
test_image_description = None test_image_description = None
@ -869,6 +870,7 @@ def create_server_alice(path: str, domain: str, port: int,
test_save_to_file, test_save_to_file,
client_to_server, client_to_server,
test_comments_enabled, test_comments_enabled,
test_apply_dithering,
test_attach_image_filename, test_attach_image_filename,
test_media_type, test_media_type,
test_image_description, test_video_transcript, test_image_description, test_video_transcript,
@ -889,6 +891,7 @@ def create_server_alice(path: str, domain: str, port: int,
test_save_to_file, test_save_to_file,
client_to_server, client_to_server,
test_comments_enabled, test_comments_enabled,
test_apply_dithering,
test_attach_image_filename, test_attach_image_filename,
test_media_type, test_media_type,
test_image_description, test_video_transcript, test_image_description, test_video_transcript,
@ -910,6 +913,7 @@ def create_server_alice(path: str, domain: str, port: int,
test_save_to_file, test_save_to_file,
client_to_server, client_to_server,
test_comments_enabled, test_comments_enabled,
test_apply_dithering,
test_attach_image_filename, test_attach_image_filename,
test_media_type, test_media_type,
test_image_description, test_video_transcript, test_image_description, test_video_transcript,
@ -1041,6 +1045,7 @@ def create_server_bob(path: str, domain: str, port: int,
if has_posts: if has_posts:
test_save_to_file: bool = True test_save_to_file: bool = True
test_comments_enabled: bool = True test_comments_enabled: bool = True
test_apply_dithering: bool = False
test_attach_image_filename = None test_attach_image_filename = None
test_image_description = None test_image_description = None
test_media_type = None test_media_type = None
@ -1075,6 +1080,7 @@ def create_server_bob(path: str, domain: str, port: int,
test_save_to_file, test_save_to_file,
client_to_server, client_to_server,
test_comments_enabled, test_comments_enabled,
test_apply_dithering,
test_attach_image_filename, test_attach_image_filename,
test_media_type, test_media_type,
test_image_description, test_video_transcript, test_image_description, test_video_transcript,
@ -1096,6 +1102,7 @@ def create_server_bob(path: str, domain: str, port: int,
test_save_to_file, test_save_to_file,
client_to_server, client_to_server,
test_comments_enabled, test_comments_enabled,
test_apply_dithering,
test_attach_image_filename, test_attach_image_filename,
test_media_type, test_media_type,
test_image_description, test_video_transcript, test_image_description, test_video_transcript,
@ -1116,6 +1123,7 @@ def create_server_bob(path: str, domain: str, port: int,
test_save_to_file, test_save_to_file,
client_to_server, client_to_server,
test_comments_enabled, test_comments_enabled,
test_apply_dithering,
test_attach_image_filename, test_attach_image_filename,
test_media_type, test_media_type,
test_image_description, test_video_transcript, test_image_description, test_video_transcript,
@ -1550,13 +1558,16 @@ def test_post_message_between_servers(base_dir: str) -> None:
auto_cw_cache: dict = {} auto_cw_cache: dict = {}
searchable_by: list[str] = [] searchable_by: list[str] = []
mitm_servers: list[str] = [] mitm_servers: list[str] = []
comments_enabled: bool = True
apply_dithering: bool = False
send_result = \ send_result = \
send_post(signing_priv_key_pem, __version__, send_post(signing_priv_key_pem, __version__,
session_alice, alice_dir, 'alice', alice_domain, alice_port, session_alice, alice_dir, 'alice', alice_domain, alice_port,
'bob', bob_domain, bob_port, cc_url, http_prefix, 'bob', bob_domain, bob_port, cc_url, http_prefix,
'Why is a mouse when it spins? ' + 'Why is a mouse when it spins? ' +
'यह एक परीक्षण है #sillyquestion', 'यह एक परीक्षण है #sillyquestion',
save_to_file, client_to_server, True, save_to_file, client_to_server, comments_enabled,
apply_dithering,
attached_image_filename, media_type, attached_image_filename, media_type,
attached_image_description, video_transcript, attached_image_description, video_transcript,
city, federation_list, city, federation_list,
@ -1955,13 +1966,20 @@ def test_follow_between_servers(base_dir: str) -> None:
auto_cw_cache: dict = {} auto_cw_cache: dict = {}
searchable_by: list[str] = [] searchable_by: list[str] = []
mitm_servers: list[str] = [] mitm_servers: list[str] = []
comments_enabled: bool = True
apply_dithering: bool = False
attached_image_filename: str = None
media_type: str = None
attached_image_description: str = None
send_result = \ send_result = \
send_post(signing_priv_key_pem, __version__, send_post(signing_priv_key_pem, __version__,
session_alice, alice_dir, 'alice', alice_domain, alice_port, session_alice, alice_dir, 'alice', alice_domain, alice_port,
'bob', bob_domain, bob_port, cc_url, 'bob', bob_domain, bob_port, cc_url,
http_prefix, 'Alice message', save_to_file, http_prefix, 'Alice message', save_to_file,
client_to_server, True, client_to_server, comments_enabled, apply_dithering,
None, None, None, video_transcript, city, federation_list, attached_image_filename, media_type,
attached_image_description, video_transcript,
city, federation_list,
alice_send_threads, alice_post_log, alice_cached_webfingers, alice_send_threads, alice_post_log, alice_cached_webfingers,
alice_person_cache, is_article, system_language, alice_person_cache, is_article, system_language,
languages_understood, languages_understood,
@ -2375,13 +2393,20 @@ def test_shared_items_federation(base_dir: str) -> None:
auto_cw_cache: dict = {} auto_cw_cache: dict = {}
searchable_by: list[str] = [] searchable_by: list[str] = []
mitm_servers: list[str] = [] mitm_servers: list[str] = []
comments_enabled: bool = True
apply_dithering: bool = False
attached_image_filename: str = None
media_type: str = None
attached_image_description: str = None
send_result = \ send_result = \
send_post(signing_priv_key_pem, __version__, send_post(signing_priv_key_pem, __version__,
session_alice, alice_dir, 'alice', alice_domain, alice_port, session_alice, alice_dir, 'alice', alice_domain, alice_port,
'bob', bob_domain, bob_port, cc_url, 'bob', bob_domain, bob_port, cc_url,
http_prefix, 'Alice message', save_to_file, http_prefix, 'Alice message', save_to_file,
client_to_server, True, client_to_server, comments_enabled, apply_dithering,
None, None, None, video_transcript, city, federation_list, attached_image_filename, media_type,
attached_image_description,
video_transcript, city, federation_list,
alice_send_threads, alice_post_log, alice_cached_webfingers, alice_send_threads, alice_post_log, alice_cached_webfingers,
alice_person_cache, is_article, system_language, alice_person_cache, is_article, system_language,
languages_understood, languages_understood,
@ -2829,13 +2854,20 @@ def test_group_follow(base_dir: str) -> None:
auto_cw_cache = {} auto_cw_cache = {}
searchable_by: list[str] = [] searchable_by: list[str] = []
mitm_servers: list[str] = [] mitm_servers: list[str] = []
comments_enabled: bool = True
apply_dithering: bool = False
attached_image_filename: str = None
media_type: str = None
attached_image_description: str = None
send_result = \ send_result = \
send_post(signing_priv_key_pem, __version__, send_post(signing_priv_key_pem, __version__,
session_alice, alice_dir, 'alice', alice_domain, alice_port, session_alice, alice_dir, 'alice', alice_domain, alice_port,
'testgroup', testgroup_domain, testgroupPort, cc_url, 'testgroup', testgroup_domain, testgroupPort, cc_url,
http_prefix, "Alice group message", http_prefix, "Alice group message",
save_to_file, client_to_server, True, save_to_file, client_to_server, comments_enabled,
None, None, None, video_transcript, city, federation_list, apply_dithering, attached_image_filename,
media_type, attached_image_description,
video_transcript, city, federation_list,
alice_send_threads, alice_post_log, alice_cached_webfingers, alice_send_threads, alice_post_log, alice_cached_webfingers,
alice_person_cache, is_article, system_language, alice_person_cache, is_article, system_language,
languages_understood, languages_understood,
@ -3217,9 +3249,10 @@ def _test_create_person_account(base_dir: str):
test_event_end_time = None test_event_end_time = None
test_event_category: str = '' test_event_category: str = ''
test_location = None test_location = None
test_is_article = False test_is_article: bool = False
save_to_file = True save_to_file: bool = True
comments_enabled = True comments_enabled: bool = True
test_apply_dithering: bool = True
attach_image_filename = None attach_image_filename = None
media_type = None media_type = None
conversation_id = None conversation_id = None
@ -3246,7 +3279,8 @@ def _test_create_person_account(base_dir: str):
create_public_post(base_dir, nickname, domain, port, http_prefix, create_public_post(base_dir, nickname, domain, port, http_prefix,
content, save_to_file, content, save_to_file,
client_to_server, client_to_server,
comments_enabled, attach_image_filename, media_type, comments_enabled, test_apply_dithering,
attach_image_filename, media_type,
'Not suitable for Vogons', '', 'London, England', 'Not suitable for Vogons', '', 'London, England',
test_in_reply_to, test_in_reply_to_atom_uri, test_in_reply_to, test_in_reply_to_atom_uri,
test_subject, test_schedule_post, test_subject, test_schedule_post,
@ -3276,7 +3310,8 @@ def _test_create_person_account(base_dir: str):
create_public_post(base_dir, nickname, domain, port, http_prefix, create_public_post(base_dir, nickname, domain, port, http_prefix,
content, save_to_file, content, save_to_file,
client_to_server, client_to_server,
comments_enabled, attach_image_filename, media_type, comments_enabled, test_apply_dithering,
attach_image_filename, media_type,
'Not suitable for Vogons', '', 'London, England', 'Not suitable for Vogons', '', 'London, England',
test_in_reply_to, test_in_reply_to_atom_uri, test_in_reply_to, test_in_reply_to_atom_uri,
test_subject, test_schedule_post, test_subject, test_schedule_post,
@ -3498,6 +3533,8 @@ def test_client_to_server(base_dir: str):
buy_url = '' buy_url = ''
chat_url = '' chat_url = ''
video_transcript = None video_transcript = None
comments_enabled: bool = True
apply_dithering: bool = False
auto_cw_cache = {} auto_cw_cache = {}
searchable_by: list[str] = [] searchable_by: list[str] = []
mitm_servers: list[str] = [] mitm_servers: list[str] = []
@ -3507,7 +3544,8 @@ def test_client_to_server(base_dir: str):
alice_domain, alice_port, alice_domain, alice_port,
'bob', bob_domain, bob_port, None, 'bob', bob_domain, bob_port, None,
http_prefix, 'Sent from my ActivityPub client', http_prefix, 'Sent from my ActivityPub client',
True, attached_image_filename, media_type, comments_enabled, apply_dithering,
attached_image_filename, media_type,
attached_image_description, attached_image_description,
video_transcript, city, video_transcript, city,
cached_webfingers, person_cache, is_article, cached_webfingers, person_cache, is_article,
@ -5345,6 +5383,7 @@ def _test_reply_to_public_post(base_dir: str) -> None:
save_to_file: bool = False save_to_file: bool = False
client_to_server: bool = False client_to_server: bool = False
comments_enabled: bool = True comments_enabled: bool = True
test_apply_dithering: bool = False
attach_image_filename = None attach_image_filename = None
media_type = None media_type = None
image_description: str = 'Some description' image_description: str = 'Some description'
@ -5352,13 +5391,13 @@ def _test_reply_to_public_post(base_dir: str) -> None:
test_in_reply_to = post_id test_in_reply_to = post_id
test_in_reply_to_atom_uri = None test_in_reply_to_atom_uri = None
test_subject = None test_subject = None
test_schedule_post = False test_schedule_post: bool = False
test_event_date = None test_event_date = None
test_event_time = None test_event_time = None
test_event_end_time = None test_event_end_time = None
test_event_category = '' test_event_category = ''
test_location = None test_location = None
test_is_article = False test_is_article: bool = False
conversation_id = None conversation_id = None
convthread_id = None convthread_id = None
low_bandwidth: bool = True low_bandwidth: bool = True
@ -5379,6 +5418,7 @@ def _test_reply_to_public_post(base_dir: str) -> None:
create_public_post(base_dir, nickname, domain, port, http_prefix, create_public_post(base_dir, nickname, domain, port, http_prefix,
content, save_to_file, content, save_to_file,
client_to_server, comments_enabled, client_to_server, comments_enabled,
test_apply_dithering,
attach_image_filename, media_type, attach_image_filename, media_type,
image_description, video_transcript, image_description, video_transcript,
city, test_in_reply_to, city, test_in_reply_to,
@ -6458,6 +6498,7 @@ def _test_links_within_post(base_dir: str) -> None:
save_to_file: bool = False save_to_file: bool = False
client_to_server: bool = False client_to_server: bool = False
comments_enabled: bool = True comments_enabled: bool = True
test_apply_dithering: bool = False
attach_image_filename = None attach_image_filename = None
media_type = None media_type = None
image_description = None image_description = None
@ -6493,6 +6534,7 @@ def _test_links_within_post(base_dir: str) -> None:
create_public_post(base_dir, nickname, domain, port, http_prefix, create_public_post(base_dir, nickname, domain, port, http_prefix,
content, save_to_file, content, save_to_file,
client_to_server, comments_enabled, client_to_server, comments_enabled,
test_apply_dithering,
attach_image_filename, media_type, attach_image_filename, media_type,
image_description, video_transcript, city, image_description, video_transcript, city,
test_in_reply_to, test_in_reply_to_atom_uri, test_in_reply_to, test_in_reply_to_atom_uri,
@ -6536,13 +6578,23 @@ def _test_links_within_post(base_dir: str) -> None:
"<p><a href=\"https://whocodedthis.huh/tags/" + \ "<p><a href=\"https://whocodedthis.huh/tags/" + \
"taggedthing\" class=\"mention hashtag\" rel=\"tag\" " + \ "taggedthing\" class=\"mention hashtag\" rel=\"tag\" " + \
"target=\"_blank\">#<span>taggedthing</span></a></p>" "target=\"_blank\">#<span>taggedthing</span></a></p>"
save_to_file: bool = False
client_to_server: bool = False
comments_enabled: bool = True
apply_dithering: bool = False
attach_image_filename: str = None
media_type: str = None
image_description: str = ''
video_transcript: str = ''
city: str = ''
post_json_object = \ post_json_object = \
create_public_post(base_dir, nickname, domain, port, http_prefix, create_public_post(base_dir, nickname, domain, port, http_prefix,
content, content, save_to_file,
False, client_to_server, comments_enabled,
False, True, apply_dithering,
None, None, attach_image_filename, media_type,
'', '', None, image_description,
video_transcript, city,
test_in_reply_to, test_in_reply_to_atom_uri, test_in_reply_to, test_in_reply_to_atom_uri,
test_subject, test_schedule_post, test_subject, test_schedule_post,
test_event_date, test_event_time, test_event_date, test_event_time,
@ -6564,11 +6616,12 @@ def _test_links_within_post(base_dir: str) -> None:
"<code>gerbils</code> and that is all she wrote.</p>" "<code>gerbils</code> and that is all she wrote.</p>"
post_json_object = \ post_json_object = \
create_public_post(base_dir, nickname, domain, port, http_prefix, create_public_post(base_dir, nickname, domain, port, http_prefix,
content, content, save_to_file,
False, client_to_server, comments_enabled,
False, True, apply_dithering,
None, None, attach_image_filename, media_type,
'', '', None, image_description,
video_transcript, city,
test_in_reply_to, test_in_reply_to_atom_uri, test_in_reply_to, test_in_reply_to_atom_uri,
test_subject, test_schedule_post, test_subject, test_schedule_post,
test_event_date, test_event_time, test_event_date, test_event_time,
@ -7657,6 +7710,7 @@ def _test_can_replyto(base_dir: str) -> None:
save_to_file: bool = False save_to_file: bool = False
client_to_server: bool = False client_to_server: bool = False
comments_enabled: bool = True comments_enabled: bool = True
test_apply_dithering: bool = False
attach_image_filename = None attach_image_filename = None
media_type = None media_type = None
image_description = None image_description = None
@ -7692,6 +7746,7 @@ def _test_can_replyto(base_dir: str) -> None:
create_public_post(base_dir, nickname, domain, port, http_prefix, create_public_post(base_dir, nickname, domain, port, http_prefix,
content, save_to_file, content, save_to_file,
client_to_server, comments_enabled, client_to_server, comments_enabled,
test_apply_dithering,
attach_image_filename, media_type, attach_image_filename, media_type,
image_description, video_transcript, city, image_description, video_transcript, city,
test_in_reply_to, test_in_reply_to_atom_uri, test_in_reply_to, test_in_reply_to_atom_uri,

View File

@ -647,6 +647,12 @@ def html_new_post(edit_post_params: {},
' <textarea id="imageDescription" name="imageDescription" ' + \ ' <textarea id="imageDescription" name="imageDescription" ' + \
'style="' + image_description_style + \ 'style="' + image_description_style + \
'" spellcheck="true" autocomplete="on"></textarea>\n' '" spellcheck="true" autocomplete="on"></textarea>\n'
# dithering
dither_filename = acct_dir(base_dir, nickname, domain) + '/.ditherImage'
apply_dithering = is_a_file(dither_filename)
new_post_image_section += \
edit_check_box(translate['Apply dithering to images.'],
'ditherImage', apply_dithering)
media_creator_str = translate['Media creator'] media_creator_str = translate['Media creator']
new_post_image_section += \ new_post_image_section += \
edit_text_field(media_creator_str, 'mediaCreator', '', '') edit_text_field(media_creator_str, 'mediaCreator', '', '')

View File

@ -772,5 +772,6 @@
"Availability": "التوافر", "Availability": "التوافر",
"Loops Instances": "حلقات التكرار", "Loops Instances": "حلقات التكرار",
"Disinformation Instances": "أمثلة على التضليل الإعلامي", "Disinformation Instances": "أمثلة على التضليل الإعلامي",
"Allow this account to be added to lists": "السماح بإضافة هذا الحساب إلى القوائم" "Allow this account to be added to lists": "السماح بإضافة هذا الحساب إلى القوائم",
"Apply dithering to images.": "طبّق تقنية التدرج النقطي (dithering) على الصور."
} }

View File

@ -772,5 +772,6 @@
"Availability": "প্রাপ্যতা", "Availability": "প্রাপ্যতা",
"Loops Instances": "লুপ ইনস্ট্যান্স", "Loops Instances": "লুপ ইনস্ট্যান্স",
"Disinformation Instances": "ভুল তথ্যের উদাহরণ", "Disinformation Instances": "ভুল তথ্যের উদাহরণ",
"Allow this account to be added to lists": "এই অ্যাকাউন্টটিকে তালিকায় যুক্ত করার অনুমতি দিন" "Allow this account to be added to lists": "এই অ্যাকাউন্টটিকে তালিকায় যুক্ত করার অনুমতি দিন",
"Apply dithering to images.": "ছবিতে ডিদারিং প্রয়োগ করুন।"
} }

View File

@ -772,5 +772,6 @@
"Availability": "Disponibilitat", "Availability": "Disponibilitat",
"Loops Instances": "Instàncies de bucles", "Loops Instances": "Instàncies de bucles",
"Disinformation Instances": "Instàncies de desinformació", "Disinformation Instances": "Instàncies de desinformació",
"Allow this account to be added to lists": "Permet que aquest compte s'afegeixi a les llistes" "Allow this account to be added to lists": "Permet que aquest compte s'afegeixi a les llistes",
"Apply dithering to images.": "Aplica el dithering a les imatges."
} }

View File

@ -772,5 +772,6 @@
"Availability": "Argaeledd", "Availability": "Argaeledd",
"Loops Instances": "Achosion Dolenni", "Loops Instances": "Achosion Dolenni",
"Disinformation Instances": "Achosion o Ddadwybodaeth", "Disinformation Instances": "Achosion o Ddadwybodaeth",
"Allow this account to be added to lists": "Caniatáu i'r cyfrif hwn gael ei ychwanegu at restrau" "Allow this account to be added to lists": "Caniatáu i'r cyfrif hwn gael ei ychwanegu at restrau",
"Apply dithering to images.": "Cymhwyso dithering i ddelweddau."
} }

View File

@ -772,5 +772,6 @@
"Availability": "Verfügbarkeit", "Availability": "Verfügbarkeit",
"Loops Instances": "Schleifeninstanzen", "Loops Instances": "Schleifeninstanzen",
"Disinformation Instances": "Fälle von Desinformation", "Disinformation Instances": "Fälle von Desinformation",
"Allow this account to be added to lists": "Erlauben, dass dieses Konto zu Listen hinzugefügt wird" "Allow this account to be added to lists": "Erlauben, dass dieses Konto zu Listen hinzugefügt wird",
"Apply dithering to images.": "Wenden Sie Dithering auf Bilder an."
} }

View File

@ -772,5 +772,6 @@
"Availability": "Διαθεσιμότητα", "Availability": "Διαθεσιμότητα",
"Loops Instances": "Παρουσίες βρόχων", "Loops Instances": "Παρουσίες βρόχων",
"Disinformation Instances": "Περιπτώσεις παραπληροφόρησης", "Disinformation Instances": "Περιπτώσεις παραπληροφόρησης",
"Allow this account to be added to lists": "Να επιτρέπεται η προσθήκη αυτού του λογαριασμού σε λίστες" "Allow this account to be added to lists": "Να επιτρέπεται η προσθήκη αυτού του λογαριασμού σε λίστες",
"Apply dithering to images.": "Εφαρμογή πρόσμειξης σε εικόνες."
} }

View File

@ -772,5 +772,6 @@
"Availability": "Availability", "Availability": "Availability",
"Loops Instances": "Loops Instances", "Loops Instances": "Loops Instances",
"Disinformation Instances": "Disinformation Instances", "Disinformation Instances": "Disinformation Instances",
"Allow this account to be added to lists": "Allow this account to be added to lists" "Allow this account to be added to lists": "Allow this account to be added to lists",
"Apply dithering to images.": "Apply dithering to images."
} }

View File

@ -772,5 +772,6 @@
"Availability": "Disponibilidad", "Availability": "Disponibilidad",
"Loops Instances": "Instancias de bucles", "Loops Instances": "Instancias de bucles",
"Disinformation Instances": "Casos de desinformación", "Disinformation Instances": "Casos de desinformación",
"Allow this account to be added to lists": "Permitir que esta cuenta se añada a listas" "Allow this account to be added to lists": "Permitir que esta cuenta se añada a listas",
"Apply dithering to images.": "Aplica tramado a las imágenes."
} }

View File

@ -772,5 +772,6 @@
"Availability": "در دسترس بودن", "Availability": "در دسترس بودن",
"Loops Instances": "نمونه‌های حلقه‌ها", "Loops Instances": "نمونه‌های حلقه‌ها",
"Disinformation Instances": "موارد انتشار اطلاعات نادرست", "Disinformation Instances": "موارد انتشار اطلاعات نادرست",
"Allow this account to be added to lists": "اجازه دهید این حساب به لیست‌ها اضافه شود" "Allow this account to be added to lists": "اجازه دهید این حساب به لیست‌ها اضافه شود",
"Apply dithering to images.": "اعمال لرزش (dithering) روی تصاویر"
} }

View File

@ -772,5 +772,6 @@
"Availability": "Saatavuus", "Availability": "Saatavuus",
"Loops Instances": "Silmukat-instanssit", "Loops Instances": "Silmukat-instanssit",
"Disinformation Instances": "Disinformaatiotapaukset", "Disinformation Instances": "Disinformaatiotapaukset",
"Allow this account to be added to lists": "Salli tämän tilin lisääminen listoihin" "Allow this account to be added to lists": "Salli tämän tilin lisääminen listoihin",
"Apply dithering to images.": "Käytä kuviin rasterointia."
} }

View File

@ -772,5 +772,6 @@
"Availability": "Disponibilité", "Availability": "Disponibilité",
"Loops Instances": "Instances de boucles", "Loops Instances": "Instances de boucles",
"Disinformation Instances": "Cas de désinformation", "Disinformation Instances": "Cas de désinformation",
"Allow this account to be added to lists": "Autoriser l'ajout de ce compte à des listes" "Allow this account to be added to lists": "Autoriser l'ajout de ce compte à des listes",
"Apply dithering to images.": "Appliquez le tramage aux images."
} }

View File

@ -772,5 +772,6 @@
"Availability": "Infhaighteacht", "Availability": "Infhaighteacht",
"Loops Instances": "Cásanna Lúb", "Loops Instances": "Cásanna Lúb",
"Disinformation Instances": "Cásanna Mífhaisnéise", "Disinformation Instances": "Cásanna Mífhaisnéise",
"Allow this account to be added to lists": "Ceadaigh an cuntas seo a chur le liostaí" "Allow this account to be added to lists": "Ceadaigh an cuntas seo a chur le liostaí",
"Apply dithering to images.": "Cuir díodrú i bhfeidhm ar íomhánna."
} }

View File

@ -772,5 +772,6 @@
"Availability": "זְמִינוּת", "Availability": "זְמִינוּת",
"Loops Instances": "מופעי לולאות", "Loops Instances": "מופעי לולאות",
"Disinformation Instances": "מקרים של דיסאינפורמציה", "Disinformation Instances": "מקרים של דיסאינפורמציה",
"Allow this account to be added to lists": "אפשר הוספת חשבון זה לרשימות" "Allow this account to be added to lists": "אפשר הוספת חשבון זה לרשימות",
"Apply dithering to images.": "החלת דיטרינג על תמונות."
} }

View File

@ -772,5 +772,6 @@
"Availability": "उपलब्धता", "Availability": "उपलब्धता",
"Loops Instances": "लूप इंस्टेंस", "Loops Instances": "लूप इंस्टेंस",
"Disinformation Instances": "गलत सूचना के उदाहरण", "Disinformation Instances": "गलत सूचना के उदाहरण",
"Allow this account to be added to lists": "इस अकाउंट को लिस्ट में जोड़ने की अनुमति दें" "Allow this account to be added to lists": "इस अकाउंट को लिस्ट में जोड़ने की अनुमति दें",
"Apply dithering to images.": "इमेज पर डिथरिंग लागू करें।"
} }

View File

@ -772,5 +772,6 @@
"Availability": "Disponibilità", "Availability": "Disponibilità",
"Loops Instances": "Istanze di cicli", "Loops Instances": "Istanze di cicli",
"Disinformation Instances": "Esempi di disinformazione", "Disinformation Instances": "Esempi di disinformazione",
"Allow this account to be added to lists": "Consenti l'aggiunta di questo account agli elenchi" "Allow this account to be added to lists": "Consenti l'aggiunta di questo account agli elenchi",
"Apply dithering to images.": "Applica il dithering alle immagini."
} }

View File

@ -772,5 +772,6 @@
"Availability": "可用性", "Availability": "可用性",
"Loops Instances": "ループインスタンス", "Loops Instances": "ループインスタンス",
"Disinformation Instances": "偽情報事例", "Disinformation Instances": "偽情報事例",
"Allow this account to be added to lists": "このアカウントをリストに追加できるようにする" "Allow this account to be added to lists": "このアカウントをリストに追加できるようにする",
"Apply dithering to images.": "画像にディザリングを適用します。"
} }

View File

@ -772,5 +772,6 @@
"Availability": "유효성", "Availability": "유효성",
"Loops Instances": "루프 인스턴스", "Loops Instances": "루프 인스턴스",
"Disinformation Instances": "허위 정보 사례", "Disinformation Instances": "허위 정보 사례",
"Allow this account to be added to lists": "이 계정을 목록에 추가할 수 있도록 허용" "Allow this account to be added to lists": "이 계정을 목록에 추가할 수 있도록 허용",
"Apply dithering to images.": "이미지에 디더링을 적용합니다."
} }

View File

@ -772,5 +772,6 @@
"Availability": "Berdestbûnî", "Availability": "Berdestbûnî",
"Loops Instances": "Nimûneyên Loopan", "Loops Instances": "Nimûneyên Loopan",
"Disinformation Instances": "Nimûneyên Dezînformasyonê", "Disinformation Instances": "Nimûneyên Dezînformasyonê",
"Allow this account to be added to lists": "Destûrê bide ku ev hesab li navnîşan were zêdekirin" "Allow this account to be added to lists": "Destûrê bide ku ev hesab li navnîşan were zêdekirin",
"Apply dithering to images.": "Ditheringê li ser wêneyan bicîh bîne."
} }

View File

@ -772,5 +772,6 @@
"Availability": "Beschikbaarheid", "Availability": "Beschikbaarheid",
"Loops Instances": "Lusinstanties", "Loops Instances": "Lusinstanties",
"Disinformation Instances": "Voorbeelden van desinformatie", "Disinformation Instances": "Voorbeelden van desinformatie",
"Allow this account to be added to lists": "Toestaan dat dit account aan lijsten wordt toegevoegd" "Allow this account to be added to lists": "Toestaan dat dit account aan lijsten wordt toegevoegd",
"Apply dithering to images.": "Pas dithering toe op afbeeldingen."
} }

View File

@ -768,5 +768,6 @@
"Availability": "Disponibilitat", "Availability": "Disponibilitat",
"Loops Instances": "Instàncias de bucles", "Loops Instances": "Instàncias de bucles",
"Disinformation Instances": "Instàncias de desinformacion", "Disinformation Instances": "Instàncias de desinformacion",
"Allow this account to be added to lists": "Autorizar aqueste compte a èsser apondut a las listas" "Allow this account to be added to lists": "Autorizar aqueste compte a èsser apondut a las listas",
"Apply dithering to images.": "Aplicar lo tremolament a d'imatges."
} }

View File

@ -772,5 +772,6 @@
"Availability": "Dostępność", "Availability": "Dostępność",
"Loops Instances": "Instancje pętli", "Loops Instances": "Instancje pętli",
"Disinformation Instances": "Przypadki dezinformacji", "Disinformation Instances": "Przypadki dezinformacji",
"Allow this account to be added to lists": "Zezwól na dodawanie tego konta do list" "Allow this account to be added to lists": "Zezwól na dodawanie tego konta do list",
"Apply dithering to images.": "Zastosuj dithering do obrazów."
} }

View File

@ -772,5 +772,6 @@
"Availability": "Disponibilidade", "Availability": "Disponibilidade",
"Loops Instances": "Instâncias de Loops", "Loops Instances": "Instâncias de Loops",
"Disinformation Instances": "Casos de desinformação", "Disinformation Instances": "Casos de desinformação",
"Allow this account to be added to lists": "Permitir que esta conta seja adicionada às listas" "Allow this account to be added to lists": "Permitir que esta conta seja adicionada às listas",
"Apply dithering to images.": "Aplicar dithering às imagens."
} }

View File

@ -772,5 +772,6 @@
"Availability": "Доступность", "Availability": "Доступность",
"Loops Instances": "Экземпляры циклов", "Loops Instances": "Экземпляры циклов",
"Disinformation Instances": "Случаи дезинформации", "Disinformation Instances": "Случаи дезинформации",
"Allow this account to be added to lists": "Разрешить добавление этого аккаунта в списки" "Allow this account to be added to lists": "Разрешить добавление этого аккаунта в списки",
"Apply dithering to images.": "Примените дизеринг к изображениям."
} }

View File

@ -772,5 +772,6 @@
"Availability": "Upatikanaji", "Availability": "Upatikanaji",
"Loops Instances": "Matukio ya Mizunguko", "Loops Instances": "Matukio ya Mizunguko",
"Disinformation Instances": "Matukio ya Taarifa Potofu", "Disinformation Instances": "Matukio ya Taarifa Potofu",
"Allow this account to be added to lists": "Ruhusu akaunti hii iongezwe kwenye orodha" "Allow this account to be added to lists": "Ruhusu akaunti hii iongezwe kwenye orodha",
"Apply dithering to images.": "Weka upau wa kuchorea kwenye picha."
} }

View File

@ -772,5 +772,6 @@
"Availability": "Müsaitlik", "Availability": "Müsaitlik",
"Loops Instances": "Döngü Örnekleri", "Loops Instances": "Döngü Örnekleri",
"Disinformation Instances": "Dezenformasyon Vakaları", "Disinformation Instances": "Dezenformasyon Vakaları",
"Allow this account to be added to lists": "Bu hesabın listelere eklenmesine izin ver" "Allow this account to be added to lists": "Bu hesabın listelere eklenmesine izin ver",
"Apply dithering to images.": "Görüntülere dithering uygulayın."
} }

View File

@ -772,5 +772,6 @@
"Availability": "Наявність", "Availability": "Наявність",
"Loops Instances": "Екземпляри циклів", "Loops Instances": "Екземпляри циклів",
"Disinformation Instances": "Випадки дезінформації", "Disinformation Instances": "Випадки дезінформації",
"Allow this account to be added to lists": "Дозволити додавання цього облікового запису до списків" "Allow this account to be added to lists": "Дозволити додавання цього облікового запису до списків",
"Apply dithering to images.": "Застосуйте дизеринг до зображень."
} }

View File

@ -772,5 +772,6 @@
"Availability": "פאַראַנען", "Availability": "פאַראַנען",
"Loops Instances": "לופּס אינסטאַנסן", "Loops Instances": "לופּס אינסטאַנסן",
"Disinformation Instances": "דיסאינפארמאציע אינסטאַנצן", "Disinformation Instances": "דיסאינפארמאציע אינסטאַנצן",
"Allow this account to be added to lists": "ערלויבן דעם חשבון צו ווערן צוגעגעבן צו ליסטעס" "Allow this account to be added to lists": "ערלויבן דעם חשבון צו ווערן צוגעגעבן צו ליסטעס",
"Apply dithering to images.": "צולייגן דיטערינג צו בילדער."
} }

View File

@ -772,5 +772,6 @@
"Availability": "可用性", "Availability": "可用性",
"Loops Instances": "循环实例", "Loops Instances": "循环实例",
"Disinformation Instances": "虚假信息实例", "Disinformation Instances": "虚假信息实例",
"Allow this account to be added to lists": "允许将此帐户添加到列表中" "Allow this account to be added to lists": "允许将此帐户添加到列表中",
"Apply dithering to images.": "对图像应用抖动处理。"
} }