sbrl / Pepperminty-Wiki

A wiki in a box
https://peppermint.mooncarrot.space/
Mozilla Public License 2.0
184 stars 22 forks source link

Allow the uploading of more file types #58

Closed sbrl closed 8 years ago

sbrl commented 8 years ago

Uploading images is great, but more file types would be nice. The problem is security though. How do we make sure that a malicious file isn't uploaded by accident?

Should we just warn users about this?

How should we deal with security here?

The other thing we should consider here is preview generation. We might want to open an issue for each different file type/class though and deal with them one at a time.

The obvious files that would benefit from preview generation are videos, but maybe we would want to embed a HTML5 video player instead if the browser supports the file type in question?

We might be able to take a similar approach with audio files - generate a preview of the waveform if the browser doesn't support the file type, and display an HTML5 audio player if the browser does.

PDFs might be a good candidate for preview generation, too - in fact we could use imagemagick to extract the first page as an image and send it to the user.

sbrl commented 8 years ago

Link to HTML5 audio/video support tables: http://caniuse.com/#feat=video http://caniuse.com/#feat=audio

sbrl commented 8 years ago

I have enabled the uploading of more file types. The next step will be to generate a preview for them all.

I think the first step will be to migrate over to using imagemagick for preview generation. This will instantly add support for way more file types.

We can then worry about video / audio preview generation later.

sbrl commented 8 years ago

We have now switched to using imagick, and have (untested) etags to speed up subsequent requests.

It looks like video and audio preview generation is relatively tough to do reliably, so we should stick with sending the appropriate HTML5 code to play them in the browser.

sbrl commented 8 years ago

We now have both video and audio previews online using the HTML5 <video> and <audio> tags! It currently doesn't check to make sure that the target browser does actually support the video / audio type that has been uploaded though.