Alternative path for avatar images

merge-requests/8/head
Bob Mottram 2020-12-18 23:10:55 +00:00
parent 8150fc9c11
commit 5acc6fe3b2
1 changed files with 14 additions and 2 deletions

View File

@ -3802,9 +3802,11 @@ class PubServer(BaseHTTPRequestHandler):
lastPartOfUrl = \
actorJson['icon']['url'].split('/')[-1]
srchStr = '/' + lastPartOfUrl
actorUrl = actorJson['icon']['url']
actorUrl = actorUrl.replace(srchStr, repStr)
actorJson['icon']['url'] = \
actorJson['icon']['url'].replace(srchStr,
repStr)
actorUrl.replace('/users/',
'/accounts/avatars/')
if '.' in actorJson['icon']['url']:
imgExt = \
actorJson['icon']['url'].split('.')[-1]
@ -9359,6 +9361,16 @@ 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 = \