Start of custom peertube sites

alt-html-css
Bob Mottram 2020-12-23 23:59:49 +00:00
parent d7da2f2e65
commit cf4d9466eb
11 changed files with 205 additions and 102 deletions

21
blog.py
View File

@ -158,6 +158,7 @@ def _htmlBlogPostContent(authorized: bool,
nickname: str, domain: str, domainFull: str,
postJsonObject: {},
handle: str, restrictToDomain: bool,
peertubeInstances: [],
blogSeparator='<hr>') -> str:
"""Returns the content for a single blog post
"""
@ -231,7 +232,8 @@ def _htmlBlogPostContent(authorized: bool,
if postJsonObject['object'].get('content'):
contentStr = addEmbeddedElements(translate,
postJsonObject['object']['content'])
postJsonObject['object']['content'],
peertubeInstances)
if postJsonObject['object'].get('tag'):
contentStr = replaceEmojiFromTags(contentStr,
postJsonObject['object']['tag'],
@ -375,7 +377,8 @@ def _htmlBlogRemoveCwButton(blogStr: str, translate: {}) -> str:
def htmlBlogPost(authorized: bool,
baseDir: str, httpPrefix: str, translate: {},
nickname: str, domain: str, domainFull: str,
postJsonObject: {}) -> str:
postJsonObject: {},
peertubeInstances: []) -> str:
"""Returns a html blog post
"""
blogStr = ''
@ -390,7 +393,8 @@ def htmlBlogPost(authorized: bool,
httpPrefix, translate,
nickname, domain,
domainFull, postJsonObject,
None, False)
None, False,
peertubeInstances)
# show rss links
blogStr += '<p class="rssfeed">'
@ -417,7 +421,8 @@ def htmlBlogPost(authorized: bool,
def htmlBlogPage(authorized: bool, session,
baseDir: str, httpPrefix: str, translate: {},
nickname: str, domain: str, port: int,
noOfItems: int, pageNumber: int) -> str:
noOfItems: int, pageNumber: int,
peertubeInstances: []) -> str:
"""Returns a html blog page containing posts
"""
if ' ' in nickname or '@' in nickname or \
@ -477,7 +482,8 @@ def htmlBlogPage(authorized: bool, session,
httpPrefix, translate,
nickname, domain,
domainFull, item,
None, True)
None, True,
peertubeInstances)
if len(timelineJson['orderedItems']) >= noOfItems:
blogStr += navigateStr
@ -638,7 +644,8 @@ def _singleBlogAccountNickname(baseDir: str) -> str:
def htmlBlogView(authorized: bool,
session, baseDir: str, httpPrefix: str,
translate: {}, domain: str, port: int,
noOfItems: int) -> str:
noOfItems: int,
peertubeInstances: []) -> str:
"""Show the blog main page
"""
blogStr = ''
@ -654,7 +661,7 @@ def htmlBlogView(authorized: bool,
return htmlBlogPage(authorized, session,
baseDir, httpPrefix, translate,
nickname, domain, port,
noOfItems, 1)
noOfItems, 1, peertubeInstances)
domainFull = getFullDomain(domain, port)

View File

