mirror of https://gitlab.com/bashrc2/epicyon
Media path same as mastodon
parent
6a9cd38912
commit
dccb22c393
|
@ -11387,7 +11387,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
'/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):
|
||||
return False
|
||||
if '/system/accounts/avatars/' in path:
|
||||
|
@ -13229,6 +13229,10 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
|
||||
# show media
|
||||
# Note that this comes before the busy flag to avoid conflicts
|
||||
# replace mastoson-style media path
|
||||
if '/system/media_attachments/files/' in self.path:
|
||||
self.path = self.path.replace('/system/media_attachments/files/',
|
||||
'/media/')
|
||||
if '/media/' in self.path:
|
||||
self._showMedia(callingDomain,
|
||||
self.path, self.server.baseDir,
|
||||
|
|
2
media.py
2
media.py
|
@ -325,6 +325,8 @@ def attachMedia(baseDir: str, httpPrefix: str,
|
|||
createMediaDirs(baseDir, mPath)
|
||||
mediaFilename = baseDir + '/' + mediaPath
|
||||
|
||||
mediaPath = \
|
||||
mediaPath.replace('media/', 'system/media_attachments/files/', 1)
|
||||
attachmentJson = {
|
||||
'mediaType': mediaType,
|
||||
'name': description,
|
||||
|
|
|
@ -337,6 +337,10 @@ def postMessageToOutbox(session, translate: {},
|
|||
# change the url of the attachment
|
||||
attach['url'] = \
|
||||
httpPrefix + '://' + domainFull + '/' + mediaPath
|
||||
attach['url'] = \
|
||||
attach['url'].replace('/media/',
|
||||
'/system/' +
|
||||
'media_attachments/files/')
|
||||
|
||||
permittedOutboxTypes = ('Create', 'Announce', 'Like', 'Follow', 'Undo',
|
||||
'Update', 'Add', 'Remove', 'Block', 'Delete',
|
||||
|
|
4
tests.py
4
tests.py
|
@ -1299,7 +1299,9 @@ def testPostMessageBetweenServers(baseDir: str) -> None:
|
|||
assert attached.get('type')
|
||||
assert attached.get('url')
|
||||
assert attached['mediaType'] == 'image/png'
|
||||
assert '/media/' in attached['url']
|
||||
if not '/system/media_attachments/files/' in attached['url']:
|
||||
print(attached['url'])
|
||||
assert '/system/media_attachments/files/' in attached['url']
|
||||
assert attached['url'].endswith('.png')
|
||||
assert attached.get('width')
|
||||
assert attached.get('height')
|
||||
|
|
Loading…
Reference in New Issue