mirror of https://gitlab.com/bashrc2/epicyon
Merge branch 'main' of gitlab.com:bashrc2/epicyon
commit
1dba1c0713
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
|
||||
|
|
1
utils.py
1
utils.py
|
@ -3790,6 +3790,7 @@ def disallow_reply(content: str) -> bool:
|
|||
'dont_at_me',
|
||||
'do not reply',
|
||||
"don't reply",
|
||||
"don't @ me",
|
||||
'DontAtMe'
|
||||
)
|
||||
for diss in disallow_strings:
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -522,10 +522,6 @@ def html_person_options(default_timeline: str,
|
|||
follow_str + \
|
||||
'" accesskey="' + access_keys['followButton'] + '">' + \
|
||||
translate[follow_str] + '</button>\n'
|
||||
options_str += \
|
||||
' <button type="submit" class="button" name="submit' + \
|
||||
block_str + '" accesskey="' + access_keys['blockButton'] + '">' + \
|
||||
translate[block_str] + '</button>\n'
|
||||
options_str += \
|
||||
' <button type="submit" class="button" name="submitDM" ' + \
|
||||
'accesskey="' + access_keys['menuDM'] + '">' + \
|
||||
|
@ -547,6 +543,10 @@ def html_person_options(default_timeline: str,
|
|||
'name="submitPersonInfo" accesskey="' + \
|
||||
access_keys['infoButton'] + '">' + \
|
||||
translate['Info'] + '</button>\n'
|
||||
options_str += \
|
||||
' <button type="submit" class="button" name="submit' + \
|
||||
block_str + '" accesskey="' + access_keys['blockButton'] + '">' + \
|
||||
translate[block_str] + '</button>\n'
|
||||
|
||||
person_notes = ''
|
||||
if origin_path_str == '/users/' + nickname:
|
||||
|
|
Loading…
Reference in New Issue