Support for contentMap when creating html posts

main
Bob Mottram 2021-07-18 12:48:29 +01:00
parent 9daac007f7
commit e3e1716f1f
10 changed files with 132 additions and 80 deletions

View File

@ -2867,7 +2867,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.showPublishedDateOnly, self.server.showPublishedDateOnly,
self.server.peertubeInstances, self.server.peertubeInstances,
self.server.allowLocalNetworkAccess, self.server.allowLocalNetworkAccess,
self.server.themeName) self.server.themeName,
self.server.systemLanguage)
if hashtagStr: if hashtagStr:
msg = hashtagStr.encode('utf-8') msg = hashtagStr.encode('utf-8')
msglen = len(msg) msglen = len(msg)
@ -2921,7 +2922,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.showPublishedDateOnly, self.server.showPublishedDateOnly,
self.server.peertubeInstances, self.server.peertubeInstances,
self.server.allowLocalNetworkAccess, self.server.allowLocalNetworkAccess,
self.server.themeName, 'outbox') self.server.themeName, 'outbox',
self.server.systemLanguage)
if historyStr: if historyStr:
msg = historyStr.encode('utf-8') msg = historyStr.encode('utf-8')
msglen = len(msg) msglen = len(msg)
@ -2955,7 +2957,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.showPublishedDateOnly, self.server.showPublishedDateOnly,
self.server.peertubeInstances, self.server.peertubeInstances,
self.server.allowLocalNetworkAccess, self.server.allowLocalNetworkAccess,
self.server.themeName, 'bookmarks') self.server.themeName, 'bookmarks',
self.server.systemLanguage)
if bookmarksStr: if bookmarksStr:
msg = bookmarksStr.encode('utf-8') msg = bookmarksStr.encode('utf-8')
msglen = len(msg) msglen = len(msg)
@ -3049,7 +3052,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.peertubeInstances, self.server.peertubeInstances,
allowLocalNetworkAccess, allowLocalNetworkAccess,
self.server.themeName, self.server.themeName,
accessKeys) accessKeys,
self.server.systemLanguage)
if profileStr: if profileStr:
msg = profileStr.encode('utf-8') msg = profileStr.encode('utf-8')
msglen = len(msg) msglen = len(msg)
@ -6173,7 +6177,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.showPublishedDateOnly, self.server.showPublishedDateOnly,
self.server.peertubeInstances, self.server.peertubeInstances,
self.server.allowLocalNetworkAccess, self.server.allowLocalNetworkAccess,
self.server.themeName) self.server.themeName,
self.server.systemLanguage)
if hashtagStr: if hashtagStr:
msg = hashtagStr.encode('utf-8') msg = hashtagStr.encode('utf-8')
msglen = len(msg) msglen = len(msg)
@ -7113,7 +7118,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.showPublishedDateOnly, self.server.showPublishedDateOnly,
self.server.peertubeInstances, self.server.peertubeInstances,
self.server.allowLocalNetworkAccess, self.server.allowLocalNetworkAccess,
self.server.themeName) self.server.themeName,
self.server.systemLanguage)
if deleteStr: if deleteStr:
deleteStrLen = len(deleteStr) deleteStrLen = len(deleteStr)
self._set_headers('text/html', deleteStrLen, self._set_headers('text/html', deleteStrLen,
@ -7321,7 +7327,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.showPublishedDateOnly, self.server.showPublishedDateOnly,
peertubeInstances, peertubeInstances,
self.server.allowLocalNetworkAccess, self.server.allowLocalNetworkAccess,
self.server.themeName) self.server.themeName,
self.server.systemLanguage)
msg = msg.encode('utf-8') msg = msg.encode('utf-8')
msglen = len(msg) msglen = len(msg)
self._set_headers('text/html', msglen, self._set_headers('text/html', msglen,
@ -7409,7 +7416,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.showPublishedDateOnly, self.server.showPublishedDateOnly,
peertubeInstances, peertubeInstances,
self.server.allowLocalNetworkAccess, self.server.allowLocalNetworkAccess,
self.server.themeName) self.server.themeName,
self.server.systemLanguage)
msg = msg.encode('utf-8') msg = msg.encode('utf-8')
msglen = len(msg) msglen = len(msg)
self._set_headers('text/html', msglen, self._set_headers('text/html', msglen,
@ -7507,7 +7515,9 @@ class PubServer(BaseHTTPRequestHandler):
self.server.allowLocalNetworkAccess, self.server.allowLocalNetworkAccess,
self.server.textModeBanner, self.server.textModeBanner,
self.server.debug, self.server.debug,
accessKeys, city, rolesList, accessKeys, city,
self.server.systemLanguage,
rolesList,
None, None) None, None)
msg = msg.encode('utf-8') msg = msg.encode('utf-8')
msglen = len(msg) msglen = len(msg)
@ -7605,7 +7615,9 @@ class PubServer(BaseHTTPRequestHandler):
allowLocalNetworkAccess, allowLocalNetworkAccess,
self.server.textModeBanner, self.server.textModeBanner,
self.server.debug, self.server.debug,
accessKeys, city, skills, accessKeys, city,
self.server.systemLanguage,
skills,
None, None) None, None)
msg = msg.encode('utf-8') msg = msg.encode('utf-8')
msglen = len(msg) msglen = len(msg)
@ -7738,7 +7750,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.showPublishedDateOnly, self.server.showPublishedDateOnly,
self.server.peertubeInstances, self.server.peertubeInstances,
self.server.allowLocalNetworkAccess, self.server.allowLocalNetworkAccess,
self.server.themeName) self.server.themeName,
self.server.systemLanguage)
msg = msg.encode('utf-8') msg = msg.encode('utf-8')
msglen = len(msg) msglen = len(msg)
self._set_headers('text/html', msglen, self._set_headers('text/html', msglen,
@ -7947,7 +7960,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.peertubeInstances, self.server.peertubeInstances,
self.server.allowLocalNetworkAccess, self.server.allowLocalNetworkAccess,
self.server.textModeBanner, self.server.textModeBanner,
accessKeys) accessKeys,
self.server.systemLanguage)
if GETstartTime: if GETstartTime:
self._benchmarkGETtimings(GETstartTime, GETtimings, self._benchmarkGETtimings(GETstartTime, GETtimings,
'show status done', 'show status done',
@ -8083,7 +8097,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.peertubeInstances, self.server.peertubeInstances,
self.server.allowLocalNetworkAccess, self.server.allowLocalNetworkAccess,
self.server.textModeBanner, self.server.textModeBanner,
accessKeys) accessKeys,
self.server.systemLanguage)
msg = msg.encode('utf-8') msg = msg.encode('utf-8')
msglen = len(msg) msglen = len(msg)
self._set_headers('text/html', msglen, self._set_headers('text/html', msglen,
@ -8212,7 +8227,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.peertubeInstances, self.server.peertubeInstances,
self.server.allowLocalNetworkAccess, self.server.allowLocalNetworkAccess,
self.server.textModeBanner, self.server.textModeBanner,
accessKeys) accessKeys,
self.server.systemLanguage)
msg = msg.encode('utf-8') msg = msg.encode('utf-8')
msglen = len(msg) msglen = len(msg)
self._set_headers('text/html', msglen, self._set_headers('text/html', msglen,
@ -8342,7 +8358,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.peertubeInstances, self.server.peertubeInstances,
self.server.allowLocalNetworkAccess, self.server.allowLocalNetworkAccess,
self.server.textModeBanner, self.server.textModeBanner,
accessKeys) accessKeys,
self.server.systemLanguage)
msg = msg.encode('utf-8') msg = msg.encode('utf-8')
msglen = len(msg) msglen = len(msg)
self._set_headers('text/html', msglen, self._set_headers('text/html', msglen,
@ -8472,7 +8489,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.peertubeInstances, self.server.peertubeInstances,
self.server.allowLocalNetworkAccess, self.server.allowLocalNetworkAccess,
self.server.textModeBanner, self.server.textModeBanner,
accessKeys) accessKeys,
self.server.systemLanguage)
msg = msg.encode('utf-8') msg = msg.encode('utf-8')
msglen = len(msg) msglen = len(msg)
self._set_headers('text/html', msglen, self._set_headers('text/html', msglen,
@ -8611,7 +8629,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.peertubeInstances, self.server.peertubeInstances,
self.server.allowLocalNetworkAccess, self.server.allowLocalNetworkAccess,
self.server.textModeBanner, self.server.textModeBanner,
accessKeys) accessKeys,
self.server.systemLanguage)
msg = msg.encode('utf-8') msg = msg.encode('utf-8')
msglen = len(msg) msglen = len(msg)
self._set_headers('text/html', msglen, self._set_headers('text/html', msglen,
@ -8746,7 +8765,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.peertubeInstances, self.server.peertubeInstances,
self.server.allowLocalNetworkAccess, self.server.allowLocalNetworkAccess,
self.server.textModeBanner, self.server.textModeBanner,
accessKeys) accessKeys,
self.server.systemLanguage)
msg = msg.encode('utf-8') msg = msg.encode('utf-8')
msglen = len(msg) msglen = len(msg)
self._set_headers('text/html', msglen, self._set_headers('text/html', msglen,
@ -8842,7 +8862,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.peertubeInstances, self.server.peertubeInstances,
self.server.allowLocalNetworkAccess, self.server.allowLocalNetworkAccess,
self.server.textModeBanner, self.server.textModeBanner,
accessKeys) accessKeys,
self.server.systemLanguage)
msg = msg.encode('utf-8') msg = msg.encode('utf-8')
msglen = len(msg) msglen = len(msg)
self._set_headers('text/html', msglen, self._set_headers('text/html', msglen,
@ -8955,7 +8976,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.peertubeInstances, self.server.peertubeInstances,
self.server.allowLocalNetworkAccess, self.server.allowLocalNetworkAccess,
self.server.textModeBanner, self.server.textModeBanner,
accessKeys) accessKeys,
self.server.systemLanguage)
msg = msg.encode('utf-8') msg = msg.encode('utf-8')
msglen = len(msg) msglen = len(msg)
self._set_headers('text/html', msglen, self._set_headers('text/html', msglen,
@ -9081,7 +9103,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.peertubeInstances, self.server.peertubeInstances,
self.server.allowLocalNetworkAccess, self.server.allowLocalNetworkAccess,
self.server.textModeBanner, self.server.textModeBanner,
accessKeys) accessKeys,
self.server.systemLanguage)
msg = msg.encode('utf-8') msg = msg.encode('utf-8')
msglen = len(msg) msglen = len(msg)
self._set_headers('text/html', msglen, self._set_headers('text/html', msglen,
@ -9196,7 +9219,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.peertubeInstances, self.server.peertubeInstances,
self.server.allowLocalNetworkAccess, self.server.allowLocalNetworkAccess,
self.server.textModeBanner, self.server.textModeBanner,
accessKeys) accessKeys,
self.server.systemLanguage)
msg = msg.encode('utf-8') msg = msg.encode('utf-8')
msglen = len(msg) msglen = len(msg)
self._set_headers('text/html', msglen, self._set_headers('text/html', msglen,
@ -9312,6 +9336,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.textModeBanner, self.server.textModeBanner,
self.server.debug, self.server.debug,
accessKeys, city, accessKeys, city,
self.server.systemLanguage,
shares, shares,
pageNumber, sharesPerPage) pageNumber, sharesPerPage)
msg = msg.encode('utf-8') msg = msg.encode('utf-8')
@ -9425,6 +9450,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.textModeBanner, self.server.textModeBanner,
self.server.debug, self.server.debug,
accessKeys, city, accessKeys, city,
self.server.systemLanguage,
following, following,
pageNumber, pageNumber,
followsPerPage).encode('utf-8') followsPerPage).encode('utf-8')
@ -9538,6 +9564,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.textModeBanner, self.server.textModeBanner,
self.server.debug, self.server.debug,
accessKeys, city, accessKeys, city,
self.server.systemLanguage,
followers, followers,
pageNumber, pageNumber,
followsPerPage).encode('utf-8') followsPerPage).encode('utf-8')
@ -9674,6 +9701,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.textModeBanner, self.server.textModeBanner,
self.server.debug, self.server.debug,
accessKeys, city, accessKeys, city,
self.server.systemLanguage,
None, None).encode('utf-8') None, None).encode('utf-8')
msglen = len(msg) msglen = len(msg)
self._set_headers('text/html', msglen, self._set_headers('text/html', msglen,

View File

@ -164,7 +164,7 @@ def _inboxStorePostToHtmlCache(recentPostsCache: {}, maxRecentPosts: int,
showPublishedDateOnly: bool, showPublishedDateOnly: bool,
peertubeInstances: [], peertubeInstances: [],
allowLocalNetworkAccess: bool, allowLocalNetworkAccess: bool,
themeName: str) -> None: themeName: str, systemLanguage: str) -> None:
"""Converts the json post into html and stores it in a cache """Converts the json post into html and stores it in a cache
This enables the post to be quickly displayed later This enables the post to be quickly displayed later
""" """
@ -182,7 +182,7 @@ def _inboxStorePostToHtmlCache(recentPostsCache: {}, maxRecentPosts: int,
httpPrefix, __version__, boxname, None, httpPrefix, __version__, boxname, None,
showPublishedDateOnly, showPublishedDateOnly,
peertubeInstances, allowLocalNetworkAccess, peertubeInstances, allowLocalNetworkAccess,
themeName, themeName, systemLanguage,
not isDM(postJsonObject), not isDM(postJsonObject),
True, True, False, True) True, True, False, True)
@ -2593,7 +2593,7 @@ def _inboxAfterInitial(recentPostsCache: {}, maxRecentPosts: int,
showPublishedDateOnly, showPublishedDateOnly,
peertubeInstances, peertubeInstances,
allowLocalNetworkAccess, allowLocalNetworkAccess,
themeName) themeName, systemLanguage)
if debug: if debug:
timeDiff = \ timeDiff = \
str(int((time.time() - htmlCacheStartTime) * str(int((time.time() - htmlCacheStartTime) *

View File

@ -28,6 +28,23 @@ invalidCharacters = (
) )
def getContentFromPost(postJsonObject: {}, systemLanguage: str) -> str:
"""Returns the content from the post in the given language
"""
thisPostJson = postJsonObject
if hasObjectDict(postJsonObject):
thisPostJson = postJsonObject['object']
if not thisPostJson.get('content'):
return ''
content = thisPostJson['content']
if thisPostJson.get('contentMap'):
if isinstance(thisPostJson['contentMap'], dict):
if thisPostJson['contentMap'].get(systemLanguage):
if isinstance(thisPostJson['contentMap'][systemLanguage], str):
return thisPostJson['contentMap'][systemLanguage]
return content
def acctDir(baseDir: str, nickname: str, domain: str) -> str: def acctDir(baseDir: str, nickname: str, domain: str) -> str:
return baseDir + '/accounts/' + nickname + '@' + domain return baseDir + '/accounts/' + nickname + '@' + domain

View File

@ -34,7 +34,7 @@ def htmlConfirmDelete(cssCache: {},
showPublishedDateOnly: bool, showPublishedDateOnly: bool,
peertubeInstances: [], peertubeInstances: [],
allowLocalNetworkAccess: bool, allowLocalNetworkAccess: bool,
themeName: str) -> str: themeName: str, systemLanguage: str) -> str:
"""Shows a screen asking to confirm the deletion of a post """Shows a screen asking to confirm the deletion of a post
""" """
if '/statuses/' not in messageId: if '/statuses/' not in messageId:
@ -75,7 +75,7 @@ def htmlConfirmDelete(cssCache: {},
YTReplacementDomain, YTReplacementDomain,
showPublishedDateOnly, showPublishedDateOnly,
peertubeInstances, allowLocalNetworkAccess, peertubeInstances, allowLocalNetworkAccess,
themeName, themeName, systemLanguage,
False, False, False, False, False) False, False, False, False, False)
deletePostStr += '<center>' deletePostStr += '<center>'
deletePostStr += \ deletePostStr += \

View File

@ -32,7 +32,7 @@ def _htmlFrontScreenPosts(recentPostsCache: {}, maxRecentPosts: int,
showPublishedDateOnly: bool, showPublishedDateOnly: bool,
peertubeInstances: [], peertubeInstances: [],
allowLocalNetworkAccess: bool, allowLocalNetworkAccess: bool,
themeName: str) -> str: themeName: str, systemLanguage: str) -> str:
"""Shows posts on the front screen of a news instance """Shows posts on the front screen of a news instance
These should only be public blog posts from the features timeline These should only be public blog posts from the features timeline
which is the blog timeline of the news actor which is the blog timeline of the news actor
@ -73,7 +73,7 @@ def _htmlFrontScreenPosts(recentPostsCache: {}, maxRecentPosts: int,
showPublishedDateOnly, showPublishedDateOnly,
peertubeInstances, peertubeInstances,
allowLocalNetworkAccess, allowLocalNetworkAccess,
themeName, themeName, systemLanguage,
False, False, False, True, False) False, False, False, True, False)
if postStr: if postStr:
profileStr += postStr + separatorStr profileStr += postStr + separatorStr
@ -98,6 +98,7 @@ def htmlFrontScreen(rssIconAtTop: bool,
peertubeInstances: [], peertubeInstances: [],
allowLocalNetworkAccess: bool, allowLocalNetworkAccess: bool,
accessKeys: {}, accessKeys: {},
systemLanguage: str,
extraJson: {} = None, extraJson: {} = None,
pageNumber: int = None, pageNumber: int = None,
maxItemsPerPage: int = None) -> str: maxItemsPerPage: int = None) -> str:
@ -167,7 +168,7 @@ def htmlFrontScreen(rssIconAtTop: bool,
showPublishedDateOnly, showPublishedDateOnly,
peertubeInstances, peertubeInstances,
allowLocalNetworkAccess, allowLocalNetworkAccess,
theme) + licenseStr theme, systemLanguage) + licenseStr
# Footer which is only used for system accounts # Footer which is only used for system accounts
profileFooterStr = ' </td>\n' profileFooterStr = ' </td>\n'

