Revert to previous avatar path

alt-html-css
Bob Mottram 2020-12-18 23:44:44 +00:00
parent 9dd5ac532f
commit 93da5f9b72
2 changed files with 1 additions and 15 deletions

View File

@ -3803,8 +3803,6 @@ class PubServer(BaseHTTPRequestHandler):
lastPartOfUrl = actorUrl.split('/')[-1]
srchStr = '/' + lastPartOfUrl
actorUrl = actorUrl.replace(srchStr, repStr)
actorUrl = actorUrl.replace('/users/',
'/accounts/avatars/')
actorJson['icon']['url'] = actorUrl
print('actorUrl: ' + actorUrl)
if '.' in actorUrl:
@ -9360,16 +9358,6 @@ class PubServer(BaseHTTPRequestHandler):
'_nodeinfo(callingDomain)',
'_mastoApi(callingDomain)')
# alternative way of referencing avatar images
# /accounts/avatars/nickname/avatar[number].png
# instead of /users/nickname/avatar[number].png
if self.path.startswith('/accounts/avatars/'):
nickname = self.path.split('/accounts/avatars/')[1]
if '/' in nickname:
avatarFilename = nickname.split('/')[1]
nickname = nickname.split('/')[0]
self.path = '/users/' + nickname + '/' + avatarFilename
if self.path == '/logout':
if not self.server.newsInstance:
msg = \

View File

@ -148,15 +148,13 @@ def randomizeActorImages(personJson: {}) -> None:
This causes other instances to update their cached avatar image
"""
personId = personJson['id']
nickname = personId.split('/users/')[1]
lastPartOfFilename = personJson['icon']['url'].split('/')[-1]
existingExtension = lastPartOfFilename.split('.')[1]
# NOTE: these files don't need to have cryptographically
# secure names
randStr = str(randint(10000000000000, 99999999999999)) # nosec
personJson['icon']['url'] = \
'/accounts/avatars/' + nickname + \
'/avatar' + randStr + '.' + existingExtension
personId + '/avatar' + randStr + '.' + existingExtension
lastPartOfFilename = personJson['image']['url'].split('/')[-1]
existingExtension = lastPartOfFilename.split('.')[1]
randStr = str(randint(10000000000000, 99999999999999)) # nosec