@ -2490,7 +2490,8 @@ class PubServer(BaseHTTPRequestHandler):
httpPrefix,
self.server.projectVersion,
self.server.YTReplacementDomain,
self.server.showPublishedDateOnly)
self.server.showPublishedDateOnly,
self.server.peertubeInstances)
if hashtagStr:
msg = hashtagStr.encode('utf-8')
msglen = len(msg)
@ -2541,7 +2542,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.personCache,
port,
self.server.YTReplacementDomain,
self.server.showPublishedDateOnly)
self.server.showPublishedDateOnly,
self.server.peertubeInstances)
if historyStr:
msg = historyStr.encode('utf-8')
msglen = len(msg)
@ -2585,7 +2587,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.projectVersion,
self.server.YTReplacementDomain,
self.server.showPublishedDateOnly,
self.server.defaultTimeline)
self.server.defaultTimeline,
self.server.peertubeInstances)
if profileStr:
msg = profileStr.encode('utf-8')
msglen = len(msg)
@ -5380,7 +5383,8 @@ class PubServer(BaseHTTPRequestHandler):
httpPrefix,
self.server.projectVersion,
self.server.YTReplacementDomain,
self.server.showPublishedDateOnly)
self.server.showPublishedDateOnly,
self.server.peertubeInstances)
if hashtagStr:
msg = hashtagStr.encode('utf-8')
msglen = len(msg)
@ -6341,7 +6345,8 @@ class PubServer(BaseHTTPRequestHandler):
__version__, self.server.cachedWebfingers,
self.server.personCache, callingDomain,
self.server.YTReplacementDomain,
self.server.showPublishedDateOnly)
self.server.showPublishedDateOnly,
self.server.peertubeInstances)
if deleteStr:
deleteStrLen = len(deleteStr)
self._set_headers('text/html', deleteStrLen,
@ -6527,6 +6532,7 @@ class PubServer(BaseHTTPRequestHandler):
personCache = self.server.personCache
projectVersion = self.server.projectVersion
ytDomain = self.server.YTReplacementDomain
peertubeInstances = self.server.peertubeInstances
msg = \
htmlPostReplies(self.server.cssCache,
recentPostsCache,
@ -6543,7 +6549,8 @@ class PubServer(BaseHTTPRequestHandler):
httpPrefix,
projectVersion,
ytDomain,
self.server.showPublishedDateOnly)
self.server.showPublishedDateOnly,
peertubeInstances)
msg = msg.encode('utf-8')
msglen = len(msg)
self._set_headers('text/html', msglen,
@ -6611,6 +6618,7 @@ class PubServer(BaseHTTPRequestHandler):
personCache = self.server.personCache
projectVersion = self.server.projectVersion
ytDomain = self.server.YTReplacementDomain
peertubeInstances = self.server.peertubeInstances
msg = \
htmlPostReplies(self.server.cssCache,
recentPostsCache,
@ -6627,7 +6635,8 @@ class PubServer(BaseHTTPRequestHandler):
httpPrefix,
projectVersion,
ytDomain,
self.server.showPublishedDateOnly)
self.server.showPublishedDateOnly,
peertubeInstances)
msg = msg.encode('utf-8')
msglen = len(msg)
self._set_headers('text/html', msglen,
@ -6713,6 +6722,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.newswire,
self.server.themeName,
self.server.dormantMonths,
self.server.peertubeInstances,
actorJson['roles'],
None, None)
msg = msg.encode('utf-8')
@ -6796,6 +6806,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.newswire,
self.server.themeName,
self.server.dormantMonths,
self.server.peertubeInstances,
actorJson['skills'],
None, None)
msg = msg.encode('utf-8')
@ -6900,6 +6911,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.YTReplacementDomain
showPublishedDateOnly = \
self.server.showPublishedDateOnly
peertubeInstances = \
self.server.peertubeInstances
cssCache = self.server.cssCache
msg = \
htmlIndividualPost(cssCache,
@ -6919,7 +6932,8 @@ class PubServer(BaseHTTPRequestHandler):
projectVersion,
likedBy,
ytDomain,
showPublishedDateOnly)
showPublishedDateOnly,
peertubeInstances)
msg = msg.encode('utf-8')
msglen = len(msg)
self._set_headers('text/html', msglen,
@ -7015,6 +7029,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.YTReplacementDomain
showPublishedDateOnly = \
self.server.showPublishedDateOnly
peertubeInstances = \
self.server.peertubeInstances
msg = \
htmlIndividualPost(self.server.cssCache,
recentPostsCache,
@ -7033,7 +7049,8 @@ class PubServer(BaseHTTPRequestHandler):
projectVersion,
likedBy,
ytDomain,
showPublishedDateOnly)
showPublishedDateOnly,
peertubeInstances)
msg = msg.encode('utf-8')
msglen = len(msg)
self._set_headers('text/html', msglen,
@ -7165,7 +7182,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.rssIconAtTop,
self.server.publishButtonAtTop,
authorized,
self.server.themeName)
self.server.themeName,
self.server.peertubeInstances)
if GETstartTime:
self._benchmarkGETtimings(GETstartTime, GETtimings,
'show status done',
@ -7291,7 +7309,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.iconsAsButtons,
self.server.rssIconAtTop,
self.server.publishButtonAtTop,
authorized, self.server.themeName)
authorized, self.server.themeName,
self.server.peertubeInstances)
msg = msg.encode('utf-8')
msglen = len(msg)
self._set_headers('text/html', msglen,
@ -7410,7 +7429,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.iconsAsButtons,
self.server.rssIconAtTop,
self.server.publishButtonAtTop,
authorized, self.server.themeName)
authorized, self.server.themeName,
self.server.peertubeInstances)
msg = msg.encode('utf-8')
msglen = len(msg)
self._set_headers('text/html', msglen,
@ -7530,7 +7550,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.rssIconAtTop,
self.server.publishButtonAtTop,
authorized,
self.server.themeName)
self.server.themeName,
self.server.peertubeInstances)
msg = msg.encode('utf-8')
msglen = len(msg)
self._set_headers('text/html', msglen,
@ -7650,7 +7671,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.rssIconAtTop,
self.server.publishButtonAtTop,
authorized,
self.server.themeName)
self.server.themeName,
self.server.peertubeInstances)
msg = msg.encode('utf-8')
msglen = len(msg)
self._set_headers('text/html', msglen,
@ -7779,7 +7801,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.rssIconAtTop,
self.server.publishButtonAtTop,
authorized,
self.server.themeName)
self.server.themeName,
self.server.peertubeInstances)
msg = msg.encode('utf-8')
msglen = len(msg)
self._set_headers('text/html', msglen,
@ -7904,7 +7927,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.rssIconAtTop,
self.server.publishButtonAtTop,
authorized,
self.server.themeName)
self.server.themeName,
self.server.peertubeInstances)
msg = msg.encode('utf-8')
msglen = len(msg)
self._set_headers('text/html', msglen,
@ -7990,7 +8014,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.iconsAsButtons,
self.server.rssIconAtTop,
self.server.publishButtonAtTop,
authorized, self.server.themeName)
authorized, self.server.themeName,
self.server.peertubeInstances)
msg = msg.encode('utf-8')
msglen = len(msg)
self._set_headers('text/html', msglen,
@ -8093,7 +8118,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.rssIconAtTop,
self.server.publishButtonAtTop,
authorized,
self.server.themeName)
self.server.themeName,
self.server.peertubeInstances)
msg = msg.encode('utf-8')
msglen = len(msg)
self._set_headers('text/html', msglen,
@ -8216,7 +8242,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.rssIconAtTop,
self.server.publishButtonAtTop,
authorized,
self.server.themeName)
self.server.themeName,
self.server.peertubeInstances)
msg = msg.encode('utf-8')
msglen = len(msg)
self._set_headers('text/html', msglen,
@ -8331,7 +8358,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.rssIconAtTop,
self.server.publishButtonAtTop,
authorized,
self.server.themeName)
self.server.themeName,
self.server.peertubeInstances)
msg = msg.encode('utf-8')
msglen = len(msg)
self._set_headers('text/html', msglen,
@ -8436,7 +8464,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.rssIconAtTop,
self.server.publishButtonAtTop,
authorized, moderationActionStr,
self.server.themeName)
self.server.themeName,
self.server.peertubeInstances)
msg = msg.encode('utf-8')
msglen = len(msg)
self._set_headers('text/html', msglen,
@ -8535,6 +8564,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.newswire,
self.server.themeName,
self.server.dormantMonths,
self.server.peertubeInstances,
shares,
pageNumber, sharesPerPage)
msg = msg.encode('utf-8')
@ -8630,6 +8660,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.newswire,
self.server.themeName,
self.server.dormantMonths,
self.server.peertubeInstances,
following,
pageNumber,
followsPerPage).encode('utf-8')
@ -8725,6 +8756,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.newswire,
self.server.themeName,
self.server.dormantMonths,
self.server.peertubeInstances,
followers,
pageNumber,
followsPerPage).encode('utf-8')
@ -8795,6 +8827,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.newswire,
self.server.themeName,
self.server.dormantMonths,
self.server.peertubeInstances,
None, None).encode('utf-8')
msglen = len(msg)
self._set_headers('text/html', msglen,
@ -8860,7 +8893,8 @@ class PubServer(BaseHTTPRequestHandler):
translate,
nickname,
domain, port,
maxPostsInBlogsFeed, pageNumber)
maxPostsInBlogsFeed, pageNumber,
self.server.peertubeInstances)
if msg is not None:
msg = msg.encode('utf-8')
msglen = len(msg)
@ -9774,7 +9808,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.translate,
self.server.domain,
self.server.port,
maxPostsInBlogsFeed)
maxPostsInBlogsFeed,
self.server.peertubeInstances)
if msg is not None:
msg = msg.encode('utf-8')
msglen = len(msg)
@ -9870,7 +9905,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.translate,
nickname, self.server.domain,
self.server.domainFull,
postJsonObject)
postJsonObject,
self.server.peertubeInstances)
if msg is not None:
msg = msg.encode('utf-8')
msglen = len(msg)
@ -13599,6 +13635,9 @@ def runDaemon(sendThreadsTimeoutMins: int,
httpd.iconsCache = {}
httpd.fontsCache = {}
# TODO load peertube instances
httpd.peertubeInstances = []
createInitialLastSeen(baseDir, httpPrefix)
print('Creating inbox queue')
@ -13619,7 +13658,8 @@ def runDaemon(sendThreadsTimeoutMins: int,
httpd.showPublishedDateOnly,
httpd.allowNewsFollowers,
httpd.maxFollowers,
httpd.allowLocalNetworkAccess), daemon=True)
httpd.allowLocalNetworkAccess,
httpd.peertubeInstances), daemon=True)
print('Creating scheduled post thread')
httpd.thrPostSchedule = \

