\n'
if blocked_following:
blocked_following.sort()
info_form += '
\n'
info_form += '
' + translate['Blocked following'] + '
\n'
info_form += \
'
' + \
translate['Receives posts from the following accounts'] + \
':
\n'
for actor in blocked_following:
following_nickname = get_nickname_from_actor(actor)
if not following_nickname:
return ''
following_domain, following_port = get_domain_from_actor(actor)
following_domain_full = \
get_full_domain(following_domain, following_port)
info_form += '' + \
following_nickname + '@' + following_domain_full + \
'
\n'
info_form += '
\n'
if blocked_followers:
blocked_followers.sort()
info_form += '
\n'
info_form += '
' + translate['Blocked followers'] + '
\n'
info_form += \
'
' + \
translate['Sends out posts to the following accounts'] + \
':
\n'
for actor in blocked_followers:
follower_nickname = get_nickname_from_actor(actor)
if not follower_nickname:
return ''
follower_domain, follower_port = get_domain_from_actor(actor)
follower_domain_full = \
get_full_domain(follower_domain, follower_port)
info_form += '' + \
follower_nickname + '@' + \
follower_domain_full + '
\n'
info_form += '
\n'
if word_frequency:
max_count = 1
for word, count in word_frequency.items():
if count > max_count:
max_count = count
minimum_word_count = int(max_count / 2)
if minimum_word_count >= 3:
info_form += '
\n'
info_form += '
' + translate['Word frequencies'] + '
\n'
word_swarm = ''
ctr = 0
for word, count in word_frequency.items():
if count >= minimum_word_count:
if ctr > 0:
word_swarm += ' '
if count < max_count - int(max_count / 4):
word_swarm += word
else:
if count != max_count:
word_swarm += '' + word + ''
else:
word_swarm += '' + word + ''
ctr += 1
info_form += word_swarm
info_form += '
\n'
info_form += html_footer()
return info_form
def html_moderation_info(translate: {}, base_dir: str,
nickname: str, domain: str, theme: str,
access_keys: {}) -> str:
msg_str1 = \
'These are globally blocked for all accounts on this instance'
msg_str2 = \
'Any blocks or suspensions made by moderators will be shown here.'
info_form = ''
css_filename = base_dir + '/epicyon-profile.css'
if os.path.isfile(base_dir + '/epicyon.css'):
css_filename = base_dir + '/epicyon.css'
instance_title = \
get_config_param(base_dir, 'instanceTitle')
info_form = html_header_with_external_style(css_filename,
instance_title, None)
# show banner
banner_file, _ = \
get_banner_file(base_dir, nickname, domain, theme)
moderation_link = '/users/' + nickname + '/moderation'
info_form += \
'\n\n'
info_form += \
'\n' + \
'\n \n'
info_form += \
'
\n'
info_shown = True
blocking_filename = base_dir + '/accounts/blocking.txt'
if os.path.isfile(blocking_filename):
with open(blocking_filename, 'r', encoding='utf-8') as fp_block:
blocked_lines = fp_block.readlines()
blocked_str = ''
if blocked_lines:
blocked_lines.sort()
for line in blocked_lines:
if not line:
continue
line = line.replace('\n', '').replace('\r', '').strip()
blocked_str += line + '\n'
info_form += '