aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEgor Kislitsyn <egor@kislitsyn.com>2019-02-05 00:38:05 +0700
committerEgor Kislitsyn <egor@kislitsyn.com>2019-02-05 00:38:05 +0700
commit14d967f515c4a431b8059a19d4b84a83c0f2aa28 (patch)
treea1f481bb71d87b53a7250495797f18f8dcb6e295
parent3a3a3996b7a37d281745586fa40bbabd5299a1ce (diff)
parent3ae11835a9ff8c4bc01c3b790229e87857a9812d (diff)
downloadpleroma-14d967f515c4a431b8059a19d4b84a83c0f2aa28.tar.gz
Merge branch 'develop' of git.pleroma.social:pleroma/pleroma into feature/jobs
-rw-r--r--lib/pleroma/config/deprecation_warnings.ex5
-rw-r--r--lib/pleroma/mime.ex10
-rw-r--r--lib/pleroma/web/mastodon_api/views/status_view.ex17
3 files changed, 27 insertions, 5 deletions
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: %{