From 99893e5e2386edd280c0b6b87d14b292dea98aec Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 15 Sep 2020 10:16:03 +0100 Subject: [PATCH] Don't insist on lowercase handle --- follow.py | 6 +++--- person.py | 12 ++++++------ utils.py | 4 ++-- webfinger.py | 10 +++++----- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/follow.py b/follow.py index 6b764df37..ea3ac55b0 100644 --- a/follow.py +++ b/follow.py @@ -244,7 +244,7 @@ def clearFollows(baseDir: str, nickname: str, domain: str, followFile='following.txt') -> None: """Removes all follows """ - handle = nickname.lower() + '@' + domain.lower() + handle = nickname + '@' + domain if not os.path.isdir(baseDir + '/accounts'): os.mkdir(baseDir + '/accounts') if not os.path.isdir(baseDir + '/accounts/' + handle): @@ -269,7 +269,7 @@ def getNoOfFollows(baseDir: str, nickname: str, domain: str, # account holders # if not authenticated: # return 9999 - handle = nickname.lower() + '@' + domain.lower() + handle = nickname + '@' + domain filename = baseDir + '/accounts/' + handle + '/' + followFile if not os.path.isfile(filename): return 0 @@ -378,7 +378,7 @@ def getFollowingFeed(baseDir: str, domain: str, port: int, path: str, handleDomain = domain if ':' in handleDomain: handleDomain = domain.split(':')[0] - handle = nickname.lower() + '@' + handleDomain.lower() + handle = nickname + '@' + handleDomain filename = baseDir + '/accounts/' + handle + '/' + followFile + '.txt' if not os.path.isfile(filename): return following diff --git a/person.py b/person.py index b1fa69444..071f4beda 100644 --- a/person.py +++ b/person.py @@ -73,7 +73,7 @@ def setProfileImage(baseDir: str, httpPrefix: str, nickname: str, domain: str, if ':' not in domain: fullDomain = domain + ':' + str(port) - handle = nickname.lower() + '@' + domain.lower() + handle = nickname + '@' + domain personFilename = baseDir + '/accounts/' + handle + '.json' if not os.path.isfile(personFilename): print('person definition not found: ' + personFilename) @@ -210,7 +210,7 @@ def createPersonBase(baseDir: str, nickname: str, domain: str, port: int, storeWebfingerEndpoint(nickname, domain, port, baseDir, webfingerEndpoint) - handle = nickname.lower() + '@' + domain.lower() + handle = nickname + '@' + domain originalDomain = domain if port: if port != 80 and port != 443: @@ -736,8 +736,8 @@ def setDisplayNickname(baseDir: str, nickname: str, domain: str, displayName: str) -> bool: if len(displayName) > 32: return False - handle = nickname.lower() + '@' + domain.lower() - filename = baseDir + '/accounts/' + handle.lower() + '.json' + handle = nickname + '@' + domain + filename = baseDir + '/accounts/' + handle + '.json' if not os.path.isfile(filename): return False @@ -752,8 +752,8 @@ def setDisplayNickname(baseDir: str, nickname: str, domain: str, def setBio(baseDir: str, nickname: str, domain: str, bio: str) -> bool: if len(bio) > 32: return False - handle = nickname.lower() + '@' + domain.lower() - filename = baseDir + '/accounts/' + handle.lower() + '.json' + handle = nickname + '@' + domain + filename = baseDir + '/accounts/' + handle + '.json' if not os.path.isfile(filename): return False diff --git a/utils.py b/utils.py index 97fccaa8b..8a18c7534 100644 --- a/utils.py +++ b/utils.py @@ -327,9 +327,9 @@ def followPerson(baseDir: str, nickname: str, domain: str, print('DEBUG: follow of domain ' + followDomain) if ':' in domain: - handle = nickname + '@' + domain.split(':')[0].lower() + handle = nickname + '@' + domain.split(':')[0] else: - handle = nickname + '@' + domain.lower() + handle = nickname + '@' + domain if not os.path.isdir(baseDir + '/accounts/' + handle): print('WARN: account for ' + handle + ' does not exist') diff --git a/webfinger.py b/webfinger.py index c1ecdfc1c..65b5666fc 100644 --- a/webfinger.py +++ b/webfinger.py @@ -121,11 +121,11 @@ def storeWebfingerEndpoint(nickname: str, domain: str, port: int, wfSubdir = '/wfendpoints' if not os.path.isdir(baseDir + wfSubdir): os.mkdir(baseDir + wfSubdir) - filename = baseDir + wfSubdir + '/' + handle.lower() + '.json' + filename = baseDir + wfSubdir + '/' + handle + '.json' saveJson(wfJson, filename) if nickname == 'inbox': handle = originalDomain + '@' + domain - filename = baseDir + wfSubdir + '/' + handle.lower() + '.json' + filename = baseDir + wfSubdir + '/' + handle + '.json' saveJson(wfJson, filename) return True @@ -261,7 +261,7 @@ def webfingerLookup(path: str, baseDir: str, if onionDomain in handle: handle = handle.replace(onionDomain, domain) onionify = True - filename = baseDir + '/wfendpoints/' + handle.lower() + '.json' + filename = baseDir + '/wfendpoints/' + handle + '.json' if debug: print('DEBUG: WEBFINGER filename ' + filename) if not os.path.isfile(filename): @@ -339,7 +339,7 @@ def webfingerUpdate(baseDir: str, nickname: str, domain: str, if not os.path.isdir(baseDir + wfSubdir): return - filename = baseDir + wfSubdir + '/' + handle.lower() + '.json' + filename = baseDir + wfSubdir + '/' + handle + '.json' onionify = False if onionDomain: if onionDomain in handle: @@ -352,7 +352,7 @@ def webfingerUpdate(baseDir: str, nickname: str, domain: str, if not wfJson: return - actorFilename = baseDir + '/accounts/' + handle.lower() + '.json' + actorFilename = baseDir + '/accounts/' + handle + '.json' actorJson = loadJson(actorFilename) if not actorJson: return