Resolving smithereen actors

main
Bob Mottram 2021-06-03 19:49:09 +01:00
parent ca17ba9fe3
commit 1c732f5d70
2 changed files with 13 additions and 2 deletions

View File

@ -1332,7 +1332,7 @@ def getActorJson(handle: str, http: bool, gnunet: bool,
personUrl = personUrl.replace('/u/', '/actor/')
if not personUrl:
# try single user instance
personUrl = httpPrefix + '://' + domain
personUrl = httpPrefix + '://' + domain + '/' + nickname
headersList = (
"ld+json", "jrd+json", "activity+json"
)
@ -1340,7 +1340,8 @@ def getActorJson(handle: str, http: bool, gnunet: bool,
headersList = (
"ld+json", "jrd+json", "activity+json"
)
if debug:
print('personUrl: ' + personUrl)
for headerType in headersList:
headerMimeType = 'application/' + headerType
asHeader = {

View File

@ -851,6 +851,16 @@ def getNicknameFromActor(actor: str) -> str:
elif '@' in actor:
nickStr = actor.split('@')[0]
return nickStr
elif '://' in actor:
domain = actor.split('://')[1]
if '/' in domain:
domain = domain.split('/')[0]
if '://' + domain + '/' not in actor:
return None
nickStr = actor.split('://' + domain + '/')[1]
if '/' in nickStr or '.' in nickStr:
return None
return nickStr
return None
nickStr = actor.split('/users/')[1].replace('@', '')
if '/' not in nickStr: