Get webfinger from cache

merge-requests/8/head
Bob Mottram 2020-12-30 10:29:14 +00:00
parent 7c177ad035
commit 7fbdb2445f
3 changed files with 20 additions and 18 deletions

View File

@ -157,14 +157,13 @@ def _inboxStorePostToHtmlCache(recentPostsCache: {}, maxRecentPosts: int,
if boxname != 'tlevents' and boxname != 'outbox':
boxname = 'inbox'
# wfRequest = {}
# requestHandle = nickname + '@' + domain
# if cachedWebfingers.get(requestHandle):
# wfRequest = cachedWebfingers[requestHandle]
# elif cachedWebfingers.get(requestHandle + ':' + str(port)):
# wfRequest = cachedWebfingers[requestHandle + ':' + str(port)]
# TODO: this may need to be changed
wfRequest = cachedWebfingers
# check if a cached version of the webfinger request exists
requestHandle = nickname + '@' + getFullDomain(domain, port)
if cachedWebfingers.get(requestHandle):
wfRequest = cachedWebfingers[requestHandle]
else:
# TODO this may not be correct
wfRequest = cachedWebfingers
individualPostAsHtml(True, recentPostsCache, maxRecentPosts,
translate, pageNumber,

View File

@ -148,8 +148,12 @@ def getUserUrl(wfRequest: {}, sourceId=0) -> str:
"""
print('getUserUrl: ' + str(sourceId) + ' ' + str(wfRequest))
if not wfRequest.get('links'):
print('getUserUrl webfinger activity+json contains no links ' +
str(sourceId) + ' ' + str(wfRequest))
if sourceId == 72367:
print('getUserUrl failed to get display name for webfinger ' +
str(wfRequest))
else:
print('getUserUrl webfinger activity+json contains no links ' +
str(sourceId) + ' ' + str(wfRequest))
return None
for link in wfRequest['links']:
if not (link.get('type') and link.get('href')):

View File

@ -260,14 +260,13 @@ def htmlProfileAfterSearch(cssCache: {},
if not item.get('object'):
continue
# wfRequest = {}
# requestHandle = nickname + '@' + domain
# if cachedWebfingers.get(requestHandle):
# wfRequest = cachedWebfingers[requestHandle]
# elif cachedWebfingers.get(requestHandle + ':' + str(port)):
# wfRequest = cachedWebfingers[requestHandle + ':' + str(port)]
# TODO: this may need to be changed
wfRequest = cachedWebfingers
# check if a cached version of the webfinger request exists
requestHandle = nickname + '@' + getFullDomain(domain, port)
if cachedWebfingers.get(requestHandle):
wfRequest = cachedWebfingers[requestHandle]
else:
# TODO this may not be correct
wfRequest = cachedWebfingers
profileStr += \
individualPostAsHtml(True, recentPostsCache, maxRecentPosts,