feat: support webm and webp media

This commit is contained in:
Daniel Kempkens 2023-08-25 00:27:30 +02:00
parent 4851b9bf7c
commit e00e6b97c3
Signed by: daniel
SSH key fingerprint: SHA256:Ks/MyhQYcPRQiwMKLAKquWCdCPe3JXlb1WttgnAoSeM

View file

@ -204,8 +204,8 @@ defmodule BdfrBrowser.HTTP.Plug do
defp post_media(post, args) do
base_directory = Application.fetch_env!(:bdfr_browser, :base_directory)
post_dir = Path.join([base_directory | Keyword.fetch!(args, :paths)])
post_img = "#{post}*.{jpg,JPG,jpeg,JPEG,png,PNG,gif,GIF}"
post_vid = "#{post}*.{mp4,MP4}"
post_img = "#{post}*.{jpg,JPG,jpeg,JPEG,png,PNG,gif,GIF,webp,WEBP}"
post_vid = "#{post}*.{mp4,MP4,webm,WEBM}"
%{
images: post_media_for_type(post_dir, post_img),
@ -240,6 +240,8 @@ defmodule BdfrBrowser.HTTP.Plug do
".png" -> "image/png"
".gif" -> "image/gif"
".mp4" -> "video/mp4"
".webp" -> "image/webp"
".webm" -> "video/webm"
".js" -> "text/javascript"
".css" -> "text/css"
end