mirror of https://gitlab.com/bashrc2/epicyon
Function for getting the avatar url
parent
73510b0c02
commit
cfd5b6393e
|
@ -181,6 +181,32 @@ def getPostFromRecent(session,
|
||||||
return postHtml
|
return postHtml
|
||||||
|
|
||||||
|
|
||||||
|
def getAvatarImageUrl(session,
|
||||||
|
baseDir: str, httpPrefix: str,
|
||||||
|
postActor: str, personCache: {},
|
||||||
|
avatarUrl: str, allowDownloads: bool) -> str:
|
||||||
|
"""Returns the avatar image url
|
||||||
|
"""
|
||||||
|
# get the avatar image url for the post actor
|
||||||
|
if not avatarUrl:
|
||||||
|
avatarUrl = \
|
||||||
|
getPersonAvatarUrl(baseDir, postActor, personCache,
|
||||||
|
allowDownloads)
|
||||||
|
avatarUrl = \
|
||||||
|
updateAvatarImageCache(session, baseDir, httpPrefix,
|
||||||
|
postActor, avatarUrl, personCache,
|
||||||
|
allowDownloads)
|
||||||
|
else:
|
||||||
|
updateAvatarImageCache(session, baseDir, httpPrefix,
|
||||||
|
postActor, avatarUrl, personCache,
|
||||||
|
allowDownloads)
|
||||||
|
|
||||||
|
if not avatarUrl:
|
||||||
|
avatarUrl = postActor + '/avatar.png'
|
||||||
|
|
||||||
|
return avatarUrl
|
||||||
|
|
||||||
|
|
||||||
def individualPostAsHtml(allowDownloads: bool,
|
def individualPostAsHtml(allowDownloads: bool,
|
||||||
recentPostsCache: {}, maxRecentPosts: int,
|
recentPostsCache: {}, maxRecentPosts: int,
|
||||||
iconsPath: str, translate: {},
|
iconsPath: str, translate: {},
|
||||||
|
@ -245,6 +271,7 @@ def individualPostAsHtml(allowDownloads: bool,
|
||||||
if pageNumber:
|
if pageNumber:
|
||||||
pageNumberParam = '?page=' + str(pageNumber)
|
pageNumberParam = '?page=' + str(pageNumber)
|
||||||
|
|
||||||
|
# get the html post from the recent posts cache if it exists there
|
||||||
postHtml = \
|
postHtml = \
|
||||||
getPostFromRecent(session, baseDir,
|
getPostFromRecent(session, baseDir,
|
||||||
httpPrefix, nickname, domain,
|
httpPrefix, nickname, domain,
|
||||||
|
@ -270,18 +297,11 @@ def individualPostAsHtml(allowDownloads: bool,
|
||||||
if timeDiff > 100:
|
if timeDiff > 100:
|
||||||
print('TIMING INDIV ' + boxName + ' 4 = ' + str(timeDiff))
|
print('TIMING INDIV ' + boxName + ' 4 = ' + str(timeDiff))
|
||||||
|
|
||||||
if not avatarUrl:
|
avatarUrl = \
|
||||||
avatarUrl = \
|
getAvatarImageUrl(session,
|
||||||
getPersonAvatarUrl(baseDir, postActor, personCache,
|
baseDir, httpPrefix,
|
||||||
allowDownloads)
|
postActor, personCache,
|
||||||
avatarUrl = \
|
avatarUrl, allowDownloads)
|
||||||
updateAvatarImageCache(session, baseDir, httpPrefix,
|
|
||||||
postActor, avatarUrl, personCache,
|
|
||||||
allowDownloads)
|
|
||||||
else:
|
|
||||||
updateAvatarImageCache(session, baseDir, httpPrefix,
|
|
||||||
postActor, avatarUrl, personCache,
|
|
||||||
allowDownloads)
|
|
||||||
|
|
||||||
# benchmark 5
|
# benchmark 5
|
||||||
if enableTimingLog:
|
if enableTimingLog:
|
||||||
|
@ -289,9 +309,6 @@ def individualPostAsHtml(allowDownloads: bool,
|
||||||
if timeDiff > 100:
|
if timeDiff > 100:
|
||||||
print('TIMING INDIV ' + boxName + ' 5 = ' + str(timeDiff))
|
print('TIMING INDIV ' + boxName + ' 5 = ' + str(timeDiff))
|
||||||
|
|
||||||
if not avatarUrl:
|
|
||||||
avatarUrl = postActor + '/avatar.png'
|
|
||||||
|
|
||||||
if fullDomain not in postActor:
|
if fullDomain not in postActor:
|
||||||
(inboxUrl, pubKeyId, pubKey,
|
(inboxUrl, pubKeyId, pubKey,
|
||||||
fromPersonId, sharedInbox,
|
fromPersonId, sharedInbox,
|
||||||
|
|
Loading…
Reference in New Issue