View File

@ -146,7 +146,8 @@ def _inboxStorePostToHtmlCache(recentPostsCache: {}, maxRecentPosts: int,
nickname: str, domain: str, port: int,
postJsonObject: {},
allowDeletion: bool, boxname: str,
showPublishedDateOnly: bool) -> None:
showPublishedDateOnly: bool,
peertubeInstances: []) -> None:
"""Converts the json post into html and stores it in a cache
This enables the post to be quickly displayed later
"""
@ -171,6 +172,7 @@ def _inboxStorePostToHtmlCache(recentPostsCache: {}, maxRecentPosts: int,
avatarUrl, True, allowDeletion,
httpPrefix, __version__, boxname, None,
showPublishedDateOnly,
peertubeInstances,
not isDM(postJsonObject),
True, True, False, True)
@ -2039,7 +2041,8 @@ def _inboxAfterInitial(recentPostsCache: {}, maxRecentPosts: int,
maxMentions: int, maxEmoji: int, translate: {},
unitTest: bool, YTReplacementDomain: str,
showPublishedDateOnly: bool,
allowLocalNetworkAccess: bool) -> bool:
allowLocalNetworkAccess: bool,
peertubeInstances: []) -> bool:
""" Anything which needs to be done after initial checks have passed
"""
actor = keyId
@ -2346,7 +2349,8 @@ def _inboxAfterInitial(recentPostsCache: {}, maxRecentPosts: int,
postJsonObject,
allowDeletion,
boxname,
showPublishedDateOnly)
showPublishedDateOnly,
peertubeInstances)
if debug:
timeDiff = \
str(int((time.time() - htmlCacheStartTime) *
@ -2446,7 +2450,8 @@ def runInboxQueue(recentPostsCache: {}, maxRecentPosts: int,
YTReplacementDomain: str,
showPublishedDateOnly: bool,
allowNewsFollowers: bool,
maxFollowers: int, allowLocalNetworkAccess: bool) -> None:
maxFollowers: int, allowLocalNetworkAccess: bool,
peertubeInstances: []) -> None:
"""Processes received items and moves them to the appropriate
directories
"""
@ -2863,7 +2868,8 @@ def runInboxQueue(recentPostsCache: {}, maxRecentPosts: int,
translate, unitTest,
YTReplacementDomain,
showPublishedDateOnly,
allowLocalNetworkAccess)
allowLocalNetworkAccess,
peertubeInstances)
if debug:
pprint(queueJson['post'])

