Merge branch 'develop' of git.pleroma.social:pleroma/pleroma into feature/jobs

This commit is contained in:
Egor Kislitsyn 2019-02-05 00:38:05 +07:00
commit 14d967f515
3 changed files with 27 additions and 5 deletions

View file

@ -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

View file

@ -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

View file

@ -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: %{