mirror of https://gitlab.com/bashrc2/epicyon
Single function defining users paths
parent
2eec26aeaa
commit
5e33821b41
|
@ -28,6 +28,7 @@ from utils import saveJson
|
|||
from utils import isAccountDir
|
||||
from utils import getUserPaths
|
||||
from utils import acctDir
|
||||
from utils import getUsersPaths
|
||||
from acceptreject import createAccept
|
||||
from acceptreject import createReject
|
||||
from webfinger import webfingerHandle
|
||||
|
@ -108,7 +109,7 @@ def _removeFromFollowBase(baseDir: str,
|
|||
acceptDenyDomain = acceptOrDenyHandle.split('@')[1]
|
||||
# for each possible users path construct an actor and
|
||||
# check if it exists in teh file
|
||||
usersPaths = ('users', 'profile', 'channel', 'accounts', 'u')
|
||||
usersPaths = getUsersPaths()
|
||||
actorFound = False
|
||||
for usersName in usersPaths:
|
||||
acceptDenyActor = \
|
||||
|
|
2
inbox.py
2
inbox.py
|
@ -749,7 +749,7 @@ def _personReceiveUpdate(baseDir: str,
|
|||
' ' + str(personJson))
|
||||
domainFull = getFullDomain(domain, port)
|
||||
updateDomainFull = getFullDomain(updateDomain, updatePort)
|
||||
usersPaths = ('users', 'profile', 'channel', 'accounts', 'u')
|
||||
usersPaths = ('users', 'profile', 'channel', 'accounts', 'u', 'c')
|
||||
usersStrFound = False
|
||||
for usersStr in usersPaths:
|
||||
actor = updateDomainFull + '/' + usersStr + '/' + updateNickname
|
||||
|
|
11
utils.py
11
utils.py
|
@ -28,6 +28,13 @@ invalidCharacters = (
|
|||
)
|
||||
|
||||
|
||||
def getUsersPaths() -> []:
|
||||
"""Returns the possible paths for users accounts
|
||||
e.g. /users/nickname, /channel/nickname
|
||||
"""
|
||||
return ('users', 'profile', 'channel', 'accounts', 'u', 'c')
|
||||
|
||||
|
||||
def getActorLanguagesList(actorJson: {}) -> []:
|
||||
"""Returns a list containing languages used by the given actor
|
||||
"""
|
||||
|
@ -159,7 +166,7 @@ def getLockedAccount(actorJson: {}) -> bool:
|
|||
def hasUsersPath(pathStr: str) -> bool:
|
||||
"""Whether there is a /users/ path (or equivalent) in the given string
|
||||
"""
|
||||
usersList = ('users', 'accounts', 'channel', 'profile', 'u')
|
||||
usersList = getUsersPaths()
|
||||
for usersStr in usersList:
|
||||
if '/' + usersStr + '/' in pathStr:
|
||||
return True
|
||||
|
@ -1579,7 +1586,7 @@ def _isReservedName(nickname: str) -> bool:
|
|||
'reply', 'replies', 'question', 'like',
|
||||
'likes', 'users', 'statuses', 'tags',
|
||||
'accounts', 'headers',
|
||||
'channels', 'profile', 'u',
|
||||
'channels', 'profile', 'u', 'c',
|
||||
'updates', 'repeat', 'announce',
|
||||
'shares', 'fonts', 'icons', 'avatars',
|
||||
'welcome', 'helpimages',
|
||||
|
|
Loading…
Reference in New Issue