mirror of https://gitlab.com/bashrc2/epicyon
More attachment types
parent
864741a8dd
commit
80e4779d44
24
daemon.py
24
daemon.py
|
@ -1823,21 +1823,21 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
else:
|
else:
|
||||||
# directly search the binary array for the beginning
|
# directly search the binary array for the beginning
|
||||||
# of an image
|
# of an image
|
||||||
searchStr=b'Content-Type: image/png'
|
mediaExtension={
|
||||||
|
'image': ['png','jpeg','gif'],
|
||||||
|
'video': ['mp4','webm','ogv'],
|
||||||
|
'audio': ['mp3','ogg']
|
||||||
|
}
|
||||||
|
for mType,extensionList in mediaTypes.items():
|
||||||
|
for extension in extensionList:
|
||||||
|
searchStr=b'Content-Type: '+mType+'/'+extension
|
||||||
imageLocation=postBytes.find(searchStr)
|
imageLocation=postBytes.find(searchStr)
|
||||||
filenameBase=self.server.baseDir+'/accounts/'+nickname+'@'+self.server.domain+'/upload'
|
filenameBase=self.server.baseDir+'/accounts/'+nickname+'@'+self.server.domain+'/upload'
|
||||||
if imageLocation>-1:
|
if imageLocation>-1:
|
||||||
filename=filenameBase+'.png'
|
if extension=='jpeg':
|
||||||
else:
|
extension='jpg'
|
||||||
searchStr=b'Content-Type: image/jpeg'
|
filename=filenameBase+'.'+extension
|
||||||
imageLocation=postBytes.find(searchStr)
|
break
|
||||||
if imageLocation>-1:
|
|
||||||
filename=filenameBase+'.jpg'
|
|
||||||
else:
|
|
||||||
searchStr=b'Content-Type: image/gif'
|
|
||||||
imageLocation=postBytes.find(searchStr)
|
|
||||||
if imageLocation>-1:
|
|
||||||
filename=filenameBase+'.gif'
|
|
||||||
if filename and imageLocation>-1:
|
if filename and imageLocation>-1:
|
||||||
# locate the beginning of the image, after any
|
# locate the beginning of the image, after any
|
||||||
# carriage returns
|
# carriage returns
|
||||||
|
|
|
@ -807,7 +807,7 @@ def htmlNewPost(baseDir: str,path: str,inReplyTo: str,mentions: [],reportUrl: st
|
||||||
' <div class="container">' \
|
' <div class="container">' \
|
||||||
' <input type="text" placeholder="Image description" name="imageDescription">' \
|
' <input type="text" placeholder="Image description" name="imageDescription">' \
|
||||||
' <input type="file" id="attachpic" name="attachpic"' \
|
' <input type="file" id="attachpic" name="attachpic"' \
|
||||||
' accept=".png, .jpg, .jpeg, .gif">' \
|
' accept=".png, .jpg, .jpeg, .gif, .mp4, .webm, .ogv, .mp3, .ogg">' \
|
||||||
' </div>' \
|
' </div>' \
|
||||||
' </div>' \
|
' </div>' \
|
||||||
'</form>'
|
'</form>'
|
||||||
|
|
Loading…
Reference in New Issue