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