View File

@ -47,7 +47,7 @@ def htmlModeration(cssCache: {}, defaultTimeline: str,
theme: str, peertubeInstances: [], theme: str, peertubeInstances: [],
allowLocalNetworkAccess: bool, allowLocalNetworkAccess: bool,
textModeBanner: str, textModeBanner: str,
accessKeys: {}) -> str: accessKeys: {}, systemLanguage: str) -> str:
"""Show the moderation feed as html """Show the moderation feed as html
This is what you see when selecting the "mod" timeline This is what you see when selecting the "mod" timeline
""" """
@ -63,7 +63,7 @@ def htmlModeration(cssCache: {}, defaultTimeline: str,
iconsAsButtons, rssIconAtTop, publishButtonAtTop, iconsAsButtons, rssIconAtTop, publishButtonAtTop,
authorized, moderationActionStr, theme, authorized, moderationActionStr, theme,
peertubeInstances, allowLocalNetworkAccess, peertubeInstances, allowLocalNetworkAccess,
textModeBanner, accessKeys) textModeBanner, accessKeys, systemLanguage)
def htmlAccountInfo(cssCache: {}, translate: {}, def htmlAccountInfo(cssCache: {}, translate: {},

View File

@ -22,6 +22,7 @@ from posts import postIsMuted
from posts import getPersonBox from posts import getPersonBox
from posts import downloadAnnounce from posts import downloadAnnounce
from posts import populateRepliesJson from posts import populateRepliesJson
from utils import getContentFromPost
from utils import hasObjectDict from utils import hasObjectDict
from utils import updateAnnounceCollection from utils import updateAnnounceCollection
from utils import isPGPEncrypted from utils import isPGPEncrypted
@ -273,7 +274,7 @@ def _getAvatarImageHtml(showAvatarOptions: bool,
def _getReplyIconHtml(nickname: str, isPublicRepeat: bool, def _getReplyIconHtml(nickname: str, isPublicRepeat: bool,
showIcons: bool, commentsEnabled: bool, showIcons: bool, commentsEnabled: bool,
postJsonObject: {}, pageNumberParam: str, postJsonObject: {}, pageNumberParam: str,
translate: {}) -> str: translate: {}, systemLanguage: str) -> str:
"""Returns html for the reply icon/button """Returns html for the reply icon/button
""" """
replyStr = '' replyStr = ''
@ -286,9 +287,9 @@ def _getReplyIconHtml(nickname: str, isPublicRepeat: bool,
if isinstance(postJsonObject['object']['attributedTo'], str): if isinstance(postJsonObject['object']['attributedTo'], str):
replyToLink += \ replyToLink += \
'?mention=' + postJsonObject['object']['attributedTo'] '?mention=' + postJsonObject['object']['attributedTo']
if postJsonObject['object'].get('content'): content = getContentFromPost(postJsonObject, systemLanguage)
mentionedActors = \ if content:
getMentionsFromHtml(postJsonObject['object']['content']) mentionedActors = getMentionsFromHtml(content)
if mentionedActors: if mentionedActors:
for actorUrl in mentionedActors: for actorUrl in mentionedActors:
if '?mention=' + actorUrl not in replyToLink: if '?mention=' + actorUrl not in replyToLink:
@ -1160,7 +1161,7 @@ def individualPostAsHtml(allowDownloads: bool,
showPublishedDateOnly: bool, showPublishedDateOnly: bool,
peertubeInstances: [], peertubeInstances: [],
allowLocalNetworkAccess: bool, allowLocalNetworkAccess: bool,
themeName: str, themeName: str, systemLanguage: str,
showRepeats: bool = True, showRepeats: bool = True,
showIcons: bool = False, showIcons: bool = False,
manuallyApprovesFollowers: bool = False, manuallyApprovesFollowers: bool = False,
@ -1410,7 +1411,7 @@ def individualPostAsHtml(allowDownloads: bool,
replyStr = _getReplyIconHtml(nickname, isPublicRepeat, replyStr = _getReplyIconHtml(nickname, isPublicRepeat,
showIcons, commentsEnabled, showIcons, commentsEnabled,
postJsonObject, pageNumberParam, postJsonObject, pageNumberParam,
translate) translate, systemLanguage)
_logPostTiming(enableTimingLog, postStartTime, '10') _logPostTiming(enableTimingLog, postStartTime, '10')
@ -1588,20 +1589,21 @@ def individualPostAsHtml(allowDownloads: bool,
postJsonObject['object']['content'] = \ postJsonObject['object']['content'] = \
E2EEdecryptMessageFromDevice(postJsonObject['object']) E2EEdecryptMessageFromDevice(postJsonObject['object'])
if not postJsonObject['object'].get('content'): contentStr = getContentFromPost(postJsonObject, systemLanguage)
if not contentStr:
return '' return ''
isPatch = isGitPatch(baseDir, nickname, domain, isPatch = isGitPatch(baseDir, nickname, domain,
postJsonObject['object']['type'], postJsonObject['object']['type'],
postJsonObject['object']['summary'], postJsonObject['object']['summary'],
postJsonObject['object']['content']) contentStr)
_logPostTiming(enableTimingLog, postStartTime, '16') _logPostTiming(enableTimingLog, postStartTime, '16')
if not isPGPEncrypted(postJsonObject['object']['content']): if not isPGPEncrypted(contentStr):
if not isPatch: if not isPatch:
objectContent = \ objectContent = \
removeLongWords(postJsonObject['object']['content'], 40, []) removeLongWords(contentStr, 40, [])
objectContent = removeTextFormatting(objectContent) objectContent = removeTextFormatting(objectContent)
objectContent = limitRepeatedWords(objectContent, 6) objectContent = limitRepeatedWords(objectContent, 6)
objectContent = \ objectContent = \
@ -1609,8 +1611,7 @@ def individualPostAsHtml(allowDownloads: bool,
objectContent = htmlReplaceEmailQuote(objectContent) objectContent = htmlReplaceEmailQuote(objectContent)
objectContent = htmlReplaceQuoteMarks(objectContent) objectContent = htmlReplaceQuoteMarks(objectContent)
else: else:
objectContent = \ objectContent = contentStr
postJsonObject['object']['content']
else: else:
objectContent = '🔒 ' + translate['Encrypted'] objectContent = '🔒 ' + translate['Encrypted']
@ -1719,7 +1720,7 @@ def htmlIndividualPost(cssCache: {},
showPublishedDateOnly: bool, showPublishedDateOnly: bool,
peertubeInstances: [], peertubeInstances: [],
allowLocalNetworkAccess: bool, allowLocalNetworkAccess: bool,
themeName: str) -> str: themeName: str, systemLanguage: str) -> str:
"""Show an individual post as html """Show an individual post as html
""" """
postStr = '' postStr = ''
@ -1761,6 +1762,7 @@ def htmlIndividualPost(cssCache: {},
showPublishedDateOnly, showPublishedDateOnly,
peertubeInstances, peertubeInstances,
allowLocalNetworkAccess, themeName, allowLocalNetworkAccess, themeName,
systemLanguage,
False, authorized, False, False, False) False, authorized, False, False, False)
messageId = removeIdEnding(postJsonObject['id']) messageId = removeIdEnding(postJsonObject['id'])
@ -1788,7 +1790,7 @@ def htmlIndividualPost(cssCache: {},
showPublishedDateOnly, showPublishedDateOnly,
peertubeInstances, peertubeInstances,
allowLocalNetworkAccess, allowLocalNetworkAccess,
themeName, themeName, systemLanguage,
False, authorized, False, authorized,
False, False, False) + postStr False, False, False) + postStr
@ -1819,7 +1821,7 @@ def htmlIndividualPost(cssCache: {},
showPublishedDateOnly, showPublishedDateOnly,
peertubeInstances, peertubeInstances,
allowLocalNetworkAccess, allowLocalNetworkAccess,
themeName, themeName, systemLanguage,
False, authorized, False, authorized,
False, False, False) False, False, False)
cssFilename = baseDir + '/epicyon-profile.css' cssFilename = baseDir + '/epicyon-profile.css'
@ -1842,7 +1844,7 @@ def htmlPostReplies(cssCache: {},
showPublishedDateOnly: bool, showPublishedDateOnly: bool,
peertubeInstances: [], peertubeInstances: [],
allowLocalNetworkAccess: bool, allowLocalNetworkAccess: bool,
themeName: str) -> str: themeName: str, systemLanguage: str) -> str:
"""Show the replies to an individual post as html """Show the replies to an individual post as html
""" """
repliesStr = '' repliesStr = ''
@ -1861,7 +1863,7 @@ def htmlPostReplies(cssCache: {},
showPublishedDateOnly, showPublishedDateOnly,
peertubeInstances, peertubeInstances,
allowLocalNetworkAccess, allowLocalNetworkAccess,
themeName, themeName, systemLanguage,
False, False, False, False, False) False, False, False, False, False)
cssFilename = baseDir + '/epicyon-profile.css' cssFilename = baseDir + '/epicyon-profile.css'

View File

@ -73,7 +73,8 @@ def htmlProfileAfterSearch(cssCache: {},
peertubeInstances: [], peertubeInstances: [],
allowLocalNetworkAccess: bool, allowLocalNetworkAccess: bool,
themeName: str, themeName: str,
accessKeys: {}) -> str: accessKeys: {},
systemLanguage: str) -> str:
"""Show a profile page after a search for a fediverse address """Show a profile page after a search for a fediverse address
""" """
http = False http = False
@ -246,7 +247,7 @@ def htmlProfileAfterSearch(cssCache: {},
YTReplacementDomain, YTReplacementDomain,
showPublishedDateOnly, showPublishedDateOnly,
peertubeInstances, allowLocalNetworkAccess, peertubeInstances, allowLocalNetworkAccess,
themeName, themeName, systemLanguage,
False, False, False, False, False) False, False, False, False, False)
i += 1 i += 1
if i >= 20: if i >= 20:
@ -447,6 +448,7 @@ def htmlProfile(rssIconAtTop: bool,
allowLocalNetworkAccess: bool, allowLocalNetworkAccess: bool,
textModeBanner: str, textModeBanner: str,
debug: bool, accessKeys: {}, city: str, debug: bool, accessKeys: {}, city: str,
systemLanguage: str,
extraJson: {} = None, pageNumber: int = None, extraJson: {} = None, pageNumber: int = None,
maxItemsPerPage: int = None) -> str: maxItemsPerPage: int = None) -> str:
"""Show the profile page as html """Show the profile page as html
@ -467,6 +469,7 @@ def htmlProfile(rssIconAtTop: bool,
showPublishedDateOnly, showPublishedDateOnly,
newswire, theme, extraJson, newswire, theme, extraJson,
allowLocalNetworkAccess, accessKeys, allowLocalNetworkAccess, accessKeys,
systemLanguage,
pageNumber, maxItemsPerPage) pageNumber, maxItemsPerPage)
domain, port = getDomainFromActor(profileJson['id']) domain, port = getDomainFromActor(profileJson['id'])
@ -796,7 +799,7 @@ def htmlProfile(rssIconAtTop: bool,
showPublishedDateOnly, showPublishedDateOnly,
peertubeInstances, peertubeInstances,
allowLocalNetworkAccess, allowLocalNetworkAccess,
theme) + licenseStr theme, systemLanguage) + licenseStr
elif selected == 'following': elif selected == 'following':
profileStr += \ profileStr += \
_htmlProfileFollowing(translate, baseDir, httpPrefix, _htmlProfileFollowing(translate, baseDir, httpPrefix,
@ -850,7 +853,7 @@ def _htmlProfilePosts(recentPostsCache: {}, maxRecentPosts: int,
showPublishedDateOnly: bool, showPublishedDateOnly: bool,
peertubeInstances: [], peertubeInstances: [],
allowLocalNetworkAccess: bool, allowLocalNetworkAccess: bool,
themeName: str) -> str: themeName: str, systemLanguage: str) -> str:
"""Shows posts on the profile screen """Shows posts on the profile screen
These should only be public posts These should only be public posts
""" """
@ -890,7 +893,7 @@ def _htmlProfilePosts(recentPostsCache: {}, maxRecentPosts: int,
showPublishedDateOnly, showPublishedDateOnly,
peertubeInstances, peertubeInstances,
allowLocalNetworkAccess, allowLocalNetworkAccess,
themeName, themeName, systemLanguage,
False, False, False, True, False) False, False, False, True, False)
if postStr: if postStr:
profileStr += postStr + separatorStr profileStr += postStr + separatorStr

