mirror of https://gitlab.com/bashrc2/epicyon
Additional users path
parent
efe1b54b38
commit
ca17ba9fe3
20
person.py
20
person.py
|
@ -1216,15 +1216,16 @@ def getActorJson(handle: str, http: bool, gnunet: bool,
|
||||||
handle.startswith('http') or \
|
handle.startswith('http') or \
|
||||||
handle.startswith('dat'):
|
handle.startswith('dat'):
|
||||||
# format: https://domain/@nick
|
# format: https://domain/@nick
|
||||||
prefixes = getProtocolPrefixes()
|
originalHandle = handle
|
||||||
for prefix in prefixes:
|
if not hasUsersPath(originalHandle):
|
||||||
handle = handle.replace(prefix, '')
|
|
||||||
handle = handle.replace('/@', '/users/')
|
|
||||||
if not hasUsersPath(handle):
|
|
||||||
if not quiet or debug:
|
if not quiet or debug:
|
||||||
print('getActorJson: Expected actor format: ' +
|
print('getActorJson: Expected actor format: ' +
|
||||||
'https://domain/@nick or https://domain/users/nick')
|
'https://domain/@nick or https://domain/users/nick')
|
||||||
return None
|
return None
|
||||||
|
prefixes = getProtocolPrefixes()
|
||||||
|
for prefix in prefixes:
|
||||||
|
handle = handle.replace(prefix, '')
|
||||||
|
handle = handle.replace('/@', '/users/')
|
||||||
if '/users/' in handle:
|
if '/users/' in handle:
|
||||||
nickname = handle.split('/users/')[1]
|
nickname = handle.split('/users/')[1]
|
||||||
nickname = nickname.replace('\n', '').replace('\r', '')
|
nickname = nickname.replace('\n', '').replace('\r', '')
|
||||||
|
@ -1245,6 +1246,15 @@ def getActorJson(handle: str, http: bool, gnunet: bool,
|
||||||
nickname = handle.split('/u/')[1]
|
nickname = handle.split('/u/')[1]
|
||||||
nickname = nickname.replace('\n', '').replace('\r', '')
|
nickname = nickname.replace('\n', '').replace('\r', '')
|
||||||
domain = handle.split('/u/')[0]
|
domain = handle.split('/u/')[0]
|
||||||
|
elif '://' in originalHandle:
|
||||||
|
domain = originalHandle.split('://')[1]
|
||||||
|
if '/' in domain:
|
||||||
|
domain = domain.split('/')[0]
|
||||||
|
if '://' + domain + '/' not in originalHandle:
|
||||||
|
return None
|
||||||
|
nickname = originalHandle.split('://' + domain + '/')[1]
|
||||||
|
if '/' in nickname or '.' in nickname:
|
||||||
|
return None
|
||||||
else:
|
else:
|
||||||
# format: @nick@domain
|
# format: @nick@domain
|
||||||
if '@' not in handle:
|
if '@' not in handle:
|
||||||
|
|
10
utils.py
10
utils.py
|
@ -97,6 +97,16 @@ def hasUsersPath(pathStr: str) -> bool:
|
||||||
for usersStr in usersList:
|
for usersStr in usersList:
|
||||||
if '/' + usersStr + '/' in pathStr:
|
if '/' + usersStr + '/' in pathStr:
|
||||||
return True
|
return True
|
||||||
|
if '://' in pathStr:
|
||||||
|
domain = pathStr.split('://')[1]
|
||||||
|
if '/' in domain:
|
||||||
|
domain = domain.split('/')[0]
|
||||||
|
if '://' + domain + '/' not in pathStr:
|
||||||
|
return False
|
||||||
|
nickname = pathStr.split('://' + domain + '/')[1]
|
||||||
|
if '/' in nickname or '.' in nickname:
|
||||||
|
return False
|
||||||
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue