2020-11-09 22:44:03 +00:00
|
|
|
|
__filename__ = "webapp_timeline.py"
|
|
|
|
|
__author__ = "Bob Mottram"
|
|
|
|
|
__license__ = "AGPL3+"
|
2021-01-26 10:07:42 +00:00
|
|
|
|
__version__ = "1.2.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
|
2021-02-26 10:29:50 +00:00
|
|
|
|
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
|
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 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
|
2020-11-09 22:44:03 +00:00
|
|
|
|
|
|
|
|
|
|
2021-12-29 21:55:09 +00:00
|
|
|
|
def _log_timeline_timing(enableTimingLog: bool, timelineStartTime,
|
|
|
|
|
boxName: str, debugId: str) -> None:
|
2020-12-01 17:23:34 +00:00
|
|
|
|
"""Create a log of timings for performance tuning
|
|
|
|
|
"""
|
|
|
|
|
if not enableTimingLog:
|
|
|
|
|
return
|
|
|
|
|
timeDiff = int((time.time() - timelineStartTime) * 1000)
|
|
|
|
|
if timeDiff > 100:
|
|
|
|
|
print('TIMELINE TIMING ' +
|
|
|
|
|
boxName + ' ' + debugId + ' = ' + str(timeDiff))
|
|
|
|
|
|
|
|
|
|
|
2021-12-29 21:55:09 +00:00
|
|
|
|
def _get_help_for_timeline(base_dir: str, boxName: str) -> str:
|
2021-02-26 10:29:50 +00:00
|
|
|
|
"""Shows help text for the given timeline
|
|
|
|
|
"""
|
|
|
|
|
# get the filename for help for this timeline
|
2021-12-25 16:17:53 +00:00
|
|
|
|
helpFilename = base_dir + '/accounts/help_' + boxName + '.md'
|
2021-02-26 10:29:50 +00:00
|
|
|
|
if not os.path.isfile(helpFilename):
|
|
|
|
|
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-02-27 10:10:05 +00:00
|
|
|
|
defaultFilename = None
|
2021-12-25 23:35:50 +00:00
|
|
|
|
if theme_name:
|
2021-02-27 10:10:05 +00:00
|
|
|
|
defaultFilename = \
|
2021-12-25 23:35:50 +00:00
|
|
|
|
base_dir + '/theme/' + theme_name + '/welcome/' + \
|
2021-02-27 10:10:05 +00:00
|
|
|
|
'help_' + boxName + '_' + language + '.md'
|
|
|
|
|
if not os.path.isfile(defaultFilename):
|
|
|
|
|
defaultFilename = None
|
|
|
|
|
if not defaultFilename:
|
|
|
|
|
defaultFilename = \
|
2021-12-25 16:17:53 +00:00
|
|
|
|
base_dir + '/defaultwelcome/' + \
|
2021-02-27 10:10:05 +00:00
|
|
|
|
'help_' + boxName + '_' + language + '.md'
|
2021-02-26 10:29:50 +00:00
|
|
|
|
if not os.path.isfile(defaultFilename):
|
|
|
|
|
defaultFilename = \
|
2021-12-25 16:17:53 +00:00
|
|
|
|
base_dir + '/defaultwelcome/help_' + boxName + '_en.md'
|
2021-02-26 10:29:50 +00:00
|
|
|
|
if os.path.isfile(defaultFilename):
|
|
|
|
|
copyfile(defaultFilename, helpFilename)
|
|
|
|
|
|
|
|
|
|
# show help text
|
|
|
|
|
if os.path.isfile(helpFilename):
|
|
|
|
|
instanceTitle = \
|
2021-12-26 14:08:58 +00:00
|
|
|
|
get_config_param(base_dir, 'instanceTitle')
|
2021-02-26 10:29:50 +00:00
|
|
|
|
if not instanceTitle:
|
|
|
|
|
instanceTitle = 'Epicyon'
|
|
|
|
|
with open(helpFilename, 'r') as helpFile:
|
|
|
|
|
helpText = helpFile.read()
|
2021-12-27 21:42:08 +00:00
|
|
|
|
if dangerous_markup(helpText, False):
|
2021-02-26 12:58:29 +00:00
|
|
|
|
return ''
|
2021-02-26 10:29:50 +00:00
|
|
|
|
helpText = helpText.replace('INSTANCE', instanceTitle)
|
2021-02-26 12:29:42 +00:00
|
|
|
|
return '<div class="container">\n' + \
|
2021-12-29 21:55:09 +00:00
|
|
|
|
markdown_to_html(helpText) + '\n' + \
|
2021-02-26 12:42:29 +00:00
|
|
|
|
'</div>\n'
|
2021-02-26 10:29:50 +00:00
|
|
|
|
return ''
|
|
|
|
|
|
|
|
|
|
|
2021-12-29 21:55:09 +00:00
|
|
|
|
def _html_timeline_new_post(manuallyApproveFollowers: bool,
|
|
|
|
|
boxName: str, icons_as_buttons: bool,
|
|
|
|
|
usersPath: str, translate: {}) -> str:
|
2021-06-27 21:40:12 +00:00
|
|
|
|
"""Returns html for the new post button
|
|
|
|
|
"""
|
|
|
|
|
newPostButtonStr = ''
|
|
|
|
|
if boxName == 'dm':
|
2021-12-25 19:19:14 +00:00
|
|
|
|
if not icons_as_buttons:
|
2021-06-27 21:40:12 +00:00
|
|
|
|
newPostButtonStr += \
|
|
|
|
|
'<a class="imageAnchor" href="' + usersPath + \
|
|
|
|
|
'/newdm?nodropdown"><img loading="lazy" src="/' + \
|
|
|
|
|
'icons/newpost.png" title="' + \
|
|
|
|
|
translate['Create a new DM'] + \
|
|
|
|
|
'" alt="| ' + translate['Create a new DM'] + \
|
|
|
|
|
'" class="timelineicon"/></a>\n'
|
|
|
|
|
else:
|
|
|
|
|
newPostButtonStr += \
|
|
|
|
|
'<a href="' + usersPath + '/newdm?nodropdown">' + \
|
|
|
|
|
'<button class="button"><span>' + \
|
|
|
|
|
translate['Post'] + ' </span></button></a>'
|
|
|
|
|
elif (boxName == 'tlblogs' or
|
|
|
|
|
boxName == 'tlnews' or
|
|
|
|
|
boxName == 'tlfeatures'):
|
2021-12-25 19:19:14 +00:00
|
|
|
|
if not icons_as_buttons:
|
2021-06-27 21:40:12 +00:00
|
|
|
|
newPostButtonStr += \
|
|
|
|
|
'<a class="imageAnchor" href="' + usersPath + \
|
|
|
|
|
'/newblog"><img loading="lazy" src="/' + \
|
|
|
|
|
'icons/newpost.png" title="' + \
|
|
|
|
|
translate['Create a new post'] + '" alt="| ' + \
|
|
|
|
|
translate['Create a new post'] + \
|
|
|
|
|
'" class="timelineicon"/></a>\n'
|
|
|
|
|
else:
|
|
|
|
|
newPostButtonStr += \
|
|
|
|
|
'<a href="' + usersPath + '/newblog">' + \
|
|
|
|
|
'<button class="button"><span>' + \
|
|
|
|
|
translate['Post'] + '</span></button></a>'
|
|
|
|
|
elif boxName == 'tlshares':
|
2021-12-25 19:19:14 +00:00
|
|
|
|
if not icons_as_buttons:
|
2021-06-27 21:40:12 +00:00
|
|
|
|
newPostButtonStr += \
|
|
|
|
|
'<a class="imageAnchor" href="' + usersPath + \
|
|
|
|
|
'/newshare?nodropdown"><img loading="lazy" src="/' + \
|
|
|
|
|
'icons/newpost.png" title="' + \
|
|
|
|
|
translate['Create a new shared item'] + '" alt="| ' + \
|
|
|
|
|
translate['Create a new shared item'] + \
|
|
|
|
|
'" class="timelineicon"/></a>\n'
|
|
|
|
|
else:
|
|
|
|
|
newPostButtonStr += \
|
|
|
|
|
'<a href="' + usersPath + '/newshare?nodropdown">' + \
|
|
|
|
|
'<button class="button"><span>' + \
|
|
|
|
|
translate['Post'] + '</span></button></a>'
|
2021-08-09 18:41:05 +00:00
|
|
|
|
elif boxName == 'tlwanted':
|
2021-12-25 19:19:14 +00:00
|
|
|
|
if not icons_as_buttons:
|
2021-08-09 18:41:05 +00:00
|
|
|
|
newPostButtonStr += \
|
|
|
|
|
'<a class="imageAnchor" href="' + usersPath + \
|
|
|
|
|
'/newwanted?nodropdown"><img loading="lazy" src="/' + \
|
|
|
|
|
'icons/newpost.png" title="' + \
|
|
|
|
|
translate['Create a new wanted item'] + '" alt="| ' + \
|
|
|
|
|
translate['Create a new wanted item'] + \
|
|
|
|
|
'" class="timelineicon"/></a>\n'
|
|
|
|
|
else:
|
|
|
|
|
newPostButtonStr += \
|
|
|
|
|
'<a href="' + usersPath + '/newwanted?nodropdown">' + \
|
|
|
|
|
'<button class="button"><span>' + \
|
|
|
|
|
translate['Post'] + '</span></button></a>'
|
2021-06-27 21:40:12 +00:00
|
|
|
|
else:
|
|
|
|
|
if not manuallyApproveFollowers:
|
2021-12-25 19:19:14 +00:00
|
|
|
|
if not icons_as_buttons:
|
2021-06-27 21:40:12 +00:00
|
|
|
|
newPostButtonStr += \
|
|
|
|
|
'<a class="imageAnchor" href="' + usersPath + \
|
|
|
|
|
'/newpost"><img loading="lazy" src="/' + \
|
|
|
|
|
'icons/newpost.png" title="' + \
|
|
|
|
|
translate['Create a new post'] + '" alt="| ' + \
|
|
|
|
|
translate['Create a new post'] + \
|
|
|
|
|
'" class="timelineicon"/></a>\n'
|
|
|
|
|
else:
|
|
|
|
|
newPostButtonStr += \
|
|
|
|
|
'<a href="' + usersPath + '/newpost">' + \
|
|
|
|
|
'<button class="button"><span>' + \
|
|
|
|
|
translate['Post'] + '</span></button></a>'
|
|
|
|
|
else:
|
2021-12-25 19:19:14 +00:00
|
|
|
|
if not icons_as_buttons:
|
2021-06-27 21:40:12 +00:00
|
|
|
|
newPostButtonStr += \
|
|
|
|
|
'<a class="imageAnchor" href="' + usersPath + \
|
|
|
|
|
'/newfollowers"><img loading="lazy" src="/' + \
|
|
|
|
|
'icons/newpost.png" title="' + \
|
|
|
|
|
translate['Create a new post'] + \
|
|
|
|
|
'" alt="| ' + translate['Create a new post'] + \
|
|
|
|
|
'" class="timelineicon"/></a>\n'
|
|
|
|
|
else:
|
|
|
|
|
newPostButtonStr += \
|
|
|
|
|
'<a href="' + usersPath + '/newfollowers">' + \
|
|
|
|
|
'<button class="button"><span>' + \
|
|
|
|
|
translate['Post'] + '</span></button></a>'
|
|
|
|
|
return newPostButtonStr
|
|
|
|
|
|
|
|
|
|
|
2021-12-29 21:55:09 +00:00
|
|
|
|
def _html_timeline_moderation_buttons(moderator: bool, boxName: str,
|
|
|
|
|
nickname: str, moderationActionStr: str,
|
|
|
|
|
translate: {}) -> str:
|
2021-06-27 22:01:58 +00:00
|
|
|
|
"""Returns html for the moderation screen buttons
|
|
|
|
|
"""
|
|
|
|
|
tlStr = ''
|
|
|
|
|
if moderator and boxName == 'moderation':
|
|
|
|
|
tlStr += \
|
|
|
|
|
'<form id="modtimeline" method="POST" action="/users/' + \
|
|
|
|
|
nickname + '/moderationaction">'
|
|
|
|
|
tlStr += '<div class="container">\n'
|
|
|
|
|
idx = 'Nickname or URL. Block using *@domain or nickname@domain'
|
|
|
|
|
tlStr += \
|
|
|
|
|
' <b>' + translate[idx] + '</b><br>\n'
|
|
|
|
|
if moderationActionStr:
|
|
|
|
|
tlStr += ' <input type="text" ' + \
|
|
|
|
|
'name="moderationAction" value="' + \
|
|
|
|
|
moderationActionStr + '" autofocus><br>\n'
|
|
|
|
|
else:
|
|
|
|
|
tlStr += ' <input type="text" ' + \
|
|
|
|
|
'name="moderationAction" value="" autofocus><br>\n'
|
|
|
|
|
|
|
|
|
|
tlStr += \
|
|
|
|
|
' <input type="submit" title="' + \
|
|
|
|
|
translate['Information about current blocks/suspensions'] + \
|
|
|
|
|
'" alt="' + \
|
|
|
|
|
translate['Information about current blocks/suspensions'] + \
|
|
|
|
|
' | " ' + \
|
|
|
|
|
'name="submitInfo" value="' + translate['Info'] + '">\n'
|
|
|
|
|
tlStr += \
|
|
|
|
|
' <input type="submit" title="' + \
|
|
|
|
|
translate['Remove the above item'] + '" ' + \
|
|
|
|
|
'alt="' + translate['Remove the above item'] + ' | " ' + \
|
|
|
|
|
'name="submitRemove" value="' + \
|
|
|
|
|
translate['Remove'] + '">\n'
|
|
|
|
|
|
|
|
|
|
tlStr += \
|
|
|
|
|
' <input type="submit" title="' + \
|
|
|
|
|
translate['Suspend the above account nickname'] + '" ' + \
|
|
|
|
|
'alt="' + \
|
|
|
|
|
translate['Suspend the above account nickname'] + ' | " ' + \
|
|
|
|
|
'name="submitSuspend" value="' + translate['Suspend'] + '">\n'
|
|
|
|
|
tlStr += \
|
|
|
|
|
' <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'
|
|
|
|
|
|
|
|
|
|
tlStr += \
|
|
|
|
|
' <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'
|
|
|
|
|
tlStr += \
|
|
|
|
|
' <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'
|
|
|
|
|
|
|
|
|
|
tlStr += \
|
|
|
|
|
' <input type="submit" title="' + \
|
|
|
|
|
translate['Filter out words'] + '" ' + \
|
|
|
|
|
'alt="' + \
|
|
|
|
|
translate['Filter out words'] + ' | " ' + \
|
|
|
|
|
'name="submitFilter" value="' + translate['Filter'] + '">\n'
|
|
|
|
|
tlStr += \
|
|
|
|
|
' <input type="submit" title="' + \
|
|
|
|
|
translate['Unfilter words'] + '" ' + \
|
|
|
|
|
'alt="' + \
|
|
|
|
|
translate['Unfilter words'] + ' | " ' + \
|
|
|
|
|
'name="submitUnfilter" value="' + translate['Unfilter'] + '">\n'
|
|
|
|
|
|
|
|
|
|
tlStr += '</div>\n</form>\n'
|
|
|
|
|
return tlStr
|
|
|
|
|
|
|
|
|
|
|
2021-12-29 21:55:09 +00:00
|
|
|
|
def _html_timeline_keyboard(moderator: bool, text_mode_banner: str,
|
|
|
|
|
usersPath: str,
|
|
|
|
|
nickname: str, newCalendarEvent: bool,
|
|
|
|
|
newDM: bool, newReply: bool,
|
|
|
|
|
newShare: bool, newWanted: bool,
|
|
|
|
|
followApprovals: bool,
|
|
|
|
|
accessKeys: {}, translate: {}) -> str:
|
2021-06-27 22:14:48 +00:00
|
|
|
|
"""Returns html for timeline keyboard navigation
|
|
|
|
|
"""
|
|
|
|
|
calendarStr = translate['Calendar']
|
|
|
|
|
if newCalendarEvent:
|
|
|
|
|
calendarStr = '<strong>' + calendarStr + '</strong>'
|
|
|
|
|
dmStr = translate['DM']
|
|
|
|
|
if newDM:
|
|
|
|
|
dmStr = '<strong>' + dmStr + '</strong>'
|
|
|
|
|
repliesStr = translate['Replies']
|
|
|
|
|
if newReply:
|
|
|
|
|
repliesStr = '<strong>' + repliesStr + '</strong>'
|
|
|
|
|
sharesStr = translate['Shares']
|
|
|
|
|
if newShare:
|
|
|
|
|
sharesStr = '<strong>' + sharesStr + '</strong>'
|
2021-08-09 18:41:05 +00:00
|
|
|
|
wantedStr = translate['Wanted']
|
|
|
|
|
if newWanted:
|
|
|
|
|
wantedStr = '<strong>' + wantedStr + '</strong>'
|
2021-06-27 22:14:48 +00:00
|
|
|
|
menuProfile = \
|
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']
|
|
|
|
|
menuInbox = \
|
2021-12-29 21:55:09 +00:00
|
|
|
|
html_hide_from_screen_reader('📥') + ' ' + translate['Inbox']
|
2021-06-27 22:14:48 +00:00
|
|
|
|
menuOutbox = \
|
2021-12-29 21:55:09 +00:00
|
|
|
|
html_hide_from_screen_reader('📤') + ' ' + translate['Sent']
|
2021-06-27 22:14:48 +00:00
|
|
|
|
menuSearch = \
|
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']
|
|
|
|
|
menuCalendar = \
|
2021-12-29 21:55:09 +00:00
|
|
|
|
html_hide_from_screen_reader('📅') + ' ' + calendarStr
|
2021-06-27 22:14:48 +00:00
|
|
|
|
menuDM = \
|
2021-12-29 21:55:09 +00:00
|
|
|
|
html_hide_from_screen_reader('📩') + ' ' + dmStr
|
2021-06-27 22:14:48 +00:00
|
|
|
|
menuReplies = \
|
2021-12-29 21:55:09 +00:00
|
|
|
|
html_hide_from_screen_reader('📨') + ' ' + repliesStr
|
2021-06-27 22:14:48 +00:00
|
|
|
|
menuBookmarks = \
|
2021-12-29 21:55:09 +00:00
|
|
|
|
html_hide_from_screen_reader('🔖') + ' ' + translate['Bookmarks']
|
2021-06-27 22:14:48 +00:00
|
|
|
|
menuShares = \
|
2021-12-29 21:55:09 +00:00
|
|
|
|
html_hide_from_screen_reader('🤝') + ' ' + sharesStr
|
2021-08-09 18:41:05 +00:00
|
|
|
|
menuWanted = \
|
2021-12-29 21:55:09 +00:00
|
|
|
|
html_hide_from_screen_reader('⛱') + ' ' + wantedStr
|
2021-06-27 22:14:48 +00:00
|
|
|
|
menuBlogs = \
|
2021-12-29 21:55:09 +00:00
|
|
|
|
html_hide_from_screen_reader('📝') + ' ' + translate['Blogs']
|
2021-06-27 22:14:48 +00:00
|
|
|
|
menuNewswire = \
|
2021-12-29 21:55:09 +00:00
|
|
|
|
html_hide_from_screen_reader('📰') + ' ' + translate['Newswire']
|
2021-06-27 22:14:48 +00:00
|
|
|
|
menuLinks = \
|
2021-12-29 21:55:09 +00:00
|
|
|
|
html_hide_from_screen_reader('🔗') + ' ' + translate['Links']
|
2021-06-27 22:14:48 +00:00
|
|
|
|
menuNewPost = \
|
2021-12-29 21:55:09 +00:00
|
|
|
|
html_hide_from_screen_reader('➕') + ' ' + \
|
|
|
|
|
translate['Create a new post']
|
2021-06-27 22:14:48 +00:00
|
|
|
|
menuModeration = \
|
2021-12-29 21:55:09 +00:00
|
|
|
|
html_hide_from_screen_reader('⚡️') + ' ' + translate['Mod']
|
2021-06-27 22:14:48 +00:00
|
|
|
|
navLinks = {
|
|
|
|
|
menuProfile: '/users/' + nickname,
|
|
|
|
|
menuInbox: usersPath + '/inbox#timelineposts',
|
|
|
|
|
menuSearch: usersPath + '/search',
|
|
|
|
|
menuNewPost: usersPath + '/newpost',
|
|
|
|
|
menuCalendar: usersPath + '/calendar',
|
|
|
|
|
menuDM: usersPath + '/dm#timelineposts',
|
|
|
|
|
menuReplies: usersPath + '/tlreplies#timelineposts',
|
|
|
|
|
menuOutbox: usersPath + '/outbox#timelineposts',
|
|
|
|
|
menuBookmarks: usersPath + '/tlbookmarks#timelineposts',
|
|
|
|
|
menuShares: usersPath + '/tlshares#timelineposts',
|
2021-08-09 18:41:05 +00:00
|
|
|
|
menuWanted: usersPath + '/tlwanted#timelineposts',
|
2021-06-27 22:14:48 +00:00
|
|
|
|
menuBlogs: usersPath + '/tlblogs#timelineposts',
|
|
|
|
|
menuNewswire: usersPath + '/newswiremobile',
|
|
|
|
|
menuLinks: usersPath + '/linksmobile'
|
|
|
|
|
}
|
|
|
|
|
navAccessKeys = {}
|
|
|
|
|
for variableName, key in accessKeys.items():
|
|
|
|
|
if not locals().get(variableName):
|
|
|
|
|
continue
|
|
|
|
|
navAccessKeys[locals()[variableName]] = key
|
|
|
|
|
if moderator:
|
|
|
|
|
navLinks[menuModeration] = usersPath + '/moderation#modtimeline'
|
2021-12-29 21:55:09 +00:00
|
|
|
|
return html_keyboard_navigation(text_mode_banner, navLinks, navAccessKeys,
|
|
|
|
|
None, usersPath, translate,
|
|
|
|
|
followApprovals)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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,
|
|
|
|
|
defaultTimeline: str, accessKeys: {},
|
|
|
|
|
boxName: str,
|
|
|
|
|
enableTimingLog: bool, timelineStartTime) -> str:
|
2021-07-28 11:26:03 +00:00
|
|
|
|
"""Ending of the timeline, containing the right column
|
|
|
|
|
"""
|
|
|
|
|
# end of timeline-posts
|
|
|
|
|
tlStr = ' </div>\n'
|
|
|
|
|
|
|
|
|
|
# end of column-center
|
|
|
|
|
tlStr += ' </td>\n'
|
|
|
|
|
|
|
|
|
|
# right column
|
2021-12-29 21:55:09 +00:00
|
|
|
|
rightColumnStr = 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,
|
|
|
|
|
defaultTimeline, accessKeys)
|
2021-07-28 11:26:03 +00:00
|
|
|
|
tlStr += ' <td valign="top" class="col-right" ' + \
|
|
|
|
|
'id="newswire" tabindex="-1">' + \
|
|
|
|
|
rightColumnStr + ' </td>\n'
|
|
|
|
|
tlStr += ' </tr>\n'
|
|
|
|
|
|
2021-12-29 21:55:09 +00:00
|
|
|
|
_log_timeline_timing(enableTimingLog, timelineStartTime, boxName, '9')
|
2021-07-28 11:26:03 +00:00
|
|
|
|
|
|
|
|
|
tlStr += ' </tbody>\n'
|
|
|
|
|
tlStr += '</table>\n'
|
|
|
|
|
return tlStr
|
|
|
|
|
|
|
|
|
|
|
2021-12-29 21:55:09 +00:00
|
|
|
|
def _page_number_buttons(usersPath: str, boxName: str, pageNumber: int) -> str:
|
2021-09-24 17:26:21 +00:00
|
|
|
|
"""Shows selactable page numbers at the bottom of the screen
|
|
|
|
|
"""
|
2021-09-24 17:37:46 +00:00
|
|
|
|
pagesWidth = 3
|
2021-09-24 17:26:21 +00:00
|
|
|
|
minPageNumber = pageNumber - pagesWidth
|
|
|
|
|
if minPageNumber < 1:
|
|
|
|
|
minPageNumber = 1
|
|
|
|
|
maxPageNumber = minPageNumber + 1 + (pagesWidth * 2)
|
|
|
|
|
numStr = ''
|
2021-09-24 17:42:14 +00:00
|
|
|
|
for page in range(minPageNumber, maxPageNumber):
|
2021-09-24 17:26:21 +00:00
|
|
|
|
if numStr:
|
2021-09-24 17:47:06 +00:00
|
|
|
|
numStr += ' ⸻ '
|
2021-09-24 17:26:21 +00:00
|
|
|
|
pageStr = str(page)
|
|
|
|
|
if page == pageNumber:
|
2021-09-24 21:41:27 +00:00
|
|
|
|
pageStr = '<mark>' + str(page) + '</mark>'
|
2021-09-24 17:26:21 +00:00
|
|
|
|
numStr += \
|
|
|
|
|
'<a href="' + usersPath + '/' + boxName + '?page=' + \
|
|
|
|
|
str(page) + '" class="pageslist">' + pageStr + '</a>'
|
2021-09-24 17:34:35 +00:00
|
|
|
|
return '<center>' + numStr + '</center>'
|
2021-09-24 17:26:21 +00:00
|
|
|
|
|
|
|
|
|
|
2021-12-29 21:55:09 +00:00
|
|
|
|
def html_timeline(css_cache: {}, defaultTimeline: str,
|
|
|
|
|
recent_posts_cache: {}, max_recent_posts: int,
|
|
|
|
|
translate: {}, pageNumber: int,
|
|
|
|
|
itemsPerPage: int, session, base_dir: str,
|
|
|
|
|
cached_webfingers: {}, person_cache: {},
|
|
|
|
|
nickname: str, domain: str, port: int, timelineJson: {},
|
|
|
|
|
boxName: str, allow_deletion: bool,
|
|
|
|
|
http_prefix: str, project_version: str,
|
|
|
|
|
manuallyApproveFollowers: bool,
|
|
|
|
|
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,
|
|
|
|
|
moderationActionStr: str,
|
|
|
|
|
theme: str,
|
|
|
|
|
peertube_instances: [],
|
|
|
|
|
allow_local_network_access: bool,
|
|
|
|
|
text_mode_banner: str,
|
|
|
|
|
accessKeys: {}, system_language: str,
|
|
|
|
|
max_like_count: int,
|
|
|
|
|
shared_items_federated_domains: [],
|
|
|
|
|
signing_priv_key_pem: str,
|
|
|
|
|
cw_lists: {}, lists_enabled: str) -> str:
|
2020-11-10 15:12:07 +00:00
|
|
|
|
"""Show the timeline as html
|
2020-11-09 22:44:03 +00:00
|
|
|
|
"""
|
2020-12-01 17:23:34 +00:00
|
|
|
|
enableTimingLog = False
|
|
|
|
|
|
2020-11-10 15:12:07 +00:00
|
|
|
|
timelineStartTime = time.time()
|
2020-11-09 22:44:03 +00:00
|
|
|
|
|
2021-12-26 12:02:29 +00:00
|
|
|
|
accountDir = 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?
|
|
|
|
|
newCalendarEvent = False
|
|
|
|
|
calendarImage = 'calendar.png'
|
|
|
|
|
calendarPath = '/calendar'
|
|
|
|
|
calendarFile = accountDir + '/.newCalendar'
|
|
|
|
|
if os.path.isfile(calendarFile):
|
|
|
|
|
newCalendarEvent = True
|
|
|
|
|
calendarImage = 'calendar_notify.png'
|
|
|
|
|
with open(calendarFile, 'r') as calfile:
|
|
|
|
|
calendarPath = calfile.read().replace('##sent##', '')
|
|
|
|
|
calendarPath = calendarPath.replace('\n', '').replace('\r', '')
|
2020-11-09 22:44:03 +00:00
|
|
|
|
|
2020-11-10 15:12:07 +00:00
|
|
|
|
# should the DM button be highlighted?
|
|
|
|
|
newDM = False
|
|
|
|
|
dmFile = accountDir + '/.newDM'
|
|
|
|
|
if os.path.isfile(dmFile):
|
|
|
|
|
newDM = True
|
|
|
|
|
if boxName == 'dm':
|
2021-09-05 10:17:43 +00:00
|
|
|
|
try:
|
|
|
|
|
os.remove(dmFile)
|
2021-11-25 18:42:38 +00:00
|
|
|
|
except OSError:
|
2021-12-29 21:55:09 +00:00
|
|
|
|
print('EX: html_timeline unable to delete ' + dmFile)
|
2020-11-09 22:44:03 +00:00
|
|
|
|
|
2020-11-10 15:12:07 +00:00
|
|
|
|
# should the Replies button be highlighted?
|
|
|
|
|
newReply = False
|
|
|
|
|
replyFile = accountDir + '/.newReply'
|
|
|
|
|
if os.path.isfile(replyFile):
|
|
|
|
|
newReply = True
|
|
|
|
|
if boxName == 'tlreplies':
|
2021-09-05 10:17:43 +00:00
|
|
|
|
try:
|
|
|
|
|
os.remove(replyFile)
|
2021-11-25 18:42:38 +00:00
|
|
|
|
except OSError:
|
2021-12-29 21:55:09 +00:00
|
|
|
|
print('EX: html_timeline unable to delete ' + replyFile)
|
2020-11-09 22:44:03 +00:00
|
|
|
|
|
2020-11-10 15:12:07 +00:00
|
|
|
|
# should the Shares button be highlighted?
|
|
|
|
|
newShare = False
|
|
|
|
|
newShareFile = accountDir + '/.newShare'
|
|
|
|
|
if os.path.isfile(newShareFile):
|
|
|
|
|
newShare = True
|
|
|
|
|
if boxName == 'tlshares':
|
2021-09-05 10:17:43 +00:00
|
|
|
|
try:
|
|
|
|
|
os.remove(newShareFile)
|
2021-11-25 18:42:38 +00:00
|
|
|
|
except OSError:
|
2021-12-29 21:55:09 +00:00
|
|
|
|
print('EX: html_timeline unable to delete ' + newShareFile)
|
2020-11-09 22:44:03 +00:00
|
|
|
|
|
2021-08-09 18:41:05 +00:00
|
|
|
|
# should the Wanted button be highlighted?
|
|
|
|
|
newWanted = False
|
|
|
|
|
newWantedFile = accountDir + '/.newWanted'
|
|
|
|
|
if os.path.isfile(newWantedFile):
|
|
|
|
|
newWanted = True
|
|
|
|
|
if boxName == 'tlwanted':
|
2021-09-05 10:17:43 +00:00
|
|
|
|
try:
|
|
|
|
|
os.remove(newWantedFile)
|
2021-11-25 18:42:38 +00:00
|
|
|
|
except OSError:
|
2021-12-29 21:55:09 +00:00
|
|
|
|
print('EX: html_timeline unable to delete ' + newWantedFile)
|
2021-08-09 18:41:05 +00:00
|
|
|
|
|
2020-11-10 15:12:07 +00:00
|
|
|
|
# should the Moderation/reports button be highlighted?
|
|
|
|
|
newReport = False
|
|
|
|
|
newReportFile = accountDir + '/.newReport'
|
|
|
|
|
if os.path.isfile(newReportFile):
|
|
|
|
|
newReport = True
|
|
|
|
|
if boxName == 'moderation':
|
2021-09-05 10:17:43 +00:00
|
|
|
|
try:
|
|
|
|
|
os.remove(newReportFile)
|
2021-11-25 18:42:38 +00:00
|
|
|
|
except OSError:
|
2021-12-29 21:55:09 +00:00
|
|
|
|
print('EX: html_timeline unable to delete ' + newReportFile)
|
2020-11-09 22:44:03 +00:00
|
|
|
|
|
2020-11-10 15:12:07 +00:00
|
|
|
|
separatorStr = ''
|
|
|
|
|
if boxName != 'tlmedia':
|
2021-12-29 21:55:09 +00:00
|
|
|
|
separatorStr = 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-25 16:17:53 +00:00
|
|
|
|
cssFilename = base_dir + '/epicyon-profile.css'
|
|
|
|
|
if os.path.isfile(base_dir + '/epicyon.css'):
|
|
|
|
|
cssFilename = 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
|
2020-12-20 17:29:15 +00:00
|
|
|
|
bannerFile, bannerFilename = \
|
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-29 21:55:09 +00:00
|
|
|
|
_log_timeline_timing(enableTimingLog, timelineStartTime, boxName, '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-29 21:55:09 +00:00
|
|
|
|
_log_timeline_timing(enableTimingLog, timelineStartTime, boxName, '2')
|
2020-11-09 22:44:03 +00:00
|
|
|
|
|
2020-11-10 15:12:07 +00:00
|
|
|
|
# the appearance of buttons - highlighted or not
|
|
|
|
|
inboxButton = 'button'
|
|
|
|
|
blogsButton = 'button'
|
2020-11-27 12:42:51 +00:00
|
|
|
|
featuresButton = 'button'
|
2020-11-10 15:12:07 +00:00
|
|
|
|
newsButton = 'button'
|
|
|
|
|
dmButton = 'button'
|
|
|
|
|
if newDM:
|
|
|
|
|
dmButton = 'buttonhighlighted'
|
|
|
|
|
repliesButton = 'button'
|
|
|
|
|
if newReply:
|
|
|
|
|
repliesButton = 'buttonhighlighted'
|
|
|
|
|
mediaButton = 'button'
|
|
|
|
|
bookmarksButton = 'button'
|
2021-02-08 17:23:17 +00:00
|
|
|
|
# eventsButton = 'button'
|
2020-11-10 15:12:07 +00:00
|
|
|
|
sentButton = 'button'
|
|
|
|
|
sharesButton = 'button'
|
|
|
|
|
if newShare:
|
|
|
|
|
sharesButton = 'buttonhighlighted'
|
2021-08-09 18:41:05 +00:00
|
|
|
|
wantedButton = 'button'
|
|
|
|
|
if newWanted:
|
|
|
|
|
wantedButton = 'buttonhighlighted'
|
2020-11-10 15:12:07 +00:00
|
|
|
|
moderationButton = 'button'
|
|
|
|
|
if newReport:
|
|
|
|
|
moderationButton = 'buttonhighlighted'
|
|
|
|
|
if boxName == 'inbox':
|
|
|
|
|
inboxButton = 'buttonselected'
|
|
|
|
|
elif boxName == 'tlblogs':
|
|
|
|
|
blogsButton = 'buttonselected'
|
2020-11-27 12:42:51 +00:00
|
|
|
|
elif boxName == 'tlfeatures':
|
|
|
|
|
featuresButton = 'buttonselected'
|
2020-11-10 15:12:07 +00:00
|
|
|
|
elif boxName == 'tlnews':
|
|
|
|
|
newsButton = 'buttonselected'
|
|
|
|
|
elif boxName == 'dm':
|
|
|
|
|
dmButton = 'buttonselected'
|
|
|
|
|
if newDM:
|
|
|
|
|
dmButton = 'buttonselectedhighlighted'
|
|
|
|
|
elif boxName == 'tlreplies':
|
|
|
|
|
repliesButton = 'buttonselected'
|
|
|
|
|
if newReply:
|
|
|
|
|
repliesButton = 'buttonselectedhighlighted'
|
|
|
|
|
elif boxName == 'tlmedia':
|
|
|
|
|
mediaButton = 'buttonselected'
|
|
|
|
|
elif boxName == 'outbox':
|
|
|
|
|
sentButton = 'buttonselected'
|
|
|
|
|
elif boxName == 'moderation':
|
|
|
|
|
moderationButton = 'buttonselected'
|
|
|
|
|
if newReport:
|
|
|
|
|
moderationButton = 'buttonselectedhighlighted'
|
|
|
|
|
elif boxName == 'tlshares':
|
|
|
|
|
sharesButton = 'buttonselected'
|
|
|
|
|
if newShare:
|
|
|
|
|
sharesButton = 'buttonselectedhighlighted'
|
2021-08-09 18:41:05 +00:00
|
|
|
|
elif boxName == 'tlwanted':
|
|
|
|
|
wantedButton = 'buttonselected'
|
|
|
|
|
if newWanted:
|
|
|
|
|
wantedButton = 'buttonselectedhighlighted'
|
2020-11-10 15:12:07 +00:00
|
|
|
|
elif boxName == 'tlbookmarks' or boxName == 'bookmarks':
|
|
|
|
|
bookmarksButton = '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-26 12:45:03 +00:00
|
|
|
|
fullDomain = get_full_domain(domain, port)
|
2020-11-09 22:44:03 +00:00
|
|
|
|
|
2020-11-10 15:12:07 +00:00
|
|
|
|
usersPath = '/users/' + nickname
|
2021-12-25 17:09:22 +00:00
|
|
|
|
actor = http_prefix + '://' + fullDomain + usersPath
|
2020-11-09 22:44:03 +00:00
|
|
|
|
|
2020-11-10 15:12:07 +00:00
|
|
|
|
showIndividualPostIcons = True
|
|
|
|
|
|
|
|
|
|
# show an icon for new follow approvals
|
|
|
|
|
followApprovals = ''
|
|
|
|
|
followRequestsFilename = \
|
2021-12-26 12:02:29 +00:00
|
|
|
|
acct_dir(base_dir, nickname, domain) + '/followrequests.txt'
|
2020-11-10 15:12:07 +00:00
|
|
|
|
if os.path.isfile(followRequestsFilename):
|
|
|
|
|
with open(followRequestsFilename, 'r') as f:
|
|
|
|
|
for line in f:
|
|
|
|
|
if len(line) > 0:
|
|
|
|
|
# show follow approvals icon
|
|
|
|
|
followApprovals = \
|
2020-11-09 22:44:03 +00:00
|
|
|
|
'<a href="' + usersPath + \
|
2021-04-23 12:24:34 +00:00
|
|
|
|
'/followers#buttonheader" ' + \
|
|
|
|
|
'accesskey="' + accessKeys['followButton'] + '">' + \
|
2020-11-10 15:12:07 +00:00
|
|
|
|
'<img loading="lazy" ' + \
|
|
|
|
|
'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-29 21:55:09 +00:00
|
|
|
|
_log_timeline_timing(enableTimingLog, timelineStartTime, boxName, '3')
|
2020-11-10 15:12:07 +00:00
|
|
|
|
|
|
|
|
|
# moderation / reports button
|
|
|
|
|
moderationButtonStr = ''
|
|
|
|
|
if moderator and not minimal:
|
|
|
|
|
moderationButtonStr = \
|
2020-11-09 22:44:03 +00:00
|
|
|
|
'<a href="' + usersPath + \
|
2020-11-10 15:12:07 +00:00
|
|
|
|
'/moderation"><button class="' + \
|
|
|
|
|
moderationButton + '"><span>' + \
|
2021-12-29 21:55:09 +00:00
|
|
|
|
html_highlight_label(translate['Mod'], newReport) + \
|
2020-11-10 15:12:07 +00:00
|
|
|
|
' </span></button></a>'
|
|
|
|
|
|
|
|
|
|
# shares, bookmarks and events buttons
|
|
|
|
|
sharesButtonStr = ''
|
2021-08-09 18:53:27 +00:00
|
|
|
|
wantedButtonStr = ''
|
2020-11-10 15:12:07 +00:00
|
|
|
|
bookmarksButtonStr = ''
|
|
|
|
|
eventsButtonStr = ''
|
|
|
|
|
if not minimal:
|
|
|
|
|
sharesButtonStr = \
|
|
|
|
|
'<a href="' + usersPath + '/tlshares"><button class="' + \
|
|
|
|
|
sharesButton + '"><span>' + \
|
2021-12-29 21:55:09 +00:00
|
|
|
|
html_highlight_label(translate['Shares'], newShare) + \
|
2020-11-09 22:44:03 +00:00
|
|
|
|
'</span></button></a>'
|
|
|
|
|
|
2021-08-09 18:41:05 +00:00
|
|
|
|
wantedButtonStr = \
|
|
|
|
|
'<a href="' + usersPath + '/tlwanted"><button class="' + \
|
|
|
|
|
wantedButton + '"><span>' + \
|
2021-12-29 21:55:09 +00:00
|
|
|
|
html_highlight_label(translate['Wanted'], newWanted) + \
|
2021-08-09 18:41:05 +00:00
|
|
|
|
'</span></button></a>'
|
|
|
|
|
|
2020-11-10 15:12:07 +00:00
|
|
|
|
bookmarksButtonStr = \
|
|
|
|
|
'<a href="' + usersPath + '/tlbookmarks"><button class="' + \
|
|
|
|
|
bookmarksButton + '"><span>' + translate['Bookmarks'] + \
|
|
|
|
|
'</span></button></a>'
|
2020-11-09 22:44:03 +00:00
|
|
|
|
|
2021-01-11 19:46:21 +00:00
|
|
|
|
instanceTitle = \
|
2021-12-26 14:08:58 +00:00
|
|
|
|
get_config_param(base_dir, 'instanceTitle')
|
2021-12-29 21:55:09 +00:00
|
|
|
|
tlStr = html_header_with_external_style(cssFilename, instanceTitle, None)
|
2020-11-10 15:12:07 +00:00
|
|
|
|
|
2021-12-29 21:55:09 +00:00
|
|
|
|
_log_timeline_timing(enableTimingLog, timelineStartTime, boxName, '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
|
|
|
|
|
newsHeader = False
|
2020-11-27 12:52:01 +00:00
|
|
|
|
if defaultTimeline == 'tlfeatures' and boxName == 'tlfeatures':
|
2020-11-10 15:12:07 +00:00
|
|
|
|
newsHeader = True
|
|
|
|
|
|
|
|
|
|
newPostButtonStr = ''
|
|
|
|
|
# start of headericons div
|
|
|
|
|
if not newsHeader:
|
2021-12-25 19:19:14 +00:00
|
|
|
|
if not icons_as_buttons:
|
2020-11-10 15:12:07 +00:00
|
|
|
|
newPostButtonStr += '<div class="headericons">'
|
|
|
|
|
|
|
|
|
|
# what screen to go to when a new post is created
|
2021-06-27 21:40:12 +00:00
|
|
|
|
newPostButtonStr += \
|
2021-12-29 21:55:09 +00:00
|
|
|
|
_html_timeline_new_post(manuallyApproveFollowers, boxName,
|
|
|
|
|
icons_as_buttons, usersPath, translate)
|
2020-11-09 22:44:03 +00:00
|
|
|
|
|
2021-02-05 15:30:51 +00:00
|
|
|
|
# keyboard navigation
|
2021-06-27 22:14:48 +00:00
|
|
|
|
tlStr += \
|
2021-12-29 21:55:09 +00:00
|
|
|
|
_html_timeline_keyboard(moderator, text_mode_banner,
|
|
|
|
|
usersPath, nickname,
|
|
|
|
|
newCalendarEvent, newDM, newReply,
|
|
|
|
|
newShare, newWanted,
|
|
|
|
|
followApprovals, accessKeys, translate)
|
2020-11-09 22:44:03 +00:00
|
|
|
|
|
2020-11-10 15:12:07 +00:00
|
|
|
|
# banner and row of buttons
|
|
|
|
|
tlStr += \
|
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="' + \
|
|
|
|
|
translate['Switch to profile view'] + '">\n'
|
2021-02-01 18:38:08 +00:00
|
|
|
|
tlStr += '<img loading="lazy" class="timeline-banner" ' + \
|
2021-02-01 19:48:46 +00:00
|
|
|
|
'alt="" ' + \
|
2021-02-01 18:38:08 +00:00
|
|
|
|
'src="' + usersPath + '/' + bannerFile + '" /></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:
|
2020-11-09 22:44:03 +00:00
|
|
|
|
tlStr += \
|
2021-12-29 21:55:09 +00:00
|
|
|
|
header_buttons_timeline(defaultTimeline, boxName, pageNumber,
|
|
|
|
|
translate, usersPath, mediaButton,
|
|
|
|
|
blogsButton, featuresButton,
|
|
|
|
|
newsButton, inboxButton,
|
|
|
|
|
dmButton, newDM, repliesButton,
|
|
|
|
|
newReply, minimal, sentButton,
|
|
|
|
|
sharesButtonStr, wantedButtonStr,
|
|
|
|
|
bookmarksButtonStr,
|
|
|
|
|
eventsButtonStr, moderationButtonStr,
|
|
|
|
|
newPostButtonStr, base_dir, nickname,
|
|
|
|
|
domain, timelineStartTime,
|
|
|
|
|
newCalendarEvent, calendarPath,
|
|
|
|
|
calendarImage, followApprovals,
|
|
|
|
|
icons_as_buttons, accessKeys)
|
2020-11-10 15:12:07 +00:00
|
|
|
|
|
|
|
|
|
# start the timeline
|
2021-07-06 12:50:38 +00:00
|
|
|
|
tlStr += \
|
|
|
|
|
'<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
|
|
|
|
|
leftColumnStr = \
|
2021-12-29 21:55:09 +00:00
|
|
|
|
get_left_column_content(base_dir, nickname, domain_full,
|
|
|
|
|
http_prefix, translate,
|
|
|
|
|
editor, artist, False, None, rss_icon_at_top,
|
|
|
|
|
True, False, theme, accessKeys,
|
|
|
|
|
shared_items_federated_domains)
|
2021-02-01 13:31:49 +00:00
|
|
|
|
tlStr += ' <td valign="top" class="col-left" ' + \
|
|
|
|
|
'id="links" tabindex="-1">' + \
|
2020-11-10 15:12:07 +00:00
|
|
|
|
leftColumnStr + ' </td>\n'
|
|
|
|
|
# center column containing posts
|
2021-02-15 15:21:07 +00:00
|
|
|
|
tlStr += ' <td valign="top" class="col-center">\n'
|
2020-11-10 15:12:07 +00:00
|
|
|
|
|
2021-12-25 19:31:24 +00:00
|
|
|
|
if not full_width_tl_button_header:
|
2020-11-09 22:44:03 +00:00
|
|
|
|
tlStr += \
|
2021-12-29 21:55:09 +00:00
|
|
|
|
header_buttons_timeline(defaultTimeline, boxName, pageNumber,
|
|
|
|
|
translate, usersPath, mediaButton,
|
|
|
|
|
blogsButton, featuresButton,
|
|
|
|
|
newsButton, inboxButton,
|
|
|
|
|
dmButton, newDM, repliesButton,
|
|
|
|
|
newReply, minimal, sentButton,
|
|
|
|
|
sharesButtonStr, wantedButtonStr,
|
|
|
|
|
bookmarksButtonStr,
|
|
|
|
|
eventsButtonStr, moderationButtonStr,
|
|
|
|
|
newPostButtonStr, base_dir, nickname,
|
|
|
|
|
domain, timelineStartTime,
|
|
|
|
|
newCalendarEvent, calendarPath,
|
|
|
|
|
calendarImage, followApprovals,
|
|
|
|
|
icons_as_buttons, accessKeys)
|
2020-11-09 22:44:03 +00:00
|
|
|
|
|
2021-02-15 15:21:07 +00:00
|
|
|
|
tlStr += ' <div id="timelineposts" class="timeline-posts">\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-06-27 22:01:58 +00:00
|
|
|
|
tlStr += \
|
2021-12-29 21:55:09 +00:00
|
|
|
|
_html_timeline_moderation_buttons(moderator, boxName, nickname,
|
|
|
|
|
moderationActionStr, translate)
|
2020-11-09 22:44:03 +00:00
|
|
|
|
|
2021-12-29 21:55:09 +00:00
|
|
|
|
_log_timeline_timing(enableTimingLog, timelineStartTime, boxName, '6')
|
2020-11-09 22:44:03 +00:00
|
|
|
|
|
2020-11-10 15:12:07 +00:00
|
|
|
|
if boxName == 'tlshares':
|
|
|
|
|
maxSharesPerAccount = itemsPerPage
|
|
|
|
|
return (tlStr +
|
2021-12-29 21:55:09 +00:00
|
|
|
|
_html_shares_timeline(translate, pageNumber, itemsPerPage,
|
|
|
|
|
base_dir, actor, nickname, domain, port,
|
|
|
|
|
maxSharesPerAccount, http_prefix,
|
|
|
|
|
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,
|
|
|
|
|
defaultTimeline, accessKeys,
|
|
|
|
|
boxName,
|
|
|
|
|
enableTimingLog, timelineStartTime) +
|
|
|
|
|
html_footer())
|
2021-08-09 18:41:05 +00:00
|
|
|
|
elif boxName == 'tlwanted':
|
|
|
|
|
maxSharesPerAccount = itemsPerPage
|
|
|
|
|
return (tlStr +
|
2021-12-29 21:55:09 +00:00
|
|
|
|
_html_shares_timeline(translate, pageNumber, itemsPerPage,
|
|
|
|
|
base_dir, actor, nickname, domain, port,
|
|
|
|
|
maxSharesPerAccount, http_prefix,
|
|
|
|
|
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,
|
|
|
|
|
defaultTimeline, accessKeys,
|
|
|
|
|
boxName,
|
|
|
|
|
enableTimingLog, timelineStartTime) +
|
|
|
|
|
html_footer())
|
|
|
|
|
|
|
|
|
|
_log_timeline_timing(enableTimingLog, timelineStartTime, boxName, '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-02-18 20:08:18 +00:00
|
|
|
|
if boxName != 'tlmedia':
|
|
|
|
|
textModeSeparator = \
|
|
|
|
|
'<div class="transparent"><hr></div>'
|
2021-02-18 20:10:26 +00:00
|
|
|
|
else:
|
|
|
|
|
textModeSeparator = ''
|
2021-02-07 21:45:31 +00:00
|
|
|
|
|
2020-11-10 15:12:07 +00:00
|
|
|
|
# page up arrow
|
|
|
|
|
if pageNumber > 1:
|
2021-02-07 21:45:31 +00:00
|
|
|
|
tlStr += textModeSeparator
|
2021-12-29 21:55:09 +00:00
|
|
|
|
tlStr += '<br>' + _page_number_buttons(usersPath, boxName, pageNumber)
|
2020-11-10 15:12:07 +00:00
|
|
|
|
tlStr += \
|
|
|
|
|
' <center>\n' + \
|
|
|
|
|
' <a href="' + usersPath + '/' + boxName + \
|
|
|
|
|
'?page=' + str(pageNumber - 1) + \
|
2021-04-23 13:20:28 +00:00
|
|
|
|
'" accesskey="' + accessKeys['Page up'] + '">' + \
|
|
|
|
|
'<img loading="lazy" 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
|
|
|
|
|
itemCtr = 0
|
2021-08-01 15:13:25 +00:00
|
|
|
|
if timelineJson:
|
2021-08-02 10:50:32 +00:00
|
|
|
|
if 'orderedItems' not in timelineJson:
|
2021-08-01 19:43:20 +00:00
|
|
|
|
print('ERROR: no orderedItems in timeline for '
|
|
|
|
|
+ boxName + ' ' + str(timelineJson))
|
2021-08-01 15:13:25 +00:00
|
|
|
|
return ''
|
|
|
|
|
|
2021-09-03 09:07:18 +00:00
|
|
|
|
useCacheOnly = False
|
|
|
|
|
if boxName == 'inbox':
|
|
|
|
|
useCacheOnly = True
|
|
|
|
|
|
2020-11-10 15:12:07 +00:00
|
|
|
|
if timelineJson:
|
|
|
|
|
# if this is the media timeline then add an extra gallery container
|
|
|
|
|
if boxName == 'tlmedia':
|
|
|
|
|
if pageNumber > 1:
|
|
|
|
|
tlStr += '<br>'
|
|
|
|
|
tlStr += '<div class="galleryContainer">\n'
|
2020-11-09 22:44:03 +00:00
|
|
|
|
|
2020-11-10 15:12:07 +00:00
|
|
|
|
# show each post in the timeline
|
|
|
|
|
for item in timelineJson['orderedItems']:
|
|
|
|
|
if item['type'] == 'Create' or \
|
2021-03-05 15:45:03 +00:00
|
|
|
|
item['type'] == '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):
|
2021-06-03 13:21:57 +00:00
|
|
|
|
continue
|
2020-11-09 22:44:03 +00:00
|
|
|
|
|
2020-11-10 15:12:07 +00:00
|
|
|
|
# is the post in the memory cache of recent ones?
|
|
|
|
|
currTlStr = None
|
2021-12-26 20:01:37 +00:00
|
|
|
|
if boxName != '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):
|
|
|
|
|
currTlStr = recent_posts_cache['html'][post_id]
|
2021-09-28 09:26:19 +00:00
|
|
|
|
currTlStr = \
|
2021-12-29 21:55:09 +00:00
|
|
|
|
prepare_post_from_html_cache(nickname,
|
|
|
|
|
currTlStr,
|
|
|
|
|
boxName,
|
|
|
|
|
pageNumber)
|
|
|
|
|
_log_timeline_timing(enableTimingLog,
|
|
|
|
|
timelineStartTime,
|
|
|
|
|
boxName, '10')
|
2020-11-09 22:44:03 +00:00
|
|
|
|
|
2020-11-10 15:12:07 +00:00
|
|
|
|
if not currTlStr:
|
2021-12-29 21:55:09 +00:00
|
|
|
|
_log_timeline_timing(enableTimingLog,
|
|
|
|
|
timelineStartTime,
|
|
|
|
|
boxName, '11')
|
2020-11-09 22:44:03 +00:00
|
|
|
|
|
2020-11-10 15:12:07 +00:00
|
|
|
|
# read the post from disk
|
|
|
|
|
currTlStr = \
|
2021-12-29 21:55:09 +00:00
|
|
|
|
individual_post_as_html(signing_priv_key_pem,
|
|
|
|
|
False, recent_posts_cache,
|
|
|
|
|
max_recent_posts,
|
|
|
|
|
translate, pageNumber,
|
|
|
|
|
base_dir, session,
|
|
|
|
|
cached_webfingers,
|
|
|
|
|
person_cache,
|
|
|
|
|
nickname, domain, port,
|
|
|
|
|
item, None, True,
|
|
|
|
|
allow_deletion,
|
|
|
|
|
http_prefix, project_version,
|
|
|
|
|
boxName,
|
|
|
|
|
yt_replace_domain,
|
|
|
|
|
twitter_replacement_domain,
|
|
|
|
|
show_published_date_only,
|
|
|
|
|
peertube_instances,
|
|
|
|
|
allow_local_network_access,
|
|
|
|
|
theme, system_language,
|
|
|
|
|
max_like_count,
|
|
|
|
|
boxName != 'dm',
|
|
|
|
|
showIndividualPostIcons,
|
|
|
|
|
manuallyApproveFollowers,
|
|
|
|
|
False, True, useCacheOnly,
|
|
|
|
|
cw_lists, lists_enabled)
|
|
|
|
|
_log_timeline_timing(enableTimingLog,
|
|
|
|
|
timelineStartTime, boxName, '12')
|
2020-11-09 22:44:03 +00:00
|
|
|
|
|
2020-11-10 15:12:07 +00:00
|
|
|
|
if currTlStr:
|
2021-09-06 09:00:10 +00:00
|
|
|
|
if currTlStr not in tlStr:
|
|
|
|
|
itemCtr += 1
|
|
|
|
|
tlStr += textModeSeparator + currTlStr
|
|
|
|
|
if separatorStr:
|
|
|
|
|
tlStr += separatorStr
|
2020-11-10 15:12:07 +00:00
|
|
|
|
if boxName == 'tlmedia':
|
|
|
|
|
tlStr += '</div>\n'
|
2020-11-09 22:44:03 +00:00
|
|
|
|
|
2021-03-05 16:10:25 +00:00
|
|
|
|
if itemCtr < 3:
|
|
|
|
|
print('Items added to html timeline ' + boxName + ': ' +
|
|
|
|
|
str(itemCtr) + ' ' + str(timelineJson['orderedItems']))
|
|
|
|
|
|
2020-11-10 15:12:07 +00:00
|
|
|
|
# page down arrow
|
2021-04-29 20:16:48 +00:00
|
|
|
|
if itemCtr > 0:
|
2021-02-07 21:41:57 +00:00
|
|
|
|
tlStr += textModeSeparator
|
2020-11-10 15:12:07 +00:00
|
|
|
|
tlStr += \
|
2021-10-30 15:49:31 +00:00
|
|
|
|
' <br>\n' + \
|
2020-11-10 15:12:07 +00:00
|
|
|
|
' <center>\n' + \
|
|
|
|
|
' <a href="' + usersPath + '/' + boxName + '?page=' + \
|
|
|
|
|
str(pageNumber + 1) + \
|
2021-04-23 13:20:28 +00:00
|
|
|
|
'" accesskey="' + accessKeys['Page down'] + '">' + \
|
|
|
|
|
'<img loading="lazy" 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'
|
2021-12-29 21:55:09 +00:00
|
|
|
|
tlStr += _page_number_buttons(usersPath, boxName, pageNumber)
|
2021-02-07 21:41:57 +00:00
|
|
|
|
tlStr += textModeSeparator
|
2021-02-26 10:29:50 +00:00
|
|
|
|
elif itemCtr == 0:
|
2021-12-29 21:55:09 +00:00
|
|
|
|
tlStr += _get_help_for_timeline(base_dir, boxName)
|
2020-11-18 18:22:05 +00:00
|
|
|
|
|
2021-07-28 11:26:03 +00:00
|
|
|
|
tlStr += \
|
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,
|
|
|
|
|
defaultTimeline, accessKeys,
|
|
|
|
|
boxName,
|
|
|
|
|
enableTimingLog, timelineStartTime)
|
|
|
|
|
tlStr += html_footer()
|
2020-11-10 15:12:07 +00:00
|
|
|
|
return tlStr
|
2020-11-09 22:44:03 +00:00
|
|
|
|
|
|
|
|
|
|
2021-12-29 21:55:09 +00:00
|
|
|
|
def html_individual_share(domain: str, shareId: str,
|
|
|
|
|
actor: str, sharedItem: {}, translate: {},
|
|
|
|
|
showContact: bool, removeButton: bool,
|
|
|
|
|
sharesFileType: str) -> str:
|
2020-11-10 15:12:07 +00:00
|
|
|
|
"""Returns an individual shared item as html
|
|
|
|
|
"""
|
|
|
|
|
profileStr = '<div class="container">\n'
|
2021-09-21 09:58:55 +00:00
|
|
|
|
profileStr += \
|
|
|
|
|
'<p class="share-title">' + sharedItem['displayName'] + '</p>\n'
|
|
|
|
|
if sharedItem.get('imageUrl'):
|
|
|
|
|
profileStr += '<a href="' + sharedItem['imageUrl'] + '">\n'
|
2020-11-10 15:12:07 +00:00
|
|
|
|
profileStr += \
|
2021-09-21 09:58:55 +00:00
|
|
|
|
'<img loading="lazy" src="' + sharedItem['imageUrl'] + \
|
2020-11-10 15:12:07 +00:00
|
|
|
|
'" alt="' + translate['Item image'] + '">\n</a>\n'
|
2021-09-21 09:58:55 +00:00
|
|
|
|
profileStr += '<p>' + sharedItem['summary'] + '</p>\n<p>'
|
|
|
|
|
if sharedItem.get('itemQty'):
|
|
|
|
|
if sharedItem['itemQty'] > 1:
|
2021-07-27 20:31:14 +00:00
|
|
|
|
profileStr += \
|
|
|
|
|
'<b>' + translate['Quantity'] + ':</b> ' + \
|
2021-09-21 09:58:55 +00:00
|
|
|
|
str(sharedItem['itemQty']) + '<br>'
|
2021-07-24 11:30:46 +00:00
|
|
|
|
profileStr += \
|
2021-09-21 09:58:55 +00:00
|
|
|
|
'<b>' + translate['Type'] + ':</b> ' + sharedItem['itemType'] + '<br>'
|
2020-11-10 15:12:07 +00:00
|
|
|
|
profileStr += \
|
2021-09-21 09:58:55 +00:00
|
|
|
|
'<b>' + translate['Category'] + ':</b> ' + \
|
|
|
|
|
sharedItem['category'] + '<br>'
|
|
|
|
|
if sharedItem.get('location'):
|
2021-07-27 19:23:55 +00:00
|
|
|
|
profileStr += \
|
2021-07-27 20:29:29 +00:00
|
|
|
|
'<b>' + translate['Location'] + ':</b> ' + \
|
2021-09-21 09:58:55 +00:00
|
|
|
|
sharedItem['location'] + '<br>'
|
|
|
|
|
contactTitleStr = translate['Contact']
|
|
|
|
|
if sharedItem.get('itemPrice') and sharedItem.get('itemCurrency'):
|
2021-12-26 18:03:39 +00:00
|
|
|
|
if is_float(sharedItem['itemPrice']):
|
2021-09-21 09:58:55 +00:00
|
|
|
|
if float(sharedItem['itemPrice']) > 0:
|
2021-07-24 22:08:11 +00:00
|
|
|
|
profileStr += ' ' + \
|
|
|
|
|
'<b>' + translate['Price'] + ':</b> ' + \
|
2021-09-21 09:58:55 +00:00
|
|
|
|
sharedItem['itemPrice'] + ' ' + sharedItem['itemCurrency']
|
|
|
|
|
contactTitleStr = translate['Buy']
|
2021-07-24 22:08:11 +00:00
|
|
|
|
profileStr += '</p>\n'
|
2021-09-21 09:58:55 +00:00
|
|
|
|
sharedesc = sharedItem['displayName']
|
2021-09-19 16:20:12 +00:00
|
|
|
|
if '<' not in sharedesc and ';' not in sharedesc:
|
2020-12-06 22:56:45 +00:00
|
|
|
|
if showContact:
|
2021-09-21 09:58:55 +00:00
|
|
|
|
buttonStyleStr = 'button'
|
|
|
|
|
if sharedItem['category'] == 'accommodation':
|
|
|
|
|
contactTitleStr = translate['Request to stay']
|
|
|
|
|
buttonStyleStr = 'contactbutton'
|
|
|
|
|
|
|
|
|
|
contactActor = sharedItem['actor']
|
2020-12-06 22:56:45 +00:00
|
|
|
|
profileStr += \
|
2021-08-07 12:19:10 +00:00
|
|
|
|
'<p>' + \
|
|
|
|
|
'<a href="' + actor + \
|
2020-12-06 22:56:45 +00:00
|
|
|
|
'?replydm=sharedesc:' + sharedesc + \
|
2021-09-21 12:44:55 +00:00
|
|
|
|
'?mention=' + contactActor + '">' + \
|
2021-09-21 09:58:55 +00:00
|
|
|
|
'<button class="' + buttonStyleStr + '">' + \
|
|
|
|
|
contactTitleStr + '</button></a>\n'
|
2021-08-07 12:19:10 +00:00
|
|
|
|
profileStr += \
|
|
|
|
|
'<a href="' + contactActor + '"><button class="button">' + \
|
2021-09-19 16:20:12 +00:00
|
|
|
|
translate['Profile'] + '</button></a>\n'
|
2021-07-27 22:29:40 +00:00
|
|
|
|
if removeButton and domain in shareId:
|
2021-08-09 20:05:14 +00:00
|
|
|
|
if sharesFileType == 'shares':
|
|
|
|
|
profileStr += \
|
|
|
|
|
' <a href="' + actor + '?rmshare=' + shareId + \
|
|
|
|
|
'"><button class="button">' + \
|
|
|
|
|
translate['Remove'] + '</button></a>\n'
|
|
|
|
|
else:
|
|
|
|
|
profileStr += \
|
|
|
|
|
' <a href="' + actor + '?rmwanted=' + shareId + \
|
|
|
|
|
'"><button class="button">' + \
|
|
|
|
|
translate['Remove'] + '</button></a>\n'
|
2020-11-10 15:12:07 +00:00
|
|
|
|
profileStr += '</div>\n'
|
|
|
|
|
return profileStr
|
2020-11-09 22:44:03 +00:00
|
|
|
|
|
|
|
|
|
|
2021-12-29 21:55:09 +00:00
|
|
|
|
def _html_shares_timeline(translate: {}, pageNumber: int, itemsPerPage: int,
|
|
|
|
|
base_dir: str, actor: str,
|
|
|
|
|
nickname: str, domain: str, port: int,
|
|
|
|
|
maxSharesPerAccount: int, http_prefix: str,
|
|
|
|
|
shared_items_federated_domains: [],
|
|
|
|
|
sharesFileType: str) -> str:
|
2020-11-10 15:12:07 +00:00
|
|
|
|
"""Show shared items timeline as html
|
|
|
|
|
"""
|
|
|
|
|
sharesJson, lastPage = \
|
2021-12-29 21:55:09 +00:00
|
|
|
|
shares_timeline_json(actor, pageNumber, itemsPerPage,
|
|
|
|
|
base_dir, domain, nickname, maxSharesPerAccount,
|
|
|
|
|
shared_items_federated_domains, sharesFileType)
|
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-26 14:08:58 +00:00
|
|
|
|
adminNickname = get_config_param(base_dir, 'admin')
|
2021-07-28 20:58:30 +00:00
|
|
|
|
adminActor = ''
|
|
|
|
|
if adminNickname:
|
|
|
|
|
adminActor = \
|
2021-12-26 10:19:59 +00:00
|
|
|
|
local_actor_url(http_prefix, adminNickname, domain_full)
|
2020-11-10 15:12:07 +00:00
|
|
|
|
timelineStr = ''
|
2020-11-09 22:44:03 +00:00
|
|
|
|
|
2020-11-10 15:12:07 +00:00
|
|
|
|
if pageNumber > 1:
|
2021-09-24 17:49:35 +00:00
|
|
|
|
timelineStr += '<br>' + \
|
2021-12-29 21:55:09 +00:00
|
|
|
|
_page_number_buttons(actor, 'tl' + sharesFileType, pageNumber)
|
2020-11-10 15:12:07 +00:00
|
|
|
|
timelineStr += \
|
|
|
|
|
' <center>\n' + \
|
2021-08-09 13:07:32 +00:00
|
|
|
|
' <a href="' + actor + '/tl' + sharesFileType + '?page=' + \
|
2020-11-10 15:12:07 +00:00
|
|
|
|
str(pageNumber - 1) + \
|
|
|
|
|
'"><img loading="lazy" 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-29 21:55:09 +00:00
|
|
|
|
separatorStr = html_post_separator(base_dir, None)
|
2021-02-26 13:31:31 +00:00
|
|
|
|
ctr = 0
|
2021-07-28 20:58:30 +00:00
|
|
|
|
|
|
|
|
|
isAdminAccount = False
|
|
|
|
|
if adminActor and actor == adminActor:
|
|
|
|
|
isAdminAccount = True
|
2021-12-28 19:33:29 +00:00
|
|
|
|
is_moderatorAccount = False
|
|
|
|
|
if is_moderator(base_dir, nickname):
|
|
|
|
|
is_moderatorAccount = True
|
2021-07-28 20:58:30 +00:00
|
|
|
|
|
2021-09-21 09:58:55 +00:00
|
|
|
|
for published, sharedItem in sharesJson.items():
|
2020-11-10 15:12:07 +00:00
|
|
|
|
showContactButton = False
|
2021-09-21 09:58:55 +00:00
|
|
|
|
if sharedItem['actor'] != actor:
|
2020-11-10 15:12:07 +00:00
|
|
|
|
showContactButton = True
|
|
|
|
|
showRemoveButton = False
|
2021-09-21 09:58:55 +00:00
|
|
|
|
if '___' + domain in sharedItem['shareId']:
|
|
|
|
|
if sharedItem['actor'] == actor or \
|
2021-12-28 19:33:29 +00:00
|
|
|
|
isAdminAccount or is_moderatorAccount:
|
2021-07-28 20:58:30 +00:00
|
|
|
|
showRemoveButton = True
|
2020-11-18 19:28:33 +00:00
|
|
|
|
timelineStr += \
|
2021-12-29 21:55:09 +00:00
|
|
|
|
html_individual_share(domain, sharedItem['shareId'],
|
|
|
|
|
actor, sharedItem, translate,
|
|
|
|
|
showContactButton, showRemoveButton,
|
|
|
|
|
sharesFileType)
|
2020-11-18 19:28:33 +00:00
|
|
|
|
timelineStr += separatorStr
|
2021-02-26 13:31:31 +00:00
|
|
|
|
ctr += 1
|
|
|
|
|
|
|
|
|
|
if ctr == 0:
|
2021-12-29 21:55:09 +00:00
|
|
|
|
timelineStr += _get_help_for_timeline(base_dir, 'tl' + sharesFileType)
|
2020-11-09 22:44:03 +00:00
|
|
|
|
|
2020-11-10 15:12:07 +00:00
|
|
|
|
if not lastPage:
|
|
|
|
|
timelineStr += \
|
|
|
|
|
' <center>\n' + \
|
2021-08-09 13:07:32 +00:00
|
|
|
|
' <a href="' + actor + '/tl' + sharesFileType + '?page=' + \
|
2020-11-10 15:12:07 +00:00
|
|
|
|
str(pageNumber + 1) + \
|
|
|
|
|
'"><img loading="lazy" 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-09-24 17:32:23 +00:00
|
|
|
|
timelineStr += \
|
2021-12-29 21:55:09 +00:00
|
|
|
|
_page_number_buttons(actor, 'tl' + sharesFileType, pageNumber)
|
2020-11-09 22:44:03 +00:00
|
|
|
|
|
2020-11-10 15:12:07 +00:00
|
|
|
|
return timelineStr
|
2020-11-09 22:44:03 +00:00
|
|
|
|
|
|
|
|
|
|
2021-12-29 21:55:09 +00:00
|
|
|
|
def html_shares(css_cache: {}, defaultTimeline: str,
|
|
|
|
|
recent_posts_cache: {}, max_recent_posts: int,
|
|
|
|
|
translate: {}, pageNumber: int, itemsPerPage: int,
|
|
|
|
|
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,
|
|
|
|
|
accessKeys: {}, system_language: str,
|
|
|
|
|
max_like_count: int,
|
|
|
|
|
shared_items_federated_domains: [],
|
|
|
|
|
signing_priv_key_pem: str,
|
|
|
|
|
cw_lists: {}, lists_enabled: str) -> str:
|
2020-11-09 22:44:03 +00:00
|
|
|
|
"""Show the shares timeline as html
|
|
|
|
|
"""
|
|
|
|
|
manuallyApproveFollowers = \
|
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
|
|
|
|
|
2021-12-29 21:55:09 +00:00
|
|
|
|
return html_timeline(css_cache, defaultTimeline,
|
|
|
|
|
recent_posts_cache, max_recent_posts,
|
|
|
|
|
translate, pageNumber,
|
|
|
|
|
itemsPerPage, session, base_dir,
|
|
|
|
|
cached_webfingers, person_cache,
|
|
|
|
|
nickname, domain, port, None,
|
|
|
|
|
'tlshares', allow_deletion,
|
|
|
|
|
http_prefix, project_version,
|
|
|
|
|
manuallyApproveFollowers,
|
|
|
|
|
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,
|
|
|
|
|
accessKeys, system_language, max_like_count,
|
|
|
|
|
shared_items_federated_domains,
|
|
|
|
|
signing_priv_key_pem,
|
|
|
|
|
cw_lists, lists_enabled)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def html_wanted(css_cache: {}, defaultTimeline: str,
|
|
|
|
|
recent_posts_cache: {}, max_recent_posts: int,
|
|
|
|
|
translate: {}, pageNumber: int, itemsPerPage: int,
|
|
|
|
|
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,
|
|
|
|
|
accessKeys: {}, system_language: str,
|
|
|
|
|
max_like_count: int,
|
|
|
|
|
shared_items_federated_domains: [],
|
|
|
|
|
signing_priv_key_pem: str,
|
|
|
|
|
cw_lists: {}, lists_enabled: str) -> str:
|
|
|
|
|
"""Show the wanted timeline as html
|
|
|
|
|
"""
|
|
|
|
|
manuallyApproveFollowers = \
|
|
|
|
|
follower_approval_active(base_dir, nickname, domain)
|
|
|
|
|
artist = is_artist(base_dir, nickname)
|
|
|
|
|
|
|
|
|
|
return html_timeline(css_cache, defaultTimeline,
|
|
|
|
|
recent_posts_cache, max_recent_posts,
|
|
|
|
|
translate, pageNumber,
|
|
|
|
|
itemsPerPage, session, base_dir,
|
|
|
|
|
cached_webfingers, person_cache,
|
|
|
|
|
nickname, domain, port, None,
|
|
|
|
|
'tlwanted', allow_deletion,
|
|
|
|
|
http_prefix, project_version,
|
|
|
|
|
manuallyApproveFollowers,
|
|
|
|
|
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,
|
|
|
|
|
accessKeys, system_language, max_like_count,
|
|
|
|
|
shared_items_federated_domains,
|
|
|
|
|
signing_priv_key_pem,
|
|
|
|
|
cw_lists, lists_enabled)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def html_inbox(css_cache: {}, defaultTimeline: str,
|
2021-12-26 20:01:37 +00:00
|
|
|
|
recent_posts_cache: {}, max_recent_posts: int,
|
2021-08-09 18:41:05 +00:00
|
|
|
|
translate: {}, pageNumber: int, itemsPerPage: 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: {},
|
2021-12-29 21:55:09 +00:00
|
|
|
|
nickname: str, domain: str, port: int, inboxJson: {},
|
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-25 23:03:28 +00:00
|
|
|
|
accessKeys: {}, 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,
|
2021-12-25 23:26:38 +00:00
|
|
|
|
cw_lists: {}, lists_enabled: str) -> str:
|
2020-11-09 22:44:03 +00:00
|
|
|
|
"""Show the inbox as html
|
|
|
|
|
"""
|
|
|
|
|
manuallyApproveFollowers = \
|
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
|
|
|
|
|
2021-12-29 21:55:09 +00:00
|
|
|
|
return html_timeline(css_cache, defaultTimeline,
|
|
|
|
|
recent_posts_cache, max_recent_posts,
|
|
|
|
|
translate, pageNumber,
|
|
|
|
|
itemsPerPage, session, base_dir,
|
|
|
|
|
cached_webfingers, person_cache,
|
|
|
|
|
nickname, domain, port, inboxJson,
|
|
|
|
|
'inbox', allow_deletion,
|
|
|
|
|
http_prefix, project_version,
|
|
|
|
|
manuallyApproveFollowers,
|
|
|
|
|
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,
|
|
|
|
|
accessKeys, system_language, max_like_count,
|
|
|
|
|
shared_items_federated_domains,
|
|
|
|
|
signing_priv_key_pem,
|
|
|
|
|
cw_lists, lists_enabled)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def html_bookmarks(css_cache: {}, defaultTimeline: str,
|
|
|
|
|
recent_posts_cache: {}, max_recent_posts: int,
|
|
|
|
|
translate: {}, pageNumber: int, itemsPerPage: int,
|
|
|
|
|
session, base_dir: str,
|
|
|
|
|
cached_webfingers: {}, person_cache: {},
|
|
|
|
|
nickname: str, domain: str, port: int, bookmarksJson: {},
|
|
|
|
|
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,
|
|
|
|
|
accessKeys: {}, system_language: str,
|
|
|
|
|
max_like_count: int,
|
|
|
|
|
shared_items_federated_domains: [],
|
|
|
|
|
signing_priv_key_pem: str,
|
|
|
|
|
cw_lists: {}, lists_enabled: str) -> str:
|
2020-11-09 22:44:03 +00:00
|
|
|
|
"""Show the bookmarks as html
|
|
|
|
|
"""
|
|
|
|
|
manuallyApproveFollowers = \
|
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
|
|
|
|
|
2021-12-29 21:55:09 +00:00
|
|
|
|
return html_timeline(css_cache, defaultTimeline,
|
|
|
|
|
recent_posts_cache, max_recent_posts,
|
|
|
|
|
translate, pageNumber,
|
|
|
|
|
itemsPerPage, session, base_dir,
|
|
|
|
|
cached_webfingers, person_cache,
|
|
|
|
|
nickname, domain, port, bookmarksJson,
|
|
|
|
|
'tlbookmarks', allow_deletion,
|
|
|
|
|
http_prefix, project_version,
|
|
|
|
|
manuallyApproveFollowers,
|
|
|
|
|
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,
|
|
|
|
|
accessKeys, system_language, max_like_count,
|
|
|
|
|
shared_items_federated_domains, signing_priv_key_pem,
|
|
|
|
|
cw_lists, lists_enabled)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def html_inbox_d_ms(css_cache: {}, defaultTimeline: str,
|
|
|
|
|
recent_posts_cache: {}, max_recent_posts: int,
|
|
|
|
|
translate: {}, pageNumber: int, itemsPerPage: int,
|
|
|
|
|
session, base_dir: str,
|
|
|
|
|
cached_webfingers: {}, person_cache: {},
|
|
|
|
|
nickname: str, domain: str, port: int, inboxJson: {},
|
|
|
|
|
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,
|
|
|
|
|
accessKeys: {}, system_language: str,
|
|
|
|
|
max_like_count: int,
|
|
|
|
|
shared_items_federated_domains: [],
|
|
|
|
|
signing_priv_key_pem: str,
|
|
|
|
|
cw_lists: {}, lists_enabled: str) -> 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)
|
2021-12-29 21:55:09 +00:00
|
|
|
|
return html_timeline(css_cache, defaultTimeline,
|
|
|
|
|
recent_posts_cache, max_recent_posts,
|
|
|
|
|
translate, pageNumber,
|
|
|
|
|
itemsPerPage, session, base_dir,
|
|
|
|
|
cached_webfingers, person_cache,
|
|
|
|
|
nickname, domain, port, inboxJson,
|
|
|
|
|
'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,
|
|
|
|
|
accessKeys, system_language, max_like_count,
|
|
|
|
|
shared_items_federated_domains,
|
|
|
|
|
signing_priv_key_pem,
|
|
|
|
|
cw_lists, lists_enabled)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def html_inbox_replies(css_cache: {}, defaultTimeline: str,
|
|
|
|
|
recent_posts_cache: {}, max_recent_posts: int,
|
|
|
|
|
translate: {}, pageNumber: int, itemsPerPage: int,
|
|
|
|
|
session, base_dir: str,
|
|
|
|
|
cached_webfingers: {}, person_cache: {},
|
|
|
|
|
nickname: str, domain: str, port: int, inboxJson: {},
|
|
|
|
|
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,
|
|
|
|
|
accessKeys: {}, system_language: str,
|
|
|
|
|
max_like_count: int,
|
|
|
|
|
shared_items_federated_domains: [],
|
|
|
|
|
signing_priv_key_pem: str,
|
|
|
|
|
cw_lists: {}, lists_enabled: str) -> str:
|
|
|
|
|
"""Show the replies timeline as html
|
|
|
|
|
"""
|
|
|
|
|
artist = is_artist(base_dir, nickname)
|
|
|
|
|
return html_timeline(css_cache, defaultTimeline,
|
|
|
|
|
recent_posts_cache, max_recent_posts,
|
|
|
|
|
translate, pageNumber,
|
|
|
|
|
itemsPerPage, session, base_dir,
|
|
|
|
|
cached_webfingers, person_cache,
|
|
|
|
|
nickname, domain, port, inboxJson, 'tlreplies',
|
|
|
|
|
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,
|
|
|
|
|
accessKeys, system_language, max_like_count,
|
|
|
|
|
shared_items_federated_domains, signing_priv_key_pem,
|
|
|
|
|
cw_lists, lists_enabled)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def html_inbox_media(css_cache: {}, defaultTimeline: str,
|
2021-12-26 20:01:37 +00:00
|
|
|
|
recent_posts_cache: {}, max_recent_posts: int,
|
2020-11-09 22:44:03 +00:00
|
|
|
|
translate: {}, pageNumber: int, itemsPerPage: 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: {},
|
2020-11-09 22:44:03 +00:00
|
|
|
|
nickname: str, domain: str, port: int, inboxJson: {},
|
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-25 23:03:28 +00:00
|
|
|
|
accessKeys: {}, 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,
|
2021-12-25 23:26:38 +00:00
|
|
|
|
cw_lists: {}, lists_enabled: str) -> 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)
|
2021-12-29 21:55:09 +00:00
|
|
|
|
return html_timeline(css_cache, defaultTimeline,
|
|
|
|
|
recent_posts_cache, max_recent_posts,
|
|
|
|
|
translate, pageNumber,
|
|
|
|
|
itemsPerPage, session, base_dir,
|
|
|
|
|
cached_webfingers, person_cache,
|
|
|
|
|
nickname, domain, port, inboxJson, 'tlmedia',
|
|
|
|
|
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,
|
|
|
|
|
accessKeys, system_language, max_like_count,
|
|
|
|
|
shared_items_federated_domains, signing_priv_key_pem,
|
|
|
|
|
cw_lists, lists_enabled)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def html_inbox_blogs(css_cache: {}, defaultTimeline: str,
|
|
|
|
|
recent_posts_cache: {}, max_recent_posts: int,
|
|
|
|
|
translate: {}, pageNumber: int, itemsPerPage: int,
|
|
|
|
|
session, base_dir: str,
|
|
|
|
|
cached_webfingers: {}, person_cache: {},
|
|
|
|
|
nickname: str, domain: str, port: int, inboxJson: {},
|
|
|
|
|
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,
|
|
|
|
|
accessKeys: {}, system_language: str,
|
|
|
|
|
max_like_count: int,
|
|
|
|
|
shared_items_federated_domains: [],
|
|
|
|
|
signing_priv_key_pem: str,
|
|
|
|
|
cw_lists: {}, lists_enabled: str) -> 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)
|
2021-12-29 21:55:09 +00:00
|
|
|
|
return html_timeline(css_cache, defaultTimeline,
|
|
|
|
|
recent_posts_cache, max_recent_posts,
|
|
|
|
|
translate, pageNumber,
|
|
|
|
|
itemsPerPage, session, base_dir,
|
|
|
|
|
cached_webfingers, person_cache,
|
|
|
|
|
nickname, domain, port, inboxJson, 'tlblogs',
|
|
|
|
|
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,
|
|
|
|
|
accessKeys, system_language, max_like_count,
|
|
|
|
|
shared_items_federated_domains, signing_priv_key_pem,
|
|
|
|
|
cw_lists, lists_enabled)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def html_inbox_features(css_cache: {}, defaultTimeline: str,
|
|
|
|
|
recent_posts_cache: {}, max_recent_posts: int,
|
|
|
|
|
translate: {}, pageNumber: int, itemsPerPage: int,
|
|
|
|
|
session, base_dir: str,
|
|
|
|
|
cached_webfingers: {}, person_cache: {},
|
|
|
|
|
nickname: str, domain: str, port: int, inboxJson: {},
|
|
|
|
|
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,
|
|
|
|
|
accessKeys: {}, system_language: str,
|
|
|
|
|
max_like_count: int,
|
|
|
|
|
shared_items_federated_domains: [],
|
|
|
|
|
signing_priv_key_pem: str,
|
|
|
|
|
cw_lists: {}, lists_enabled: str) -> str:
|
2020-11-27 11:22:47 +00:00
|
|
|
|
"""Show the features timeline as html
|
|
|
|
|
"""
|
2021-12-29 21:55:09 +00:00
|
|
|
|
return html_timeline(css_cache, defaultTimeline,
|
|
|
|
|
recent_posts_cache, max_recent_posts,
|
|
|
|
|
translate, pageNumber,
|
|
|
|
|
itemsPerPage, session, base_dir,
|
|
|
|
|
cached_webfingers, person_cache,
|
|
|
|
|
nickname, domain, port, inboxJson, 'tlfeatures',
|
|
|
|
|
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,
|
|
|
|
|
accessKeys, system_language, max_like_count,
|
|
|
|
|
shared_items_federated_domains, signing_priv_key_pem,
|
|
|
|
|
cw_lists, lists_enabled)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def html_inbox_news(css_cache: {}, defaultTimeline: str,
|
|
|
|
|
recent_posts_cache: {}, max_recent_posts: int,
|
|
|
|
|
translate: {}, pageNumber: int, itemsPerPage: int,
|
|
|
|
|
session, base_dir: str,
|
|
|
|
|
cached_webfingers: {}, person_cache: {},
|
|
|
|
|
nickname: str, domain: str, port: int, inboxJson: {},
|
|
|
|
|
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,
|
|
|
|
|
accessKeys: {}, system_language: str,
|
|
|
|
|
max_like_count: int,
|
|
|
|
|
shared_items_federated_domains: [],
|
|
|
|
|
signing_priv_key_pem: str,
|
|
|
|
|
cw_lists: {}, lists_enabled: str) -> str:
|
2020-11-09 22:44:03 +00:00
|
|
|
|
"""Show the news timeline as html
|
|
|
|
|
"""
|
2021-12-29 21:55:09 +00:00
|
|
|
|
return html_timeline(css_cache, defaultTimeline,
|
|
|
|
|
recent_posts_cache, max_recent_posts,
|
|
|
|
|
translate, pageNumber,
|
|
|
|
|
itemsPerPage, session, base_dir,
|
|
|
|
|
cached_webfingers, person_cache,
|
|
|
|
|
nickname, domain, port, inboxJson, 'tlnews',
|
|
|
|
|
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,
|
|
|
|
|
accessKeys, system_language, max_like_count,
|
|
|
|
|
shared_items_federated_domains, signing_priv_key_pem,
|
|
|
|
|
cw_lists, lists_enabled)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def html_outbox(css_cache: {}, defaultTimeline: str,
|
|
|
|
|
recent_posts_cache: {}, max_recent_posts: int,
|
|
|
|
|
translate: {}, pageNumber: int, itemsPerPage: int,
|
|
|
|
|
session, base_dir: str,
|
|
|
|
|
cached_webfingers: {}, person_cache: {},
|
|
|
|
|
nickname: str, domain: str, port: int, outboxJson: {},
|
|
|
|
|
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,
|
|
|
|
|
accessKeys: {}, system_language: str,
|
|
|
|
|
max_like_count: int,
|
|
|
|
|
shared_items_federated_domains: [],
|
|
|
|
|
signing_priv_key_pem: str,
|
|
|
|
|
cw_lists: {}, lists_enabled: str) -> str:
|
2020-11-09 22:44:03 +00:00
|
|
|
|
"""Show the Outbox as html
|
|
|
|
|
"""
|
|
|
|
|
manuallyApproveFollowers = \
|
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)
|
2021-12-29 21:55:09 +00:00
|
|
|
|
return html_timeline(css_cache, defaultTimeline,
|
|
|
|
|
recent_posts_cache, max_recent_posts,
|
|
|
|
|
translate, pageNumber,
|
|
|
|
|
itemsPerPage, session, base_dir,
|
|
|
|
|
cached_webfingers, person_cache,
|
|
|
|
|
nickname, domain, port, outboxJson, 'outbox',
|
|
|
|
|
allow_deletion, http_prefix, project_version,
|
|
|
|
|
manuallyApproveFollowers, 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,
|
|
|
|
|
accessKeys, system_language, max_like_count,
|
|
|
|
|
shared_items_federated_domains, signing_priv_key_pem,
|
|
|
|
|
cw_lists, lists_enabled)
|