mirror of https://gitlab.com/bashrc2/epicyon
Less verbose
parent
a3be3c1803
commit
041b6f0a8c
|
@ -76,7 +76,7 @@ def _updateMovedHandle(baseDir: str, nickname: str, domain: str,
|
|||
'Accept': 'application/activity+json; profile="' + profileStr + '"'
|
||||
}
|
||||
if not personUrl:
|
||||
personUrl = getUserUrl(wfRequest)
|
||||
personUrl = getUserUrl(wfRequest, 0, debug)
|
||||
if not personUrl:
|
||||
return ctr
|
||||
|
||||
|
|
|
@ -1204,7 +1204,7 @@ def getActorJson(handle: str, http: bool, gnunet: bool,
|
|||
'Accept': 'application/activity+json; profile="' + profileStr + '"'
|
||||
}
|
||||
if not personUrl:
|
||||
personUrl = getUserUrl(wfRequest)
|
||||
personUrl = getUserUrl(wfRequest, 0, debug)
|
||||
if nickname == domain:
|
||||
personUrl = personUrl.replace('/users/', '/actor/')
|
||||
personUrl = personUrl.replace('/accounts/', '/actor/')
|
||||
|
|
6
posts.py
6
posts.py
|
@ -148,7 +148,7 @@ def _cleanHtml(rawHtml: str) -> str:
|
|||
return html.unescape(text)
|
||||
|
||||
|
||||
def getUserUrl(wfRequest: {}, sourceId=0) -> str:
|
||||
def getUserUrl(wfRequest: {}, sourceId=0, debug=False) -> str:
|
||||
"""Gets the actor url from a webfinger request
|
||||
"""
|
||||
if not wfRequest.get('links'):
|
||||
|
@ -166,7 +166,7 @@ def getUserUrl(wfRequest: {}, sourceId=0) -> str:
|
|||
if link['type'] != 'application/activity+json':
|
||||
continue
|
||||
if '/@' not in link['href']:
|
||||
if not hasUsersPath(link['href']):
|
||||
if debug and not hasUsersPath(link['href']):
|
||||
print('getUserUrl webfinger activity+json ' +
|
||||
'contains single user instance actor ' +
|
||||
str(sourceId) + ' ' + str(link))
|
||||
|
@ -229,7 +229,7 @@ def getPersonBox(baseDir: str, session, wfRequest: {},
|
|||
return None, None, None, None, None, None, None
|
||||
|
||||
if not wfRequest.get('errors'):
|
||||
personUrl = getUserUrl(wfRequest, sourceId)
|
||||
personUrl = getUserUrl(wfRequest, sourceId, False)
|
||||
else:
|
||||
if nickname == 'dev':
|
||||
# try single user instance
|
||||
|
|
|
@ -75,11 +75,13 @@ def htmlProfileAfterSearch(cssCache: {},
|
|||
searchDomain, searchPort = getDomainFromActor(profileHandle)
|
||||
else:
|
||||
if '@' not in profileHandle:
|
||||
if debug:
|
||||
print('DEBUG: no @ in ' + profileHandle)
|
||||
return None
|
||||
if profileHandle.startswith('@'):
|
||||
profileHandle = profileHandle[1:]
|
||||
if '@' not in profileHandle:
|
||||
if debug:
|
||||
print('DEBUG: no @ in ' + profileHandle)
|
||||
return None
|
||||
searchNickname = profileHandle.split('@')[0]
|
||||
|
@ -91,16 +93,20 @@ def htmlProfileAfterSearch(cssCache: {},
|
|||
searchPort = int(searchPortStr)
|
||||
searchDomain = searchDomain.split(':')[0]
|
||||
if searchPort:
|
||||
if debug:
|
||||
print('DEBUG: Search for handle ' +
|
||||
str(searchNickname) + '@' + str(searchDomain) + ':' +
|
||||
str(searchPort))
|
||||
else:
|
||||
if debug:
|
||||
print('DEBUG: Search for handle ' +
|
||||
str(searchNickname) + '@' + str(searchDomain))
|
||||
if not searchNickname:
|
||||
if debug:
|
||||
print('DEBUG: No nickname found in ' + profileHandle)
|
||||
return None
|
||||
if not searchDomain:
|
||||
if debug:
|
||||
print('DEBUG: No domain found in ' + profileHandle)
|
||||
return None
|
||||
|
||||
|
@ -117,6 +123,7 @@ def htmlProfileAfterSearch(cssCache: {},
|
|||
httpPrefix, cachedWebfingers,
|
||||
domain, projectVersion, debug)
|
||||
if not wf:
|
||||
if debug:
|
||||
print('DEBUG: Unable to webfinger ' +
|
||||
searchNickname + '@' + searchDomainFull)
|
||||
print('DEBUG: cachedWebfingers ' + str(cachedWebfingers))
|
||||
|
@ -124,6 +131,7 @@ def htmlProfileAfterSearch(cssCache: {},
|
|||
print('DEBUG: domain ' + domain)
|
||||
return None
|
||||
if not isinstance(wf, dict):
|
||||
if debug:
|
||||
print('WARN: Webfinger search for ' +
|
||||
searchNickname + '@' + searchDomainFull +
|
||||
' did not return a dict. ' +
|
||||
|
@ -140,7 +148,7 @@ def htmlProfileAfterSearch(cssCache: {},
|
|||
'Accept': 'application/activity+json; profile="' + profileStr + '"'
|
||||
}
|
||||
if not personUrl:
|
||||
personUrl = getUserUrl(wf)
|
||||
personUrl = getUserUrl(wf, 0, debug)
|
||||
if not personUrl:
|
||||
# try single user instance
|
||||
asHeader = {
|
||||
|
|
Loading…
Reference in New Issue