View File

@ -536,7 +536,8 @@ def htmlHistorySearch(cssCache: {}, translate: {}, baseDir: str,
showPublishedDateOnly: bool, showPublishedDateOnly: bool,
peertubeInstances: [], peertubeInstances: [],
allowLocalNetworkAccess: bool, allowLocalNetworkAccess: bool,
themeName: str, boxName: str) -> str: themeName: str, boxName: str,
systemLanguage: str) -> str:
"""Show a page containing search results for your post history """Show a page containing search results for your post history
""" """
if historysearch.startswith('!'): if historysearch.startswith('!'):
@ -616,7 +617,7 @@ def htmlHistorySearch(cssCache: {}, translate: {}, baseDir: str,
showPublishedDateOnly, showPublishedDateOnly,
peertubeInstances, peertubeInstances,
allowLocalNetworkAccess, allowLocalNetworkAccess,
themeName, themeName, systemLanguage,
showIndividualPostIcons, showIndividualPostIcons,
showIndividualPostIcons, showIndividualPostIcons,
False, False, False) False, False, False)
@ -640,7 +641,7 @@ def htmlHashtagSearch(cssCache: {},
showPublishedDateOnly: bool, showPublishedDateOnly: bool,
peertubeInstances: [], peertubeInstances: [],
allowLocalNetworkAccess: bool, allowLocalNetworkAccess: bool,
themeName: str) -> str: themeName: str, systemLanguage: str) -> str:
"""Show a page containing search results for a hashtag """Show a page containing search results for a hashtag
""" """
if hashtag.startswith('#'): if hashtag.startswith('#'):
@ -790,7 +791,7 @@ def htmlHashtagSearch(cssCache: {},
showPublishedDateOnly, showPublishedDateOnly,
peertubeInstances, peertubeInstances,
allowLocalNetworkAccess, allowLocalNetworkAccess,
themeName, themeName, systemLanguage,
showRepeats, showIcons, showRepeats, showIcons,
manuallyApprovesFollowers, manuallyApprovesFollowers,
showPublicOnly, showPublicOnly,

View File

@ -358,7 +358,7 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str,
peertubeInstances: [], peertubeInstances: [],
allowLocalNetworkAccess: bool, allowLocalNetworkAccess: bool,
textModeBanner: str, textModeBanner: str,
accessKeys: {}) -> str: accessKeys: {}, systemLanguage: str) -> str:
"""Show the timeline as html """Show the timeline as html
""" """
enableTimingLog = False enableTimingLog = False
@ -743,7 +743,7 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str,
showPublishedDateOnly, showPublishedDateOnly,
peertubeInstances, peertubeInstances,
allowLocalNetworkAccess, allowLocalNetworkAccess,
theme, theme, systemLanguage,
boxName != 'dm', boxName != 'dm',
showIndividualPostIcons, showIndividualPostIcons,
manuallyApproveFollowers, manuallyApproveFollowers,
@ -919,7 +919,7 @@ def htmlShares(cssCache: {}, defaultTimeline: str,
peertubeInstances: [], peertubeInstances: [],
allowLocalNetworkAccess: bool, allowLocalNetworkAccess: bool,
textModeBanner: str, textModeBanner: str,
accessKeys: {}) -> str: accessKeys: {}, systemLanguage: str) -> str:
"""Show the shares timeline as html """Show the shares timeline as html
""" """
manuallyApproveFollowers = \ manuallyApproveFollowers = \
@ -941,7 +941,7 @@ def htmlShares(cssCache: {}, defaultTimeline: str,
iconsAsButtons, rssIconAtTop, publishButtonAtTop, iconsAsButtons, rssIconAtTop, publishButtonAtTop,
authorized, None, theme, peertubeInstances, authorized, None, theme, peertubeInstances,
allowLocalNetworkAccess, textModeBanner, allowLocalNetworkAccess, textModeBanner,
accessKeys) accessKeys, systemLanguage)
def htmlInbox(cssCache: {}, defaultTimeline: str, def htmlInbox(cssCache: {}, defaultTimeline: str,
@ -964,7 +964,7 @@ def htmlInbox(cssCache: {}, defaultTimeline: str,
peertubeInstances: [], peertubeInstances: [],
allowLocalNetworkAccess: bool, allowLocalNetworkAccess: bool,
textModeBanner: str, textModeBanner: str,
accessKeys: {}) -> str: accessKeys: {}, systemLanguage: str) -> str:
"""Show the inbox as html """Show the inbox as html
""" """
manuallyApproveFollowers = \ manuallyApproveFollowers = \
@ -986,7 +986,7 @@ def htmlInbox(cssCache: {}, defaultTimeline: str,
iconsAsButtons, rssIconAtTop, publishButtonAtTop, iconsAsButtons, rssIconAtTop, publishButtonAtTop,
authorized, None, theme, peertubeInstances, authorized, None, theme, peertubeInstances,
allowLocalNetworkAccess, textModeBanner, allowLocalNetworkAccess, textModeBanner,
accessKeys) accessKeys, systemLanguage)
def htmlBookmarks(cssCache: {}, defaultTimeline: str, def htmlBookmarks(cssCache: {}, defaultTimeline: str,
@ -1009,7 +1009,7 @@ def htmlBookmarks(cssCache: {}, defaultTimeline: str,
peertubeInstances: [], peertubeInstances: [],
allowLocalNetworkAccess: bool, allowLocalNetworkAccess: bool,
textModeBanner: str, textModeBanner: str,
accessKeys: {}) -> str: accessKeys: {}, systemLanguage: str) -> str:
"""Show the bookmarks as html """Show the bookmarks as html
""" """
manuallyApproveFollowers = \ manuallyApproveFollowers = \
@ -1031,7 +1031,7 @@ def htmlBookmarks(cssCache: {}, defaultTimeline: str,
iconsAsButtons, rssIconAtTop, publishButtonAtTop, iconsAsButtons, rssIconAtTop, publishButtonAtTop,
authorized, None, theme, peertubeInstances, authorized, None, theme, peertubeInstances,
allowLocalNetworkAccess, textModeBanner, allowLocalNetworkAccess, textModeBanner,
accessKeys) accessKeys, systemLanguage)
def htmlInboxDMs(cssCache: {}, defaultTimeline: str, def htmlInboxDMs(cssCache: {}, defaultTimeline: str,
@ -1054,7 +1054,7 @@ def htmlInboxDMs(cssCache: {}, defaultTimeline: str,
peertubeInstances: [], peertubeInstances: [],
allowLocalNetworkAccess: bool, allowLocalNetworkAccess: bool,
textModeBanner: str, textModeBanner: str,
accessKeys: {}) -> str: accessKeys: {}, systemLanguage: str) -> str:
"""Show the DM timeline as html """Show the DM timeline as html
""" """
return htmlTimeline(cssCache, defaultTimeline, return htmlTimeline(cssCache, defaultTimeline,
@ -1071,7 +1071,7 @@ def htmlInboxDMs(cssCache: {}, defaultTimeline: str,
iconsAsButtons, rssIconAtTop, publishButtonAtTop, iconsAsButtons, rssIconAtTop, publishButtonAtTop,
authorized, None, theme, peertubeInstances, authorized, None, theme, peertubeInstances,
allowLocalNetworkAccess, textModeBanner, allowLocalNetworkAccess, textModeBanner,
accessKeys) accessKeys, systemLanguage)
def htmlInboxReplies(cssCache: {}, defaultTimeline: str, def htmlInboxReplies(cssCache: {}, defaultTimeline: str,
@ -1094,7 +1094,7 @@ def htmlInboxReplies(cssCache: {}, defaultTimeline: str,
peertubeInstances: [], peertubeInstances: [],
allowLocalNetworkAccess: bool, allowLocalNetworkAccess: bool,
textModeBanner: str, textModeBanner: str,
accessKeys: {}) -> str: accessKeys: {}, systemLanguage: str) -> str:
"""Show the replies timeline as html """Show the replies timeline as html
""" """
return htmlTimeline(cssCache, defaultTimeline, return htmlTimeline(cssCache, defaultTimeline,
@ -1112,7 +1112,7 @@ def htmlInboxReplies(cssCache: {}, defaultTimeline: str,
iconsAsButtons, rssIconAtTop, publishButtonAtTop, iconsAsButtons, rssIconAtTop, publishButtonAtTop,
authorized, None, theme, peertubeInstances, authorized, None, theme, peertubeInstances,
allowLocalNetworkAccess, textModeBanner, allowLocalNetworkAccess, textModeBanner,
accessKeys) accessKeys, systemLanguage)
def htmlInboxMedia(cssCache: {}, defaultTimeline: str, def htmlInboxMedia(cssCache: {}, defaultTimeline: str,
@ -1135,7 +1135,7 @@ def htmlInboxMedia(cssCache: {}, defaultTimeline: str,
peertubeInstances: [], peertubeInstances: [],
allowLocalNetworkAccess: bool, allowLocalNetworkAccess: bool,
textModeBanner: str, textModeBanner: str,
accessKeys: {}) -> str: accessKeys: {}, systemLanguage: str) -> str:
"""Show the media timeline as html """Show the media timeline as html
""" """
return htmlTimeline(cssCache, defaultTimeline, return htmlTimeline(cssCache, defaultTimeline,
@ -1153,7 +1153,7 @@ def htmlInboxMedia(cssCache: {}, defaultTimeline: str,
iconsAsButtons, rssIconAtTop, publishButtonAtTop, iconsAsButtons, rssIconAtTop, publishButtonAtTop,
authorized, None, theme, peertubeInstances, authorized, None, theme, peertubeInstances,
allowLocalNetworkAccess, textModeBanner, allowLocalNetworkAccess, textModeBanner,
accessKeys) accessKeys, systemLanguage)
def htmlInboxBlogs(cssCache: {}, defaultTimeline: str, def htmlInboxBlogs(cssCache: {}, defaultTimeline: str,
@ -1176,7 +1176,7 @@ def htmlInboxBlogs(cssCache: {}, defaultTimeline: str,
peertubeInstances: [], peertubeInstances: [],
allowLocalNetworkAccess: bool, allowLocalNetworkAccess: bool,
textModeBanner: str, textModeBanner: str,
accessKeys: {}) -> str: accessKeys: {}, systemLanguage: str) -> str:
"""Show the blogs timeline as html """Show the blogs timeline as html
""" """
return htmlTimeline(cssCache, defaultTimeline, return htmlTimeline(cssCache, defaultTimeline,
@ -1194,7 +1194,7 @@ def htmlInboxBlogs(cssCache: {}, defaultTimeline: str,
iconsAsButtons, rssIconAtTop, publishButtonAtTop, iconsAsButtons, rssIconAtTop, publishButtonAtTop,
authorized, None, theme, peertubeInstances, authorized, None, theme, peertubeInstances,
allowLocalNetworkAccess, textModeBanner, allowLocalNetworkAccess, textModeBanner,
accessKeys) accessKeys, systemLanguage)
def htmlInboxFeatures(cssCache: {}, defaultTimeline: str, def htmlInboxFeatures(cssCache: {}, defaultTimeline: str,
@ -1218,7 +1218,7 @@ def htmlInboxFeatures(cssCache: {}, defaultTimeline: str,
peertubeInstances: [], peertubeInstances: [],
allowLocalNetworkAccess: bool, allowLocalNetworkAccess: bool,
textModeBanner: str, textModeBanner: str,
accessKeys: {}) -> str: accessKeys: {}, systemLanguage: str) -> str:
"""Show the features timeline as html """Show the features timeline as html
""" """
return htmlTimeline(cssCache, defaultTimeline, return htmlTimeline(cssCache, defaultTimeline,
@ -1236,7 +1236,7 @@ def htmlInboxFeatures(cssCache: {}, defaultTimeline: str,
iconsAsButtons, rssIconAtTop, publishButtonAtTop, iconsAsButtons, rssIconAtTop, publishButtonAtTop,
authorized, None, theme, peertubeInstances, authorized, None, theme, peertubeInstances,
allowLocalNetworkAccess, textModeBanner, allowLocalNetworkAccess, textModeBanner,
accessKeys) accessKeys, systemLanguage)
def htmlInboxNews(cssCache: {}, defaultTimeline: str, def htmlInboxNews(cssCache: {}, defaultTimeline: str,
@ -1259,7 +1259,7 @@ def htmlInboxNews(cssCache: {}, defaultTimeline: str,
peertubeInstances: [], peertubeInstances: [],
allowLocalNetworkAccess: bool, allowLocalNetworkAccess: bool,
textModeBanner: str, textModeBanner: str,
accessKeys: {}) -> str: accessKeys: {}, systemLanguage: str) -> str:
"""Show the news timeline as html """Show the news timeline as html
""" """
return htmlTimeline(cssCache, defaultTimeline, return htmlTimeline(cssCache, defaultTimeline,
@ -1277,7 +1277,7 @@ def htmlInboxNews(cssCache: {}, defaultTimeline: str,
iconsAsButtons, rssIconAtTop, publishButtonAtTop, iconsAsButtons, rssIconAtTop, publishButtonAtTop,
authorized, None, theme, peertubeInstances, authorized, None, theme, peertubeInstances,
allowLocalNetworkAccess, textModeBanner, allowLocalNetworkAccess, textModeBanner,
accessKeys) accessKeys, systemLanguage)
def htmlOutbox(cssCache: {}, defaultTimeline: str, def htmlOutbox(cssCache: {}, defaultTimeline: str,
@ -1300,7 +1300,7 @@ def htmlOutbox(cssCache: {}, defaultTimeline: str,
peertubeInstances: [], peertubeInstances: [],
allowLocalNetworkAccess: bool, allowLocalNetworkAccess: bool,
textModeBanner: str, textModeBanner: str,
accessKeys: {}) -> str: accessKeys: {}, systemLanguage: str) -> str:
"""Show the Outbox as html """Show the Outbox as html
""" """
manuallyApproveFollowers = \ manuallyApproveFollowers = \
@ -1319,4 +1319,4 @@ def htmlOutbox(cssCache: {}, defaultTimeline: str,
iconsAsButtons, rssIconAtTop, publishButtonAtTop, iconsAsButtons, rssIconAtTop, publishButtonAtTop,
authorized, None, theme, peertubeInstances, authorized, None, theme, peertubeInstances,
allowLocalNetworkAccess, textModeBanner, allowLocalNetworkAccess, textModeBanner,
accessKeys) accessKeys, systemLanguage)