mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-12-25 02:19:31 +00:00
Render peertube videos in mastodon.
This commit is contained in:
parent
c381d0b577
commit
a6b021a52b
|
@ -99,8 +99,9 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
|
||||||
repeated = opts[:for] && opts[:for].ap_id in (object["announcements"] || [])
|
repeated = opts[:for] && opts[:for].ap_id in (object["announcements"] || [])
|
||||||
favorited = opts[:for] && opts[:for].ap_id in (object["likes"] || [])
|
favorited = opts[:for] && opts[:for].ap_id in (object["likes"] || [])
|
||||||
|
|
||||||
attachments =
|
attachment_data = object["attachment"] || []
|
||||||
render_many(object["attachment"] || [], StatusView, "attachment.json", as: :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"])
|
created_at = Utils.to_masto_date(object["published"])
|
||||||
|
|
||||||
|
@ -151,7 +152,9 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
|
||||||
end
|
end
|
||||||
|
|
||||||
def render("attachment.json", %{attachment: attachment}) do
|
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 =
|
type =
|
||||||
cond do
|
cond do
|
||||||
|
|
Loading…
Reference in a new issue