mirror of https://gitlab.com/bashrc2/epicyon
Add opengraph metadata to individual html posts
parent
6e42ba3e2f
commit
df573d1c93
7
blog.py
7
blog.py
|
@ -487,7 +487,7 @@ def htmlBlogPage(authorized: bool, session,
|
|||
cssFilename = baseDir + '/epicyon.css'
|
||||
instanceTitle = \
|
||||
getConfigParam(baseDir, 'instanceTitle')
|
||||
blogStr = htmlHeaderWithExternalStyle(cssFilename, instanceTitle)
|
||||
blogStr = htmlHeaderWithExternalStyle(cssFilename, instanceTitle, None)
|
||||
_htmlBlogRemoveCwButton(blogStr, translate)
|
||||
|
||||
blogsIndex = acctDir(baseDir, nickname, domain) + '/tlblogs.index'
|
||||
|
@ -707,7 +707,7 @@ def htmlBlogView(authorized: bool,
|
|||
cssFilename = baseDir + '/epicyon.css'
|
||||
instanceTitle = \
|
||||
getConfigParam(baseDir, 'instanceTitle')
|
||||
blogStr = htmlHeaderWithExternalStyle(cssFilename, instanceTitle)
|
||||
blogStr = htmlHeaderWithExternalStyle(cssFilename, instanceTitle, None)
|
||||
|
||||
if _noOfBlogAccounts(baseDir) <= 1:
|
||||
nickname = _singleBlogAccountNickname(baseDir)
|
||||
|
@ -810,7 +810,8 @@ def htmlEditBlog(mediaInstance: bool, translate: {},
|
|||
|
||||
instanceTitle = \
|
||||
getConfigParam(baseDir, 'instanceTitle')
|
||||
editBlogForm = htmlHeaderWithExternalStyle(cssFilename, instanceTitle)
|
||||
editBlogForm = \
|
||||
htmlHeaderWithExternalStyle(cssFilename, instanceTitle, None)
|
||||
|
||||
editBlogForm += \
|
||||
'<form enctype="multipart/form-data" method="POST" ' + \
|
||||
|
|
|
@ -76,7 +76,7 @@ def htmlWatchPointsGraph(baseDir: str, fitness: {}, fitnessId: str,
|
|||
|
||||
instanceTitle = \
|
||||
getConfigParam(baseDir, 'instanceTitle')
|
||||
htmlStr = htmlHeaderWithExternalStyle(cssFilename, instanceTitle)
|
||||
htmlStr = htmlHeaderWithExternalStyle(cssFilename, instanceTitle, None)
|
||||
htmlStr += \
|
||||
'<table class="graph">\n' + \
|
||||
'<caption>Watchpoints for ' + fitnessId + '</caption>\n' + \
|
||||
|
|
|
@ -60,7 +60,8 @@ def htmlAccessKeys(cssCache: {}, baseDir: str,
|
|||
|
||||
instanceTitle = \
|
||||
getConfigParam(baseDir, 'instanceTitle')
|
||||
accessKeysForm = htmlHeaderWithExternalStyle(cssFilename, instanceTitle)
|
||||
accessKeysForm = \
|
||||
htmlHeaderWithExternalStyle(cssFilename, instanceTitle, None)
|
||||
accessKeysForm += '<div class="container">\n'
|
||||
|
||||
accessKeysForm += \
|
||||
|
|
|
@ -58,7 +58,8 @@ def htmlCalendarDeleteConfirm(cssCache: {}, translate: {}, baseDir: str,
|
|||
|
||||
instanceTitle = \
|
||||
getConfigParam(baseDir, 'instanceTitle')
|
||||
deletePostStr = htmlHeaderWithExternalStyle(cssFilename, instanceTitle)
|
||||
deletePostStr = \
|
||||
htmlHeaderWithExternalStyle(cssFilename, instanceTitle, None)
|
||||
deletePostStr += \
|
||||
'<center><h1>' + postTime + ' ' + str(year) + '/' + \
|
||||
str(monthNumber) + \
|
||||
|
@ -120,7 +121,7 @@ def _htmlCalendarDay(personCache: {}, cssCache: {}, translate: {},
|
|||
calActor = '/users/' + actor.split('/users/')[1]
|
||||
|
||||
instanceTitle = getConfigParam(baseDir, 'instanceTitle')
|
||||
calendarStr = htmlHeaderWithExternalStyle(cssFilename, instanceTitle)
|
||||
calendarStr = htmlHeaderWithExternalStyle(cssFilename, instanceTitle, None)
|
||||
calendarStr += '<main><table class="calendar">\n'
|
||||
calendarStr += '<caption class="calendar__banner--month">\n'
|
||||
calendarStr += \
|
||||
|
@ -340,7 +341,7 @@ def htmlCalendar(personCache: {}, cssCache: {}, translate: {},
|
|||
|
||||
instanceTitle = \
|
||||
getConfigParam(baseDir, 'instanceTitle')
|
||||
headerStr = htmlHeaderWithExternalStyle(cssFilename, instanceTitle)
|
||||
headerStr = htmlHeaderWithExternalStyle(cssFilename, instanceTitle, None)
|
||||
|
||||
# the main graphical calendar as a table
|
||||
calendarStr = '<main><table class="calendar">\n'
|
||||
|
|
|
@ -364,7 +364,7 @@ def htmlLinksMobile(cssCache: {}, baseDir: str,
|
|||
|
||||
instanceTitle = \
|
||||
getConfigParam(baseDir, 'instanceTitle')
|
||||
htmlStr = htmlHeaderWithExternalStyle(cssFilename, instanceTitle)
|
||||
htmlStr = htmlHeaderWithExternalStyle(cssFilename, instanceTitle, None)
|
||||
bannerFile, bannerFilename = \
|
||||
getBannerFile(baseDir, nickname, domain, theme)
|
||||
htmlStr += \
|
||||
|
@ -430,7 +430,8 @@ def htmlEditLinks(cssCache: {}, translate: {}, baseDir: str, path: str,
|
|||
|
||||
instanceTitle = \
|
||||
getConfigParam(baseDir, 'instanceTitle')
|
||||
editLinksForm = htmlHeaderWithExternalStyle(cssFilename, instanceTitle)
|
||||
editLinksForm = \
|
||||
htmlHeaderWithExternalStyle(cssFilename, instanceTitle, None)
|
||||
|
||||
# top banner
|
||||
editLinksForm += \
|
||||
|
|
|
@ -361,7 +361,7 @@ def htmlCitations(baseDir: str, nickname: str, domain: str,
|
|||
|
||||
instanceTitle = \
|
||||
getConfigParam(baseDir, 'instanceTitle')
|
||||
htmlStr = htmlHeaderWithExternalStyle(cssFilename, instanceTitle)
|
||||
htmlStr = htmlHeaderWithExternalStyle(cssFilename, instanceTitle, None)
|
||||
|
||||
# top banner
|
||||
bannerFile, bannerFilename = \
|
||||
|
@ -476,7 +476,7 @@ def htmlNewswireMobile(cssCache: {}, baseDir: str, nickname: str,
|
|||
|
||||
instanceTitle = \
|
||||
getConfigParam(baseDir, 'instanceTitle')
|
||||
htmlStr = htmlHeaderWithExternalStyle(cssFilename, instanceTitle)
|
||||
htmlStr = htmlHeaderWithExternalStyle(cssFilename, instanceTitle, None)
|
||||
|
||||
bannerFile, bannerFilename = \
|
||||
getBannerFile(baseDir, nickname, domain, theme)
|
||||
|
@ -545,7 +545,8 @@ def htmlEditNewswire(cssCache: {}, translate: {}, baseDir: str, path: str,
|
|||
|
||||
instanceTitle = \
|
||||
getConfigParam(baseDir, 'instanceTitle')
|
||||
editNewswireForm = htmlHeaderWithExternalStyle(cssFilename, instanceTitle)
|
||||
editNewswireForm = \
|
||||
htmlHeaderWithExternalStyle(cssFilename, instanceTitle, None)
|
||||
|
||||
# top banner
|
||||
editNewswireForm += \
|
||||
|
@ -667,7 +668,8 @@ def htmlEditNewsPost(cssCache: {}, translate: {}, baseDir: str, path: str,
|
|||
|
||||
instanceTitle = \
|
||||
getConfigParam(baseDir, 'instanceTitle')
|
||||
editNewsPostForm = htmlHeaderWithExternalStyle(cssFilename, instanceTitle)
|
||||
editNewsPostForm = \
|
||||
htmlHeaderWithExternalStyle(cssFilename, instanceTitle, None)
|
||||
editNewsPostForm += \
|
||||
'<form enctype="multipart/form-data" method="POST" ' + \
|
||||
'accept-charset="UTF-8" action="' + path + '/newseditdata">\n'
|
||||
|
|
|
@ -62,7 +62,8 @@ def htmlConfirmDelete(cssCache: {},
|
|||
|
||||
instanceTitle = \
|
||||
getConfigParam(baseDir, 'instanceTitle')
|
||||
deletePostStr = htmlHeaderWithExternalStyle(cssFilename, instanceTitle)
|
||||
deletePostStr = \
|
||||
htmlHeaderWithExternalStyle(cssFilename, instanceTitle, None)
|
||||
deletePostStr += \
|
||||
individualPostAsHtml(signingPrivateKeyPem,
|
||||
True, recentPostsCache, maxRecentPosts,
|
||||
|
@ -137,7 +138,7 @@ def htmlConfirmRemoveSharedItem(cssCache: {}, translate: {}, baseDir: str,
|
|||
cssFilename = baseDir + '/follow.css'
|
||||
|
||||
instanceTitle = getConfigParam(baseDir, 'instanceTitle')
|
||||
sharesStr = htmlHeaderWithExternalStyle(cssFilename, instanceTitle)
|
||||
sharesStr = htmlHeaderWithExternalStyle(cssFilename, instanceTitle, None)
|
||||
sharesStr += '<div class="follow">\n'
|
||||
sharesStr += ' <div class="followAvatar">\n'
|
||||
sharesStr += ' <center>\n'
|
||||
|
@ -190,7 +191,7 @@ def htmlConfirmFollow(cssCache: {}, translate: {}, baseDir: str,
|
|||
cssFilename = baseDir + '/follow.css'
|
||||
|
||||
instanceTitle = getConfigParam(baseDir, 'instanceTitle')
|
||||
followStr = htmlHeaderWithExternalStyle(cssFilename, instanceTitle)
|
||||
followStr = htmlHeaderWithExternalStyle(cssFilename, instanceTitle, None)
|
||||
followStr += '<div class="follow">\n'
|
||||
followStr += ' <div class="followAvatar">\n'
|
||||
followStr += ' <center>\n'
|
||||
|
@ -235,7 +236,7 @@ def htmlConfirmUnfollow(cssCache: {}, translate: {}, baseDir: str,
|
|||
cssFilename = baseDir + '/follow.css'
|
||||
|
||||
instanceTitle = getConfigParam(baseDir, 'instanceTitle')
|
||||
followStr = htmlHeaderWithExternalStyle(cssFilename, instanceTitle)
|
||||
followStr = htmlHeaderWithExternalStyle(cssFilename, instanceTitle, None)
|
||||
followStr += '<div class="follow">\n'
|
||||
followStr += ' <div class="followAvatar">\n'
|
||||
followStr += ' <center>\n'
|
||||
|
@ -278,7 +279,7 @@ def htmlConfirmUnblock(cssCache: {}, translate: {}, baseDir: str,
|
|||
cssFilename = baseDir + '/follow.css'
|
||||
|
||||
instanceTitle = getConfigParam(baseDir, 'instanceTitle')
|
||||
blockStr = htmlHeaderWithExternalStyle(cssFilename, instanceTitle)
|
||||
blockStr = htmlHeaderWithExternalStyle(cssFilename, instanceTitle, None)
|
||||
blockStr += '<div class="block">\n'
|
||||
blockStr += ' <div class="blockAvatar">\n'
|
||||
blockStr += ' <center>\n'
|
||||
|
|
|
@ -597,7 +597,7 @@ def htmlNewPost(cssCache: {}, mediaInstance: bool, translate: {},
|
|||
dateAndLocation += '</div>\n'
|
||||
|
||||
instanceTitle = getConfigParam(baseDir, 'instanceTitle')
|
||||
newPostForm = htmlHeaderWithExternalStyle(cssFilename, instanceTitle)
|
||||
newPostForm = htmlHeaderWithExternalStyle(cssFilename, instanceTitle, None)
|
||||
|
||||
newPostForm += \
|
||||
'<header>\n' + \
|
||||
|
|
|
@ -207,6 +207,6 @@ def htmlFrontScreen(signingPrivateKeyPem: str,
|
|||
instanceTitle = \
|
||||
getConfigParam(baseDir, 'instanceTitle')
|
||||
profileStr = \
|
||||
htmlHeaderWithExternalStyle(cssFilename, instanceTitle) + \
|
||||
htmlHeaderWithExternalStyle(cssFilename, instanceTitle, None) + \
|
||||
profileStr + profileFooterStr + htmlFooter()
|
||||
return profileStr
|
||||
|
|
|
@ -209,7 +209,7 @@ def htmlSearchHashtagCategory(cssCache: {}, translate: {},
|
|||
|
||||
instanceTitle = \
|
||||
getConfigParam(baseDir, 'instanceTitle')
|
||||
htmlStr = htmlHeaderWithExternalStyle(cssFilename, instanceTitle)
|
||||
htmlStr = htmlHeaderWithExternalStyle(cssFilename, instanceTitle, None)
|
||||
|
||||
# show a banner above the search box
|
||||
searchBannerFile, searchBannerFilename = \
|
||||
|
|
|
@ -95,7 +95,7 @@ def htmlAccountInfo(cssCache: {}, translate: {},
|
|||
|
||||
instanceTitle = \
|
||||
getConfigParam(baseDir, 'instanceTitle')
|
||||
infoForm = htmlHeaderWithExternalStyle(cssFilename, instanceTitle)
|
||||
infoForm = htmlHeaderWithExternalStyle(cssFilename, instanceTitle, None)
|
||||
|
||||
searchNickname = getNicknameFromActor(searchHandle)
|
||||
searchDomain, searchPort = getDomainFromActor(searchHandle)
|
||||
|
@ -282,7 +282,7 @@ def htmlModerationInfo(cssCache: {}, translate: {},
|
|||
|
||||
instanceTitle = \
|
||||
getConfigParam(baseDir, 'instanceTitle')
|
||||
infoForm = htmlHeaderWithExternalStyle(cssFilename, instanceTitle)
|
||||
infoForm = htmlHeaderWithExternalStyle(cssFilename, instanceTitle, None)
|
||||
|
||||
infoForm += \
|
||||
'<center><h1><a href="/users/' + nickname + '/moderation">' + \
|
||||
|
|
|
@ -129,7 +129,7 @@ def htmlPersonOptions(defaultTimeline: str,
|
|||
|
||||
instanceTitle = \
|
||||
getConfigParam(baseDir, 'instanceTitle')
|
||||
optionsStr = htmlHeaderWithExternalStyle(cssFilename, instanceTitle)
|
||||
optionsStr = htmlHeaderWithExternalStyle(cssFilename, instanceTitle, None)
|
||||
optionsStr += htmlKeyboardNavigation(textModeBanner, {}, {})
|
||||
optionsStr += '<br><br>\n'
|
||||
optionsStr += '<div class="options">\n'
|
||||
|
|
|
@ -22,6 +22,7 @@ from posts import postIsMuted
|
|||
from posts import getPersonBox
|
||||
from posts import downloadAnnounce
|
||||
from posts import populateRepliesJson
|
||||
from utils import removeHtml
|
||||
from utils import getActorLanguagesList
|
||||
from utils import getBaseContentFromPost
|
||||
from utils import getContentFromPost
|
||||
|
@ -80,6 +81,88 @@ from blocking import isBlocked
|
|||
from blocking import addCWfromLists
|
||||
|
||||
|
||||
def _htmlPostMetadataOpenGraph(domain: str, postJsonObject: {}) -> str:
|
||||
"""Returns html OpenGraph metadata for a post
|
||||
"""
|
||||
metadata = \
|
||||
"<meta content=\"" + domain + "\" property=\"og:site_name\" />\n"
|
||||
metadata += \
|
||||
"<meta content=\"article\" property=\"og:type\" />\n"
|
||||
objJson = postJsonObject
|
||||
if hasObjectDict(postJsonObject):
|
||||
objJson = postJsonObject['object']
|
||||
if objJson.get('attributedTo'):
|
||||
if isinstance(objJson['attributedTo'], str):
|
||||
attrib = objJson['attributedTo']
|
||||
actorNick = getNicknameFromActor(attrib)
|
||||
actorDomain, _ = getDomainFromActor(attrib)
|
||||
actorHandle = actorNick + '@' + actorDomain
|
||||
metadata += \
|
||||
"<meta content=\"@" + actorHandle + \
|
||||
"\" property=\"og:title\" />\n"
|
||||
if objJson.get('url'):
|
||||
metadata += \
|
||||
"<meta content=\"" + objJson['url'] + \
|
||||
"\" property=\"og:url\" />\n"
|
||||
if objJson.get('published'):
|
||||
metadata += \
|
||||
"<meta content=\"" + objJson['published'] + \
|
||||
"\" property=\"og:published_time\" />\n"
|
||||
if not objJson.get('attachment'):
|
||||
if objJson.get('content'):
|
||||
description = '\n\n' + removeHtml(objJson['content'])
|
||||
metadata += \
|
||||
"<meta content='" + description + "' name='description'>\n"
|
||||
metadata += \
|
||||
"<meta content='" + description + "' name='og:description'>\n"
|
||||
return metadata
|
||||
|
||||
# metadata for attachment
|
||||
for attachJson in objJson['attachment']:
|
||||
if not isinstance(attachJson, dict):
|
||||
continue
|
||||
if not attachJson.get('mediaType'):
|
||||
continue
|
||||
description = None
|
||||
if attachJson['mediaType'].startswith('image/'):
|
||||
description = 'Attached: 1 image'
|
||||
elif attachJson['mediaType'].startswith('video/'):
|
||||
description = 'Attached: 1 video'
|
||||
elif attachJson['mediaType'].startswith('audio/'):
|
||||
description = 'Attached: 1 audio'
|
||||
if description and \
|
||||
attachJson.get('name') and \
|
||||
attachJson.get('url'):
|
||||
if objJson.get('content'):
|
||||
description += '\n\n' + removeHtml(objJson['content'])
|
||||
metadata += \
|
||||
"<meta content='" + description + "' name='description'>\n"
|
||||
metadata += \
|
||||
"<meta content='" + description + "' name='og:description'>\n"
|
||||
metadata += \
|
||||
"<meta content=\"" + attachJson['url'] + \
|
||||
"\" property=\"og:image\" />\n"
|
||||
metadata += \
|
||||
"<meta content=\"" + attachJson['mediaType'] + \
|
||||
"\" property=\"og:image:type\" />\n"
|
||||
if attachJson.get('width'):
|
||||
metadata += \
|
||||
"<meta content=\"" + attachJson['width'] + \
|
||||
"\" property=\"og:image:width\" />\n"
|
||||
if attachJson.get('height'):
|
||||
metadata += \
|
||||
"<meta content=\"" + attachJson['height'] + \
|
||||
"\" property=\"og:image:height\" />\n"
|
||||
metadata += \
|
||||
"<meta content=\"" + attachJson['name'] + \
|
||||
"\" property=\"og:image:alt\" />\n"
|
||||
if attachJson['mediaType'].startswith('image/'):
|
||||
metadata += \
|
||||
"<meta content=\"summary_large_image\" " + \
|
||||
"property=\"twitter:card\" />\n"
|
||||
return metadata
|
||||
|
||||
|
||||
def _logPostTiming(enableTimingLog: bool, postStartTime, debugId: str) -> None:
|
||||
"""Create a log of timings for performance tuning
|
||||
"""
|
||||
|
@ -1961,8 +2044,10 @@ def htmlIndividualPost(cssCache: {},
|
|||
|
||||
instanceTitle = \
|
||||
getConfigParam(baseDir, 'instanceTitle')
|
||||
return htmlHeaderWithExternalStyle(cssFilename, instanceTitle) + \
|
||||
postStr + htmlFooter()
|
||||
metadataStr = _htmlPostMetadataOpenGraph(domain, postJsonObject)
|
||||
headerStr = htmlHeaderWithExternalStyle(cssFilename,
|
||||
instanceTitle, metadataStr)
|
||||
return headerStr + postStr + htmlFooter()
|
||||
|
||||
|
||||
def htmlPostReplies(cssCache: {},
|
||||
|
@ -2011,5 +2096,8 @@ def htmlPostReplies(cssCache: {},
|
|||
|
||||
instanceTitle = \
|
||||
getConfigParam(baseDir, 'instanceTitle')
|
||||
return htmlHeaderWithExternalStyle(cssFilename, instanceTitle) + \
|
||||
repliesStr + htmlFooter()
|
||||
# TODO
|
||||
metadata = ''
|
||||
headerStr = \
|
||||
htmlHeaderWithExternalStyle(cssFilename, instanceTitle, metadata)
|
||||
return headerStr + repliesStr + htmlFooter()
|
||||
|
|
|
@ -336,7 +336,7 @@ def htmlProfileAfterSearch(cssCache: {},
|
|||
|
||||
instanceTitle = \
|
||||
getConfigParam(baseDir, 'instanceTitle')
|
||||
return htmlHeaderWithExternalStyle(cssFilename, instanceTitle) + \
|
||||
return htmlHeaderWithExternalStyle(cssFilename, instanceTitle, None) + \
|
||||
profileStr + htmlFooter()
|
||||
|
||||
|
||||
|
@ -2131,7 +2131,8 @@ def htmlEditProfile(cssCache: {}, translate: {}, baseDir: str, path: str,
|
|||
systemMonitorStr = _htmlSystemMonitor(nickname, translate)
|
||||
|
||||
instanceTitle = getConfigParam(baseDir, 'instanceTitle')
|
||||
editProfileForm = htmlHeaderWithExternalStyle(cssFilename, instanceTitle)
|
||||
editProfileForm = \
|
||||
htmlHeaderWithExternalStyle(cssFilename, instanceTitle, None)
|
||||
|
||||
# keyboard navigation
|
||||
userPathStr = '/users/' + nickname
|
||||
|
|
|
@ -64,7 +64,7 @@ def htmlSearchEmoji(cssCache: {}, translate: {},
|
|||
# create header
|
||||
instanceTitle = \
|
||||
getConfigParam(baseDir, 'instanceTitle')
|
||||
emojiForm = htmlHeaderWithExternalStyle(cssFilename, instanceTitle)
|
||||
emojiForm = htmlHeaderWithExternalStyle(cssFilename, instanceTitle, None)
|
||||
emojiForm += '<center><h1>' + \
|
||||
translate['Emoji Search'] + \
|
||||
'</h1></center>'
|
||||
|
@ -241,7 +241,7 @@ def htmlSearchSharedItems(cssCache: {}, translate: {},
|
|||
instanceTitle = \
|
||||
getConfigParam(baseDir, 'instanceTitle')
|
||||
sharedItemsForm = \
|
||||
htmlHeaderWithExternalStyle(cssFilename, instanceTitle)
|
||||
htmlHeaderWithExternalStyle(cssFilename, instanceTitle, None)
|
||||
if sharesFileType == 'shares':
|
||||
titleStr = translate['Shared Items Search']
|
||||
else:
|
||||
|
@ -347,7 +347,7 @@ def htmlSearchEmojiTextEntry(cssCache: {}, translate: {},
|
|||
|
||||
instanceTitle = \
|
||||
getConfigParam(baseDir, 'instanceTitle')
|
||||
emojiStr = htmlHeaderWithExternalStyle(cssFilename, instanceTitle)
|
||||
emojiStr = htmlHeaderWithExternalStyle(cssFilename, instanceTitle, None)
|
||||
emojiStr += '<div class="follow">\n'
|
||||
emojiStr += ' <div class="followAvatar">\n'
|
||||
emojiStr += ' <center>\n'
|
||||
|
@ -386,7 +386,7 @@ def htmlSearch(cssCache: {}, translate: {},
|
|||
cssFilename = baseDir + '/search.css'
|
||||
|
||||
instanceTitle = getConfigParam(baseDir, 'instanceTitle')
|
||||
followStr = htmlHeaderWithExternalStyle(cssFilename, instanceTitle)
|
||||
followStr = htmlHeaderWithExternalStyle(cssFilename, instanceTitle, None)
|
||||
|
||||
# show a banner above the search box
|
||||
searchBannerFile, searchBannerFilename = \
|
||||
|
@ -550,7 +550,8 @@ def htmlSkillsSearch(actor: str,
|
|||
|
||||
instanceTitle = \
|
||||
getConfigParam(baseDir, 'instanceTitle')
|
||||
skillSearchForm = htmlHeaderWithExternalStyle(cssFilename, instanceTitle)
|
||||
skillSearchForm = \
|
||||
htmlHeaderWithExternalStyle(cssFilename, instanceTitle, None)
|
||||
skillSearchForm += \
|
||||
'<center><h1><a href = "' + actor + '/search">' + \
|
||||
translate['Skills search'] + ': ' + \
|
||||
|
@ -627,7 +628,7 @@ def htmlHistorySearch(cssCache: {}, translate: {}, baseDir: str,
|
|||
instanceTitle = \
|
||||
getConfigParam(baseDir, 'instanceTitle')
|
||||
historySearchForm = \
|
||||
htmlHeaderWithExternalStyle(cssFilename, instanceTitle)
|
||||
htmlHeaderWithExternalStyle(cssFilename, instanceTitle, None)
|
||||
|
||||
# add the page title
|
||||
domainFull = getFullDomain(domain, port)
|
||||
|
@ -769,7 +770,7 @@ def htmlHashtagSearch(cssCache: {},
|
|||
instanceTitle = \
|
||||
getConfigParam(baseDir, 'instanceTitle')
|
||||
hashtagSearchForm = \
|
||||
htmlHeaderWithExternalStyle(cssFilename, instanceTitle)
|
||||
htmlHeaderWithExternalStyle(cssFilename, instanceTitle, None)
|
||||
if nickname:
|
||||
hashtagSearchForm += '<center>\n' + \
|
||||
'<h1><a href="/users/' + nickname + '/search">#' + \
|
||||
|
|
|
@ -23,7 +23,8 @@ def htmlSuspended(cssCache: {}, baseDir: str) -> str:
|
|||
|
||||
instanceTitle = \
|
||||
getConfigParam(baseDir, 'instanceTitle')
|
||||
suspendedForm = htmlHeaderWithExternalStyle(cssFilename, instanceTitle)
|
||||
suspendedForm = \
|
||||
htmlHeaderWithExternalStyle(cssFilename, instanceTitle, None)
|
||||
suspendedForm += \
|
||||
'<div><center>\n' + \
|
||||
' <p class="screentitle">Account Suspended</p>\n' + \
|
||||
|
|
|
@ -677,7 +677,7 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str,
|
|||
|
||||
instanceTitle = \
|
||||
getConfigParam(baseDir, 'instanceTitle')
|
||||
tlStr = htmlHeaderWithExternalStyle(cssFilename, instanceTitle)
|
||||
tlStr = htmlHeaderWithExternalStyle(cssFilename, instanceTitle, None)
|
||||
|
||||
_logTimelineTiming(enableTimingLog, timelineStartTime, boxName, '4')
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ def htmlTermsOfService(cssCache: {}, baseDir: str,
|
|||
|
||||
instanceTitle = \
|
||||
getConfigParam(baseDir, 'instanceTitle')
|
||||
TOSForm = htmlHeaderWithExternalStyle(cssFilename, instanceTitle)
|
||||
TOSForm = htmlHeaderWithExternalStyle(cssFilename, instanceTitle, None)
|
||||
TOSForm += '<div class="container">' + TOSText + '</div>\n'
|
||||
if adminNickname:
|
||||
adminActor = localActorUrl(httpPrefix, adminNickname, domainFull)
|
||||
|
|
|
@ -55,8 +55,8 @@ def htmlFollowingList(cssCache: {}, baseDir: str,
|
|||
|
||||
instanceTitle = \
|
||||
getConfigParam(baseDir, 'instanceTitle')
|
||||
followingListHtml = htmlHeaderWithExternalStyle(cssFilename,
|
||||
instanceTitle)
|
||||
followingListHtml = \
|
||||
htmlHeaderWithExternalStyle(cssFilename, instanceTitle, None)
|
||||
for followingAddress in followingList:
|
||||
if followingAddress:
|
||||
followingListHtml += \
|
||||
|
@ -77,8 +77,8 @@ def htmlHashtagBlocked(cssCache: {}, baseDir: str, translate: {}) -> str:
|
|||
|
||||
instanceTitle = \
|
||||
getConfigParam(baseDir, 'instanceTitle')
|
||||
blockedHashtagForm = htmlHeaderWithExternalStyle(cssFilename,
|
||||
instanceTitle)
|
||||
blockedHashtagForm = \
|
||||
htmlHeaderWithExternalStyle(cssFilename, instanceTitle, None)
|
||||
blockedHashtagForm += '<div><center>\n'
|
||||
blockedHashtagForm += \
|
||||
' <p class="screentitle">' + \
|
||||
|
@ -524,7 +524,9 @@ def getRightImageFile(baseDir: str,
|
|||
|
||||
|
||||
def htmlHeaderWithExternalStyle(cssFilename: str, instanceTitle: str,
|
||||
lang='en') -> str:
|
||||
metadata: str, lang='en') -> str:
|
||||
if metadata is None:
|
||||
metadata = ''
|
||||
cssFile = '/' + cssFilename.split('/')[-1]
|
||||
htmlStr = \
|
||||
'<!DOCTYPE html>\n' + \
|
||||
|
@ -534,6 +536,7 @@ def htmlHeaderWithExternalStyle(cssFilename: str, instanceTitle: str,
|
|||
' <link rel="stylesheet" href="' + cssFile + '">\n' + \
|
||||
' <link rel="manifest" href="/manifest.json">\n' + \
|
||||
' <meta name="theme-color" content="grey">\n' + \
|
||||
metadata + \
|
||||
' <title>' + instanceTitle + '</title>\n' + \
|
||||
' </head>\n' + \
|
||||
' <body>\n'
|
||||
|
@ -546,7 +549,8 @@ def htmlHeaderWithPersonMarkup(cssFilename: str, instanceTitle: str,
|
|||
"""html header which includes person markup
|
||||
https://schema.org/Person
|
||||
"""
|
||||
htmlStr = htmlHeaderWithExternalStyle(cssFilename, instanceTitle, lang)
|
||||
htmlStr = \
|
||||
htmlHeaderWithExternalStyle(cssFilename, instanceTitle, None, lang)
|
||||
if not actorJson:
|
||||
return htmlStr
|
||||
|
||||
|
@ -663,8 +667,9 @@ def htmlHeaderWithWebsiteMarkup(cssFilename: str, instanceTitle: str,
|
|||
"""html header which includes website markup
|
||||
https://schema.org/WebSite
|
||||
"""
|
||||
htmlStr = htmlHeaderWithExternalStyle(cssFilename, instanceTitle,
|
||||
systemLanguage)
|
||||
htmlStr = \
|
||||
htmlHeaderWithExternalStyle(cssFilename, instanceTitle, None,
|
||||
systemLanguage)
|
||||
|
||||
licenseUrl = 'https://www.gnu.org/licenses/agpl-3.0.rdf'
|
||||
|
||||
|
@ -707,8 +712,9 @@ def htmlHeaderWithBlogMarkup(cssFilename: str, instanceTitle: str,
|
|||
"""html header which includes blog post markup
|
||||
https://schema.org/BlogPosting
|
||||
"""
|
||||
htmlStr = htmlHeaderWithExternalStyle(cssFilename, instanceTitle,
|
||||
systemLanguage)
|
||||
htmlStr = \
|
||||
htmlHeaderWithExternalStyle(cssFilename, instanceTitle, None,
|
||||
systemLanguage)
|
||||
|
||||
authorUrl = localActorUrl(httpPrefix, nickname, domain)
|
||||
aboutUrl = httpPrefix + '://' + domain + '/about.html'
|
||||
|
@ -1458,7 +1464,7 @@ def htmlShowShare(baseDir: str, domain: str, nickname: str,
|
|||
instanceTitle = \
|
||||
getConfigParam(baseDir, 'instanceTitle')
|
||||
|
||||
return htmlHeaderWithExternalStyle(cssFilename, instanceTitle) + \
|
||||
return htmlHeaderWithExternalStyle(cssFilename, instanceTitle, None) + \
|
||||
shareStr + htmlFooter()
|
||||
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ def htmlWelcomeScreen(baseDir: str, nickname: str,
|
|||
if os.path.isfile(baseDir + '/welcome.css'):
|
||||
cssFilename = baseDir + '/welcome.css'
|
||||
|
||||
welcomeForm = htmlHeaderWithExternalStyle(cssFilename, instanceTitle)
|
||||
welcomeForm = htmlHeaderWithExternalStyle(cssFilename, instanceTitle, None)
|
||||
welcomeForm += \
|
||||
'<form enctype="multipart/form-data" method="POST" ' + \
|
||||
'accept-charset="UTF-8" ' + \
|
||||
|
|
|
@ -61,7 +61,7 @@ def htmlWelcomeFinal(baseDir: str, nickname: str, domain: str,
|
|||
if os.path.isfile(baseDir + '/welcome.css'):
|
||||
cssFilename = baseDir + '/welcome.css'
|
||||
|
||||
finalForm = htmlHeaderWithExternalStyle(cssFilename, instanceTitle)
|
||||
finalForm = htmlHeaderWithExternalStyle(cssFilename, instanceTitle, None)
|
||||
|
||||
finalForm += \
|
||||
'<div class="container">' + finalText + '</div>\n' + \
|
||||
|
|
|
@ -67,7 +67,7 @@ def htmlWelcomeProfile(baseDir: str, nickname: str, domain: str,
|
|||
if os.path.isfile(baseDir + '/welcome.css'):
|
||||
cssFilename = baseDir + '/welcome.css'
|
||||
|
||||
profileForm = htmlHeaderWithExternalStyle(cssFilename, instanceTitle)
|
||||
profileForm = htmlHeaderWithExternalStyle(cssFilename, instanceTitle, None)
|
||||
|
||||
# get the url of the avatar
|
||||
for ext in getImageExtensions():
|
||||
|
|
Loading…
Reference in New Issue