2020-11-28 10:40:19 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								__filename__ = "webapp_confirm.py"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								__author__ = "Bob Mottram"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								__license__ = "AGPL3+"
							 | 
						
					
						
							
								
									
										
										
										
											2024-12-22 23:37:30 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								__version__ = "1.6.0"
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-28 10:40:19 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								__maintainer__ = "Bob Mottram"
							 | 
						
					
						
							
								
									
										
										
										
											2021-09-10 16:14:50 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								__email__ = "bob@libreserver.org"
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-28 10:40:19 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								__status__ = "Production"
							 | 
						
					
						
							
								
									
										
										
										
											2021-06-15 15:08:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								__module_group__ = "Web Interface"
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-28 10:40:19 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								import os
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								from shutil import copyfile
							 | 
						
					
						
							
								
									
										
										
										
											2024-05-12 12:35:26 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								from utils import data_dir
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-26 12:45:03 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								from utils import get_full_domain
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-27 22:19:18 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								from utils import get_nickname_from_actor
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-27 19:05:25 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								from utils import get_domain_from_actor
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-26 20:36:08 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								from utils import locate_post
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-26 15:13:34 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								from utils import load_json
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-26 14:08:58 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								from utils import get_config_param
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-26 18:32:02 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								from utils import get_alt_path
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-26 12:02:29 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								from utils import acct_dir
							 | 
						
					
						
							
								
									
										
										
										
											2022-02-25 19:12:40 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								from utils import get_account_timezone
							 | 
						
					
						
							
								
									
										
										
										
											2024-12-24 18:17:36 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								from blocking import sending_is_blocked2
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-29 21:55:09 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								from webapp_utils import set_custom_background
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								from webapp_utils import html_header_with_external_style
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								from webapp_utils import html_footer
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								from webapp_post import individual_post_as_html
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-28 10:40:19 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2022-07-12 19:03:30 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								def html_confirm_delete(server,
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-29 21:55:09 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                        recent_posts_cache: {}, max_recent_posts: int,
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-31 23:07:23 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                        translate, page_number: int,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                        session, base_dir: str, message_id: str,
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-29 21:55:09 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                        http_prefix: str, project_version: str,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                        cached_webfingers: {}, person_cache: {},
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                        calling_domain: str,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                        yt_replace_domain: str,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                        twitter_replacement_domain: str,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                        show_published_date_only: bool,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                        peertube_instances: [],
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                        allow_local_network_access: bool,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                        theme_name: str, system_language: str,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                        max_like_count: int, signing_priv_key_pem: str,
							 | 
						
					
						
							
								
									
										
										
										
											2022-07-05 14:40:26 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                        cw_lists: {}, lists_enabled: str,
							 | 
						
					
						
							
								
									
										
										
										
											2022-11-13 18:54:11 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                        dogwhistles: {},
							 | 
						
					
						
							
								
									
										
										
										
											2023-01-13 15:04:48 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                        min_images_for_accounts: [],
							 | 
						
					
						
							
								
									
										
										
										
											2024-01-18 13:27:22 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                        buy_sites: {},
							 | 
						
					
						
							
								
									
										
										
										
											2024-12-17 13:50:48 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                        auto_cw_cache: {},
							 | 
						
					
						
							
								
									
										
										
										
											2025-01-20 17:55:29 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                        mitm_servers: [],
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                        instance_software: {}) -> str:
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-28 10:40:19 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    """Shows a screen asking to confirm the deletion of a post
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    """
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-31 23:07:23 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    if '/statuses/' not in message_id:
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-28 10:40:19 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return None
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-31 23:07:23 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    actor = message_id.split('/statuses/')[0]
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-27 22:19:18 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    nickname = get_nickname_from_actor(actor)
							 | 
						
					
						
							
								
									
										
										
										
											2022-03-23 23:59:29 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    if not nickname:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return None
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-27 19:05:25 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    domain, port = get_domain_from_actor(actor)
							 | 
						
					
						
							
								
									
										
										
										
											2023-01-15 14:33:18 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    if not domain:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return None
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-26 12:45:03 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    domain_full = get_full_domain(domain, port)
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-28 10:40:19 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-31 23:07:23 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    post_filename = locate_post(base_dir, nickname, domain, message_id)
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-26 23:41:34 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    if not post_filename:
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-28 10:40:19 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return None
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-26 23:41:34 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    post_json_object = load_json(post_filename)
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-25 22:09:19 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    if not post_json_object:
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-28 10:40:19 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return None
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-31 23:07:23 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    delete_post_str = None
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-31 21:18:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    css_filename = base_dir + '/epicyon-profile.css'
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-25 16:17:53 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    if os.path.isfile(base_dir + '/epicyon.css'):
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-31 21:18:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        css_filename = base_dir + '/epicyon.css'
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-28 10:40:19 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-31 23:07:23 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    instance_title = \
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-26 14:08:58 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        get_config_param(base_dir, 'instanceTitle')
							 | 
						
					
						
							
								
									
										
										
										
											2024-12-23 18:23:47 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    preload_images: list[str] = []
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-31 23:07:23 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    delete_post_str = \
							 | 
						
					
						
							
								
									
										
										
										
											2024-10-22 12:12:16 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        html_header_with_external_style(css_filename, instance_title, None,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                                        preload_images)
							 | 
						
					
						
							
								
									
										
										
										
											2022-02-25 19:12:40 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    timezone = get_account_timezone(base_dir, nickname, domain)
							 | 
						
					
						
							
								
									
										
										
										
											2022-03-14 19:55:36 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    mitm = False
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    if os.path.isfile(post_filename.replace('.json', '') + '.mitm'):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        mitm = True
							 | 
						
					
						
							
								
									
										
										
										
											2022-03-24 13:14:41 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    bold_reading = False
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    if server.bold_reading.get(nickname):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        bold_reading = True
							 | 
						
					
						
							
								
									
										
										
										
											2022-11-13 18:54:11 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    minimize_all_images = False
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    if nickname in min_images_for_accounts:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        minimize_all_images = True
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-31 23:07:23 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    delete_post_str += \
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-29 21:55:09 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        individual_post_as_html(signing_priv_key_pem,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                                True, recent_posts_cache, max_recent_posts,
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-31 23:07:23 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                                translate, page_number,
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-29 21:55:09 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                                base_dir, session,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                                cached_webfingers, person_cache,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                                nickname, domain, port, post_json_object,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                                None, True, False,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                                http_prefix, project_version, 'outbox',
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                                yt_replace_domain,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                                twitter_replacement_domain,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                                show_published_date_only,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                                peertube_instances, allow_local_network_access,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                                theme_name, system_language, max_like_count,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                                False, False, False, False, False, False,
							 | 
						
					
						
							
								
									
										
										
										
											2022-03-24 13:14:41 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                                cw_lists, lists_enabled, timezone, mitm,
							 | 
						
					
						
							
								
									
										
										
										
											2022-11-13 18:54:11 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                                bold_reading, dogwhistles,
							 | 
						
					
						
							
								
									
										
										
										
											2024-01-18 13:27:22 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                                minimize_all_images, None, buy_sites,
							 | 
						
					
						
							
								
									
										
										
										
											2025-01-20 17:55:29 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                                auto_cw_cache, mitm_servers,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                                instance_software)
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-31 23:07:23 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    delete_post_str += '<center>'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    delete_post_str += \
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-28 10:40:19 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        '  <p class="followText">' + \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        translate['Delete this post?'] + '</p>'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-31 23:07:23 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    post_actor = get_alt_path(actor, domain_full, calling_domain)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    delete_post_str += \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        '  <form method="POST" action="' + post_actor + '/rmpost">\n'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    delete_post_str += \
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-28 10:40:19 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        '    <input type="hidden" name="pageNumber" value="' + \
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-31 23:07:23 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        str(page_number) + '">\n'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    delete_post_str += \
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-28 10:40:19 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        '    <input type="hidden" name="messageId" value="' + \
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-31 23:07:23 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        message_id + '">\n'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    delete_post_str += \
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-28 10:40:19 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        '    <button type="submit" class="button" name="submitYes">' + \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        translate['Yes'] + '</button>\n'
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-31 23:07:23 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    delete_post_str += \
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-28 10:40:19 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        '    <a href="' + actor + '/inbox"><button class="button">' + \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        translate['No'] + '</button></a>\n'
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-31 23:07:23 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    delete_post_str += '  </form>\n'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    delete_post_str += '</center>\n'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    delete_post_str += html_footer()
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    return delete_post_str
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-28 10:40:19 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2022-07-12 19:03:30 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								def html_confirm_remove_shared_item(translate: {},
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-29 21:55:09 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                                    base_dir: str,
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-31 23:07:23 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                                    actor: str, item_id: str,
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-29 21:55:09 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                                    calling_domain: str,
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-31 23:07:23 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                                    shares_file_type: str) -> str:
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-28 10:40:19 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    """Shows a screen asking to confirm the removal of a shared item
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    """
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-27 22:19:18 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    nickname = get_nickname_from_actor(actor)
							 | 
						
					
						
							
								
									
										
										
										
											2022-03-23 23:59:29 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    if not nickname:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return None
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-27 19:05:25 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    domain, port = get_domain_from_actor(actor)
							 | 
						
					
						
							
								
									
										
										
										
											2023-01-15 14:33:18 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    if not domain:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return None
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-26 12:45:03 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    domain_full = get_full_domain(domain, port)
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-31 23:07:23 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    shares_file = \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        acct_dir(base_dir, nickname, domain) + '/' + shares_file_type + '.json'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    if not os.path.isfile(shares_file):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        print('ERROR: no ' + shares_file_type + ' file ' + shares_file)
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-28 10:40:19 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return None
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-31 23:07:23 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    shares_json = load_json(shares_file)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    if not shares_json:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        print('ERROR: unable to load ' + shares_file_type + '.json')
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-28 10:40:19 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return None
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-31 23:07:23 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    if not shares_json.get(item_id):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        print('ERROR: share named "' + item_id + '" is not in ' + shares_file)
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-28 10:40:19 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        return None
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-31 23:07:23 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    shared_item_display_name = shares_json[item_id]['displayName']
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    shared_item_image_url = None
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    if shares_json[item_id].get('imageUrl'):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        shared_item_image_url = shares_json[item_id]['imageUrl']
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-28 10:40:19 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-29 21:55:09 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    set_custom_background(base_dir, 'shares-background', 'follow-background')
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-28 10:40:19 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-31 21:18:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    css_filename = base_dir + '/epicyon-follow.css'
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-25 16:17:53 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    if os.path.isfile(base_dir + '/follow.css'):
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-31 21:18:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        css_filename = base_dir + '/follow.css'
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-28 10:40:19 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-31 23:07:23 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    instance_title = get_config_param(base_dir, 'instanceTitle')
							 | 
						
					
						
							
								
									
										
										
										
											2024-12-23 18:23:47 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    preload_images: list[str] = []
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-31 23:07:23 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    shares_str = html_header_with_external_style(css_filename,
							 | 
						
					
						
							
								
									
										
										
										
											2024-10-22 12:12:16 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                                                 instance_title, None,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                                                 preload_images)
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-31 23:07:23 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    shares_str += '<div class="follow">\n'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    shares_str += '  <div class="followAvatar">\n'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    shares_str += '  <center>\n'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    if shared_item_image_url:
							 | 
						
					
						
							
								
									
										
										
										
											2022-03-28 08:47:53 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        shares_str += '  <img loading="lazy" decoding="async" src="' + \
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-31 23:07:23 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            shared_item_image_url + '"/>\n'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    shares_str += \
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-28 10:40:19 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        '  <p class="followText">' + translate['Remove'] + \
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-31 23:07:23 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        ' ' + shared_item_display_name + ' ?</p>\n'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    post_actor = get_alt_path(actor, domain_full, calling_domain)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    if shares_file_type == 'shares':
							 | 
						
					
						
							
								
									
										
										
										
											2021-08-09 13:07:32 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        endpoint = 'rmshare'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    else:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        endpoint = 'rmwanted'
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-31 23:07:23 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    shares_str += \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        '  <form method="POST" action="' + post_actor + '/' + endpoint + '">\n'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    shares_str += \
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-28 10:40:19 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        '    <input type="hidden" name="actor" value="' + actor + '">\n'
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-31 23:07:23 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    shares_str += '    <input type="hidden" name="itemID" value="' + \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        item_id + '">\n'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    shares_str += \
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-28 10:40:19 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        '    <button type="submit" class="button" name="submitYes">' + \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        translate['Yes'] + '</button>\n'
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-31 23:07:23 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    shares_str += \
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-28 10:40:19 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        '    <a href="' + actor + '/inbox' + '"><button class="button">' + \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        translate['No'] + '</button></a>\n'
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-31 23:07:23 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    shares_str += '  </form>\n'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    shares_str += '  </center>\n'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    shares_str += '  </div>\n'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    shares_str += '</div>\n'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    shares_str += html_footer()
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    return shares_str
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-28 10:40:19 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2022-07-12 19:03:30 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								def html_confirm_follow(translate: {}, base_dir: str,
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-31 23:07:23 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                        origin_path_str: str,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                        follow_actor: str,
							 | 
						
					
						
							
								
									
										
										
										
											2023-08-29 17:14:06 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                        follow_profile_url: str,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                        nickname: str, domain: str) -> str:
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-28 10:40:19 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    """Asks to confirm a follow
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    """
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-31 23:07:23 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    follow_domain, _ = get_domain_from_actor(follow_actor)
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-28 10:40:19 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2024-05-12 12:35:26 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    dir_str = data_dir(base_dir)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    if os.path.isfile(dir_str + '/follow-background-custom.jpg'):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        if not os.path.isfile(dir_str + '/follow-background.jpg'):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            copyfile(dir_str + '/follow-background-custom.jpg',
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                     dir_str + '/follow-background.jpg')
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-28 10:40:19 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-31 21:18:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    css_filename = base_dir + '/epicyon-follow.css'
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-25 16:17:53 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    if os.path.isfile(base_dir + '/follow.css'):
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-31 21:18:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        css_filename = base_dir + '/follow.css'
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-28 10:40:19 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-31 23:07:23 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    instance_title = get_config_param(base_dir, 'instanceTitle')
							 | 
						
					
						
							
								
									
										
										
										
											2024-12-23 18:23:47 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    preload_images: list[str] = []
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-31 23:07:23 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    follow_str = html_header_with_external_style(css_filename,
							 | 
						
					
						
							
								
									
										
										
										
											2024-10-22 12:12:16 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                                                 instance_title, None,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                                                 preload_images)
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-31 23:07:23 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    follow_str += '<div class="follow">\n'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    follow_str += '  <div class="followAvatar">\n'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    follow_str += '  <center>\n'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    follow_str += '  <a href="' + follow_actor + '">\n'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    follow_str += \
							 | 
						
					
						
							
								
									
										
										
										
											2022-03-28 08:47:53 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        '  <img loading="lazy" decoding="async" ' + \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        'src="' + follow_profile_url + '"/></a>\n'
							 | 
						
					
						
							
								
									
										
										
										
											2022-03-23 23:59:29 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    follow_actor_nick = get_nickname_from_actor(follow_actor)
							 | 
						
					
						
							
								
									
										
										
										
											2023-01-15 14:33:18 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    if follow_actor_nick and follow_domain:
							 | 
						
					
						
							
								
									
										
										
										
											2024-12-24 18:17:36 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        if sending_is_blocked2(base_dir, nickname, domain,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                               follow_domain, follow_actor):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            follow_str += \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                '  <p class="followText"><b>' + \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                translate['FollowWarning'] + '</b></p>\n'
							 | 
						
					
						
							
								
									
										
										
										
											2022-03-23 23:59:29 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        follow_str += \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            '  <p class="followText">' + translate['Follow'] + ' ' + \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            follow_actor_nick + '@' + follow_domain + ' ?</p>\n'
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-31 23:07:23 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    follow_str += '  <form method="POST" action="' + \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        origin_path_str + '/followconfirm">\n'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    follow_str += '    <input type="hidden" name="actor" value="' + \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        follow_actor + '">\n'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    follow_str += \
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-28 10:40:19 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        '    <button type="submit" class="button" name="submitYes">' + \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        translate['Yes'] + '</button>\n'
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-31 23:07:23 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    follow_str += \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        '    <a href="' + origin_path_str + '"><button class="button">' + \
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-28 10:40:19 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        translate['No'] + '</button></a>\n'
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-31 23:07:23 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    follow_str += '  </form>\n'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    follow_str += '</center>\n'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    follow_str += '</div>\n'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    follow_str += '</div>\n'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    follow_str += html_footer()
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    return follow_str
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-28 10:40:19 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2022-07-12 19:03:30 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								def html_confirm_unfollow(translate: {}, base_dir: str,
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-31 23:07:23 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                          origin_path_str: str,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                          follow_actor: str,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                          follow_profile_url: str) -> str:
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-28 10:40:19 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    """Asks to confirm unfollowing an actor
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    """
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-31 23:07:23 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    follow_domain, _ = get_domain_from_actor(follow_actor)
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-28 10:40:19 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2024-05-12 12:35:26 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    dir_str = data_dir(base_dir)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    if os.path.isfile(dir_str + '/follow-background-custom.jpg'):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        if not os.path.isfile(dir_str + '/follow-background.jpg'):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            copyfile(dir_str + '/follow-background-custom.jpg',
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                     dir_str + '/follow-background.jpg')
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-28 10:40:19 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-31 21:18:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    css_filename = base_dir + '/epicyon-follow.css'
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-25 16:17:53 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    if os.path.isfile(base_dir + '/follow.css'):
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-31 21:18:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        css_filename = base_dir + '/follow.css'
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-28 10:40:19 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-31 23:07:23 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    instance_title = get_config_param(base_dir, 'instanceTitle')
							 | 
						
					
						
							
								
									
										
										
										
											2024-12-23 18:23:47 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    preload_images: list[str] = []
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-31 23:07:23 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    follow_str = html_header_with_external_style(css_filename,
							 | 
						
					
						
							
								
									
										
										
										
											2024-10-22 12:12:16 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                                                 instance_title, None,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                                                 preload_images)
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-31 23:07:23 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    follow_str += '<div class="follow">\n'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    follow_str += '  <div class="followAvatar">\n'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    follow_str += '  <center>\n'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    follow_str += '  <a href="' + follow_actor + '">\n'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    follow_str += \
							 | 
						
					
						
							
								
									
										
										
										
											2022-03-28 08:47:53 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        '  <img loading="lazy" decoding="async" src="' + \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        follow_profile_url + '"/></a>\n'
							 | 
						
					
						
							
								
									
										
										
										
											2022-03-23 23:59:29 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    follow_actor_nick = get_nickname_from_actor(follow_actor)
							 | 
						
					
						
							
								
									
										
										
										
											2023-01-15 14:33:18 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    if follow_actor_nick and follow_domain:
							 | 
						
					
						
							
								
									
										
										
										
											2022-03-23 23:59:29 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        follow_str += \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            '  <p class="followText">' + translate['Stop following'] + \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            ' ' + follow_actor_nick + '@' + follow_domain + ' ?</p>\n'
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-31 23:07:23 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    follow_str += '  <form method="POST" action="' + \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        origin_path_str + '/unfollowconfirm">\n'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    follow_str += '    <input type="hidden" name="actor" value="' + \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        follow_actor + '">\n'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    follow_str += \
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-28 10:40:19 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        '    <button type="submit" class="button" name="submitYes">' + \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        translate['Yes'] + '</button>\n'
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-31 23:07:23 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    follow_str += \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        '    <a href="' + origin_path_str + '"><button class="button">' + \
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-28 10:40:19 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        translate['No'] + '</button></a>\n'
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-31 23:07:23 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    follow_str += '  </form>\n'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    follow_str += '</center>\n'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    follow_str += '</div>\n'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    follow_str += '</div>\n'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    follow_str += html_footer()
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    return follow_str
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-28 10:40:19 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2022-07-12 19:03:30 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								def html_confirm_unblock(translate: {}, base_dir: str,
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-31 23:07:23 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                         origin_path_str: str,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                         block_actor: str,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                         block_profile_url: str) -> str:
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-28 10:40:19 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    """Asks to confirm unblocking an actor
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    """
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-31 23:07:23 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    block_domain, _ = get_domain_from_actor(block_actor)
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-28 10:40:19 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-29 21:55:09 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    set_custom_background(base_dir, 'block-background', 'follow-background')
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-28 10:40:19 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-31 21:18:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    css_filename = base_dir + '/epicyon-follow.css'
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-25 16:17:53 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    if os.path.isfile(base_dir + '/follow.css'):
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-31 21:18:12 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        css_filename = base_dir + '/follow.css'
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-28 10:40:19 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-31 23:07:23 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    instance_title = get_config_param(base_dir, 'instanceTitle')
							 | 
						
					
						
							
								
									
										
										
										
											2024-12-23 18:23:47 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    preload_images: list[str] = []
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-31 23:07:23 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    block_str = html_header_with_external_style(css_filename,
							 | 
						
					
						
							
								
									
										
										
										
											2024-10-22 12:12:16 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                                                instance_title, None,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                                                preload_images)
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-31 23:07:23 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    block_str += '<div class="block">\n'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    block_str += '  <div class="blockAvatar">\n'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    block_str += '  <center>\n'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    block_str += '  <a href="' + block_actor + '">\n'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    block_str += \
							 | 
						
					
						
							
								
									
										
										
										
											2022-03-28 08:47:53 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        '  <img loading="lazy" decoding="async" src="' + \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        block_profile_url + '"/></a>\n'
							 | 
						
					
						
							
								
									
										
										
										
											2022-03-23 23:59:29 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    block_actor_nick = get_nickname_from_actor(block_actor)
							 | 
						
					
						
							
								
									
										
										
										
											2023-01-15 14:33:18 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    if block_actor_nick and block_domain:
							 | 
						
					
						
							
								
									
										
										
										
											2022-03-23 23:59:29 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        block_str += \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            '  <p class="blockText">' + translate['Stop blocking'] + ' ' + \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            block_actor_nick + '@' + block_domain + ' ?</p>\n'
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-31 23:07:23 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    block_str += '  <form method="POST" action="' + \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        origin_path_str + '/unblockconfirm">\n'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    block_str += '    <input type="hidden" name="actor" value="' + \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        block_actor + '">\n'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    block_str += \
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-28 10:40:19 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        '    <button type="submit" class="button" name="submitYes">' + \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        translate['Yes'] + '</button>\n'
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-31 23:07:23 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    block_str += \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        '    <a href="' + origin_path_str + '"><button class="button">' + \
							 | 
						
					
						
							
								
									
										
										
										
											2020-11-28 10:40:19 +00:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        translate['No'] + '</button></a>\n'
							 | 
						
					
						
							
								
									
										
										
										
											2021-12-31 23:07:23 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    block_str += '  </form>\n'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    block_str += '</center>\n'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    block_str += '</div>\n'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    block_str += '</div>\n'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    block_str += html_footer()
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    return block_str
							 | 
						
					
						
							
								
									
										
										
										
											2022-07-15 11:29:43 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								def html_confirm_block(translate: {}, base_dir: str,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                       origin_path_str: str,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                       block_actor: str,
							 | 
						
					
						
							
								
									
										
										
										
											2023-01-15 15:14:18 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                       block_profile_url: str) -> str:
							 | 
						
					
						
							
								
									
										
										
										
											2022-07-15 11:29:43 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    """Asks to confirm blocking an actor
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    """
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    block_domain, _ = get_domain_from_actor(block_actor)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    set_custom_background(base_dir, 'block-background', 'follow-background')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    css_filename = base_dir + '/epicyon-follow.css'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    if os.path.isfile(base_dir + '/follow.css'):
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        css_filename = base_dir + '/follow.css'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    instance_title = get_config_param(base_dir, 'instanceTitle')
							 | 
						
					
						
							
								
									
										
										
										
											2024-12-23 18:23:47 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    preload_images: list[str] = []
							 | 
						
					
						
							
								
									
										
										
										
											2022-07-15 11:29:43 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    block_str = html_header_with_external_style(css_filename,
							 | 
						
					
						
							
								
									
										
										
										
											2024-10-22 12:12:16 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								                                                instance_title, None,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								                                                preload_images)
							 | 
						
					
						
							
								
									
										
										
										
											2022-07-15 11:29:43 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    block_str += '<div class="block">\n'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    block_str += '  <div class="blockAvatar">\n'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    block_str += '  <center>\n'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    block_str += '  <a href="' + block_actor + '">\n'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    block_str += \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        '  <img loading="lazy" decoding="async" src="' + \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        block_profile_url + '"/></a>\n'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    block_actor_nick = get_nickname_from_actor(block_actor)
							 | 
						
					
						
							
								
									
										
										
										
											2023-01-15 14:33:18 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    if block_actor_nick and block_domain:
							 | 
						
					
						
							
								
									
										
										
										
											2022-07-15 11:29:43 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        block_str += \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            '  <p class="blockText">' + translate['Block'] + ' ' + \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            block_actor_nick + '@' + block_domain + ' ?</p>\n'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    block_str += '  <form method="POST" action="' + \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        origin_path_str + '/blockconfirm">\n'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    block_str += '    <input type="hidden" name="actor" value="' + \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        block_actor + '">\n'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    block_str += \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        '    <button type="submit" class="button" name="submitYes">' + \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        translate['Yes'] + '</button>\n'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    block_str += \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        '    <a href="' + origin_path_str + '"><button class="button">' + \
							 | 
						
					
						
							
								
									
										
										
										
											2023-07-08 10:44:54 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        translate['No'] + '</button></a><br>\n'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    block_str += \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        '      <b><label class="labels">' + \
							 | 
						
					
						
							
								
									
										
										
										
											2023-07-08 11:55:42 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        translate['Reason'] + '</label></b><br>\n' + \
							 | 
						
					
						
							
								
									
										
										
										
											2023-07-08 10:44:54 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        '      <textarea id="message" ' + \
							 | 
						
					
						
							
								
									
										
										
										
											2023-07-08 12:03:53 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        'name="blockReason" style="width:90%;height:200px" ' + \
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        'spellcheck="true"></textarea>\n'
							 | 
						
					
						
							
								
									
										
										
										
											2022-07-15 11:29:43 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    block_str += '  </form>\n'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    block_str += '</center>\n'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    block_str += '</div>\n'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    block_str += '</div>\n'
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    block_str += html_footer()
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    return block_str
							 |