mirror of https://gitlab.com/bashrc2/epicyon
If a nsfw indication exists within post content then minimize any attached image
parent
fdfa3d4276
commit
d18b2acd9f
21
blog.py
21
blog.py
|
@ -260,16 +260,6 @@ def _html_blog_post_content(debug: bool, session, authorized: bool,
|
||||||
delete_str = ''
|
delete_str = ''
|
||||||
mute_str = ''
|
mute_str = ''
|
||||||
is_muted = False
|
is_muted = False
|
||||||
attachment_str, _ = \
|
|
||||||
get_post_attachments_as_html(base_dir, nickname, domain,
|
|
||||||
domain_full, post_json_object,
|
|
||||||
'tlblogs', translate,
|
|
||||||
is_muted, avatar_link,
|
|
||||||
reply_str, announce_str,
|
|
||||||
like_str, bookmark_str,
|
|
||||||
delete_str, mute_str)
|
|
||||||
if attachment_str:
|
|
||||||
blog_str += '<br><center>' + attachment_str + '</center>'
|
|
||||||
|
|
||||||
person_url = local_actor_url(http_prefix, nickname, domain_full)
|
person_url = local_actor_url(http_prefix, nickname, domain_full)
|
||||||
actor_json = \
|
actor_json = \
|
||||||
|
@ -279,6 +269,17 @@ def _html_blog_post_content(debug: bool, session, authorized: bool,
|
||||||
languages_understood = get_actor_languages_list(actor_json)
|
languages_understood = get_actor_languages_list(actor_json)
|
||||||
json_content = get_content_from_post(post_json_object, system_language,
|
json_content = get_content_from_post(post_json_object, system_language,
|
||||||
languages_understood)
|
languages_understood)
|
||||||
|
attachment_str, _ = \
|
||||||
|
get_post_attachments_as_html(base_dir, nickname, domain,
|
||||||
|
domain_full, post_json_object,
|
||||||
|
'tlblogs', translate,
|
||||||
|
is_muted, avatar_link,
|
||||||
|
reply_str, announce_str,
|
||||||
|
like_str, bookmark_str,
|
||||||
|
delete_str, mute_str,
|
||||||
|
json_content)
|
||||||
|
if attachment_str:
|
||||||
|
blog_str += '<br><center>' + attachment_str + '</center>'
|
||||||
if json_content:
|
if json_content:
|
||||||
content_str = add_embedded_elements(translate, json_content,
|
content_str = add_embedded_elements(translate, json_content,
|
||||||
peertube_instances)
|
peertube_instances)
|
||||||
|
|
|
@ -2041,6 +2041,15 @@ def individual_post_as_html(signing_priv_key_pem: str,
|
||||||
|
|
||||||
_log_post_timing(enable_timing_log, post_start_time, '14')
|
_log_post_timing(enable_timing_log, post_start_time, '14')
|
||||||
|
|
||||||
|
person_url = local_actor_url(http_prefix, nickname, domain_full)
|
||||||
|
actor_json = \
|
||||||
|
get_person_from_cache(base_dir, person_url, person_cache)
|
||||||
|
languages_understood = []
|
||||||
|
if actor_json:
|
||||||
|
languages_understood = get_actor_languages_list(actor_json)
|
||||||
|
content_str = get_content_from_post(post_json_object, system_language,
|
||||||
|
languages_understood)
|
||||||
|
|
||||||
attachment_str, gallery_str = \
|
attachment_str, gallery_str = \
|
||||||
get_post_attachments_as_html(base_dir, nickname, domain,
|
get_post_attachments_as_html(base_dir, nickname, domain,
|
||||||
domain_full,
|
domain_full,
|
||||||
|
@ -2048,7 +2057,8 @@ def individual_post_as_html(signing_priv_key_pem: str,
|
||||||
box_name, translate,
|
box_name, translate,
|
||||||
is_muted, avatar_link,
|
is_muted, avatar_link,
|
||||||
reply_str, announce_str, like_str,
|
reply_str, announce_str, like_str,
|
||||||
bookmark_str, delete_str, mute_str)
|
bookmark_str, delete_str, mute_str,
|
||||||
|
content_str)
|
||||||
|
|
||||||
published_str = \
|
published_str = \
|
||||||
_get_published_date_str(post_json_object, show_published_date_only,
|
_get_published_date_str(post_json_object, show_published_date_only,
|
||||||
|
@ -2119,12 +2129,7 @@ def individual_post_as_html(signing_priv_key_pem: str,
|
||||||
post_json_object['object']['content']
|
post_json_object['object']['content']
|
||||||
|
|
||||||
domain_full = get_full_domain(domain, port)
|
domain_full = get_full_domain(domain, port)
|
||||||
person_url = local_actor_url(http_prefix, nickname, domain_full)
|
if not content_str:
|
||||||
actor_json = \
|
|
||||||
get_person_from_cache(base_dir, person_url, person_cache)
|
|
||||||
languages_understood = []
|
|
||||||
if actor_json:
|
|
||||||
languages_understood = get_actor_languages_list(actor_json)
|
|
||||||
content_str = get_content_from_post(post_json_object, system_language,
|
content_str = get_content_from_post(post_json_object, system_language,
|
||||||
languages_understood)
|
languages_understood)
|
||||||
if not content_str:
|
if not content_str:
|
||||||
|
|
|
@ -1129,7 +1129,8 @@ def get_post_attachments_as_html(base_dir: str,
|
||||||
reply_str: str, announce_str: str,
|
reply_str: str, announce_str: str,
|
||||||
like_str: str,
|
like_str: str,
|
||||||
bookmark_str: str, delete_str: str,
|
bookmark_str: str, delete_str: str,
|
||||||
mute_str: str) -> (str, str):
|
mute_str: str,
|
||||||
|
content: str) -> (str, str):
|
||||||
"""Returns a string representing any attachments
|
"""Returns a string representing any attachments
|
||||||
"""
|
"""
|
||||||
attachment_str = ''
|
attachment_str = ''
|
||||||
|
@ -1232,6 +1233,11 @@ def get_post_attachments_as_html(base_dir: str,
|
||||||
following_nickname,
|
following_nickname,
|
||||||
following_domain)
|
following_domain)
|
||||||
|
|
||||||
|
# minimize any NSFW images
|
||||||
|
if not minimize_images and content:
|
||||||
|
if 'nsfw' in content.lower():
|
||||||
|
minimize_images = True
|
||||||
|
|
||||||
if minimize_images:
|
if minimize_images:
|
||||||
show_img_str = 'SHOW MEDIA'
|
show_img_str = 'SHOW MEDIA'
|
||||||
if translate:
|
if translate:
|
||||||
|
|
Loading…
Reference in New Issue