View File

@ -28,7 +28,8 @@ def htmlConfirmDelete(cssCache: {},
wfRequest: {}, personCache: {},
callingDomain: str,
YTReplacementDomain: str,
showPublishedDateOnly: bool) -> str:
showPublishedDateOnly: bool,
peertubeInstances: []) -> str:
"""Shows a screen asking to confirm the deletion of a post
"""
if '/statuses/' not in messageId:
@ -66,6 +67,7 @@ def htmlConfirmDelete(cssCache: {},
httpPrefix, projectVersion, 'outbox',
YTReplacementDomain,
showPublishedDateOnly,
peertubeInstances,
False, False, False, False, False)
deletePostStr += '<center>'
deletePostStr += \

View File

@ -27,7 +27,8 @@ def _htmlFrontScreenPosts(recentPostsCache: {}, maxRecentPosts: int,
session, wfRequest: {}, personCache: {},
projectVersion: str,
YTReplacementDomain: str,
showPublishedDateOnly: bool) -> str:
showPublishedDateOnly: bool,
peertubeInstances: []) -> str:
"""Shows posts on the front screen of a news instance
These should only be public blog posts from the features timeline
which is the blog timeline of the news actor
@ -65,6 +66,7 @@ def _htmlFrontScreenPosts(recentPostsCache: {}, maxRecentPosts: int,
httpPrefix, projectVersion, 'inbox',
YTReplacementDomain,
showPublishedDateOnly,
peertubeInstances,
False, False, False, True, False)
if postStr:
profileStr += postStr + separatorStr
@ -85,7 +87,9 @@ def htmlFrontScreen(rssIconAtTop: bool,
session, wfRequest: {}, personCache: {},
YTReplacementDomain: str,
showPublishedDateOnly: bool,
newswire: {}, theme: str, extraJson=None,
newswire: {}, theme: str,
peertubeInstances: [],
extraJson=None,
pageNumber=None, maxItemsPerPage=None) -> str:
"""Show the news instance front screen
"""
@ -148,7 +152,8 @@ def htmlFrontScreen(rssIconAtTop: bool,
session, wfRequest, personCache,
projectVersion,
YTReplacementDomain,
showPublishedDateOnly) + licenseStr
showPublishedDateOnly,
peertubeInstances) + licenseStr
# Footer which is only used for system accounts
profileFooterStr = ' </td>\n'

View File

@ -8,6 +8,7 @@ __status__ = "Production"
def _addEmbeddedVideoFromSites(translate: {}, content: str,
peertubeInstances: [],
width=400, height=300) -> str:
"""Adds embedded videos
"""
@ -88,31 +89,38 @@ def _addEmbeddedVideoFromSites(translate: {}, content: str,
# and the content of each has not been reviewed, so mileage could vary
# Also see https://peertube_isolation.frama.io/list/ for
# adversarial instances
peerTubeSites = ('peertube.mastodon.host', 'share.tube',
'tube.tr4sk.me', 'videos.elbinario.net',
'hkvideo.live',
'peertube.snargol.com', 'tube.22decembre.eu',
'tube.fabrigli.fr', 'libretube.net', 'libre.video',
'peertube.linuxrocks.online', 'spacepub.space',
'video.ploud.jp', 'video.omniatv.com',
'peertube.servebeer.com',
'tube.tchncs.de', 'tubee.fr', 'video.alternanet.fr',
'devtube.dev-wiki.de', 'video.samedi.pm',
'video.irem.univ-paris-diderot.fr',
'peertube.openstreetmap.fr', 'video.antopie.org',
'scitech.video', 'tube.4aem.com', 'video.ploud.fr',
'peervideo.net', 'video.valme.io',
'videos.pair2jeux.tube',
'vault.mle.party', 'hostyour.tv',
'diode.zone', 'visionon.tv',
'artitube.artifaille.fr', 'peertube.fr',
'peertube.live', 'kolektiva.media',
'tube.ac-lyon.fr', 'www.yiny.org', 'betamax.video',
'tube.piweb.be', 'pe.ertu.be', 'peertube.social',
'videos.lescommuns.org', 'peertube.nogafa.org',
'skeptikon.fr', 'video.tedomum.net',
'tube.p2p.legal', 'tilvids.com',
'sikke.fi', 'exode.me', 'peertube.video')
if peertubeInstances:
peerTubeSites = peertubeInstances
else:
peerTubeSites = ('peertube.mastodon.host', 'share.tube',
'tube.tr4sk.me', 'videos.elbinario.net',
'hkvideo.live',
'peertube.snargol.com', 'tube.22decembre.eu',
'tube.fabrigli.fr', 'libretube.net',
'libre.video',
'peertube.linuxrocks.online', 'spacepub.space',
'video.ploud.jp', 'video.omniatv.com',
'peertube.servebeer.com',
'tube.tchncs.de', 'tubee.fr',
'video.alternanet.fr',
'devtube.dev-wiki.de', 'video.samedi.pm',
'video.irem.univ-paris-diderot.fr',
'peertube.openstreetmap.fr', 'video.antopie.org',
'scitech.video', 'tube.4aem.com',
'video.ploud.fr',
'peervideo.net', 'video.valme.io',
'videos.pair2jeux.tube',
'vault.mle.party', 'hostyour.tv',
'diode.zone', 'visionon.tv',
'artitube.artifaille.fr', 'peertube.fr',
'peertube.live', 'kolektiva.media',
'tube.ac-lyon.fr', 'www.yiny.org',
'betamax.video',
'tube.piweb.be', 'pe.ertu.be', 'peertube.social',
'videos.lescommuns.org', 'peertube.nogafa.org',
'skeptikon.fr', 'video.tedomum.net',
'tube.p2p.legal', 'tilvids.com',
'sikke.fi', 'exode.me', 'peertube.video')
for site in peerTubeSites:
if '"https://' + site in content:
url = content.split('"https://' + site)[1]
@ -224,9 +232,11 @@ def _addEmbeddedVideo(translate: {}, content: str,
return content
def addEmbeddedElements(translate: {}, content: str) -> str:
def addEmbeddedElements(translate: {}, content: str,
peertubeInstances: []) -> str:
"""Adds embedded elements for various media types
"""
content = _addEmbeddedVideoFromSites(translate, content)
content = _addEmbeddedVideoFromSites(translate, content,
peertubeInstances)
content = _addEmbeddedAudio(translate, content)
return _addEmbeddedVideo(translate, content)

View File

@ -37,7 +37,7 @@ def htmlModeration(cssCache: {}, defaultTimeline: str,
rssIconAtTop: bool,
publishButtonAtTop: bool,
authorized: bool, moderationActionStr: str,
theme: str) -> str:
theme: str, peertubeInstances: []) -> str:
"""Show the moderation feed as html
This is what you see when selecting the "mod" timeline
"""
@ -51,7 +51,8 @@ def htmlModeration(cssCache: {}, defaultTimeline: str,
newswire, False, False, positiveVoting,
showPublishAsIcon, fullWidthTimelineButtonHeader,
iconsAsButtons, rssIconAtTop, publishButtonAtTop,
authorized, moderationActionStr, theme)
authorized, moderationActionStr, theme,
peertubeInstances)
def htmlAccountInfo(cssCache: {}, translate: {},

View File

@ -1076,6 +1076,7 @@ def individualPostAsHtml(allowDownloads: bool,
httpPrefix: str, projectVersion: str,
boxName: str, YTReplacementDomain: str,
showPublishedDateOnly: bool,
peertubeInstances: [],
showRepeats=True,
showIcons=False,
manuallyApprovesFollowers=False,
@ -1483,7 +1484,8 @@ def individualPostAsHtml(allowDownloads: bool,
if not postIsSensitive:
contentStr = objectContent + attachmentStr
contentStr = addEmbeddedElements(translate, contentStr)
contentStr = addEmbeddedElements(translate, contentStr,
peertubeInstances)
contentStr = insertQuestion(baseDir, translate,
nickname, domain, port,
contentStr, postJsonObject,
@ -1499,7 +1501,8 @@ def individualPostAsHtml(allowDownloads: bool,
# get the content warning text
cwContentStr = objectContent + attachmentStr
if not isPatch:
cwContentStr = addEmbeddedElements(translate, cwContentStr)
cwContentStr = addEmbeddedElements(translate, cwContentStr,
peertubeInstances)
cwContentStr = \
insertQuestion(baseDir, translate, nickname, domain, port,
cwContentStr, postJsonObject, pageNumber)
@ -1571,7 +1574,8 @@ def htmlIndividualPost(cssCache: {},
postJsonObject: {}, httpPrefix: str,
projectVersion: str, likedBy: str,
YTReplacementDomain: str,
showPublishedDateOnly: bool) -> str:
showPublishedDateOnly: bool,
peertubeInstances: []) -> str:
"""Show an individual post as html
"""
postStr = ''
@ -1611,6 +1615,7 @@ def htmlIndividualPost(cssCache: {},
httpPrefix, projectVersion, 'inbox',
YTReplacementDomain,
showPublishedDateOnly,
peertubeInstances,
False, authorized, False, False, False)
messageId = removeIdEnding(postJsonObject['id'])
@ -1636,6 +1641,7 @@ def htmlIndividualPost(cssCache: {},
httpPrefix, projectVersion, 'inbox',
YTReplacementDomain,
showPublishedDateOnly,
peertubeInstances,
False, authorized,
False, False, False) + postStr
@ -1664,6 +1670,7 @@ def htmlIndividualPost(cssCache: {},
httpPrefix, projectVersion, 'inbox',
YTReplacementDomain,
showPublishedDateOnly,
peertubeInstances,
False, authorized,
False, False, False)
cssFilename = baseDir + '/epicyon-profile.css'
@ -1680,7 +1687,8 @@ def htmlPostReplies(cssCache: {},
nickname: str, domain: str, port: int, repliesJson: {},
httpPrefix: str, projectVersion: str,
YTReplacementDomain: str,
showPublishedDateOnly: bool) -> str:
showPublishedDateOnly: bool,
peertubeInstances: []) -> str:
"""Show the replies to an individual post as html
"""
repliesStr = ''
@ -1696,6 +1704,7 @@ def htmlPostReplies(cssCache: {},
httpPrefix, projectVersion, 'inbox',
YTReplacementDomain,
showPublishedDateOnly,
peertubeInstances,
False, False, False, False, False)
cssFilename = baseDir + '/epicyon-profile.css'

View File

@ -59,7 +59,8 @@ def htmlProfileAfterSearch(cssCache: {},
debug: bool, projectVersion: str,
YTReplacementDomain: str,
showPublishedDateOnly: bool,
defaultTimeline: str) -> str:
defaultTimeline: str,
peertubeInstances: []) -> str:
"""Show a profile page after a search for a fediverse address
"""
if hasUsersPath(profileHandle) or '/@' in profileHandle:
@ -276,6 +277,7 @@ def htmlProfileAfterSearch(cssCache: {},
httpPrefix, projectVersion, 'inbox',
YTReplacementDomain,
showPublishedDateOnly,
peertubeInstances,
False, False, False, False, False)
i += 1
if i >= 20:
@ -369,6 +371,7 @@ def htmlProfile(rssIconAtTop: bool,
YTReplacementDomain: str,
showPublishedDateOnly: bool,
newswire: {}, theme: str, dormantMonths: int,
peertubeInstances: [],
extraJson=None, pageNumber=None,
maxItemsPerPage=None) -> str:
"""Show the profile page as html
@ -625,7 +628,8 @@ def htmlProfile(rssIconAtTop: bool,
session, wfRequest, personCache,
projectVersion,
YTReplacementDomain,
showPublishedDateOnly) + licenseStr
showPublishedDateOnly,
peertubeInstances) + licenseStr
elif selected == 'following':
profileStr += \
_htmlProfileFollowing(translate, baseDir, httpPrefix,
@ -671,7 +675,8 @@ def _htmlProfilePosts(recentPostsCache: {}, maxRecentPosts: int,
session, wfRequest: {}, personCache: {},
projectVersion: str,
YTReplacementDomain: str,
showPublishedDateOnly: bool) -> str:
showPublishedDateOnly: bool,
peertubeInstances: []) -> str:
"""Shows posts on the profile screen
These should only be public posts
"""
@ -709,6 +714,7 @@ def _htmlProfilePosts(recentPostsCache: {}, maxRecentPosts: int,
httpPrefix, projectVersion, 'inbox',
YTReplacementDomain,
showPublishedDateOnly,
peertubeInstances,
False, False, False, True, False)
if postStr:
profileStr += postStr + separatorStr

