transmogrifier: significantly rework handling of peertube videos, add test
This commit is contained in:
parent
3aff8067e4
commit
71f6d9f418
2 changed files with 56 additions and 11 deletions
|
|
@ -684,6 +684,36 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
|
|||
|
||||
:error = Transmogrifier.handle_incoming(data)
|
||||
end
|
||||
|
||||
test "it remaps video URLs as attachments if necessary" do
|
||||
{:ok, object} =
|
||||
ActivityPub.fetch_object_from_id(
|
||||
"https://peertube.moe/videos/watch/df5f464b-be8d-46fb-ad81-2d4c2d1630e3"
|
||||
)
|
||||
|
||||
attachment = %{
|
||||
"type" => "Link",
|
||||
"mediaType" => "video/mp4",
|
||||
"href" =>
|
||||
"https://peertube.moe/static/webseed/df5f464b-be8d-46fb-ad81-2d4c2d1630e3-480.mp4",
|
||||
"mimeType" => "video/mp4",
|
||||
"size" => 5_015_880,
|
||||
"url" => [
|
||||
%{
|
||||
"href" =>
|
||||
"https://peertube.moe/static/webseed/df5f464b-be8d-46fb-ad81-2d4c2d1630e3-480.mp4",
|
||||
"mediaType" => "video/mp4",
|
||||
"type" => "Link"
|
||||
}
|
||||
],
|
||||
"width" => 480
|
||||
}
|
||||
|
||||
assert object.data["url"] ==
|
||||
"https://peertube.moe/videos/watch/df5f464b-be8d-46fb-ad81-2d4c2d1630e3"
|
||||
|
||||
assert object.data["attachment"] == [attachment]
|
||||
end
|
||||
end
|
||||
|
||||
describe "prepare outgoing" do
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue