mirror of https://gitlab.com/bashrc2/epicyon
Add confirmation screen for person options block button
parent
bc2609dc09
commit
b40990f7bf
25
daemon.py
25
daemon.py
|
@ -179,6 +179,7 @@ from webapp_accesskeys import html_access_keys
|
|||
from webapp_accesskeys import load_access_keys_for_accounts
|
||||
from webapp_confirm import html_confirm_delete
|
||||
from webapp_confirm import html_confirm_remove_shared_item
|
||||
from webapp_confirm import html_confirm_block
|
||||
from webapp_confirm import html_confirm_unblock
|
||||
from webapp_person_options import person_minimize_images
|
||||
from webapp_person_options import person_undo_minimize_images
|
||||
|
@ -3057,16 +3058,20 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
# person options screen, block button
|
||||
# See html_person_options
|
||||
if '&submitBlock=' in options_confirm_params:
|
||||
print('Adding block by ' + chooser_nickname +
|
||||
' of ' + options_actor)
|
||||
if add_block(base_dir, chooser_nickname,
|
||||
domain,
|
||||
options_nickname, options_domain_full):
|
||||
# send block activity
|
||||
self._send_block(http_prefix,
|
||||
chooser_nickname, domain_full,
|
||||
options_nickname, options_domain_full,
|
||||
curr_session, proxy_type)
|
||||
if debug:
|
||||
print('Blocking ' + options_actor)
|
||||
msg = \
|
||||
html_confirm_block(self.server.translate,
|
||||
base_dir,
|
||||
users_path,
|
||||
options_actor,
|
||||
options_avatar_url).encode('utf-8')
|
||||
msglen = len(msg)
|
||||
self._set_headers('text/html', msglen,
|
||||
cookie, calling_domain, False)
|
||||
self._write(msg)
|
||||
self.server.postreq_busy = False
|
||||
return
|
||||
|
||||
# person options screen, unblock button
|
||||
# See html_person_options
|
||||
|
|
|
@ -335,3 +335,50 @@ def html_confirm_unblock(translate: {}, base_dir: str,
|
|||
block_str += '</div>\n'
|
||||
block_str += html_footer()
|
||||
return block_str
|
||||
|
||||
|
||||
def html_confirm_block(translate: {}, base_dir: str,
|
||||
origin_path_str: str,
|
||||
block_actor: str,
|
||||
block_profile_url: str) -> str:
|
||||
"""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')
|
||||
block_str = html_header_with_external_style(css_filename,
|
||||
instance_title, None)
|
||||
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)
|
||||
if block_actor_nick:
|
||||
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">' + \
|
||||
translate['No'] + '</button></a>\n'
|
||||
block_str += ' </form>\n'
|
||||
block_str += '</center>\n'
|
||||
block_str += '</div>\n'
|
||||
block_str += '</div>\n'
|
||||
block_str += html_footer()
|
||||
return block_str
|
||||
|
|
Loading…
Reference in New Issue