aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorlain <lain@soykaf.club>2018-03-25 17:07:40 +0200
committerHaelwenn (lanodan) Monnier <contact@hacktivis.me>2018-08-21 18:24:10 +0200
commita6b021a52b8d73a2ac5fdbe1298d46be25137223 (patch)
tree83ca145009b471db7f990c455ea157658986b8f3 /lib
parentc381d0b57737b0a011a42de7ff369c57c4962383 (diff)
downloadpleroma-a6b021a52b8d73a2ac5fdbe1298d46be25137223.tar.gz
Render peertube videos in mastodon.
Diffstat (limited to 'lib')
-rw-r--r--lib/pleroma/web/mastodon_api/views/status_view.ex9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/pleroma/web/mastodon_api/views/status_view.ex b/lib/pleroma/web/mastodon_api/views/status_view.ex
index 5dbd59dd9..9625da822 100644
--- a/lib/pleroma/web/mastodon_api/views/status_view.ex
+++ b/lib/pleroma/web/mastodon_api/views/status_view.ex
@@ -99,8 +99,9 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
repeated = opts[:for] && opts[:for].ap_id in (object["announcements"] || [])
favorited = opts[:for] && opts[:for].ap_id in (object["likes"] || [])
- attachments =
- render_many(object["attachment"] || [], StatusView, "attachment.json", as: :attachment)
+ attachment_data = object["attachment"] || []
+ attachment_data = attachment_data ++ if object["type"] == "Video", do: [object], else: []
+ attachments = render_many(attachment_data, StatusView, "attachment.json", as: :attachment)
created_at = Utils.to_masto_date(object["published"])
@@ -151,7 +152,9 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
end
def render("attachment.json", %{attachment: attachment}) do
- [%{"mediaType" => media_type, "href" => href} | _] = attachment["url"]
+ [attachment | _] = attachment["url"]
+ media_type = attachment["mediaType"] || attachment["mimeType"]
+ href = attachment["href"]
type =
cond do