epicyon/webapp_timeline.py

1999 lines
89 KiB
Python
Raw Normal View History

2020-11-09 22:44:03 +00:00
__filename__ = "webapp_timeline.py"
__author__ = "Bob Mottram"
__license__ = "AGPL3+"
2023-01-21 23:03:30 +00:00
__version__ = "1.4.0"
2020-11-09 22:44:03 +00:00
__maintainer__ = "Bob Mottram"
2021-09-10 16:14:50 +00:00
__email__ = "bob@libreserver.org"
2020-11-09 22:44:03 +00:00
__status__ = "Production"
2021-06-15 15:08:12 +00:00
__module_group__ = "Timeline"
2020-11-09 22:44:03 +00:00
import os
import time
from shutil import copyfile
2021-12-26 14:17:13 +00:00
from utils import is_artist
2021-12-27 21:42:08 +00:00
from utils import dangerous_markup
2021-12-26 14:08:58 +00:00
from utils import get_config_param
2021-12-26 12:45:03 +00:00
from utils import get_full_domain
2021-12-26 13:27:57 +00:00
from utils import is_editor
2021-12-27 11:20:57 +00:00
from utils import remove_id_ending
2021-12-26 12:02:29 +00:00
from utils import acct_dir
2021-12-26 18:03:39 +00:00
from utils import is_float
2021-12-26 10:19:59 +00:00
from utils import local_actor_url
2022-06-21 11:58:50 +00:00
from utils import remove_eol
2024-01-09 16:59:23 +00:00
from utils import get_actor_from_post
2021-12-28 20:32:11 +00:00
from follow import follower_approval_active
2021-12-29 21:55:09 +00:00
from person import is_person_snoozed
from markdown import markdown_to_html
from webapp_utils import text_mode_browser
2021-12-29 21:55:09 +00:00
from webapp_utils import html_keyboard_navigation
from webapp_utils import html_hide_from_screen_reader
from webapp_utils import html_post_separator
from webapp_utils import get_banner_file
from webapp_utils import html_header_with_external_style
from webapp_utils import html_footer
from webapp_utils import shares_timeline_json
from webapp_utils import html_highlight_label
from webapp_post import prepare_post_from_html_cache
from webapp_post import individual_post_as_html
from webapp_column_left import get_left_column_content
from webapp_column_right import get_right_column_content
from webapp_headerbuttons import header_buttons_timeline
2021-12-28 19:33:29 +00:00
from posts import is_moderator
2021-12-29 21:55:09 +00:00
from announce import is_self_announce
2023-04-06 09:34:39 +00:00
from question import is_html_question
from question import is_question
2020-11-09 22:44:03 +00:00
2021-12-31 21:18:12 +00:00
def _log_timeline_timing(enable_timing_log: bool, timeline_start_time,
box_name: str, debug_id: str) -> None:
2020-12-01 17:23:34 +00:00
"""Create a log of timings for performance tuning
"""
2021-12-31 21:18:12 +00:00
if not enable_timing_log:
2020-12-01 17:23:34 +00:00
return
2021-12-31 21:18:12 +00:00
time_diff = int((time.time() - timeline_start_time) * 1000)
if time_diff > 100:
2020-12-01 17:23:34 +00:00
print('TIMELINE TIMING ' +
2021-12-31 21:18:12 +00:00
box_name + ' ' + debug_id + ' = ' + str(time_diff))
2020-12-01 17:23:34 +00:00
2021-12-31 21:18:12 +00:00
def _get_help_for_timeline(base_dir: str, box_name: str) -> str:
"""Shows help text for the given timeline
"""
# get the filename for help for this timeline
2021-12-31 21:18:12 +00:00
help_filename = base_dir + '/accounts/help_' + box_name + '.md'
if not os.path.isfile(help_filename):
language = \
2021-12-26 14:08:58 +00:00
get_config_param(base_dir, 'language')
2021-02-26 12:24:55 +00:00
if not language:
language = 'en'
2021-12-25 23:35:50 +00:00
theme_name = \
2021-12-26 14:08:58 +00:00
get_config_param(base_dir, 'theme')
2021-12-31 21:18:12 +00:00
default_filename = None
2021-12-25 23:35:50 +00:00
if theme_name:
2021-12-31 21:18:12 +00:00
default_filename = \
2021-12-25 23:35:50 +00:00
base_dir + '/theme/' + theme_name + '/welcome/' + \
2021-12-31 21:18:12 +00:00
'help_' + box_name + '_' + language + '.md'
if not os.path.isfile(default_filename):
default_filename = None
if not default_filename:
default_filename = \
2021-12-25 16:17:53 +00:00
base_dir + '/defaultwelcome/' + \
2021-12-31 21:18:12 +00:00
'help_' + box_name + '_' + language + '.md'
if not os.path.isfile(default_filename):
default_filename = \
base_dir + '/defaultwelcome/help_' + box_name + '_en.md'
if os.path.isfile(default_filename):
copyfile(default_filename, help_filename)
# show help text
2021-12-31 21:18:12 +00:00
if os.path.isfile(help_filename):
instance_title = \
2021-12-26 14:08:58 +00:00
get_config_param(base_dir, 'instanceTitle')
2021-12-31 21:18:12 +00:00
if not instance_title:
instance_title = 'Epicyon'
2022-06-09 14:46:30 +00:00
with open(help_filename, 'r', encoding='utf-8') as help_file:
2021-12-31 21:18:12 +00:00
help_text = help_file.read()
if dangerous_markup(help_text, False, []):
return ''
2021-12-31 21:18:12 +00:00
help_text = help_text.replace('INSTANCE', instance_title)
2021-02-26 12:29:42 +00:00
return '<div class="container">\n' + \
2021-12-31 21:18:12 +00:00
markdown_to_html(help_text) + '\n' + \
2021-02-26 12:42:29 +00:00
'</div>\n'
return ''
2021-12-31 21:18:12 +00:00
def _html_timeline_new_post(manually_approve_followers: bool,
box_name: str, icons_as_buttons: bool,
2022-05-25 19:19:48 +00:00
users_path: str, translate: {},
access_keys: {}) -> str:
2021-06-27 21:40:12 +00:00
"""Returns html for the new post button
"""
2021-12-31 21:18:12 +00:00
new_post_button_str = ''
if box_name == 'dm':
2021-12-25 19:19:14 +00:00
if not icons_as_buttons:
2021-12-31 21:18:12 +00:00
new_post_button_str += \
'<a class="imageAnchor" href="' + users_path + \
2022-05-25 19:19:48 +00:00
'/newdm?nodropdown" tabindex="3" accesskey="' + \
access_keys['menuNewPost'] + '">' + \
'<img loading="lazy" decoding="async" src="/' + \
2021-06-27 21:40:12 +00:00
'icons/newpost.png" title="' + \
translate['Create a new DM'] + \
'" alt="| ' + translate['Create a new DM'] + \
'" class="timelineicon"/></a>\n'
else:
2021-12-31 21:18:12 +00:00
new_post_button_str += \
2022-05-25 10:36:15 +00:00
'<a href="' + users_path + \
2022-05-25 19:19:48 +00:00
'/newdm?nodropdown" tabindex="3" accesskey="' + \
access_keys['menuNewPost'] + '">' + \
2021-06-27 21:40:12 +00:00
'<button class="button"><span>' + \
translate['Post'] + ' </span></button></a>'
2021-12-31 21:18:12 +00:00
elif box_name in ('tlblogs', 'tlnews', 'tlfeatures'):
2021-12-25 19:19:14 +00:00
if not icons_as_buttons:
2021-12-31 21:18:12 +00:00
new_post_button_str += \
'<a class="imageAnchor" href="' + users_path + \
2022-05-25 19:19:48 +00:00
'/newblog" tabindex="3" accesskey="' + \
2022-05-25 19:33:09 +00:00
access_keys['menuNewPost'] + '">' + \
2022-05-25 10:36:15 +00:00
'<img loading="lazy" decoding="async" src="/' + \
2021-06-27 21:40:12 +00:00
'icons/newpost.png" title="' + \
translate['Create a new post'] + '" alt="| ' + \
translate['Create a new post'] + \
'" class="timelineicon"/></a>\n'
else:
2021-12-31 21:18:12 +00:00
new_post_button_str += \
2022-05-25 19:19:48 +00:00
'<a href="' + users_path + \
'/newblog" tabindex="3" accesskey="' + \
2022-05-25 19:33:09 +00:00
access_keys['menuNewPost'] + '">' + \
2021-06-27 21:40:12 +00:00
'<button class="button"><span>' + \
translate['Post'] + '</span></button></a>'
2021-12-31 21:18:12 +00:00
elif box_name == 'tlshares':
2021-12-25 19:19:14 +00:00
if not icons_as_buttons:
2021-12-31 21:18:12 +00:00
new_post_button_str += \
'<a class="imageAnchor" href="' + users_path + \
2022-05-25 19:19:48 +00:00
'/newshare?nodropdown" tabindex="3" accesskey="' + \
access_keys['menuNewPost'] + '">' + \
2022-03-28 08:47:53 +00:00
'<img loading="lazy" decoding="async" src="/' + \
2021-06-27 21:40:12 +00:00
'icons/newpost.png" title="' + \
translate['Create a new shared item'] + '" alt="| ' + \
translate['Create a new shared item'] + \
'" class="timelineicon"/></a>\n'
else:
2021-12-31 21:18:12 +00:00
new_post_button_str += \
2022-05-25 10:36:15 +00:00
'<a href="' + users_path + \
2022-05-25 19:19:48 +00:00
'/newshare?nodropdown" tabindex="3" accesskey="' + \
access_keys['menuNewPost'] + '">' + \
2021-06-27 21:40:12 +00:00
'<button class="button"><span>' + \
translate['Post'] + '</span></button></a>'
2021-12-31 21:18:12 +00:00
elif box_name == 'tlwanted':
2021-12-25 19:19:14 +00:00
if not icons_as_buttons:
2021-12-31 21:18:12 +00:00
new_post_button_str += \
'<a class="imageAnchor" href="' + users_path + \
2022-05-25 19:19:48 +00:00
'/newwanted?nodropdown" tabindex="3" accesskey="' + \
access_keys['menuNewPost'] + '">' + \
2022-03-28 08:47:53 +00:00
'<img loading="lazy" decoding="async" src="/' + \
2021-08-09 18:41:05 +00:00
'icons/newpost.png" title="' + \
translate['Create a new wanted item'] + '" alt="| ' + \
translate['Create a new wanted item'] + \
'" class="timelineicon"/></a>\n'
else:
2021-12-31 21:18:12 +00:00
new_post_button_str += \
2022-05-25 10:36:15 +00:00
'<a href="' + users_path + \
2022-05-25 19:19:48 +00:00
'/newwanted?nodropdown" tabindex="3" accesskey="' + \
access_keys['menuNewPost'] + '">' + \
2021-08-09 18:41:05 +00:00
'<button class="button"><span>' + \
translate['Post'] + '</span></button></a>'
2021-06-27 21:40:12 +00:00
else:
2021-12-31 21:18:12 +00:00
if not manually_approve_followers:
2021-12-25 19:19:14 +00:00
if not icons_as_buttons:
2021-12-31 21:18:12 +00:00
new_post_button_str += \
'<a class="imageAnchor" href="' + users_path + \
2022-05-25 10:58:43 +00:00
'/newpost" tabindex="3">' + \
2022-03-28 08:47:53 +00:00
'<img loading="lazy" decoding="async" src="/' + \
2021-06-27 21:40:12 +00:00
'icons/newpost.png" title="' + \
translate['Create a new post'] + '" alt="| ' + \
translate['Create a new post'] + \
'" class="timelineicon"/></a>\n'
else:
2021-12-31 21:18:12 +00:00
new_post_button_str += \
2022-05-25 10:58:43 +00:00
'<a href="' + users_path + '/newpost" tabindex="3">' + \
2021-06-27 21:40:12 +00:00
'<button class="button"><span>' + \
translate['Post'] + '</span></button></a>'
else:
2021-12-25 19:19:14 +00:00
if not icons_as_buttons:
2021-12-31 21:18:12 +00:00
new_post_button_str += \
'<a class="imageAnchor" href="' + users_path + \
2022-05-25 19:19:48 +00:00
'/newfollowers" tabindex="3" accesskey="' + \
access_keys['menuNewPost'] + '">' + \
2022-03-28 08:47:53 +00:00
'<img loading="lazy" decoding="async" src="/' + \
2021-06-27 21:40:12 +00:00
'icons/newpost.png" title="' + \
translate['Create a new post'] + \
'" alt="| ' + translate['Create a new post'] + \
'" class="timelineicon"/></a>\n'
else:
2021-12-31 21:18:12 +00:00
new_post_button_str += \
2022-05-25 10:36:15 +00:00
'<a href="' + users_path + \
2022-05-25 19:19:48 +00:00
'/newfollowers" tabindex="3" accesskey="' + \
access_keys['menuNewPost'] + '">' + \
2021-06-27 21:40:12 +00:00
'<button class="button"><span>' + \
translate['Post'] + '</span></button></a>'
2021-12-31 21:18:12 +00:00
return new_post_button_str
2021-06-27 21:40:12 +00:00
2021-12-31 21:18:12 +00:00
def _html_timeline_moderation_buttons(moderator: bool, box_name: str,
nickname: str,
moderation_action_str: str,
2021-12-29 21:55:09 +00:00
translate: {}) -> str:
2021-06-27 22:01:58 +00:00
"""Returns html for the moderation screen buttons
"""
2021-12-31 21:18:12 +00:00
tl_str = ''
if moderator and box_name == 'moderation':
tl_str += \
2021-06-27 22:01:58 +00:00
'<form id="modtimeline" method="POST" action="/users/' + \
nickname + '/moderationaction">'
2021-12-31 21:18:12 +00:00
tl_str += '<div class="container">\n'
2021-06-27 22:01:58 +00:00
idx = 'Nickname or URL. Block using *@domain or nickname@domain'
2021-12-31 21:18:12 +00:00
tl_str += \
2021-06-27 22:01:58 +00:00
' <b>' + translate[idx] + '</b><br>\n'
2021-12-31 21:18:12 +00:00
if moderation_action_str:
tl_str += ' <input type="text" ' + \
2021-06-27 22:01:58 +00:00
'name="moderationAction" value="' + \
2021-12-31 21:18:12 +00:00
moderation_action_str + '" autofocus><br>\n'
2021-06-27 22:01:58 +00:00
else:
2021-12-31 21:18:12 +00:00
tl_str += ' <input type="text" ' + \
2021-06-27 22:01:58 +00:00
'name="moderationAction" value="" autofocus><br>\n'
2021-12-31 21:18:12 +00:00
tl_str += \
2021-06-27 22:01:58 +00:00
' <input type="submit" title="' + \
translate['Information about current blocks/suspensions'] + \
'" alt="' + \
translate['Information about current blocks/suspensions'] + \
' | " ' + \
'name="submitInfo" value="' + translate['Info'] + '">\n'
2021-12-31 21:18:12 +00:00
tl_str += \
2021-06-27 22:01:58 +00:00
' <input type="submit" title="' + \
translate['Remove the above item'] + '" ' + \
'alt="' + translate['Remove the above item'] + ' | " ' + \
'name="submitRemove" value="' + \
translate['Remove'] + '">\n'
2021-12-31 21:18:12 +00:00
tl_str += \
2021-06-27 22:01:58 +00:00
' <input type="submit" title="' + \
translate['Suspend the above account nickname'] + '" ' + \
'alt="' + \
translate['Suspend the above account nickname'] + ' | " ' + \
'name="submitSuspend" value="' + translate['Suspend'] + '">\n'
2021-12-31 21:18:12 +00:00
tl_str += \
2021-06-27 22:01:58 +00:00
' <input type="submit" title="' + \
translate['Remove a suspension for an account nickname'] + '" ' + \
'alt="' + \
translate['Remove a suspension for an account nickname'] + \
' | " ' + \
'name="submitUnsuspend" value="' + \
translate['Unsuspend'] + '">\n'
2021-12-31 21:18:12 +00:00
tl_str += \
2021-06-27 22:01:58 +00:00
' <input type="submit" title="' + \
translate['Block an account on another instance'] + '" ' + \
'alt="' + \
translate['Block an account on another instance'] + ' | " ' + \
'name="submitBlock" value="' + translate['Block'] + '">\n'
2021-12-31 21:18:12 +00:00
tl_str += \
2021-06-27 22:01:58 +00:00
' <input type="submit" title="' + \
translate['Unblock an account on another instance'] + '" ' + \
'alt="' + \
translate['Unblock an account on another instance'] + ' | " ' + \
'name="submitUnblock" value="' + translate['Unblock'] + '">\n'
2021-12-31 21:18:12 +00:00
tl_str += \
2021-06-27 22:01:58 +00:00
' <input type="submit" title="' + \
translate['Filter out words'] + '" ' + \
'alt="' + \
translate['Filter out words'] + ' | " ' + \
'name="submitFilter" value="' + translate['Filter'] + '">\n'
2021-12-31 21:18:12 +00:00
tl_str += \
2021-06-27 22:01:58 +00:00
' <input type="submit" title="' + \
translate['Unfilter words'] + '" ' + \
'alt="' + \
translate['Unfilter words'] + ' | " ' + \
'name="submitUnfilter" value="' + translate['Unfilter'] + '">\n'
tl_str += \
' <input type="submit" title="' + \
translate['Clear Cache'] + '" ' + \
'alt="' + \
translate['Clear Cache'] + ' | " ' + \
'name="submitClearCache" value="' + \
translate['Clear Cache'] + '">\n'
2021-06-27 22:01:58 +00:00
2021-12-31 21:18:12 +00:00
tl_str += '</div>\n</form>\n'
return tl_str
2021-06-27 22:01:58 +00:00
2021-12-29 21:55:09 +00:00
def _html_timeline_keyboard(moderator: bool, text_mode_banner: str,
2021-12-31 21:18:12 +00:00
users_path: str,
nickname: str, new_calendar_event: bool,
new_dm: bool, new_reply: bool,
new_share: bool, new_wanted: bool,
follow_approvals: bool,
access_keys: {}, translate: {}) -> str:
2021-06-27 22:14:48 +00:00
"""Returns html for timeline keyboard navigation
"""
2021-12-31 21:18:12 +00:00
calendar_str = translate['Calendar']
if new_calendar_event:
calendar_str = '<strong>' + calendar_str + '</strong>'
dm_str = translate['DM']
if new_dm:
dm_str = '<strong>' + dm_str + '</strong>'
replies_str = translate['Replies']
if new_reply:
replies_str = '<strong>' + replies_str + '</strong>'
shares_str = translate['Shares']
if new_share:
shares_str = '<strong>' + shares_str + '</strong>'
wanted_str = translate['Wanted']
if new_wanted:
wanted_str = '<strong>' + wanted_str + '</strong>'
menu_profile = \
2021-12-29 21:55:09 +00:00
html_hide_from_screen_reader('👤') + ' ' + \
2021-06-27 22:14:48 +00:00
translate['Switch to profile view']
2021-12-31 21:18:12 +00:00
menu_inbox = \
2021-12-29 21:55:09 +00:00
html_hide_from_screen_reader('📥') + ' ' + translate['Inbox']
2021-12-31 21:18:12 +00:00
menu_outbox = \
2021-12-29 21:55:09 +00:00
html_hide_from_screen_reader('📤') + ' ' + translate['Sent']
2021-12-31 21:18:12 +00:00
menu_search = \
2021-12-29 21:55:09 +00:00
html_hide_from_screen_reader('🔍') + ' ' + \
2021-06-27 22:14:48 +00:00
translate['Search and follow']
2021-12-31 21:18:12 +00:00
menu_calendar = \
html_hide_from_screen_reader('📅') + ' ' + calendar_str
menu_dm = \
html_hide_from_screen_reader('📩') + ' ' + dm_str
menu_replies = \
html_hide_from_screen_reader('📨') + ' ' + replies_str
menu_bookmarks = \
2021-12-29 21:55:09 +00:00
html_hide_from_screen_reader('🔖') + ' ' + translate['Bookmarks']
2021-12-31 21:18:12 +00:00
menu_shares = \
html_hide_from_screen_reader('🤝') + ' ' + shares_str
menu_wanted = \
2022-07-13 13:23:12 +00:00
html_hide_from_screen_reader('') + ' ' + wanted_str
2021-12-31 21:18:12 +00:00
menu_blogs = \
2021-12-29 21:55:09 +00:00
html_hide_from_screen_reader('📝') + ' ' + translate['Blogs']
2021-12-31 21:18:12 +00:00
menu_newswire = \
2021-12-29 21:55:09 +00:00
html_hide_from_screen_reader('📰') + ' ' + translate['Newswire']
2021-12-31 21:18:12 +00:00
menu_links = \
2021-12-29 21:55:09 +00:00
html_hide_from_screen_reader('🔗') + ' ' + translate['Links']
2021-12-31 21:18:12 +00:00
menu_new_post = \
2021-12-29 21:55:09 +00:00
html_hide_from_screen_reader('') + ' ' + \
translate['Create a new post']
2021-12-31 21:18:12 +00:00
menu_moderation = \
2021-12-29 21:55:09 +00:00
html_hide_from_screen_reader('⚡️') + ' ' + translate['Mod']
2021-12-31 21:18:12 +00:00
nav_links = {
menu_profile: '/users/' + nickname,
menu_inbox: users_path + '/inbox#timelineposts',
menu_search: users_path + '/search',
menu_new_post: users_path + '/newpost',
menu_calendar: users_path + '/calendar',
menu_dm: users_path + '/dm#timelineposts',
menu_replies: users_path + '/tlreplies#timelineposts',
menu_outbox: users_path + '/outbox#timelineposts',
menu_bookmarks: users_path + '/tlbookmarks#timelineposts',
menu_shares: users_path + '/tlshares#timelineposts',
menu_wanted: users_path + '/tlwanted#timelineposts',
menu_blogs: users_path + '/tlblogs#timelineposts',
menu_newswire: users_path + '/newswiremobile',
menu_links: users_path + '/linksmobile'
2021-06-27 22:14:48 +00:00
}
2021-12-31 21:18:12 +00:00
nav_access_keys = {}
for variable_name, key in access_keys.items():
if not locals().get(variable_name):
2021-06-27 22:14:48 +00:00
continue
2021-12-31 21:18:12 +00:00
nav_access_keys[locals()[variable_name]] = key
2021-06-27 22:14:48 +00:00
if moderator:
2021-12-31 21:18:12 +00:00
nav_links[menu_moderation] = users_path + '/moderation#modtimeline'
return html_keyboard_navigation(text_mode_banner, nav_links,
nav_access_keys,
None, users_path, translate,
follow_approvals)
2021-12-29 21:55:09 +00:00
def _html_timeline_end(base_dir: str, nickname: str, domain_full: str,
http_prefix: str, translate: {},
moderator: bool, editor: bool,
newswire: {}, positive_voting: bool,
show_publish_as_icon: bool,
rss_icon_at_top: bool, publish_button_at_top: bool,
authorized: bool, theme: str,
2021-12-31 21:18:12 +00:00
default_timeline: str, access_keys: {},
box_name: str,
enable_timing_log: bool, timeline_start_time,
ua_str: str) -> str:
2021-07-28 11:26:03 +00:00
"""Ending of the timeline, containing the right column
"""
# end of timeline-posts
2021-12-31 21:18:12 +00:00
tl_str = ' </div>\n'
2021-07-28 11:26:03 +00:00
# end of column-center
2022-05-17 20:10:48 +00:00
tl_str += ' </td>\n'
2021-07-28 11:26:03 +00:00
# right column
right_column_str = ''
2022-07-13 11:48:21 +00:00
if not text_mode_browser(ua_str):
right_column_str = \
get_right_column_content(base_dir, nickname, domain_full,
http_prefix, translate,
moderator, editor,
newswire, positive_voting,
False, None, True,
show_publish_as_icon,
rss_icon_at_top,
publish_button_at_top,
authorized, True, theme,
default_timeline, access_keys)
2021-12-31 21:18:12 +00:00
tl_str += ' <td valign="top" class="col-right" ' + \
2022-05-25 10:17:44 +00:00
'id="newswire" tabindex="-1">\n' + \
' <aside>\n' + \
2022-05-17 19:41:09 +00:00
right_column_str + \
' </aside>\n' + \
2022-05-17 19:41:09 +00:00
' </td>\n' + \
' </tr>\n'
2021-07-28 11:26:03 +00:00
2021-12-31 21:18:12 +00:00
_log_timeline_timing(enable_timing_log, timeline_start_time, box_name, '9')
2021-07-28 11:26:03 +00:00
2021-12-31 21:18:12 +00:00
tl_str += ' </tbody>\n'
tl_str += '</table>\n'
2022-05-17 19:41:09 +00:00
tl_str += '</main>\n'
2021-12-31 21:18:12 +00:00
return tl_str
2021-07-28 11:26:03 +00:00
2022-07-08 16:33:38 +00:00
def page_number_buttons(users_path: str, box_name: str,
page_number: int, header: str) -> str:
2021-09-24 17:26:21 +00:00
"""Shows selactable page numbers at the bottom of the screen
"""
2021-12-31 21:18:12 +00:00
pages_width = 3
min_page_number = page_number - pages_width
2022-05-30 20:47:23 +00:00
min_page_number = max(min_page_number, 1)
2021-12-31 21:18:12 +00:00
max_page_number = min_page_number + 1 + (pages_width * 2)
num_str = ''
for page in range(min_page_number, max_page_number):
if num_str:
2022-05-29 12:27:13 +00:00
separator_str = \
'<label class="pageslistDash">────</label>'
num_str += html_hide_from_screen_reader(separator_str)
aria_page_str = ''
2022-07-05 09:16:41 +00:00
page_str = ' ' + str(page) + ' '
2022-05-29 09:05:01 +00:00
curr_page_str = ''
2021-12-31 21:18:12 +00:00
if page == page_number:
page_str = '[<mark>' + str(page) + '</mark>]'
2022-05-14 13:16:49 +00:00
aria_page_str = ' aria-current="true"'
2022-05-29 09:05:01 +00:00
curr_page_str = 'Current Page, '
2021-12-31 21:18:12 +00:00
num_str += \
'<a href="' + users_path + '/' + box_name + '?page=' + \
2022-07-08 16:33:38 +00:00
str(page) + '#' + header + '" class="pageslist" ' + \
2022-05-29 09:05:01 +00:00
'aria-label="' + curr_page_str + 'Page ' + str(page) + \
2022-05-25 11:47:53 +00:00
'"' + aria_page_str + ' tabindex="11">' + page_str + '</a>'
2022-05-14 13:16:49 +00:00
return '<center>\n' + \
' <nav role="navigation" aria-label="Pagination Navigation">\n' + \
' ' + num_str + '\n' + \
' </nav>\n' + \
'</center>\n'
2021-12-31 21:18:12 +00:00
2022-07-12 19:03:30 +00:00
def html_timeline(default_timeline: str,
2021-12-29 21:55:09 +00:00
recent_posts_cache: {}, max_recent_posts: int,
2021-12-31 21:18:12 +00:00
translate: {}, page_number: int,
items_per_page: int, session, base_dir: str,
2021-12-29 21:55:09 +00:00
cached_webfingers: {}, person_cache: {},
2021-12-31 21:18:12 +00:00
nickname: str, domain: str, port: int, timeline_json: {},
box_name: str, allow_deletion: bool,
2021-12-29 21:55:09 +00:00
http_prefix: str, project_version: str,
2021-12-31 21:18:12 +00:00
manually_approve_followers: bool,
2021-12-29 21:55:09 +00:00
minimal: bool,
yt_replace_domain: str,
twitter_replacement_domain: str,
show_published_date_only: bool,
newswire: {}, moderator: bool,
editor: bool, artist: bool,
positive_voting: bool,
show_publish_as_icon: bool,
full_width_tl_button_header: bool,
icons_as_buttons: bool,
rss_icon_at_top: bool,
publish_button_at_top: bool,
authorized: bool,
2021-12-31 21:18:12 +00:00
moderation_action_str: str,
2021-12-29 21:55:09 +00:00
theme: str,
peertube_instances: [],
allow_local_network_access: bool,
text_mode_banner: str,
2021-12-31 21:18:12 +00:00
access_keys: {}, system_language: str,
2021-12-29 21:55:09 +00:00
max_like_count: int,
shared_items_federated_domains: [],
signing_priv_key_pem: str,
2022-02-25 19:12:40 +00:00
cw_lists: {}, lists_enabled: str,
2022-07-05 14:40:26 +00:00
timezone: str, bold_reading: bool,
dogwhistles: {}, ua_str: str,
2022-11-26 15:31:46 +00:00
min_images_for_accounts: [],
2022-12-28 14:14:44 +00:00
reverse_sequence: bool,
2023-01-13 15:04:48 +00:00
last_post_id: str,
buy_sites: {}) -> str:
2020-11-10 15:12:07 +00:00
"""Show the timeline as html
2020-11-09 22:44:03 +00:00
"""
2021-12-31 21:18:12 +00:00
enable_timing_log = False
2020-12-01 17:23:34 +00:00
2021-12-31 21:18:12 +00:00
timeline_start_time = time.time()
2020-11-09 22:44:03 +00:00
2021-12-31 21:18:12 +00:00
account_dir = acct_dir(base_dir, nickname, domain)
2020-11-09 22:44:03 +00:00
2020-11-10 15:12:07 +00:00
# should the calendar icon be highlighted?
2021-12-31 21:18:12 +00:00
new_calendar_event = False
calendar_image = 'calendar.png'
calendar_path = '/calendar'
calendar_file = account_dir + '/.newCalendar'
if os.path.isfile(calendar_file):
new_calendar_event = True
calendar_image = 'calendar_notify.png'
2022-06-09 14:46:30 +00:00
with open(calendar_file, 'r', encoding='utf-8') as calfile:
2021-12-31 21:18:12 +00:00
calendar_path = calfile.read().replace('##sent##', '')
2022-06-21 11:58:50 +00:00
calendar_path = remove_eol(calendar_path)
if '/calendar' not in calendar_path:
calendar_path = '/calendar'
2020-11-09 22:44:03 +00:00
2020-11-10 15:12:07 +00:00
# should the DM button be highlighted?
2021-12-31 21:18:12 +00:00
new_dm = False
dm_file = account_dir + '/.newDM'
if os.path.isfile(dm_file):
new_dm = True
if box_name == 'dm':
try:
2021-12-31 21:18:12 +00:00
os.remove(dm_file)
2021-11-25 18:42:38 +00:00
except OSError:
2021-12-31 21:18:12 +00:00
print('EX: html_timeline unable to delete ' + dm_file)
2020-11-09 22:44:03 +00:00
2020-11-10 15:12:07 +00:00
# should the Replies button be highlighted?
2021-12-31 21:18:12 +00:00
new_reply = False
reply_file = account_dir + '/.newReply'
if os.path.isfile(reply_file):
new_reply = True
if box_name == 'tlreplies':
try:
2021-12-31 21:18:12 +00:00
os.remove(reply_file)
2021-11-25 18:42:38 +00:00
except OSError:
2021-12-31 21:18:12 +00:00
print('EX: html_timeline unable to delete ' + reply_file)
2020-11-09 22:44:03 +00:00
2020-11-10 15:12:07 +00:00
# should the Shares button be highlighted?
2021-12-31 21:18:12 +00:00
new_share = False
new_share_file = account_dir + '/.newShare'
if os.path.isfile(new_share_file):
new_share = True
if box_name == 'tlshares':
try:
2021-12-31 21:18:12 +00:00
os.remove(new_share_file)
2021-11-25 18:42:38 +00:00
except OSError:
2021-12-31 21:18:12 +00:00
print('EX: html_timeline unable to delete ' + new_share_file)
2020-11-09 22:44:03 +00:00
2021-08-09 18:41:05 +00:00
# should the Wanted button be highlighted?
2021-12-31 21:18:12 +00:00
new_wanted = False
new_wanted_file = account_dir + '/.newWanted'
if os.path.isfile(new_wanted_file):
new_wanted = True
if box_name == 'tlwanted':
try:
2021-12-31 21:18:12 +00:00
os.remove(new_wanted_file)
2021-11-25 18:42:38 +00:00
except OSError:
2021-12-31 21:18:12 +00:00
print('EX: html_timeline unable to delete ' + new_wanted_file)
2021-08-09 18:41:05 +00:00
2020-11-10 15:12:07 +00:00
# should the Moderation/reports button be highlighted?
2021-12-31 21:18:12 +00:00
new_report = False
new_report_file = account_dir + '/.newReport'
if os.path.isfile(new_report_file):
new_report = True
if box_name == 'moderation':
try:
2021-12-31 21:18:12 +00:00
os.remove(new_report_file)
2021-11-25 18:42:38 +00:00
except OSError:
2021-12-31 21:18:12 +00:00
print('EX: html_timeline unable to delete ' + new_report_file)
2020-11-09 22:44:03 +00:00
2023-04-05 16:48:50 +00:00
# show polls/votes?
show_vote_posts = True
show_vote_file = account_dir + '/.noVotes'
if os.path.isfile(show_vote_file):
show_vote_posts = False
2021-12-31 21:18:12 +00:00
separator_str = ''
if box_name != 'tlmedia':
separator_str = html_post_separator(base_dir, None)
2020-11-09 22:44:03 +00:00
2020-11-10 15:12:07 +00:00
# the css filename
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-09 22:44:03 +00:00
2020-11-10 15:12:07 +00:00
# filename of the banner shown at the top
2021-12-31 21:18:12 +00:00
banner_file, _ = \
2021-12-29 21:55:09 +00:00
get_banner_file(base_dir, nickname, domain, theme)
2020-11-09 22:44:03 +00:00
2021-12-31 21:18:12 +00:00
_log_timeline_timing(enable_timing_log, timeline_start_time, box_name, '1')
2020-11-09 22:44:03 +00:00
2020-11-10 15:12:07 +00:00
# is the user a moderator?
if not moderator:
2021-12-28 19:33:29 +00:00
moderator = is_moderator(base_dir, nickname)
2020-11-09 22:44:03 +00:00
2020-11-10 15:12:07 +00:00
# is the user a site editor?
if not editor:
2021-12-26 13:27:57 +00:00
editor = is_editor(base_dir, nickname)
2020-11-09 22:44:03 +00:00
2021-12-31 21:18:12 +00:00
_log_timeline_timing(enable_timing_log, timeline_start_time, box_name, '2')
2020-11-09 22:44:03 +00:00
2020-11-10 15:12:07 +00:00
# the appearance of buttons - highlighted or not
2021-12-31 21:18:12 +00:00
inbox_button = 'button'
blogs_button = 'button'
features_button = 'button'
news_button = 'button'
dm_button = 'button'
if new_dm:
dm_button = 'buttonhighlighted'
replies_button = 'button'
if new_reply:
replies_button = 'buttonhighlighted'
media_button = 'button'
bookmarks_button = 'button'
# eventsButton = 'button'
2021-12-31 21:18:12 +00:00
sent_button = 'button'
shares_button = 'button'
if new_share:
shares_button = 'buttonhighlighted'
wanted_button = 'button'
if new_wanted:
wanted_button = 'buttonhighlighted'
moderation_button = 'button'
if new_report:
moderation_button = 'buttonhighlighted'
if box_name == 'inbox':
inbox_button = 'buttonselected'
elif box_name == 'tlblogs':
blogs_button = 'buttonselected'
elif box_name == 'tlfeatures':
features_button = 'buttonselected'
elif box_name == 'tlnews':
news_button = 'buttonselected'
elif box_name == 'dm':
dm_button = 'buttonselected'
if new_dm:
dm_button = 'buttonselectedhighlighted'
elif box_name == 'tlreplies':
replies_button = 'buttonselected'
if new_reply:
replies_button = 'buttonselectedhighlighted'
elif box_name == 'tlmedia':
media_button = 'buttonselected'
elif box_name == 'outbox':
sent_button = 'buttonselected'
elif box_name == 'moderation':
moderation_button = 'buttonselected'
if new_report:
moderation_button = 'buttonselectedhighlighted'
elif box_name == 'tlshares':
shares_button = 'buttonselected'
if new_share:
shares_button = 'buttonselectedhighlighted'
elif box_name == 'tlwanted':
wanted_button = 'buttonselected'
if new_wanted:
wanted_button = 'buttonselectedhighlighted'
elif box_name in ('tlbookmarks', 'bookmarks'):
bookmarks_button = 'buttonselected'
2020-11-09 22:44:03 +00:00
2020-11-10 15:12:07 +00:00
# get the full domain, including any port number
2021-12-31 21:18:12 +00:00
full_domain = get_full_domain(domain, port)
2020-11-09 22:44:03 +00:00
2021-12-31 21:18:12 +00:00
users_path = '/users/' + nickname
actor = http_prefix + '://' + full_domain + users_path
2020-11-09 22:44:03 +00:00
2021-12-31 21:18:12 +00:00
show_individual_post_icons = True
2020-11-10 15:12:07 +00:00
# show an icon for new follow approvals
2021-12-31 21:18:12 +00:00
follow_approvals = ''
follow_requests_filename = \
2021-12-26 12:02:29 +00:00
acct_dir(base_dir, nickname, domain) + '/followrequests.txt'
2021-12-31 21:18:12 +00:00
if os.path.isfile(follow_requests_filename):
2022-06-09 14:46:30 +00:00
with open(follow_requests_filename, 'r',
encoding='utf-8') as foll_file:
2021-12-31 21:18:12 +00:00
for line in foll_file:
2020-11-10 15:12:07 +00:00
if len(line) > 0:
# show follow approvals icon
2021-12-31 21:18:12 +00:00
follow_approvals = \
'<a href="' + users_path + \
2021-04-23 12:24:34 +00:00
'/followers#buttonheader" ' + \
2021-12-31 21:18:12 +00:00
'accesskey="' + access_keys['followButton'] + '">' + \
2022-03-28 08:47:53 +00:00
'<img loading="lazy" decoding="async" ' + \
2020-11-10 15:12:07 +00:00
'class="timelineicon" alt="' + \
translate['Approve follow requests'] + \
'" title="' + translate['Approve follow requests'] + \
2020-12-09 13:08:26 +00:00
'" src="/icons/person.png"/></a>\n'
2020-11-10 15:12:07 +00:00
break
2020-11-09 22:44:03 +00:00
2021-12-31 21:18:12 +00:00
_log_timeline_timing(enable_timing_log, timeline_start_time, box_name, '3')
2020-11-10 15:12:07 +00:00
# moderation / reports button
2021-12-31 21:18:12 +00:00
moderation_button_str = ''
2020-11-10 15:12:07 +00:00
if moderator and not minimal:
2021-12-31 21:18:12 +00:00
moderation_button_str = \
'<a href="' + users_path + '/moderation"'
if box_name == 'moderation':
moderation_button_str += ' aria-current="location"'
moderation_button_str += \
'><button class="' + \
2022-05-25 11:04:15 +00:00
moderation_button + '" tabindex="2"><span>' + \
2021-12-31 21:18:12 +00:00
html_highlight_label(translate['Mod'], new_report) + \
2020-11-10 15:12:07 +00:00
' </span></button></a>'
# shares, bookmarks and events buttons
2021-12-31 21:18:12 +00:00
shares_button_str = ''
wanted_button_str = ''
bookmarks_button_str = ''
events_button_str = ''
2020-11-10 15:12:07 +00:00
if not minimal:
2021-12-31 21:18:12 +00:00
shares_button_str = \
'<a href="' + users_path + '/tlshares"'
if box_name == 'tlshares':
shares_button_str += ' aria-current="location"'
shares_button_str += \
2022-05-25 11:04:15 +00:00
'><button class="' + shares_button + '" tabindex="2"><span>' + \
2021-12-31 21:18:12 +00:00
html_highlight_label(translate['Shares'], new_share) + \
2020-11-09 22:44:03 +00:00
'</span></button></a>'
2021-12-31 21:18:12 +00:00
wanted_button_str = \
'<a href="' + users_path + '/tlwanted"><button class="' + \
2022-05-25 11:04:15 +00:00
wanted_button + '" tabindex="2"'
if box_name == 'tlwanted':
wanted_button_str += ' aria-current="location"'
wanted_button_str += \
'><span>' + \
2021-12-31 21:18:12 +00:00
html_highlight_label(translate['Wanted'], new_wanted) + \
2021-08-09 18:41:05 +00:00
'</span></button></a>'
2021-12-31 21:18:12 +00:00
bookmarks_button_str = \
'<a href="' + users_path + '/tlbookmarks"'
if box_name == 'tlbookmarks':
bookmarks_button_str += ' aria-current="location"'
bookmarks_button_str += \
'><button class="' + \
2022-05-25 11:04:15 +00:00
bookmarks_button + '" tabindex="2">' + \
'<span>' + translate['Bookmarks'] + '</span></button></a>'
2020-11-09 22:44:03 +00:00
2021-12-31 21:18:12 +00:00
instance_title = \
2021-12-26 14:08:58 +00:00
get_config_param(base_dir, 'instanceTitle')
2021-12-31 21:18:12 +00:00
tl_str = \
html_header_with_external_style(css_filename, instance_title, None)
2020-11-10 15:12:07 +00:00
2021-12-31 21:18:12 +00:00
_log_timeline_timing(enable_timing_log, timeline_start_time, box_name, '4')
2020-11-09 22:44:03 +00:00
2020-11-10 15:12:07 +00:00
# if this is a news instance and we are viewing the news timeline
2021-12-31 21:18:12 +00:00
news_header = False
if default_timeline == 'tlfeatures' and box_name == 'tlfeatures':
news_header = True
2020-11-10 15:12:07 +00:00
2021-12-31 21:18:12 +00:00
new_post_button_str = ''
2020-11-10 15:12:07 +00:00
# start of headericons div
2021-12-31 21:18:12 +00:00
if not news_header:
2021-12-25 19:19:14 +00:00
if not icons_as_buttons:
2021-12-31 21:18:12 +00:00
new_post_button_str += '<div class="headericons">'
2020-11-10 15:12:07 +00:00
# what screen to go to when a new post is created
2021-12-31 21:18:12 +00:00
new_post_button_str += \
_html_timeline_new_post(manually_approve_followers, box_name,
2022-05-25 19:19:48 +00:00
icons_as_buttons, users_path, translate,
access_keys)
2020-11-09 22:44:03 +00:00
2021-02-05 15:30:51 +00:00
# keyboard navigation
2021-12-31 21:18:12 +00:00
tl_str += \
2021-12-29 21:55:09 +00:00
_html_timeline_keyboard(moderator, text_mode_banner,
2021-12-31 21:18:12 +00:00
users_path, nickname,
new_calendar_event, new_dm, new_reply,
new_share, new_wanted,
follow_approvals, access_keys, translate)
2020-11-09 22:44:03 +00:00
2020-11-10 15:12:07 +00:00
# banner and row of buttons
2021-12-31 21:18:12 +00:00
tl_str += \
2020-12-27 16:57:15 +00:00
'<header>\n' + \
2020-11-10 15:12:07 +00:00
'<a href="/users/' + nickname + '" title="' + \
translate['Switch to profile view'] + '" alt="' + \
2022-05-25 10:36:15 +00:00
translate['Switch to profile view'] + '" ' + \
2022-05-25 13:50:43 +00:00
'aria-flowto="containerHeader" tabindex="1" accesskey="' + \
access_keys['menuProfile'] + '">\n'
2022-03-28 08:47:53 +00:00
tl_str += '<img loading="lazy" decoding="async" ' + \
'class="timeline-banner" alt="" ' + \
2021-12-31 21:18:12 +00:00
'src="' + users_path + '/' + banner_file + '" /></a>\n' + \
2020-12-27 16:57:15 +00:00
'</header>\n'
2020-11-10 15:12:07 +00:00
2021-12-25 19:31:24 +00:00
if full_width_tl_button_header:
is_text_browser = text_mode_browser(ua_str)
2021-12-31 21:18:12 +00:00
tl_str += \
header_buttons_timeline(default_timeline, box_name, page_number,
translate, users_path, media_button,
blogs_button, features_button,
news_button, inbox_button,
dm_button, new_dm, replies_button,
new_reply, minimal, sent_button,
shares_button_str, wanted_button_str,
bookmarks_button_str,
events_button_str, moderation_button_str,
new_post_button_str, base_dir, nickname,
domain, timeline_start_time,
new_calendar_event, calendar_path,
calendar_image, follow_approvals,
icons_as_buttons, access_keys,
is_text_browser)
2020-11-10 15:12:07 +00:00
# start the timeline
2021-12-31 21:18:12 +00:00
tl_str += \
2022-05-17 19:41:09 +00:00
'<main>\n' + \
2021-07-06 12:50:38 +00:00
'<table class="timeline">\n' + \
' <colgroup>\n' + \
' <col span="1" class="column-left">\n' + \
' <col span="1" class="column-center">\n' + \
' <col span="1" class="column-right">\n' + \
' </colgroup>\n' + \
' <tbody>\n' + \
' <tr>\n'
2020-11-10 15:12:07 +00:00
2021-12-26 12:45:03 +00:00
domain_full = get_full_domain(domain, port)
2020-11-10 15:12:07 +00:00
# left column
left_column_str = ''
2022-07-13 11:48:21 +00:00
if not text_mode_browser(ua_str):
left_column_str = \
get_left_column_content(base_dir, nickname, domain_full,
http_prefix, translate,
editor, artist, False, None,
rss_icon_at_top,
True, False, theme, access_keys,
shared_items_federated_domains)
2021-12-31 21:18:12 +00:00
tl_str += ' <td valign="top" class="col-left" ' + \
2022-05-25 10:17:44 +00:00
'id="links" tabindex="-1">\n' + \
' <aside>\n' + \
2022-05-17 19:41:09 +00:00
left_column_str + \
' </aside>\n' + \
2022-05-17 19:41:09 +00:00
' </td>\n'
2020-11-10 15:12:07 +00:00
# center column containing posts
2022-05-25 10:17:44 +00:00
tl_str += ' <td valign="top" class="col-center" tabindex="-1">\n'
2020-11-10 15:12:07 +00:00
2021-12-25 19:31:24 +00:00
if not full_width_tl_button_header:
is_text_browser = text_mode_browser(ua_str)
2021-12-31 21:18:12 +00:00
tl_str += \
header_buttons_timeline(default_timeline, box_name, page_number,
translate, users_path, media_button,
blogs_button, features_button,
news_button, inbox_button,
dm_button, new_dm, replies_button,
new_reply, minimal, sent_button,
shares_button_str, wanted_button_str,
bookmarks_button_str,
events_button_str, moderation_button_str,
new_post_button_str, base_dir, nickname,
domain, timeline_start_time,
new_calendar_event, calendar_path,
calendar_image, follow_approvals,
icons_as_buttons, access_keys,
is_text_browser)
2021-12-31 21:18:12 +00:00
tl_str += \
' <div id="timelineposts" class="timeline-posts" ' + \
'itemscope itemtype="http://schema.org/Collection">\n'
2020-11-18 18:22:05 +00:00
2020-11-10 15:12:07 +00:00
# second row of buttons for moderator actions
2021-12-31 21:18:12 +00:00
tl_str += \
_html_timeline_moderation_buttons(moderator, box_name, nickname,
moderation_action_str, translate)
2020-11-09 22:44:03 +00:00
2021-12-31 21:18:12 +00:00
_log_timeline_timing(enable_timing_log, timeline_start_time, box_name, '6')
2020-11-09 22:44:03 +00:00
2021-12-31 21:18:12 +00:00
if box_name == 'tlshares':
max_shares_per_account = items_per_page
return (tl_str +
_html_shares_timeline(translate, page_number, items_per_page,
2021-12-29 21:55:09 +00:00
base_dir, actor, nickname, domain, port,
2021-12-31 21:18:12 +00:00
max_shares_per_account, http_prefix,
2021-12-29 21:55:09 +00:00
shared_items_federated_domains,
'shares') +
_html_timeline_end(base_dir, nickname, domain_full,
http_prefix, translate,
moderator, editor,
newswire, positive_voting,
show_publish_as_icon,
rss_icon_at_top, publish_button_at_top,
authorized, theme,
2021-12-31 21:18:12 +00:00
default_timeline, access_keys,
box_name,
enable_timing_log, timeline_start_time,
ua_str) +
2021-12-29 21:55:09 +00:00
html_footer())
2021-12-31 21:18:12 +00:00
elif box_name == 'tlwanted':
max_shares_per_account = items_per_page
return (tl_str +
_html_shares_timeline(translate, page_number, items_per_page,
2021-12-29 21:55:09 +00:00
base_dir, actor, nickname, domain, port,
2021-12-31 21:18:12 +00:00
max_shares_per_account, http_prefix,
2021-12-29 21:55:09 +00:00
shared_items_federated_domains,
'wanted') +
_html_timeline_end(base_dir, nickname, domain_full,
http_prefix, translate,
moderator, editor,
newswire, positive_voting,
show_publish_as_icon,
rss_icon_at_top, publish_button_at_top,
authorized, theme,
2021-12-31 21:18:12 +00:00
default_timeline, access_keys,
box_name,
enable_timing_log, timeline_start_time,
ua_str) +
2021-12-29 21:55:09 +00:00
html_footer())
2021-12-31 21:18:12 +00:00
_log_timeline_timing(enable_timing_log, timeline_start_time, box_name, '7')
2020-11-09 22:44:03 +00:00
2021-02-07 21:45:31 +00:00
# separator between posts which only appears in shell browsers
# such as Lynx and is not read by screen readers
2021-12-31 21:18:12 +00:00
if box_name != 'tlmedia':
text_mode_separator = \
'<div class="transparent"><hr></div>'
2021-02-18 20:10:26 +00:00
else:
2021-12-31 21:18:12 +00:00
text_mode_separator = ''
2021-02-07 21:45:31 +00:00
2020-11-10 15:12:07 +00:00
# page up arrow
2021-12-31 21:18:12 +00:00
if page_number > 1:
tl_str += text_mode_separator
tl_str += '<br>' + \
2022-07-08 16:33:38 +00:00
page_number_buttons(users_path, box_name, page_number,
'timelineposts')
2022-12-28 14:14:44 +00:00
first_post_str = ''
if page_number > 2:
if last_post_id:
first_post_str = ';firstpost=' + last_post_id
2021-12-31 21:18:12 +00:00
tl_str += \
2020-11-10 15:12:07 +00:00
' <center>\n' + \
2021-12-31 21:18:12 +00:00
' <a href="' + users_path + '/' + box_name + \
2022-12-28 14:14:44 +00:00
'?page=' + str(page_number - 1) + first_post_str + \
'#timelineposts" accesskey="' + access_keys['Page up'] + '" ' + \
2022-05-25 18:23:31 +00:00
'class="imageAnchor" tabindex="9">' + \
2022-03-28 08:47:53 +00:00
'<img loading="lazy" decoding="async" class="pageicon" src="/' + \
2020-12-09 13:08:26 +00:00
'icons/pageup.png" title="' + \
2020-11-10 15:12:07 +00:00
translate['Page up'] + '" alt="' + \
translate['Page up'] + '"></a>\n' + \
' </center>\n'
2020-11-09 22:44:03 +00:00
2020-11-10 15:12:07 +00:00
# show the posts
2021-12-31 21:18:12 +00:00
item_ctr = 0
if timeline_json:
if 'orderedItems' not in timeline_json:
2021-08-01 19:43:20 +00:00
print('ERROR: no orderedItems in timeline for '
2021-12-31 21:18:12 +00:00
+ box_name + ' ' + str(timeline_json))
return ''
2021-12-31 21:18:12 +00:00
use_cache_only = False
if box_name == 'inbox':
use_cache_only = True
2022-12-28 14:14:44 +00:00
first_post_id = ''
2022-11-20 16:26:15 +00:00
last_post_id = ''
2022-12-26 21:43:37 +00:00
last_item_str = ''
2021-12-31 21:18:12 +00:00
if timeline_json:
2020-11-10 15:12:07 +00:00
# if this is the media timeline then add an extra gallery container
2021-12-31 21:18:12 +00:00
if box_name == 'tlmedia':
if page_number > 1:
tl_str += '<br>'
tl_str += '<div class="galleryContainer">\n'
2020-11-09 22:44:03 +00:00
minimize_all_images = False
if nickname in min_images_for_accounts:
minimize_all_images = True
2020-11-10 15:12:07 +00:00
# show each post in the timeline
2022-11-26 16:40:59 +00:00
tl_items_str = ''
2021-12-31 21:18:12 +00:00
for item in timeline_json['orderedItems']:
2023-12-09 19:18:14 +00:00
if item['type'] in ('Create', 'Announce'):
2020-11-10 15:12:07 +00:00
# is the actor who sent this post snoozed?
2021-12-29 21:55:09 +00:00
if is_person_snoozed(base_dir, nickname, domain,
item['actor']):
2020-11-10 15:12:07 +00:00
continue
2021-12-29 21:55:09 +00:00
if is_self_announce(item):
continue
2023-04-06 09:34:39 +00:00
# is this a poll/vote/question?
2023-04-05 16:48:50 +00:00
if not show_vote_posts:
2023-04-06 09:34:39 +00:00
if is_question(item):
2023-04-05 16:48:50 +00:00
continue
2020-11-10 15:12:07 +00:00
# is the post in the memory cache of recent ones?
2021-12-31 21:18:12 +00:00
curr_tl_str = None
if box_name != 'tlmedia' and recent_posts_cache.get('html'):
2021-12-27 11:20:57 +00:00
post_id = remove_id_ending(item['id']).replace('/', '#')
2021-12-26 20:01:37 +00:00
if recent_posts_cache['html'].get(post_id):
if not first_post_id:
first_post_id = post_id
last_post_id = post_id
2021-12-31 21:18:12 +00:00
curr_tl_str = recent_posts_cache['html'][post_id]
curr_tl_str = \
2021-12-29 21:55:09 +00:00
prepare_post_from_html_cache(nickname,
2021-12-31 21:18:12 +00:00
curr_tl_str,
box_name,
page_number,
first_post_id,
ua_str,
translate)
2021-12-31 21:18:12 +00:00
_log_timeline_timing(enable_timing_log,
timeline_start_time,
box_name, '10')
if not curr_tl_str:
_log_timeline_timing(enable_timing_log,
timeline_start_time,
box_name, '11')
2020-11-09 22:44:03 +00:00
mitm = False
if item.get('mitm'):
mitm = True
2020-11-10 15:12:07 +00:00
# read the post from disk
2021-12-31 21:18:12 +00:00
curr_tl_str = \
2021-12-29 21:55:09 +00:00
individual_post_as_html(signing_priv_key_pem,
False, recent_posts_cache,
max_recent_posts,
2021-12-31 21:18:12 +00:00
translate, page_number,
2021-12-29 21:55:09 +00:00
base_dir, session,
cached_webfingers,
person_cache,
nickname, domain, port,
item, None, True,
allow_deletion,
http_prefix, project_version,
2021-12-31 21:18:12 +00:00
box_name,
2021-12-29 21:55:09 +00:00
yt_replace_domain,
twitter_replacement_domain,
show_published_date_only,
peertube_instances,
allow_local_network_access,
theme, system_language,
max_like_count,
2021-12-31 21:18:12 +00:00
box_name != 'dm',
show_individual_post_icons,
manually_approve_followers,
False, True, use_cache_only,
2022-02-25 19:12:40 +00:00
cw_lists, lists_enabled,
2022-03-24 13:14:41 +00:00
timezone, mitm,
bold_reading, dogwhistles,
minimize_all_images,
2023-01-13 15:04:48 +00:00
first_post_id, buy_sites)
2021-12-31 21:18:12 +00:00
_log_timeline_timing(enable_timing_log,
timeline_start_time, box_name, '12')
if curr_tl_str:
2022-11-26 16:40:59 +00:00
if curr_tl_str not in tl_items_str:
2023-04-06 09:34:39 +00:00
# is this a poll/vote/question?
if not show_vote_posts:
if is_html_question(curr_tl_str):
continue
2022-12-26 21:43:37 +00:00
last_item_str = text_mode_separator + curr_tl_str
2022-11-20 16:26:15 +00:00
last_post_id = \
remove_id_ending(item['id']).replace('/', '#')
2022-12-28 14:14:44 +00:00
if not first_post_id:
first_post_id = last_post_id
2021-12-31 21:18:12 +00:00
item_ctr += 1
2022-11-26 15:31:46 +00:00
if not reverse_sequence:
2022-12-26 21:43:37 +00:00
tl_items_str += last_item_str
2022-11-26 15:31:46 +00:00
if separator_str:
2022-11-26 16:40:59 +00:00
tl_items_str += separator_str
2022-11-26 15:31:46 +00:00
else:
2022-12-26 21:43:37 +00:00
tl_items_str = last_item_str + tl_items_str
2022-11-26 15:31:46 +00:00
if separator_str:
2022-11-26 16:40:59 +00:00
tl_items_str = \
2022-12-26 21:43:37 +00:00
last_item_str + \
2022-11-26 16:40:59 +00:00
separator_str + tl_items_str
tl_str += tl_items_str
2021-12-31 21:18:12 +00:00
if box_name == 'tlmedia':
tl_str += '</div>\n'
if item_ctr < 3:
print('Items added to html timeline ' + box_name + ': ' +
str(item_ctr) + ' ' + str(timeline_json['orderedItems']))
2020-11-10 15:12:07 +00:00
# page down arrow
2021-12-31 21:18:12 +00:00
if item_ctr > 0:
2022-12-26 21:43:37 +00:00
# if showing the page down icon then remove the last item so that
# firstpost does not overlap on the next timeline
2023-01-02 11:23:05 +00:00
if last_item_str and first_post_id != last_post_id:
if item_ctr > items_per_page / 2:
tl_str = tl_str.replace(last_item_str, '')
2022-12-26 21:59:24 +00:00
tl_str += text_mode_separator
2022-11-20 16:26:15 +00:00
first_post = ''
if last_post_id:
2022-11-20 16:28:46 +00:00
first_post = ';firstpost=' + last_post_id.replace('#', '--')
2022-12-28 14:14:44 +00:00
last_post = ''
if first_post_id:
last_post = ';lastpost=' + first_post_id.replace('#', '--')
2021-12-31 21:18:12 +00:00
tl_str += \
' <br>\n' + \
2020-11-10 15:12:07 +00:00
' <center>\n' + \
2021-12-31 21:18:12 +00:00
' <a href="' + users_path + '/' + box_name + '?page=' + \
2022-12-28 14:14:44 +00:00
str(page_number + 1) + last_post + first_post + \
'#timelineposts" accesskey="' + access_keys['Page down'] + '" ' + \
2022-05-25 18:23:31 +00:00
'class="imageAnchor" tabindex="9">' + \
2022-03-28 08:47:53 +00:00
'<img loading="lazy" decoding="async" class="pageicon" src="/' + \
2020-12-09 13:08:26 +00:00
'icons/pagedown.png" title="' + \
2020-11-10 15:12:07 +00:00
translate['Page down'] + '" alt="' + \
translate['Page down'] + '"></a>\n' + \
' </center>\n'
2022-07-08 16:33:38 +00:00
tl_str += page_number_buttons(users_path, box_name, page_number,
'timelineposts')
2022-05-29 12:57:31 +00:00
tl_str += '<br>'
2021-12-31 21:18:12 +00:00
tl_str += text_mode_separator
elif item_ctr == 0:
tl_str += _get_help_for_timeline(base_dir, box_name)
2020-11-18 18:22:05 +00:00
2021-12-31 21:18:12 +00:00
tl_str += \
2021-12-29 21:55:09 +00:00
_html_timeline_end(base_dir, nickname, domain_full,
http_prefix, translate,
moderator, editor,
newswire, positive_voting,
show_publish_as_icon,
rss_icon_at_top, publish_button_at_top,
authorized, theme,
2021-12-31 21:18:12 +00:00
default_timeline, access_keys,
box_name,
enable_timing_log, timeline_start_time, ua_str)
2021-12-31 21:18:12 +00:00
tl_str += html_footer()
return tl_str
2020-11-09 22:44:03 +00:00
2021-12-31 21:18:12 +00:00
def html_individual_share(domain: str, share_id: str,
actor: str, shared_item: {}, translate: {},
show_contact: bool, remove_button: bool,
2022-05-30 20:47:23 +00:00
shares_file_type: str) -> str:
2020-11-10 15:12:07 +00:00
"""Returns an individual shared item as html
"""
2021-12-31 21:18:12 +00:00
profile_str = '<div class="container">\n'
profile_str += \
'<p class="share-title">' + shared_item['displayName'] + '</p>\n'
if shared_item.get('imageUrl'):
profile_str += '<a href="' + shared_item['imageUrl'] + '">\n'
profile_str += \
2022-03-28 08:47:53 +00:00
'<img loading="lazy" decoding="async" ' + \
'src="' + shared_item['imageUrl'] + \
2020-11-10 15:12:07 +00:00
'" alt="' + translate['Item image'] + '">\n</a>\n'
2021-12-31 21:18:12 +00:00
profile_str += '<p>' + shared_item['summary'] + '</p>\n<p>'
if shared_item.get('itemQty'):
if shared_item['itemQty'] > 1:
profile_str += \
2021-07-27 20:31:14 +00:00
'<b>' + translate['Quantity'] + ':</b> ' + \
2021-12-31 21:18:12 +00:00
str(shared_item['itemQty']) + '<br>'
profile_str += \
'<b>' + translate['Type'] + ':</b> ' + shared_item['itemType'] + '<br>'
profile_str += \
2021-09-21 09:58:55 +00:00
'<b>' + translate['Category'] + ':</b> ' + \
2021-12-31 21:18:12 +00:00
shared_item['category'] + '<br>'
if shared_item.get('location'):
profile_str += \
2021-07-27 20:29:29 +00:00
'<b>' + translate['Location'] + ':</b> ' + \
2021-12-31 21:18:12 +00:00
shared_item['location'] + '<br>'
contact_title_str = translate['Contact']
if shared_item.get('itemPrice') and shared_item.get('itemCurrency'):
if is_float(shared_item['itemPrice']):
if float(shared_item['itemPrice']) > 0:
profile_str += ' ' + \
2021-07-24 22:08:11 +00:00
'<b>' + translate['Price'] + ':</b> ' + \
2021-12-31 21:18:12 +00:00
shared_item['itemPrice'] + ' ' + \
shared_item['itemCurrency']
contact_title_str = translate['Buy']
profile_str += '</p>\n'
sharedesc = shared_item['displayName']
2021-09-19 16:20:12 +00:00
if '<' not in sharedesc and ';' not in sharedesc:
2021-12-31 21:18:12 +00:00
if show_contact:
button_style_str = 'button'
if shared_item['category'] == 'accommodation':
contact_title_str = translate['Request to stay']
button_style_str = 'contactbutton'
2024-01-09 16:59:23 +00:00
contact_actor = get_actor_from_post(shared_item)
2021-12-31 21:18:12 +00:00
profile_str += \
'<p>' + \
'<a href="' + actor + \
'?replydm=sharedesc:' + sharedesc + \
2021-12-31 21:18:12 +00:00
'?mention=' + contact_actor + '">' + \
'<button class="' + button_style_str + '">' + \
contact_title_str + '</button></a>\n'
profile_str += \
'<a href="' + contact_actor + '"><button class="button">' + \
2021-09-19 16:20:12 +00:00
translate['Profile'] + '</button></a>\n'
2021-12-31 21:18:12 +00:00
if remove_button and domain in share_id:
2022-05-30 20:47:23 +00:00
if shares_file_type == 'shares':
2021-12-31 21:18:12 +00:00
profile_str += \
' <a href="' + actor + '?rmshare=' + share_id + \
2021-08-09 20:05:14 +00:00
'"><button class="button">' + \
translate['Remove'] + '</button></a>\n'
else:
2021-12-31 21:18:12 +00:00
profile_str += \
' <a href="' + actor + '?rmwanted=' + share_id + \
2021-08-09 20:05:14 +00:00
'"><button class="button">' + \
translate['Remove'] + '</button></a>\n'
2021-12-31 21:18:12 +00:00
profile_str += '</div>\n'
return profile_str
2020-11-09 22:44:03 +00:00
2021-12-31 21:18:12 +00:00
def _html_shares_timeline(translate: {}, page_number: int, items_per_page: int,
2021-12-29 21:55:09 +00:00
base_dir: str, actor: str,
nickname: str, domain: str, port: int,
2021-12-31 21:18:12 +00:00
max_shares_per_account: int, http_prefix: str,
2021-12-29 21:55:09 +00:00
shared_items_federated_domains: [],
2022-05-30 20:47:23 +00:00
shares_file_type: str) -> str:
2020-11-10 15:12:07 +00:00
"""Show shared items timeline as html
"""
2022-05-30 20:47:23 +00:00
shares_json, last_page = \
2021-12-31 21:18:12 +00:00
shares_timeline_json(actor, page_number, items_per_page,
base_dir, domain, nickname,
max_shares_per_account,
2022-05-30 20:47:23 +00:00
shared_items_federated_domains, shares_file_type)
2021-12-26 12:45:03 +00:00
domain_full = get_full_domain(domain, port)
2021-12-26 10:19:59 +00:00
actor = local_actor_url(http_prefix, nickname, domain_full)
2021-12-31 21:18:12 +00:00
admin_nickname = get_config_param(base_dir, 'admin')
admin_actor = ''
if admin_nickname:
admin_actor = \
local_actor_url(http_prefix, admin_nickname, domain_full)
timeline_str = ''
if page_number > 1:
timeline_str += '<br>' + \
2022-07-08 16:33:38 +00:00
page_number_buttons(actor, 'tl' + shares_file_type, page_number,
'timelineposts')
2021-12-31 21:18:12 +00:00
timeline_str += \
2020-11-10 15:12:07 +00:00
' <center>\n' + \
2022-05-30 20:47:23 +00:00
' <a href="' + actor + '/tl' + shares_file_type + '?page=' + \
2021-12-31 21:18:12 +00:00
str(page_number - 1) + \
'#timelineposts" class="imageAnchor" tabindex="9">' + \
2022-05-25 18:23:31 +00:00
'<img loading="lazy" decoding="async" ' + \
2022-03-28 08:47:53 +00:00
'class="pageicon" src="/' + \
2020-12-09 13:08:26 +00:00
'icons/pageup.png" title="' + translate['Page up'] + \
2020-11-10 15:12:07 +00:00
'" alt="' + translate['Page up'] + '"></a>\n' + \
' </center>\n'
2020-11-09 22:44:03 +00:00
2021-12-31 21:18:12 +00:00
separator_str = html_post_separator(base_dir, None)
2021-02-26 13:31:31 +00:00
ctr = 0
2021-12-31 21:18:12 +00:00
is_admin_account = False
if admin_actor and actor == admin_actor:
is_admin_account = True
is_moderator_account = False
2021-12-28 19:33:29 +00:00
if is_moderator(base_dir, nickname):
2021-12-31 21:18:12 +00:00
is_moderator_account = True
for _, shared_item in shares_json.items():
show_contact_button = False
2024-01-09 16:59:23 +00:00
actor_url = get_actor_from_post(shared_item)
if actor_url != actor:
2021-12-31 21:18:12 +00:00
show_contact_button = True
show_remove_button = False
if '___' + domain in shared_item['shareId']:
2024-01-09 16:59:23 +00:00
if actor_url == actor or \
2021-12-31 21:18:12 +00:00
is_admin_account or is_moderator_account:
show_remove_button = True
timeline_str += \
html_individual_share(domain, shared_item['shareId'],
actor, shared_item, translate,
show_contact_button, show_remove_button,
2022-05-30 20:47:23 +00:00
shares_file_type)
2021-12-31 21:18:12 +00:00
timeline_str += separator_str
2021-02-26 13:31:31 +00:00
ctr += 1
if ctr == 0:
2022-05-30 20:47:23 +00:00
timeline_str += \
_get_help_for_timeline(base_dir, 'tl' + shares_file_type)
2020-11-09 22:44:03 +00:00
2022-05-30 20:47:23 +00:00
if not last_page:
2021-12-31 21:18:12 +00:00
timeline_str += \
2020-11-10 15:12:07 +00:00
' <center>\n' + \
2022-05-30 20:47:23 +00:00
' <a href="' + actor + '/tl' + shares_file_type + '?page=' + \
2021-12-31 21:18:12 +00:00
str(page_number + 1) + \
'#timelineposts" class="imageAnchor" tabindex="9">' + \
2022-05-25 18:23:31 +00:00
'<img loading="lazy" decoding="async" ' + \
2022-03-28 08:47:53 +00:00
'class="pageicon" src="/' + \
2020-12-09 13:08:26 +00:00
'icons/pagedown.png" title="' + translate['Page down'] + \
2020-11-10 15:12:07 +00:00
'" alt="' + translate['Page down'] + '"></a>\n' + \
' </center>\n'
2021-12-31 21:18:12 +00:00
timeline_str += \
2022-07-08 16:33:38 +00:00
page_number_buttons(actor, 'tl' + shares_file_type, page_number,
'timelineposts')
2022-05-29 12:57:31 +00:00
timeline_str += '<br>'
2020-11-09 22:44:03 +00:00
2021-12-31 21:18:12 +00:00
return timeline_str
2020-11-09 22:44:03 +00:00
2022-07-12 19:03:30 +00:00
def html_shares(default_timeline: str,
2021-12-29 21:55:09 +00:00
recent_posts_cache: {}, max_recent_posts: int,
2021-12-31 21:18:12 +00:00
translate: {}, page_number: int, items_per_page: int,
2021-12-29 21:55:09 +00:00
session, base_dir: str,
cached_webfingers: {}, person_cache: {},
nickname: str, domain: str, port: int,
allow_deletion: bool,
http_prefix: str, project_version: str,
yt_replace_domain: str,
twitter_replacement_domain: str,
show_published_date_only: bool,
newswire: {}, positive_voting: bool,
show_publish_as_icon: bool,
full_width_tl_button_header: bool,
icons_as_buttons: bool,
rss_icon_at_top: bool,
publish_button_at_top: bool,
authorized: bool, theme: str,
peertube_instances: [],
allow_local_network_access: bool,
text_mode_banner: str,
2021-12-31 21:18:12 +00:00
access_keys: {}, system_language: str,
2021-12-29 21:55:09 +00:00
max_like_count: int,
shared_items_federated_domains: [],
signing_priv_key_pem: str,
2022-02-25 19:12:40 +00:00
cw_lists: {}, lists_enabled: str,
2022-07-05 14:40:26 +00:00
timezone: str, bold_reading: bool,
dogwhistles: {}, ua_str: str,
2022-11-26 15:31:46 +00:00
min_images_for_accounts: [],
2023-01-13 15:04:48 +00:00
reverse_sequence: bool,
buy_sites: {}) -> str:
2020-11-09 22:44:03 +00:00
"""Show the shares timeline as html
"""
2021-12-31 21:18:12 +00:00
manually_approve_followers = \
2021-12-28 20:32:11 +00:00
follower_approval_active(base_dir, nickname, domain)
2021-12-26 14:17:13 +00:00
artist = is_artist(base_dir, nickname)
2020-11-09 22:44:03 +00:00
2022-07-12 19:03:30 +00:00
return html_timeline(default_timeline,
2021-12-29 21:55:09 +00:00
recent_posts_cache, max_recent_posts,
2021-12-31 21:18:12 +00:00
translate, page_number,
items_per_page, session, base_dir,
2021-12-29 21:55:09 +00:00
cached_webfingers, person_cache,
nickname, domain, port, None,
'tlshares', allow_deletion,
http_prefix, project_version,
2021-12-31 21:18:12 +00:00
manually_approve_followers,
2021-12-29 21:55:09 +00:00
False,
yt_replace_domain,
twitter_replacement_domain,
show_published_date_only,
newswire, False, False, artist,
positive_voting, show_publish_as_icon,
full_width_tl_button_header,
icons_as_buttons, rss_icon_at_top,
publish_button_at_top,
authorized, None, theme, peertube_instances,
allow_local_network_access, text_mode_banner,
2021-12-31 21:18:12 +00:00
access_keys, system_language, max_like_count,
2021-12-29 21:55:09 +00:00
shared_items_federated_domains,
signing_priv_key_pem,
2022-03-24 13:14:41 +00:00
cw_lists, lists_enabled, timezone,
bold_reading, dogwhistles, ua_str,
2022-11-26 15:31:46 +00:00
min_images_for_accounts,
2023-01-13 15:04:48 +00:00
reverse_sequence, None, buy_sites)
2021-12-29 21:55:09 +00:00
2022-07-12 19:03:30 +00:00
def html_wanted(default_timeline: str,
2021-12-29 21:55:09 +00:00
recent_posts_cache: {}, max_recent_posts: int,
2021-12-31 21:18:12 +00:00
translate: {}, page_number: int, items_per_page: int,
2021-12-29 21:55:09 +00:00
session, base_dir: str,
cached_webfingers: {}, person_cache: {},
nickname: str, domain: str, port: int,
allow_deletion: bool,
http_prefix: str, project_version: str,
yt_replace_domain: str,
twitter_replacement_domain: str,
show_published_date_only: bool,
newswire: {}, positive_voting: bool,
show_publish_as_icon: bool,
full_width_tl_button_header: bool,
icons_as_buttons: bool,
rss_icon_at_top: bool,
publish_button_at_top: bool,
authorized: bool, theme: str,
peertube_instances: [],
allow_local_network_access: bool,
text_mode_banner: str,
2021-12-31 21:18:12 +00:00
access_keys: {}, system_language: str,
2021-12-29 21:55:09 +00:00
max_like_count: int,
shared_items_federated_domains: [],
signing_priv_key_pem: str,
2022-02-25 19:12:40 +00:00
cw_lists: {}, lists_enabled: str,
2022-07-05 14:40:26 +00:00
timezone: str, bold_reading: bool,
dogwhistles: {}, ua_str: str,
2022-11-26 15:31:46 +00:00
min_images_for_accounts: [],
2023-01-13 15:04:48 +00:00
reverse_sequence: bool,
buy_sites: {}) -> str:
2021-12-29 21:55:09 +00:00
"""Show the wanted timeline as html
"""
2021-12-31 21:18:12 +00:00
manually_approve_followers = \
2021-12-29 21:55:09 +00:00
follower_approval_active(base_dir, nickname, domain)
artist = is_artist(base_dir, nickname)
2022-07-12 19:03:30 +00:00
return html_timeline(default_timeline,
2021-12-29 21:55:09 +00:00
recent_posts_cache, max_recent_posts,
2021-12-31 21:18:12 +00:00
translate, page_number,
items_per_page, session, base_dir,
2021-12-29 21:55:09 +00:00
cached_webfingers, person_cache,
nickname, domain, port, None,
'tlwanted', allow_deletion,
http_prefix, project_version,
2021-12-31 21:18:12 +00:00
manually_approve_followers,
2021-12-29 21:55:09 +00:00
False,
yt_replace_domain,
twitter_replacement_domain,
show_published_date_only,
newswire, False, False, artist,
positive_voting, show_publish_as_icon,
full_width_tl_button_header,
icons_as_buttons, rss_icon_at_top,
publish_button_at_top,
authorized, None, theme, peertube_instances,
allow_local_network_access, text_mode_banner,
2021-12-31 21:18:12 +00:00
access_keys, system_language, max_like_count,
2021-12-29 21:55:09 +00:00
shared_items_federated_domains,
signing_priv_key_pem,
2022-03-24 13:14:41 +00:00
cw_lists, lists_enabled, timezone,
bold_reading, dogwhistles, ua_str,
2022-11-26 15:31:46 +00:00
min_images_for_accounts,
2023-01-13 15:04:48 +00:00
reverse_sequence, None, buy_sites)
2021-12-29 21:55:09 +00:00
2022-07-12 19:03:30 +00:00
def html_inbox(default_timeline: str,
2021-12-26 20:01:37 +00:00
recent_posts_cache: {}, max_recent_posts: int,
2021-12-31 21:18:12 +00:00
translate: {}, page_number: int, items_per_page: int,
2021-12-25 16:17:53 +00:00
session, base_dir: str,
2021-12-25 22:28:18 +00:00
cached_webfingers: {}, person_cache: {},
2022-05-30 20:47:23 +00:00
nickname: str, domain: str, port: int, inbox_json: {},
2021-12-25 21:29:53 +00:00
allow_deletion: bool,
2021-12-25 20:34:38 +00:00
http_prefix: str, project_version: str,
2021-12-29 21:55:09 +00:00
minimal: bool,
2021-12-25 17:15:52 +00:00
yt_replace_domain: str,
2021-12-25 20:55:47 +00:00
twitter_replacement_domain: str,
2021-12-25 20:06:27 +00:00
show_published_date_only: bool,
2021-12-25 20:14:45 +00:00
newswire: {}, positive_voting: bool,
2021-12-25 19:34:20 +00:00
show_publish_as_icon: bool,
2021-12-25 19:31:24 +00:00
full_width_tl_button_header: bool,
2021-12-25 19:19:14 +00:00
icons_as_buttons: bool,
2021-12-25 19:09:03 +00:00
rss_icon_at_top: bool,
2021-12-25 19:00:00 +00:00
publish_button_at_top: bool,
2021-08-09 18:41:05 +00:00
authorized: bool, theme: str,
2021-12-25 23:38:53 +00:00
peertube_instances: [],
2021-12-25 18:54:50 +00:00
allow_local_network_access: bool,
2021-12-25 23:09:49 +00:00
text_mode_banner: str,
2021-12-31 21:18:12 +00:00
access_keys: {}, system_language: str,
2021-12-25 18:23:12 +00:00
max_like_count: int,
2021-12-25 18:05:01 +00:00
shared_items_federated_domains: [],
2021-12-25 23:03:28 +00:00
signing_priv_key_pem: str,
2022-02-25 19:12:40 +00:00
cw_lists: {}, lists_enabled: str,
2022-07-05 14:40:26 +00:00
timezone: str, bold_reading: bool,
dogwhistles: {}, ua_str: str,
2022-11-26 15:31:46 +00:00
min_images_for_accounts: [],
2022-12-28 14:14:44 +00:00
reverse_sequence: bool,
2023-01-13 15:04:48 +00:00
last_post_id: str,
buy_sites: {}) -> str:
2020-11-09 22:44:03 +00:00
"""Show the inbox as html
"""
2021-12-31 21:18:12 +00:00
manually_approve_followers = \
2021-12-28 20:32:11 +00:00
follower_approval_active(base_dir, nickname, domain)
2021-12-26 14:17:13 +00:00
artist = is_artist(base_dir, nickname)
2020-11-09 22:44:03 +00:00
2022-07-12 19:03:30 +00:00
return html_timeline(default_timeline,
2021-12-29 21:55:09 +00:00
recent_posts_cache, max_recent_posts,
2021-12-31 21:18:12 +00:00
translate, page_number,
items_per_page, session, base_dir,
2021-12-29 21:55:09 +00:00
cached_webfingers, person_cache,
2022-05-30 20:47:23 +00:00
nickname, domain, port, inbox_json,
2021-12-29 21:55:09 +00:00
'inbox', allow_deletion,
http_prefix, project_version,
2021-12-31 21:18:12 +00:00
manually_approve_followers,
2021-12-29 21:55:09 +00:00
minimal,
yt_replace_domain,
twitter_replacement_domain,
show_published_date_only,
newswire, False, False, artist,
positive_voting, show_publish_as_icon,
full_width_tl_button_header,
icons_as_buttons, rss_icon_at_top,
publish_button_at_top,
authorized, None, theme, peertube_instances,
allow_local_network_access, text_mode_banner,
2021-12-31 21:18:12 +00:00
access_keys, system_language, max_like_count,
2021-12-29 21:55:09 +00:00
shared_items_federated_domains,
signing_priv_key_pem,
2022-03-24 13:14:41 +00:00
cw_lists, lists_enabled, timezone,
bold_reading, dogwhistles, ua_str,
2022-11-26 15:31:46 +00:00
min_images_for_accounts,
2023-01-13 15:04:48 +00:00
reverse_sequence, last_post_id,
buy_sites)
2021-12-29 21:55:09 +00:00
2022-07-12 19:03:30 +00:00
def html_bookmarks(default_timeline: str,
2021-12-29 21:55:09 +00:00
recent_posts_cache: {}, max_recent_posts: int,
2021-12-31 21:18:12 +00:00
translate: {}, page_number: int, items_per_page: int,
2021-12-29 21:55:09 +00:00
session, base_dir: str,
cached_webfingers: {}, person_cache: {},
2022-05-30 20:47:23 +00:00
nickname: str, domain: str, port: int, bookmarks_json: {},
2021-12-29 21:55:09 +00:00
allow_deletion: bool,
http_prefix: str, project_version: str,
minimal: bool,
yt_replace_domain: str,
twitter_replacement_domain: str,
show_published_date_only: bool,
newswire: {}, positive_voting: bool,
show_publish_as_icon: bool,
full_width_tl_button_header: bool,
icons_as_buttons: bool,
rss_icon_at_top: bool,
publish_button_at_top: bool,
authorized: bool, theme: str,
peertube_instances: [],
allow_local_network_access: bool,
text_mode_banner: str,
2021-12-31 21:18:12 +00:00
access_keys: {}, system_language: str,
2021-12-29 21:55:09 +00:00
max_like_count: int,
shared_items_federated_domains: [],
signing_priv_key_pem: str,
2022-02-25 19:12:40 +00:00
cw_lists: {}, lists_enabled: str,
2022-07-05 14:40:26 +00:00
timezone: str, bold_reading: bool,
dogwhistles: {}, ua_str: str,
2022-11-26 15:31:46 +00:00
min_images_for_accounts: [],
2023-01-13 15:04:48 +00:00
reverse_sequence: bool,
buy_sites: {}) -> str:
2020-11-09 22:44:03 +00:00
"""Show the bookmarks as html
"""
2021-12-31 21:18:12 +00:00
manually_approve_followers = \
2021-12-28 20:32:11 +00:00
follower_approval_active(base_dir, nickname, domain)
2021-12-26 14:17:13 +00:00
artist = is_artist(base_dir, nickname)
2020-11-09 22:44:03 +00:00
2022-07-12 19:03:30 +00:00
return html_timeline(default_timeline,
2021-12-29 21:55:09 +00:00
recent_posts_cache, max_recent_posts,
2021-12-31 21:18:12 +00:00
translate, page_number,
items_per_page, session, base_dir,
2021-12-29 21:55:09 +00:00
cached_webfingers, person_cache,
2022-05-30 20:47:23 +00:00
nickname, domain, port, bookmarks_json,
2021-12-29 21:55:09 +00:00
'tlbookmarks', allow_deletion,
http_prefix, project_version,
2021-12-31 21:18:12 +00:00
manually_approve_followers,
2021-12-29 21:55:09 +00:00
minimal,
yt_replace_domain,
twitter_replacement_domain,
show_published_date_only,
newswire, False, False, artist,
positive_voting, show_publish_as_icon,
full_width_tl_button_header,
icons_as_buttons, rss_icon_at_top,
publish_button_at_top,
authorized, None, theme, peertube_instances,
allow_local_network_access, text_mode_banner,
2021-12-31 21:18:12 +00:00
access_keys, system_language, max_like_count,
2021-12-29 21:55:09 +00:00
shared_items_federated_domains, signing_priv_key_pem,
2022-03-24 13:14:41 +00:00
cw_lists, lists_enabled, timezone,
bold_reading, dogwhistles, ua_str,
2022-11-26 15:31:46 +00:00
min_images_for_accounts,
2023-01-13 15:04:48 +00:00
reverse_sequence, None, buy_sites)
2021-12-29 21:55:09 +00:00
2022-07-12 19:03:30 +00:00
def html_inbox_dms(default_timeline: str,
2022-01-04 13:34:31 +00:00
recent_posts_cache: {}, max_recent_posts: int,
translate: {}, page_number: int, items_per_page: int,
session, base_dir: str,
cached_webfingers: {}, person_cache: {},
2022-05-30 20:47:23 +00:00
nickname: str, domain: str, port: int, inbox_json: {},
2022-01-04 13:34:31 +00:00
allow_deletion: bool,
http_prefix: str, project_version: str,
minimal: bool,
yt_replace_domain: str,
twitter_replacement_domain: str,
show_published_date_only: bool,
newswire: {}, positive_voting: bool,
show_publish_as_icon: bool,
full_width_tl_button_header: bool,
icons_as_buttons: bool,
rss_icon_at_top: bool,
publish_button_at_top: bool,
authorized: bool, theme: str,
peertube_instances: [],
allow_local_network_access: bool,
text_mode_banner: str,
access_keys: {}, system_language: str,
max_like_count: int,
shared_items_federated_domains: [],
signing_priv_key_pem: str,
2022-02-25 19:12:40 +00:00
cw_lists: {}, lists_enabled: str,
2022-07-05 14:40:26 +00:00
timezone: str, bold_reading: bool,
dogwhistles: {}, ua_str: str,
2022-11-26 15:31:46 +00:00
min_images_for_accounts: [],
2022-12-28 14:14:44 +00:00
reverse_sequence: bool,
2023-01-13 15:04:48 +00:00
last_post_id: str,
buy_sites: {}) -> str:
2020-11-09 22:44:03 +00:00
"""Show the DM timeline as html
"""
2021-12-26 14:17:13 +00:00
artist = is_artist(base_dir, nickname)
2022-07-12 19:03:30 +00:00
return html_timeline(default_timeline,
2021-12-29 21:55:09 +00:00
recent_posts_cache, max_recent_posts,
2021-12-31 21:18:12 +00:00
translate, page_number,
items_per_page, session, base_dir,
2021-12-29 21:55:09 +00:00
cached_webfingers, person_cache,
2022-05-30 20:47:23 +00:00
nickname, domain, port, inbox_json,
2021-12-29 21:55:09 +00:00
'dm', allow_deletion,
http_prefix, project_version, False, minimal,
yt_replace_domain,
twitter_replacement_domain,
show_published_date_only,
newswire, False, False, artist, positive_voting,
show_publish_as_icon,
full_width_tl_button_header,
icons_as_buttons, rss_icon_at_top,
publish_button_at_top,
authorized, None, theme, peertube_instances,
allow_local_network_access, text_mode_banner,
2021-12-31 21:18:12 +00:00
access_keys, system_language, max_like_count,
2021-12-29 21:55:09 +00:00
shared_items_federated_domains,
signing_priv_key_pem,
2022-03-24 13:14:41 +00:00
cw_lists, lists_enabled, timezone,
bold_reading, dogwhistles, ua_str,
2022-11-26 15:31:46 +00:00
min_images_for_accounts,
2023-01-13 15:04:48 +00:00
reverse_sequence, last_post_id,
buy_sites)
2021-12-29 21:55:09 +00:00
2022-07-12 19:03:30 +00:00
def html_inbox_replies(default_timeline: str,
2021-12-29 21:55:09 +00:00
recent_posts_cache: {}, max_recent_posts: int,
2021-12-31 21:18:12 +00:00
translate: {}, page_number: int, items_per_page: int,
2021-12-29 21:55:09 +00:00
session, base_dir: str,
cached_webfingers: {}, person_cache: {},
2022-05-30 20:47:23 +00:00
nickname: str, domain: str, port: int, inbox_json: {},
2021-12-29 21:55:09 +00:00
allow_deletion: bool,
http_prefix: str, project_version: str,
minimal: bool,
yt_replace_domain: str,
twitter_replacement_domain: str,
show_published_date_only: bool,
newswire: {}, positive_voting: bool,
show_publish_as_icon: bool,
full_width_tl_button_header: bool,
icons_as_buttons: bool,
rss_icon_at_top: bool,
publish_button_at_top: bool,
authorized: bool, theme: str,
peertube_instances: [],
allow_local_network_access: bool,
text_mode_banner: str,
2021-12-31 21:18:12 +00:00
access_keys: {}, system_language: str,
2021-12-29 21:55:09 +00:00
max_like_count: int,
shared_items_federated_domains: [],
signing_priv_key_pem: str,
2022-02-25 19:12:40 +00:00
cw_lists: {}, lists_enabled: str,
2022-07-05 14:40:26 +00:00
timezone: str, bold_reading: bool,
dogwhistles: {}, ua_str: str,
2022-11-26 15:31:46 +00:00
min_images_for_accounts: [],
2022-12-28 14:14:44 +00:00
reverse_sequence: bool,
2023-01-13 15:04:48 +00:00
last_post_id: str,
buy_sites: {}) -> str:
2021-12-29 21:55:09 +00:00
"""Show the replies timeline as html
"""
artist = is_artist(base_dir, nickname)
2022-07-12 19:03:30 +00:00
return html_timeline(default_timeline,
2021-12-29 21:55:09 +00:00
recent_posts_cache, max_recent_posts,
2021-12-31 21:18:12 +00:00
translate, page_number,
items_per_page, session, base_dir,
2021-12-29 21:55:09 +00:00
cached_webfingers, person_cache,
2022-05-30 20:47:23 +00:00
nickname, domain, port, inbox_json, 'tlreplies',
2021-12-29 21:55:09 +00:00
allow_deletion, http_prefix, project_version, False,
minimal,
yt_replace_domain,
twitter_replacement_domain,
show_published_date_only,
newswire, False, False, artist,
positive_voting, show_publish_as_icon,
full_width_tl_button_header,
icons_as_buttons, rss_icon_at_top,
publish_button_at_top,
authorized, None, theme, peertube_instances,
allow_local_network_access, text_mode_banner,
2021-12-31 21:18:12 +00:00
access_keys, system_language, max_like_count,
2021-12-29 21:55:09 +00:00
shared_items_federated_domains, signing_priv_key_pem,
2022-07-05 14:40:26 +00:00
cw_lists, lists_enabled, timezone, bold_reading,
2022-11-26 15:31:46 +00:00
dogwhistles, ua_str, min_images_for_accounts,
2023-01-13 15:04:48 +00:00
reverse_sequence, last_post_id, buy_sites)
2021-12-29 21:55:09 +00:00
2022-07-12 19:03:30 +00:00
def html_inbox_media(default_timeline: str,
2021-12-26 20:01:37 +00:00
recent_posts_cache: {}, max_recent_posts: int,
2021-12-31 21:18:12 +00:00
translate: {}, page_number: int, items_per_page: int,
2021-12-25 16:17:53 +00:00
session, base_dir: str,
2021-12-25 22:28:18 +00:00
cached_webfingers: {}, person_cache: {},
2022-05-30 20:47:23 +00:00
nickname: str, domain: str, port: int, inbox_json: {},
2021-12-25 21:29:53 +00:00
allow_deletion: bool,
2021-12-25 20:34:38 +00:00
http_prefix: str, project_version: str,
2021-09-18 17:08:14 +00:00
minimal: bool,
2021-12-25 17:15:52 +00:00
yt_replace_domain: str,
2021-12-25 20:55:47 +00:00
twitter_replacement_domain: str,
2021-12-25 20:06:27 +00:00
show_published_date_only: bool,
2021-12-25 20:14:45 +00:00
newswire: {}, positive_voting: bool,
2021-12-25 19:34:20 +00:00
show_publish_as_icon: bool,
2021-12-25 19:31:24 +00:00
full_width_tl_button_header: bool,
2021-12-25 19:19:14 +00:00
icons_as_buttons: bool,
2021-12-25 19:09:03 +00:00
rss_icon_at_top: bool,
2021-12-25 19:00:00 +00:00
publish_button_at_top: bool,
2020-12-23 23:59:49 +00:00
authorized: bool, theme: str,
2021-12-25 23:38:53 +00:00
peertube_instances: [],
2021-12-25 18:54:50 +00:00
allow_local_network_access: bool,
2021-12-25 23:09:49 +00:00
text_mode_banner: str,
2021-12-31 21:18:12 +00:00
access_keys: {}, system_language: str,
2021-12-25 18:23:12 +00:00
max_like_count: int,
2021-12-25 18:05:01 +00:00
shared_items_federated_domains: [],
2021-12-25 23:03:28 +00:00
signing_priv_key_pem: str,
2022-02-25 19:12:40 +00:00
cw_lists: {}, lists_enabled: str,
2022-07-05 14:40:26 +00:00
timezone: str, bold_reading: bool,
dogwhistles: {}, ua_str: str,
2022-11-26 15:31:46 +00:00
min_images_for_accounts: [],
2022-12-28 14:14:44 +00:00
reverse_sequence: bool,
2023-01-13 15:04:48 +00:00
last_post_id: str,
buy_sites: {}) -> str:
2020-11-09 22:44:03 +00:00
"""Show the media timeline as html
"""
2021-12-26 14:17:13 +00:00
artist = is_artist(base_dir, nickname)
2022-07-12 19:03:30 +00:00
return html_timeline(default_timeline,
2021-12-29 21:55:09 +00:00
recent_posts_cache, max_recent_posts,
2021-12-31 21:18:12 +00:00
translate, page_number,
items_per_page, session, base_dir,
2021-12-29 21:55:09 +00:00
cached_webfingers, person_cache,
2022-05-30 20:47:23 +00:00
nickname, domain, port, inbox_json, 'tlmedia',
2021-12-29 21:55:09 +00:00
allow_deletion, http_prefix, project_version, False,
minimal,
yt_replace_domain,
twitter_replacement_domain,
show_published_date_only,
newswire, False, False, artist,
positive_voting, show_publish_as_icon,
full_width_tl_button_header,
icons_as_buttons, rss_icon_at_top,
publish_button_at_top,
authorized, None, theme, peertube_instances,
allow_local_network_access, text_mode_banner,
2021-12-31 21:18:12 +00:00
access_keys, system_language, max_like_count,
2021-12-29 21:55:09 +00:00
shared_items_federated_domains, signing_priv_key_pem,
2022-07-05 14:40:26 +00:00
cw_lists, lists_enabled, timezone, bold_reading,
2022-11-26 15:31:46 +00:00
dogwhistles, ua_str, min_images_for_accounts,
2023-01-13 15:04:48 +00:00
reverse_sequence, last_post_id, buy_sites)
2021-12-29 21:55:09 +00:00
2022-07-12 19:03:30 +00:00
def html_inbox_blogs(default_timeline: str,
2021-12-29 21:55:09 +00:00
recent_posts_cache: {}, max_recent_posts: int,
2021-12-31 21:18:12 +00:00
translate: {}, page_number: int, items_per_page: int,
2021-12-29 21:55:09 +00:00
session, base_dir: str,
cached_webfingers: {}, person_cache: {},
2022-05-30 20:47:23 +00:00
nickname: str, domain: str, port: int, inbox_json: {},
2021-12-29 21:55:09 +00:00
allow_deletion: bool,
http_prefix: str, project_version: str,
minimal: bool,
yt_replace_domain: str,
twitter_replacement_domain: str,
show_published_date_only: bool,
newswire: {}, positive_voting: bool,
show_publish_as_icon: bool,
full_width_tl_button_header: bool,
icons_as_buttons: bool,
rss_icon_at_top: bool,
publish_button_at_top: bool,
authorized: bool, theme: str,
peertube_instances: [],
allow_local_network_access: bool,
text_mode_banner: str,
2021-12-31 21:18:12 +00:00
access_keys: {}, system_language: str,
2021-12-29 21:55:09 +00:00
max_like_count: int,
shared_items_federated_domains: [],
signing_priv_key_pem: str,
2022-02-25 19:12:40 +00:00
cw_lists: {}, lists_enabled: str,
2022-07-05 14:40:26 +00:00
timezone: str, bold_reading: bool,
dogwhistles: {}, ua_str: str,
2022-11-26 15:31:46 +00:00
min_images_for_accounts: [],
2022-12-28 14:14:44 +00:00
reverse_sequence: bool,
2023-01-13 15:04:48 +00:00
last_post_id: str,
buy_sites: {}) -> str:
2020-11-09 22:44:03 +00:00
"""Show the blogs timeline as html
"""
2021-12-26 14:17:13 +00:00
artist = is_artist(base_dir, nickname)
2022-07-12 19:03:30 +00:00
return html_timeline(default_timeline,
2021-12-29 21:55:09 +00:00
recent_posts_cache, max_recent_posts,
2021-12-31 21:18:12 +00:00
translate, page_number,
items_per_page, session, base_dir,
2021-12-29 21:55:09 +00:00
cached_webfingers, person_cache,
2022-05-30 20:47:23 +00:00
nickname, domain, port, inbox_json, 'tlblogs',
2021-12-29 21:55:09 +00:00
allow_deletion, http_prefix, project_version, False,
minimal,
yt_replace_domain,
twitter_replacement_domain,
show_published_date_only,
newswire, False, False, artist,
positive_voting, show_publish_as_icon,
full_width_tl_button_header,
icons_as_buttons, rss_icon_at_top,
publish_button_at_top,
authorized, None, theme, peertube_instances,
allow_local_network_access, text_mode_banner,
2021-12-31 21:18:12 +00:00
access_keys, system_language, max_like_count,
2021-12-29 21:55:09 +00:00
shared_items_federated_domains, signing_priv_key_pem,
2022-07-05 14:40:26 +00:00
cw_lists, lists_enabled, timezone, bold_reading,
2022-11-26 15:31:46 +00:00
dogwhistles, ua_str, min_images_for_accounts,
2023-01-13 15:04:48 +00:00
reverse_sequence, last_post_id, buy_sites)
2021-12-29 21:55:09 +00:00
2022-07-12 19:03:30 +00:00
def html_inbox_features(default_timeline: str,
2021-12-29 21:55:09 +00:00
recent_posts_cache: {}, max_recent_posts: int,
2021-12-31 21:18:12 +00:00
translate: {}, page_number: int, items_per_page: int,
2021-12-29 21:55:09 +00:00
session, base_dir: str,
cached_webfingers: {}, person_cache: {},
2022-05-30 20:47:23 +00:00
nickname: str, domain: str, port: int, inbox_json: {},
2021-12-29 21:55:09 +00:00
allow_deletion: bool,
http_prefix: str, project_version: str,
minimal: bool,
yt_replace_domain: str,
twitter_replacement_domain: str,
show_published_date_only: bool,
newswire: {}, positive_voting: bool,
show_publish_as_icon: bool,
full_width_tl_button_header: bool,
icons_as_buttons: bool,
rss_icon_at_top: bool,
publish_button_at_top: bool,
authorized: bool,
theme: str,
peertube_instances: [],
allow_local_network_access: bool,
text_mode_banner: str,
2021-12-31 21:18:12 +00:00
access_keys: {}, system_language: str,
2021-12-29 21:55:09 +00:00
max_like_count: int,
shared_items_federated_domains: [],
signing_priv_key_pem: str,
2022-02-25 19:12:40 +00:00
cw_lists: {}, lists_enabled: str,
2022-07-05 14:40:26 +00:00
timezone: str, bold_reading: bool,
dogwhistles: {}, ua_str: str,
2022-11-26 15:31:46 +00:00
min_images_for_accounts: [],
2023-01-13 15:04:48 +00:00
reverse_sequence: bool,
buy_sites: {}) -> str:
2020-11-27 11:22:47 +00:00
"""Show the features timeline as html
"""
2022-07-12 19:03:30 +00:00
return html_timeline(default_timeline,
2021-12-29 21:55:09 +00:00
recent_posts_cache, max_recent_posts,
2021-12-31 21:18:12 +00:00
translate, page_number,
items_per_page, session, base_dir,
2021-12-29 21:55:09 +00:00
cached_webfingers, person_cache,
2022-05-30 20:47:23 +00:00
nickname, domain, port, inbox_json, 'tlfeatures',
2021-12-29 21:55:09 +00:00
allow_deletion, http_prefix, project_version, False,
minimal,
yt_replace_domain,
twitter_replacement_domain,
show_published_date_only,
newswire, False, False, False,
positive_voting, show_publish_as_icon,
full_width_tl_button_header,
icons_as_buttons, rss_icon_at_top,
publish_button_at_top,
authorized, None, theme, peertube_instances,
allow_local_network_access, text_mode_banner,
2021-12-31 21:18:12 +00:00
access_keys, system_language, max_like_count,
2021-12-29 21:55:09 +00:00
shared_items_federated_domains, signing_priv_key_pem,
2022-07-05 14:40:26 +00:00
cw_lists, lists_enabled, timezone, bold_reading,
2022-11-26 15:31:46 +00:00
dogwhistles, ua_str, min_images_for_accounts,
2023-01-13 15:04:48 +00:00
reverse_sequence, None, buy_sites)
2021-12-29 21:55:09 +00:00
2022-07-12 19:03:30 +00:00
def html_inbox_news(default_timeline: str,
2021-12-29 21:55:09 +00:00
recent_posts_cache: {}, max_recent_posts: int,
2021-12-31 21:18:12 +00:00
translate: {}, page_number: int, items_per_page: int,
2021-12-29 21:55:09 +00:00
session, base_dir: str,
cached_webfingers: {}, person_cache: {},
2022-05-30 20:47:23 +00:00
nickname: str, domain: str, port: int, inbox_json: {},
2021-12-29 21:55:09 +00:00
allow_deletion: bool,
http_prefix: str, project_version: str,
minimal: bool,
yt_replace_domain: str,
twitter_replacement_domain: str,
show_published_date_only: bool,
newswire: {}, moderator: bool, editor: bool, artist: bool,
positive_voting: bool, show_publish_as_icon: bool,
full_width_tl_button_header: bool,
icons_as_buttons: bool,
rss_icon_at_top: bool,
publish_button_at_top: bool,
authorized: bool, theme: str,
peertube_instances: [],
allow_local_network_access: bool,
text_mode_banner: str,
2021-12-31 21:18:12 +00:00
access_keys: {}, system_language: str,
2021-12-29 21:55:09 +00:00
max_like_count: int,
shared_items_federated_domains: [],
signing_priv_key_pem: str,
2022-02-25 19:12:40 +00:00
cw_lists: {}, lists_enabled: str,
2022-07-05 14:40:26 +00:00
timezone: str, bold_reading: bool,
dogwhistles: {}, ua_str: str,
2022-11-26 15:31:46 +00:00
min_images_for_accounts: [],
2023-01-13 15:04:48 +00:00
reverse_sequence: bool,
buy_sites: {}) -> str:
2020-11-09 22:44:03 +00:00
"""Show the news timeline as html
"""
2022-07-12 19:03:30 +00:00
return html_timeline(default_timeline,
2021-12-29 21:55:09 +00:00
recent_posts_cache, max_recent_posts,
2021-12-31 21:18:12 +00:00
translate, page_number,
items_per_page, session, base_dir,
2021-12-29 21:55:09 +00:00
cached_webfingers, person_cache,
2022-05-30 20:47:23 +00:00
nickname, domain, port, inbox_json, 'tlnews',
2021-12-29 21:55:09 +00:00
allow_deletion, http_prefix, project_version, False,
minimal,
yt_replace_domain,
twitter_replacement_domain,
show_published_date_only,
newswire, moderator, editor, artist,
positive_voting, show_publish_as_icon,
full_width_tl_button_header,
icons_as_buttons, rss_icon_at_top,
publish_button_at_top,
authorized, None, theme, peertube_instances,
allow_local_network_access, text_mode_banner,
2021-12-31 21:18:12 +00:00
access_keys, system_language, max_like_count,
2021-12-29 21:55:09 +00:00
shared_items_federated_domains, signing_priv_key_pem,
2022-07-05 14:40:26 +00:00
cw_lists, lists_enabled, timezone, bold_reading,
2022-11-26 15:31:46 +00:00
dogwhistles, ua_str, min_images_for_accounts,
2023-01-13 15:04:48 +00:00
reverse_sequence, None, buy_sites)
2021-12-29 21:55:09 +00:00
2022-07-12 19:03:30 +00:00
def html_outbox(default_timeline: str,
2021-12-29 21:55:09 +00:00
recent_posts_cache: {}, max_recent_posts: int,
2021-12-31 21:18:12 +00:00
translate: {}, page_number: int, items_per_page: int,
2021-12-29 21:55:09 +00:00
session, base_dir: str,
cached_webfingers: {}, person_cache: {},
2022-05-30 20:47:23 +00:00
nickname: str, domain: str, port: int, outbox_json: {},
2021-12-29 21:55:09 +00:00
allow_deletion: bool,
http_prefix: str, project_version: str,
minimal: bool,
yt_replace_domain: str,
twitter_replacement_domain: str,
show_published_date_only: bool,
newswire: {}, positive_voting: bool,
show_publish_as_icon: bool,
full_width_tl_button_header: bool,
icons_as_buttons: bool,
rss_icon_at_top: bool,
publish_button_at_top: bool,
authorized: bool, theme: str,
peertube_instances: [],
allow_local_network_access: bool,
text_mode_banner: str,
2021-12-31 21:18:12 +00:00
access_keys: {}, system_language: str,
2021-12-29 21:55:09 +00:00
max_like_count: int,
shared_items_federated_domains: [],
signing_priv_key_pem: str,
2022-02-25 19:12:40 +00:00
cw_lists: {}, lists_enabled: str,
2022-07-05 14:40:26 +00:00
timezone: str, bold_reading: bool,
dogwhistles: {}, ua_str: str,
2022-11-26 15:31:46 +00:00
min_images_for_accounts: [],
2023-01-13 15:04:48 +00:00
reverse_sequence: bool,
buy_sites: {}) -> str:
2020-11-09 22:44:03 +00:00
"""Show the Outbox as html
"""
2021-12-31 21:18:12 +00:00
manually_approve_followers = \
2021-12-28 20:32:11 +00:00
follower_approval_active(base_dir, nickname, domain)
2021-12-26 14:17:13 +00:00
artist = is_artist(base_dir, nickname)
2022-07-12 19:03:30 +00:00
return html_timeline(default_timeline,
2021-12-29 21:55:09 +00:00
recent_posts_cache, max_recent_posts,
2021-12-31 21:18:12 +00:00
translate, page_number,
items_per_page, session, base_dir,
2021-12-29 21:55:09 +00:00
cached_webfingers, person_cache,
2022-05-30 20:47:23 +00:00
nickname, domain, port, outbox_json, 'outbox',
2021-12-29 21:55:09 +00:00
allow_deletion, http_prefix, project_version,
2021-12-31 21:18:12 +00:00
manually_approve_followers, minimal,
2021-12-29 21:55:09 +00:00
yt_replace_domain,
twitter_replacement_domain,
show_published_date_only,
newswire, False, False, artist, positive_voting,
show_publish_as_icon,
full_width_tl_button_header,
icons_as_buttons, rss_icon_at_top,
publish_button_at_top,
authorized, None, theme, peertube_instances,
allow_local_network_access, text_mode_banner,
2021-12-31 21:18:12 +00:00
access_keys, system_language, max_like_count,
2021-12-29 21:55:09 +00:00
shared_items_federated_domains, signing_priv_key_pem,
2022-07-05 14:40:26 +00:00
cw_lists, lists_enabled, timezone, bold_reading,
2022-11-26 15:31:46 +00:00
dogwhistles, ua_str, min_images_for_accounts,
2023-01-13 15:04:48 +00:00
reverse_sequence, None, buy_sites)