diff --git a/cache.py b/cache.py index d6b06bba2..dc805f1b5 100644 --- a/cache.py +++ b/cache.py @@ -14,7 +14,7 @@ from session import getJson from utils import loadJson from utils import saveJson from utils import getFileCaseInsensitive -from utils import getUserPaths +from utils import get_user_paths def _removePersonFromCache(base_dir: str, personUrl: str, @@ -144,7 +144,7 @@ def getPersonPubKey(base_dir: str, session, personUrl: str, if not personUrl: return None personUrl = personUrl.replace('#main-key', '') - usersPaths = getUserPaths() + usersPaths = get_user_paths() for possibleUsersPath in usersPaths: if personUrl.endswith(possibleUsersPath + 'inbox'): if debug: diff --git a/follow.py b/follow.py index f0118fb5d..0e7c682d7 100644 --- a/follow.py +++ b/follow.py @@ -26,7 +26,7 @@ from posts import getPersonBox from utils import loadJson from utils import saveJson from utils import isAccountDir -from utils import getUserPaths +from utils import get_user_paths from utils import acct_dir from utils import hasGroupType from utils import local_actor_url @@ -118,7 +118,7 @@ def _removeFromFollowBase(base_dir: str, acceptDenyDomain = acceptOrDenyHandle.split('@')[1] # for each possible users path construct an actor and # check if it exists in teh file - usersPaths = getUserPaths() + usersPaths = get_user_paths() actorFound = False for usersName in usersPaths: acceptDenyActor = \ @@ -271,7 +271,7 @@ def isFollowerOfPerson(base_dir: str, nickname: str, domain: str, if handle in followersStr: alreadyFollowing = True else: - paths = getUserPaths() + paths = get_user_paths() for userPath in paths: url = '://' + followerDomain + userPath + followerNickname if url in followersStr: @@ -652,7 +652,7 @@ def storeFollowRequest(base_dir: str, if approveHandle in followersStr: alreadyFollowing = True else: - usersPaths = getUserPaths() + usersPaths = get_user_paths() for possibleUsersPath in usersPaths: url = '://' + domain_full + possibleUsersPath + nickname if url in followersStr: diff --git a/inbox.py b/inbox.py index f2443c5d4..4e8fe3fe2 100644 --- a/inbox.py +++ b/inbox.py @@ -27,7 +27,7 @@ from utils import hasObjectString from utils import hasObjectStringObject from utils import getReplyIntervalHours from utils import canReplyTo -from utils import getUserPaths +from utils import get_user_paths from utils import get_base_content_from_post from utils import acct_dir from utils import removeDomainPort @@ -836,7 +836,7 @@ def _personReceiveUpdate(base_dir: str, ' ' + str(personJson)) domain_full = getFullDomain(domain, port) updateDomainFull = getFullDomain(updateDomain, updatePort) - usersPaths = getUserPaths() + usersPaths = get_user_paths() usersStrFound = False for usersStr in usersPaths: actor = updateDomainFull + usersStr + updateNickname diff --git a/manualapprove.py b/manualapprove.py index c966f420a..1ebc103dd 100644 --- a/manualapprove.py +++ b/manualapprove.py @@ -14,7 +14,7 @@ from follow import removeFromFollowRequests from utils import loadJson from utils import removeDomainPort from utils import getPortFromDomain -from utils import getUserPaths +from utils import get_user_paths from utils import acct_dir from threads import threadWithTrace @@ -157,7 +157,7 @@ def manualApproveFollowRequest(session, base_dir: str, reqNick = approveHandle.split('@')[0].replace('!', '') reqDomain = approveHandle.split('@')[1].strip() reqPrefix = http_prefix + '://' + reqDomain - paths = getUserPaths() + paths = get_user_paths() for userPath in paths: if reqPrefix + userPath + reqNick in approveFollowsStr: exists = True diff --git a/person.py b/person.py index 8e3b3ab8e..8f0cc5fc0 100644 --- a/person.py +++ b/person.py @@ -56,7 +56,7 @@ from utils import has_users_path from utils import getImageExtensions from utils import isImageFile from utils import acct_dir -from utils import getUserPaths +from utils import get_user_paths from utils import getGroupPaths from utils import local_actor_url from utils import dangerousSVG @@ -1421,7 +1421,7 @@ def _detectUsersPath(url: str) -> str: """ if '/' not in url: return '/users/' - usersPaths = getUserPaths() + usersPaths = get_user_paths() for possibleUsersPath in usersPaths: if possibleUsersPath in url: return possibleUsersPath @@ -1460,7 +1460,7 @@ def getActorJson(hostDomain: str, handle: str, http: bool, gnunet: bool, for prefix in prefixes: handle = handle.replace(prefix, '') handle = handle.replace('/@', detectedUsersPath) - paths = getUserPaths() + paths = get_user_paths() userPathFound = False for userPath in paths: if userPath in handle: @@ -1570,7 +1570,7 @@ def getActorJson(hostDomain: str, handle: str, http: bool, gnunet: bool, if not personUrl and wfRequest: personUrl = getUserUrl(wfRequest, 0, debug) if nickname == domain: - paths = getUserPaths() + paths = get_user_paths() for userPath in paths: personUrl = personUrl.replace(userPath, '/actor/') if not personUrl and group_account: diff --git a/posts.py b/posts.py index 8239c71c5..d7c1182f9 100644 --- a/posts.py +++ b/posts.py @@ -32,7 +32,7 @@ from webfinger import webfingerHandle from httpsig import createSignedHeader from siteactive import siteIsActive from languages import understoodPostLanguage -from utils import getUserPaths +from utils import get_user_paths from utils import invalidCiphertext from utils import hasObjectStringType from utils import removeIdEnding @@ -1271,7 +1271,7 @@ def _consolidateActorsList(actorsList: []) -> None: if ccActor not in possibleDuplicateActors: possibleDuplicateActors.append(ccActor) if possibleDuplicateActors: - uPaths = getUserPaths() + uPaths = get_user_paths() removeActors = [] for ccActor in possibleDuplicateActors: for usrPath in uPaths: diff --git a/utils.py b/utils.py index 0de196e19..0f0aff57a 100644 --- a/utils.py +++ b/utils.py @@ -194,7 +194,7 @@ def get_locked_account(actor_json: {}) -> bool: def has_users_path(pathStr: str) -> bool: """Whether there is a /users/ path (or equivalent) in the given string """ - usersList = getUserPaths() + usersList = get_user_paths() for usersStr in usersList: if usersStr in pathStr: return True @@ -1022,7 +1022,7 @@ def getNicknameFromActor(actor: str) -> str: """ if actor.startswith('@'): actor = actor[1:] - usersPaths = getUserPaths() + usersPaths = get_user_paths() for possiblePath in usersPaths: if possiblePath in actor: nickStr = actor.split(possiblePath)[1].replace('@', '') @@ -1052,7 +1052,7 @@ def getNicknameFromActor(actor: str) -> str: return None -def getUserPaths() -> []: +def get_user_paths() -> []: """Returns possible user paths e.g. /users/nickname, /channel/nickname """ @@ -1074,7 +1074,7 @@ def getDomainFromActor(actor: str) -> (str, int): actor = actor[1:] port = None prefixes = getProtocolPrefixes() - usersPaths = getUserPaths() + usersPaths = get_user_paths() for possiblePath in usersPaths: if possiblePath in actor: domain = actor.split(possiblePath)[0] @@ -3148,7 +3148,7 @@ def getSharesFilesList() -> []: def replaceUsersWithAt(actor: str) -> str: """ https://domain/users/nick becomes https://domain/@nick """ - uPaths = getUserPaths() + uPaths = get_user_paths() for path in uPaths: if path in actor: actor = actor.replace(path, '/@') diff --git a/webfinger.py b/webfinger.py index 253284e5d..f0337f4aa 100644 --- a/webfinger.py +++ b/webfinger.py @@ -18,7 +18,7 @@ from utils import loadJsonOnionify from utils import saveJson from utils import getProtocolPrefixes from utils import removeDomainPort -from utils import getUserPaths +from utils import get_user_paths from utils import getGroupPaths from utils import local_actor_url @@ -48,7 +48,7 @@ def _parseHandle(handle: str) -> (str, str, bool): return nickname, domain, group_account # try for different /users/ paths - usersPaths = getUserPaths() + usersPaths = get_user_paths() groupPaths = getGroupPaths() for possibleUsersPath in usersPaths: if possibleUsersPath in handle: