diff --git a/lib/pleroma/config/deprecation_warnings.ex b/lib/pleroma/config/deprecation_warnings.ex index 0eb1833aa..7451fd0a7 100644 --- a/lib/pleroma/config/deprecation_warnings.ex +++ b/lib/pleroma/config/deprecation_warnings.ex @@ -12,8 +12,10 @@ defmodule Pleroma.Config.DeprecationWarnings do You are using the old configuration mechanism for the frontend. Please check config.md. """) end + end - if Pleroma.Config.get(:mrf_hellthread, :threshold) do + def check_hellthread_threshold do + if Pleroma.Config.get([:mrf_hellthread, :threshold]) do Logger.warn(""" !!!DEPRECATION WARNING!!! You are using the old configuration mechanism for the hellthread filter. Please check config.md. @@ -23,5 +25,6 @@ defmodule Pleroma.Config.DeprecationWarnings do def warn do check_frontend_config_mechanism() + check_hellthread_threshold() end end diff --git a/lib/pleroma/mime.ex b/lib/pleroma/mime.ex index 84fb536e0..36771533f 100644 --- a/lib/pleroma/mime.ex +++ b/lib/pleroma/mime.ex @@ -102,10 +102,18 @@ defmodule Pleroma.MIME do "audio/ogg" end - defp check_mime_type(<<0x52, 0x49, 0x46, 0x46, _::binary>>) do + defp check_mime_type(<<"RIFF", _::binary-size(4), "WAVE", _::binary>>) do "audio/wav" end + defp check_mime_type(<<"RIFF", _::binary-size(4), "WEBP", _::binary>>) do + "image/webp" + end + + defp check_mime_type(<<"RIFF", _::binary-size(4), "AVI.", _::binary>>) do + "video/avi" + end + defp check_mime_type(_) do @default end diff --git a/lib/pleroma/web/mastodon_api/views/status_view.ex b/lib/pleroma/web/mastodon_api/views/status_view.ex index d5b7e68c7..d1b11d4f1 100644 --- a/lib/pleroma/web/mastodon_api/views/status_view.ex +++ b/lib/pleroma/web/mastodon_api/views/status_view.ex @@ -182,8 +182,19 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do end def render("card.json", %{rich_media: rich_media, page_url: page_url}) do - page_url = rich_media[:url] || page_url - page_url_data = URI.parse(page_url) + page_url_data = + if rich_media[:url] != nil do + URI.merge(URI.parse(page_url), URI.parse(rich_media[:url])) + else + page_url + end + + page_url = page_url_data |> to_string + + image_url = + URI.merge(page_url_data, URI.parse(rich_media[:image])) + |> to_string + site_name = rich_media[:site_name] || page_url_data.host %{ @@ -191,7 +202,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do provider_name: site_name, provider_url: page_url_data.scheme <> "://" <> page_url_data.host, url: page_url, - image: rich_media[:image] |> MediaProxy.url(), + image: image_url |> MediaProxy.url(), title: rich_media[:title], description: rich_media[:description], pleroma: %{