View File

@ -506,7 +506,8 @@ def htmlHistorySearch(cssCache: {}, translate: {}, baseDir: str,
personCache: {},
port: int,
YTReplacementDomain: str,
showPublishedDateOnly: bool) -> str:
showPublishedDateOnly: bool,
peertubeInstances: []) -> str:
"""Show a page containing search results for your post history
"""
if historysearch.startswith('!'):
@ -579,6 +580,7 @@ def htmlHistorySearch(cssCache: {}, translate: {}, baseDir: str,
'search',
YTReplacementDomain,
showPublishedDateOnly,
peertubeInstances,
showIndividualPostIcons,
showIndividualPostIcons,
False, False, False)
@ -599,7 +601,8 @@ def htmlHashtagSearch(cssCache: {},
session, wfRequest: {}, personCache: {},
httpPrefix: str, projectVersion: str,
YTReplacementDomain: str,
showPublishedDateOnly: bool) -> str:
showPublishedDateOnly: bool,
peertubeInstances: []) -> str:
"""Show a page containing search results for a hashtag
"""
if hashtag.startswith('#'):
@ -745,6 +748,7 @@ def htmlHashtagSearch(cssCache: {},
'search',
YTReplacementDomain,
showPublishedDateOnly,
peertubeInstances,
showRepeats, showIcons,
manuallyApprovesFollowers,
showPublicOnly,

View File

@ -61,7 +61,8 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str,
publishButtonAtTop: bool,
authorized: bool,
moderationActionStr: str,
theme: str) -> str:
theme: str,
peertubeInstances: []) -> str:
"""Show the timeline as html
"""
enableTimingLog = False
@ -566,6 +567,7 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str,
boxName,
YTReplacementDomain,
showPublishedDateOnly,
peertubeInstances,
boxName != 'dm',
showIndividualPostIcons,
manuallyApproveFollowers,
@ -720,7 +722,8 @@ def htmlShares(cssCache: {}, defaultTimeline: str,
iconsAsButtons: bool,
rssIconAtTop: bool,
publishButtonAtTop: bool,
authorized: bool, theme: str) -> str:
authorized: bool, theme: str,
peertubeInstances: []) -> str:
"""Show the shares timeline as html
"""
manuallyApproveFollowers = \
@ -739,7 +742,7 @@ def htmlShares(cssCache: {}, defaultTimeline: str,
positiveVoting, showPublishAsIcon,
fullWidthTimelineButtonHeader,
iconsAsButtons, rssIconAtTop, publishButtonAtTop,
authorized, None, theme)
authorized, None, theme, peertubeInstances)
def htmlInbox(cssCache: {}, defaultTimeline: str,
@ -757,7 +760,8 @@ def htmlInbox(cssCache: {}, defaultTimeline: str,
iconsAsButtons: bool,
rssIconAtTop: bool,
publishButtonAtTop: bool,
authorized: bool, theme: str) -> str:
authorized: bool, theme: str,
peertubeInstances: []) -> str:
"""Show the inbox as html
"""
manuallyApproveFollowers = \
@ -776,7 +780,7 @@ def htmlInbox(cssCache: {}, defaultTimeline: str,
positiveVoting, showPublishAsIcon,
fullWidthTimelineButtonHeader,
iconsAsButtons, rssIconAtTop, publishButtonAtTop,
authorized, None, theme)
authorized, None, theme, peertubeInstances)
def htmlBookmarks(cssCache: {}, defaultTimeline: str,
@ -794,7 +798,8 @@ def htmlBookmarks(cssCache: {}, defaultTimeline: str,
iconsAsButtons: bool,
rssIconAtTop: bool,
publishButtonAtTop: bool,
authorized: bool, theme: str) -> str:
authorized: bool, theme: str,
peertubeInstances: []) -> str:
"""Show the bookmarks as html
"""
manuallyApproveFollowers = \
@ -813,7 +818,7 @@ def htmlBookmarks(cssCache: {}, defaultTimeline: str,
positiveVoting, showPublishAsIcon,
fullWidthTimelineButtonHeader,
iconsAsButtons, rssIconAtTop, publishButtonAtTop,
authorized, None, theme)
authorized, None, theme, peertubeInstances)
def htmlEvents(cssCache: {}, defaultTimeline: str,
@ -831,7 +836,8 @@ def htmlEvents(cssCache: {}, defaultTimeline: str,
iconsAsButtons: bool,
rssIconAtTop: bool,
publishButtonAtTop: bool,
authorized: bool, theme: str) -> str:
authorized: bool, theme: str,
peertubeInstances: []) -> str:
"""Show the events as html
"""
manuallyApproveFollowers = \
@ -850,7 +856,7 @@ def htmlEvents(cssCache: {}, defaultTimeline: str,
positiveVoting, showPublishAsIcon,
fullWidthTimelineButtonHeader,
iconsAsButtons, rssIconAtTop, publishButtonAtTop,
authorized, None, theme)
authorized, None, theme, peertubeInstances)
def htmlInboxDMs(cssCache: {}, defaultTimeline: str,
@ -868,7 +874,8 @@ def htmlInboxDMs(cssCache: {}, defaultTimeline: str,
iconsAsButtons: bool,
rssIconAtTop: bool,
publishButtonAtTop: bool,
authorized: bool, theme: str) -> str:
authorized: bool, theme: str,
peertubeInstances: []) -> str:
"""Show the DM timeline as html
"""
return htmlTimeline(cssCache, defaultTimeline,
@ -882,7 +889,7 @@ def htmlInboxDMs(cssCache: {}, defaultTimeline: str,
showPublishAsIcon,
fullWidthTimelineButtonHeader,
iconsAsButtons, rssIconAtTop, publishButtonAtTop,
authorized, None, theme)
authorized, None, theme, peertubeInstances)
def htmlInboxReplies(cssCache: {}, defaultTimeline: str,
@ -900,7 +907,8 @@ def htmlInboxReplies(cssCache: {}, defaultTimeline: str,
iconsAsButtons: bool,
rssIconAtTop: bool,
publishButtonAtTop: bool,
authorized: bool, theme: str) -> str:
authorized: bool, theme: str,
peertubeInstances: []) -> str:
"""Show the replies timeline as html
"""
return htmlTimeline(cssCache, defaultTimeline,
@ -915,7 +923,7 @@ def htmlInboxReplies(cssCache: {}, defaultTimeline: str,
positiveVoting, showPublishAsIcon,
fullWidthTimelineButtonHeader,
iconsAsButtons, rssIconAtTop, publishButtonAtTop,
authorized, None, theme)
authorized, None, theme, peertubeInstances)
def htmlInboxMedia(cssCache: {}, defaultTimeline: str,
@ -933,7 +941,8 @@ def htmlInboxMedia(cssCache: {}, defaultTimeline: str,
iconsAsButtons: bool,
rssIconAtTop: bool,
publishButtonAtTop: bool,
authorized: bool, theme: str) -> str:
authorized: bool, theme: str,
peertubeInstances: []) -> str:
"""Show the media timeline as html
"""
return htmlTimeline(cssCache, defaultTimeline,
@ -948,7 +957,7 @@ def htmlInboxMedia(cssCache: {}, defaultTimeline: str,
positiveVoting, showPublishAsIcon,
fullWidthTimelineButtonHeader,
iconsAsButtons, rssIconAtTop, publishButtonAtTop,
authorized, None, theme)
authorized, None, theme, peertubeInstances)
def htmlInboxBlogs(cssCache: {}, defaultTimeline: str,
@ -966,7 +975,8 @@ def htmlInboxBlogs(cssCache: {}, defaultTimeline: str,
iconsAsButtons: bool,
rssIconAtTop: bool,
publishButtonAtTop: bool,
authorized: bool, theme: str) -> str:
authorized: bool, theme: str,
peertubeInstances: []) -> str:
"""Show the blogs timeline as html
"""
return htmlTimeline(cssCache, defaultTimeline,
@ -981,7 +991,7 @@ def htmlInboxBlogs(cssCache: {}, defaultTimeline: str,
positiveVoting, showPublishAsIcon,
fullWidthTimelineButtonHeader,
iconsAsButtons, rssIconAtTop, publishButtonAtTop,
authorized, None, theme)
authorized, None, theme, peertubeInstances)
def htmlInboxFeatures(cssCache: {}, defaultTimeline: str,
@ -1000,7 +1010,8 @@ def htmlInboxFeatures(cssCache: {}, defaultTimeline: str,
rssIconAtTop: bool,
publishButtonAtTop: bool,
authorized: bool,
theme: str) -> str:
theme: str,
peertubeInstances: []) -> str:
"""Show the features timeline as html
"""
return htmlTimeline(cssCache, defaultTimeline,
@ -1015,7 +1026,7 @@ def htmlInboxFeatures(cssCache: {}, defaultTimeline: str,
positiveVoting, showPublishAsIcon,
fullWidthTimelineButtonHeader,
iconsAsButtons, rssIconAtTop, publishButtonAtTop,
authorized, None, theme)
authorized, None, theme, peertubeInstances)
def htmlInboxNews(cssCache: {}, defaultTimeline: str,
@ -1033,7 +1044,8 @@ def htmlInboxNews(cssCache: {}, defaultTimeline: str,
iconsAsButtons: bool,
rssIconAtTop: bool,
publishButtonAtTop: bool,
authorized: bool, theme: str) -> str:
authorized: bool, theme: str,
peertubeInstances: []) -> str:
"""Show the news timeline as html
"""
return htmlTimeline(cssCache, defaultTimeline,
@ -1048,7 +1060,7 @@ def htmlInboxNews(cssCache: {}, defaultTimeline: str,
positiveVoting, showPublishAsIcon,
fullWidthTimelineButtonHeader,
iconsAsButtons, rssIconAtTop, publishButtonAtTop,
authorized, None, theme)
authorized, None, theme, peertubeInstances)
def htmlOutbox(cssCache: {}, defaultTimeline: str,
@ -1066,7 +1078,8 @@ def htmlOutbox(cssCache: {}, defaultTimeline: str,
iconsAsButtons: bool,
rssIconAtTop: bool,
publishButtonAtTop: bool,
authorized: bool, theme: str) -> str:
authorized: bool, theme: str,
peertubeInstances: []) -> str:
"""Show the Outbox as html
"""
manuallyApproveFollowers = \
@ -1082,4 +1095,4 @@ def htmlOutbox(cssCache: {}, defaultTimeline: str,
newswire, False, False, positiveVoting,
showPublishAsIcon, fullWidthTimelineButtonHeader,
iconsAsButtons, rssIconAtTop, publishButtonAtTop,
authorized, None, theme)
authorized, None, theme, peertubeInstances)