mirror of https://gitlab.com/bashrc2/epicyon
Avatar and header path same as mastodon
parent
4103672e07
commit
6a9cd38912
15
daemon.py
15
daemon.py
|
@ -1454,6 +1454,9 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
|
||||
notAuthPaths = (
|
||||
'/icons/', '/avatars/',
|
||||
'/system/accounts/avatars/',
|
||||
'/system/accounts/headers/',
|
||||
'/system/media_attachments/files/',
|
||||
'/accounts/avatars/', '/accounts/headers/',
|
||||
'/favicon.ico', '/newswire.xml',
|
||||
'/newswire_favicon.ico', '/categories.xml'
|
||||
|
@ -11380,13 +11383,19 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
"""Shows an avatar or banner or profile background image
|
||||
"""
|
||||
if '/users/' not in path:
|
||||
if '/accounts/avatars/' not in path:
|
||||
if '/accounts/headers/' not in path:
|
||||
if '/system/accounts/avatars/' not in path and \
|
||||
'/system/accounts/headers/' not in path and \
|
||||
'/accounts/avatars/' not in path and \
|
||||
'/accounts/headers/' not in path:
|
||||
return False
|
||||
if not isImageFile(path):
|
||||
return False
|
||||
if '/accounts/avatars/' in path:
|
||||
if '/system/accounts/avatars/' in path:
|
||||
avatarStr = path.split('/system/accounts/avatars/')[1]
|
||||
elif '/accounts/avatars/' in path:
|
||||
avatarStr = path.split('/accounts/avatars/')[1]
|
||||
elif '/system/accounts/headers/' in path:
|
||||
avatarStr = path.split('/system/accounts/headers/')[1]
|
||||
elif '/accounts/headers/' in path:
|
||||
avatarStr = path.split('/accounts/headers/')[1]
|
||||
else:
|
||||
|
|
|
@ -177,13 +177,13 @@ def randomizeActorImages(personJson: {}) -> None:
|
|||
baseUrl = personId.split('/users/')[0]
|
||||
nickname = personJson['preferredUsername']
|
||||
personJson['icon']['url'] = \
|
||||
baseUrl + '/accounts/avatars/' + nickname + \
|
||||
baseUrl + '/system/accounts/avatars/' + nickname + \
|
||||
'/avatar' + randStr + '.' + existingExtension
|
||||
lastPartOfFilename = personJson['image']['url'].split('/')[-1]
|
||||
existingExtension = lastPartOfFilename.split('.')[1]
|
||||
randStr = str(randint(10000000000000, 99999999999999)) # nosec
|
||||
personJson['image']['url'] = \
|
||||
baseUrl + '/accounts/headers/' + nickname + \
|
||||
baseUrl + '/system/accounts/headers/' + nickname + \
|
||||
'/image' + randStr + '.' + existingExtension
|
||||
|
||||
|
||||
|
|
|
@ -761,9 +761,9 @@ def htmlProfile(signingPrivateKeyPem: str,
|
|||
|
||||
avatarUrl = profileJson['icon']['url']
|
||||
# use alternate path for local avatars to avoid any caching issues
|
||||
if '://' + domainFull + '/accounts/avatars/' in avatarUrl:
|
||||
if '://' + domainFull + '/system/accounts/avatars/' in avatarUrl:
|
||||
avatarUrl = \
|
||||
avatarUrl.replace('://' + domainFull + '/accounts/avatars/',
|
||||
avatarUrl.replace('://' + domainFull + '/system/accounts/avatars/',
|
||||
'://' + domainFull + '/users/')
|
||||
|
||||
# get pinned post content
|
||||
|
|
Loading…
Reference in New Issue