Extra extensions

main
Bob Mottram 2019-11-14 14:40:51 +00:00
parent 2f9ae10f83
commit 14b9266ba8
1 changed files with 7 additions and 2 deletions

View File

@ -1001,6 +1001,7 @@ class PubServer(BaseHTTPRequestHandler):
# image on login screen # image on login screen
if self.path=='/login.png' or \ if self.path=='/login.png' or \
self.path=='/login.gif' or \ self.path=='/login.gif' or \
self.path=='/login.webp' or \
self.path=='/login.jpeg' or \ self.path=='/login.jpeg' or \
self.path=='/login.jpg': self.path=='/login.jpg':
mediaFilename= \ mediaFilename= \
@ -1196,14 +1197,16 @@ class PubServer(BaseHTTPRequestHandler):
return return
self._404() self._404()
return return
# show avatar or background image # show avatar or background image
# Note that this comes before the busy flag to avoid conflicts # Note that this comes before the busy flag to avoid conflicts
if '/users/' in self.path: if '/users/' in self.path:
if self.path.endswith('.png') or \ if self.path.endswith('.png') or \
self.path.endswith('.jpg') or \ self.path.endswith('.jpg') or \
self.path.endswith('.webp') or \
self.path.endswith('.gif'): self.path.endswith('.gif'):
avatarStr=self.path.split('/users/')[1] avatarStr=self.path.split('/users/')[1]
if '/' in avatarStr: if '/' in avatarStr and '.temp.' not in self.path:
avatarNickname=avatarStr.split('/')[0] avatarNickname=avatarStr.split('/')[0]
avatarFile=avatarStr.split('/')[1] avatarFile=avatarStr.split('/')[1]
avatarFilename= \ avatarFilename= \
@ -1216,8 +1219,10 @@ class PubServer(BaseHTTPRequestHandler):
mediaImageType='png' mediaImageType='png'
elif avatarFile.endswith('.jpg'): elif avatarFile.endswith('.jpg'):
mediaImageType='jpeg' mediaImageType='jpeg'
else: elif avatarFile.endswith('.gif'):
mediaImageType='gif' mediaImageType='gif'
else:
mediaImageType='webp'
with open(avatarFilename, 'rb') as avFile: with open(avatarFilename, 'rb') as avFile:
mediaBinary = avFile.read() mediaBinary = avFile.read()
self._set_headers('image/'+mediaImageType, \ self._set_headers('image/'+mediaImageType, \