forked from AkkomaGang/akkoma
Merge branch 'develop' of git.pleroma.social:pleroma/pleroma into feature/jobs
This commit is contained in:
commit
14d967f515
3 changed files with 27 additions and 5 deletions
|
@ -12,8 +12,10 @@ def check_frontend_config_mechanism() do
|
||||||
You are using the old configuration mechanism for the frontend. Please check config.md.
|
You are using the old configuration mechanism for the frontend. Please check config.md.
|
||||||
""")
|
""")
|
||||||
end
|
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("""
|
Logger.warn("""
|
||||||
!!!DEPRECATION WARNING!!!
|
!!!DEPRECATION WARNING!!!
|
||||||
You are using the old configuration mechanism for the hellthread filter. Please check config.md.
|
You are using the old configuration mechanism for the hellthread filter. Please check config.md.
|
||||||
|
@ -23,5 +25,6 @@ def check_frontend_config_mechanism() do
|
||||||
|
|
||||||
def warn do
|
def warn do
|
||||||
check_frontend_config_mechanism()
|
check_frontend_config_mechanism()
|
||||||
|
check_hellthread_threshold()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -102,10 +102,18 @@ defp check_mime_type(<<0x4F, 0x67, 0x67, 0x53, 0x00, 0x02, 0x00, 0x00, _::binary
|
||||||
"audio/ogg"
|
"audio/ogg"
|
||||||
end
|
end
|
||||||
|
|
||||||
defp check_mime_type(<<0x52, 0x49, 0x46, 0x46, _::binary>>) do
|
defp check_mime_type(<<"RIFF", _::binary-size(4), "WAVE", _::binary>>) do
|
||||||
"audio/wav"
|
"audio/wav"
|
||||||
end
|
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
|
defp check_mime_type(_) do
|
||||||
@default
|
@default
|
||||||
end
|
end
|
||||||
|
|
|
@ -182,8 +182,19 @@ def render("status.json", _) do
|
||||||
end
|
end
|
||||||
|
|
||||||
def render("card.json", %{rich_media: rich_media, page_url: page_url}) do
|
def render("card.json", %{rich_media: rich_media, page_url: page_url}) do
|
||||||
page_url = rich_media[:url] || page_url
|
page_url_data =
|
||||||
page_url_data = URI.parse(page_url)
|
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
|
site_name = rich_media[:site_name] || page_url_data.host
|
||||||
|
|
||||||
%{
|
%{
|
||||||
|
@ -191,7 +202,7 @@ def render("card.json", %{rich_media: rich_media, page_url: page_url}) do
|
||||||
provider_name: site_name,
|
provider_name: site_name,
|
||||||
provider_url: page_url_data.scheme <> "://" <> page_url_data.host,
|
provider_url: page_url_data.scheme <> "://" <> page_url_data.host,
|
||||||
url: page_url,
|
url: page_url,
|
||||||
image: rich_media[:image] |> MediaProxy.url(),
|
image: image_url |> MediaProxy.url(),
|
||||||
title: rich_media[:title],
|
title: rich_media[:title],
|
||||||
description: rich_media[:description],
|
description: rich_media[:description],
|
||||||
pleroma: %{
|
pleroma: %{
|
||||||
|
|
Loading…
Reference in a new issue