1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
6 use Oban.Testing, repo: Pleroma.Repo
11 alias Pleroma.Object.Fetcher
12 alias Pleroma.Tests.ObanHelpers
14 alias Pleroma.Web.ActivityPub.ActivityPub
15 alias Pleroma.Web.ActivityPub.Transmogrifier
16 alias Pleroma.Web.AdminAPI.AccountView
17 alias Pleroma.Web.CommonAPI
20 import Pleroma.Factory
21 import ExUnit.CaptureLog
24 Tesla.Mock.mock_global(fn env -> apply(HttpRequestMock, :request, [env]) end)
28 setup do: clear_config([:instance, :max_remote_account_fields])
30 describe "handle_incoming" do
31 test "it works for incoming notices with tag not being an array (kroeg)" do
32 data = File.read!("test/fixtures/kroeg-array-less-emoji.json") |> Poison.decode!()
34 {:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data)
35 object = Object.normalize(data["object"])
37 assert object.data["emoji"] == %{
38 "icon_e_smile" => "https://puckipedia.com/forum/images/smilies/icon_e_smile.png"
41 data = File.read!("test/fixtures/kroeg-array-less-hashtag.json") |> Poison.decode!()
43 {:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data)
44 object = Object.normalize(data["object"])
46 assert "test" in object.data["tag"]
49 test "it works for incoming notices with url not being a string (prismo)" do
50 data = File.read!("test/fixtures/prismo-url-map.json") |> Poison.decode!()
52 {:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data)
53 object = Object.normalize(data["object"])
55 assert object.data["url"] == "https://prismo.news/posts/83"
58 test "it cleans up incoming notices which are not really DMs" do
60 other_user = insert(:user)
62 to = [user.ap_id, other_user.ap_id]
65 File.read!("test/fixtures/mastodon-post-activity.json")
75 data = Map.put(data, "object", object)
77 {:ok, %Activity{data: data, local: false} = activity} = Transmogrifier.handle_incoming(data)
79 assert data["to"] == []
80 assert data["cc"] == to
82 object_data = Object.normalize(activity).data
84 assert object_data["to"] == []
85 assert object_data["cc"] == to
88 test "it ignores an incoming notice if we already have it" do
89 activity = insert(:note_activity)
92 File.read!("test/fixtures/mastodon-post-activity.json")
94 |> Map.put("object", Object.normalize(activity).data)
96 {:ok, returned_activity} = Transmogrifier.handle_incoming(data)
98 assert activity == returned_activity
101 @tag capture_log: true
102 test "it fetches reply-to activities if we don't have them" do
104 File.read!("test/fixtures/mastodon-post-activity.json")
109 |> Map.put("inReplyTo", "https://shitposter.club/notice/2827873")
111 data = Map.put(data, "object", object)
112 {:ok, returned_activity} = Transmogrifier.handle_incoming(data)
113 returned_object = Object.normalize(returned_activity, false)
116 Activity.get_create_by_object_ap_id(
117 "tag:shitposter.club,2017-05-05:noticeId=2827873:objectType=comment"
120 assert returned_object.data["inReplyToAtomUri"] == "https://shitposter.club/notice/2827873"
123 test "it does not fetch reply-to activities beyond max replies depth limit" do
125 File.read!("test/fixtures/mastodon-post-activity.json")
130 |> Map.put("inReplyTo", "https://shitposter.club/notice/2827873")
132 data = Map.put(data, "object", object)
134 with_mock Pleroma.Web.Federator,
135 allowed_thread_distance?: fn _ -> false end do
136 {:ok, returned_activity} = Transmogrifier.handle_incoming(data)
138 returned_object = Object.normalize(returned_activity, false)
140 refute Activity.get_create_by_object_ap_id(
141 "tag:shitposter.club,2017-05-05:noticeId=2827873:objectType=comment"
144 assert returned_object.data["inReplyToAtomUri"] ==
145 "https://shitposter.club/notice/2827873"
149 test "it does not crash if the object in inReplyTo can't be fetched" do
151 File.read!("test/fixtures/mastodon-post-activity.json")
156 |> Map.put("inReplyTo", "https://404.site/whatever")
160 |> Map.put("object", object)
162 assert capture_log(fn ->
163 {:ok, _returned_activity} = Transmogrifier.handle_incoming(data)
164 end) =~ "[error] Couldn't fetch \"https://404.site/whatever\", error: nil"
167 test "it works for incoming notices" do
168 data = File.read!("test/fixtures/mastodon-post-activity.json") |> Poison.decode!()
170 {:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data)
173 "http://mastodon.example.org/users/admin/statuses/99512778738411822/activity"
175 assert data["context"] ==
176 "tag:mastodon.example.org,2018-02-12:objectId=20:objectType=Conversation"
178 assert data["to"] == ["https://www.w3.org/ns/activitystreams#Public"]
180 assert data["cc"] == [
181 "http://mastodon.example.org/users/admin/followers",
182 "http://localtesting.pleroma.lol/users/lain"
185 assert data["actor"] == "http://mastodon.example.org/users/admin"
187 object_data = Object.normalize(data["object"]).data
189 assert object_data["id"] ==
190 "http://mastodon.example.org/users/admin/statuses/99512778738411822"
192 assert object_data["to"] == ["https://www.w3.org/ns/activitystreams#Public"]
194 assert object_data["cc"] == [
195 "http://mastodon.example.org/users/admin/followers",
196 "http://localtesting.pleroma.lol/users/lain"
199 assert object_data["actor"] == "http://mastodon.example.org/users/admin"
200 assert object_data["attributedTo"] == "http://mastodon.example.org/users/admin"
202 assert object_data["context"] ==
203 "tag:mastodon.example.org,2018-02-12:objectId=20:objectType=Conversation"
205 assert object_data["sensitive"] == true
207 user = User.get_cached_by_ap_id(object_data["actor"])
209 assert user.note_count == 1
212 test "it works for incoming notices with hashtags" do
213 data = File.read!("test/fixtures/mastodon-post-activity-hashtag.json") |> Poison.decode!()
215 {:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data)
216 object = Object.normalize(data["object"])
218 assert Enum.at(object.data["tag"], 2) == "moo"
221 test "it works for incoming questions" do
222 data = File.read!("test/fixtures/mastodon-question-activity.json") |> Poison.decode!()
224 {:ok, %Activity{local: false} = activity} = Transmogrifier.handle_incoming(data)
226 object = Object.normalize(activity)
228 assert Enum.all?(object.data["oneOf"], fn choice ->
231 "Everyone knows that!",
232 "25 char limit is dumb",
233 "I can't even fit a funny"
238 test "it works for incoming listens" do
240 "@context" => "https://www.w3.org/ns/activitystreams",
241 "to" => ["https://www.w3.org/ns/activitystreams#Public"],
244 "id" => "http://mastodon.example.org/users/admin/listens/1234/activity",
245 "actor" => "http://mastodon.example.org/users/admin",
248 "id" => "http://mastodon.example.org/users/admin/listens/1234",
249 "attributedTo" => "http://mastodon.example.org/users/admin",
250 "title" => "lain radio episode 1",
252 "album" => "lain radio",
257 {:ok, %Activity{local: false} = activity} = Transmogrifier.handle_incoming(data)
259 object = Object.normalize(activity)
261 assert object.data["title"] == "lain radio episode 1"
262 assert object.data["artist"] == "lain"
263 assert object.data["album"] == "lain radio"
264 assert object.data["length"] == 180_000
267 test "it rewrites Note votes to Answers and increments vote counters on question activities" do
271 CommonAPI.post(user, %{
273 poll: %{options: ["suya", "suya.", "suya.."], expires_in: 10}
276 object = Object.normalize(activity)
279 File.read!("test/fixtures/mastodon-vote.json")
281 |> Kernel.put_in(["to"], user.ap_id)
282 |> Kernel.put_in(["object", "inReplyTo"], object.data["id"])
283 |> Kernel.put_in(["object", "to"], user.ap_id)
285 {:ok, %Activity{local: false} = activity} = Transmogrifier.handle_incoming(data)
286 answer_object = Object.normalize(activity)
287 assert answer_object.data["type"] == "Answer"
288 object = Object.get_by_ap_id(object.data["id"])
291 object.data["oneOf"],
293 %{"name" => "suya..", "replies" => %{"totalItems" => 1}} -> true
299 test "it works for incoming notices with contentMap" do
301 File.read!("test/fixtures/mastodon-post-activity-contentmap.json") |> Poison.decode!()
303 {:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data)
304 object = Object.normalize(data["object"])
306 assert object.data["content"] ==
307 "<p><span class=\"h-card\"><a href=\"http://localtesting.pleroma.lol/users/lain\" class=\"u-url mention\">@<span>lain</span></a></span></p>"
310 test "it works for incoming notices with to/cc not being an array (kroeg)" do
311 data = File.read!("test/fixtures/kroeg-post-activity.json") |> Poison.decode!()
313 {:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data)
314 object = Object.normalize(data["object"])
316 assert object.data["content"] ==
317 "<p>henlo from my Psion netBook</p><p>message sent from my Psion netBook</p>"
320 test "it ensures that as:Public activities make it to their followers collection" do
324 File.read!("test/fixtures/mastodon-post-activity.json")
326 |> Map.put("actor", user.ap_id)
327 |> Map.put("to", ["https://www.w3.org/ns/activitystreams#Public"])
332 |> Map.put("attributedTo", user.ap_id)
333 |> Map.put("to", ["https://www.w3.org/ns/activitystreams#Public"])
335 |> Map.put("id", user.ap_id <> "/activities/12345678")
337 data = Map.put(data, "object", object)
339 {:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data)
341 assert data["cc"] == [User.ap_followers(user)]
344 test "it ensures that address fields become lists" do
348 File.read!("test/fixtures/mastodon-post-activity.json")
350 |> Map.put("actor", user.ap_id)
351 |> Map.put("to", nil)
352 |> Map.put("cc", nil)
356 |> Map.put("attributedTo", user.ap_id)
357 |> Map.put("to", nil)
358 |> Map.put("cc", nil)
359 |> Map.put("id", user.ap_id <> "/activities/12345678")
361 data = Map.put(data, "object", object)
363 {:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data)
365 assert !is_nil(data["to"])
366 assert !is_nil(data["cc"])
369 test "it strips internal likes" do
371 File.read!("test/fixtures/mastodon-post-activity.json")
376 "http://mastodon.example.org/objects/dbdbc507-52c8-490d-9b7c-1e1d52e5c132/likes?page=1",
377 "id" => "http://mastodon.example.org/objects/dbdbc507-52c8-490d-9b7c-1e1d52e5c132/likes",
379 "type" => "OrderedCollection"
382 object = Map.put(data["object"], "likes", likes)
383 data = Map.put(data, "object", object)
385 {:ok, %Activity{object: object}} = Transmogrifier.handle_incoming(data)
387 refute Map.has_key?(object.data, "likes")
390 test "it strips internal reactions" do
392 {:ok, activity} = CommonAPI.post(user, %{status: "#cofe"})
393 {:ok, _} = CommonAPI.react_with_emoji(activity.id, user, "📢")
395 %{object: object} = Activity.get_by_id_with_object(activity.id)
396 assert Map.has_key?(object.data, "reactions")
397 assert Map.has_key?(object.data, "reaction_count")
399 object_data = Transmogrifier.strip_internal_fields(object.data)
400 refute Map.has_key?(object_data, "reactions")
401 refute Map.has_key?(object_data, "reaction_count")
404 test "it works for incomming unfollows with an existing follow" do
408 File.read!("test/fixtures/mastodon-follow-activity.json")
410 |> Map.put("object", user.ap_id)
412 {:ok, %Activity{data: _, local: false}} = Transmogrifier.handle_incoming(follow_data)
415 File.read!("test/fixtures/mastodon-unfollow-activity.json")
417 |> Map.put("object", follow_data)
419 {:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data)
421 assert data["type"] == "Undo"
422 assert data["object"]["type"] == "Follow"
423 assert data["object"]["object"] == user.ap_id
424 assert data["actor"] == "http://mastodon.example.org/users/admin"
426 refute User.following?(User.get_cached_by_ap_id(data["actor"]), user)
429 test "it works for incoming follows to locked account" do
430 pending_follower = insert(:user, ap_id: "http://mastodon.example.org/users/admin")
431 user = insert(:user, locked: true)
434 File.read!("test/fixtures/mastodon-follow-activity.json")
436 |> Map.put("object", user.ap_id)
438 {:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data)
440 assert data["type"] == "Follow"
441 assert data["object"] == user.ap_id
442 assert data["state"] == "pending"
443 assert data["actor"] == "http://mastodon.example.org/users/admin"
445 assert [^pending_follower] = User.get_follow_requests(user)
448 test "it works for incoming accepts which were pre-accepted" do
449 follower = insert(:user)
450 followed = insert(:user)
452 {:ok, follower} = User.follow(follower, followed)
453 assert User.following?(follower, followed) == true
455 {:ok, follow_activity} = ActivityPub.follow(follower, followed)
458 File.read!("test/fixtures/mastodon-accept-activity.json")
460 |> Map.put("actor", followed.ap_id)
463 accept_data["object"]
464 |> Map.put("actor", follower.ap_id)
465 |> Map.put("id", follow_activity.data["id"])
467 accept_data = Map.put(accept_data, "object", object)
469 {:ok, activity} = Transmogrifier.handle_incoming(accept_data)
470 refute activity.local
472 assert activity.data["object"] == follow_activity.data["id"]
474 assert activity.data["id"] == accept_data["id"]
476 follower = User.get_cached_by_id(follower.id)
478 assert User.following?(follower, followed) == true
481 test "it works for incoming accepts which were orphaned" do
482 follower = insert(:user)
483 followed = insert(:user, locked: true)
485 {:ok, follow_activity} = ActivityPub.follow(follower, followed)
488 File.read!("test/fixtures/mastodon-accept-activity.json")
490 |> Map.put("actor", followed.ap_id)
493 Map.put(accept_data, "object", Map.put(accept_data["object"], "actor", follower.ap_id))
495 {:ok, activity} = Transmogrifier.handle_incoming(accept_data)
496 assert activity.data["object"] == follow_activity.data["id"]
498 follower = User.get_cached_by_id(follower.id)
500 assert User.following?(follower, followed) == true
503 test "it works for incoming accepts which are referenced by IRI only" do
504 follower = insert(:user)
505 followed = insert(:user, locked: true)
507 {:ok, follow_activity} = ActivityPub.follow(follower, followed)
510 File.read!("test/fixtures/mastodon-accept-activity.json")
512 |> Map.put("actor", followed.ap_id)
513 |> Map.put("object", follow_activity.data["id"])
515 {:ok, activity} = Transmogrifier.handle_incoming(accept_data)
516 assert activity.data["object"] == follow_activity.data["id"]
518 follower = User.get_cached_by_id(follower.id)
520 assert User.following?(follower, followed) == true
522 follower = User.get_by_id(follower.id)
523 assert follower.following_count == 1
525 followed = User.get_by_id(followed.id)
526 assert followed.follower_count == 1
529 test "it fails for incoming accepts which cannot be correlated" do
530 follower = insert(:user)
531 followed = insert(:user, locked: true)
534 File.read!("test/fixtures/mastodon-accept-activity.json")
536 |> Map.put("actor", followed.ap_id)
539 Map.put(accept_data, "object", Map.put(accept_data["object"], "actor", follower.ap_id))
541 :error = Transmogrifier.handle_incoming(accept_data)
543 follower = User.get_cached_by_id(follower.id)
545 refute User.following?(follower, followed) == true
548 test "it fails for incoming rejects which cannot be correlated" do
549 follower = insert(:user)
550 followed = insert(:user, locked: true)
553 File.read!("test/fixtures/mastodon-reject-activity.json")
555 |> Map.put("actor", followed.ap_id)
558 Map.put(accept_data, "object", Map.put(accept_data["object"], "actor", follower.ap_id))
560 :error = Transmogrifier.handle_incoming(accept_data)
562 follower = User.get_cached_by_id(follower.id)
564 refute User.following?(follower, followed) == true
567 test "it works for incoming rejects which are orphaned" do
568 follower = insert(:user)
569 followed = insert(:user, locked: true)
571 {:ok, follower} = User.follow(follower, followed)
572 {:ok, _follow_activity} = ActivityPub.follow(follower, followed)
574 assert User.following?(follower, followed) == true
577 File.read!("test/fixtures/mastodon-reject-activity.json")
579 |> Map.put("actor", followed.ap_id)
582 Map.put(reject_data, "object", Map.put(reject_data["object"], "actor", follower.ap_id))
584 {:ok, activity} = Transmogrifier.handle_incoming(reject_data)
585 refute activity.local
586 assert activity.data["id"] == reject_data["id"]
588 follower = User.get_cached_by_id(follower.id)
590 assert User.following?(follower, followed) == false
593 test "it works for incoming rejects which are referenced by IRI only" do
594 follower = insert(:user)
595 followed = insert(:user, locked: true)
597 {:ok, follower} = User.follow(follower, followed)
598 {:ok, follow_activity} = ActivityPub.follow(follower, followed)
600 assert User.following?(follower, followed) == true
603 File.read!("test/fixtures/mastodon-reject-activity.json")
605 |> Map.put("actor", followed.ap_id)
606 |> Map.put("object", follow_activity.data["id"])
608 {:ok, %Activity{data: _}} = Transmogrifier.handle_incoming(reject_data)
610 follower = User.get_cached_by_id(follower.id)
612 assert User.following?(follower, followed) == false
615 test "it rejects activities without a valid ID" do
619 File.read!("test/fixtures/mastodon-follow-activity.json")
621 |> Map.put("object", user.ap_id)
624 :error = Transmogrifier.handle_incoming(data)
627 test "skip converting the content when it is nil" do
628 object_id = "https://peertube.social/videos/watch/278d2b7c-0f38-4aaa-afe6-9ecc0c4a34fe"
630 {:ok, object} = Fetcher.fetch_and_contain_remote_object_from_id(object_id)
633 Pleroma.Web.ActivityPub.Transmogrifier.fix_object(Map.merge(object, %{"content" => nil}))
635 assert result["content"] == nil
638 test "it converts content of object to html" do
639 object_id = "https://peertube.social/videos/watch/278d2b7c-0f38-4aaa-afe6-9ecc0c4a34fe"
641 {:ok, %{"content" => content_markdown}} =
642 Fetcher.fetch_and_contain_remote_object_from_id(object_id)
644 {:ok, %Pleroma.Object{data: %{"content" => content}} = object} =
645 Fetcher.fetch_object_from_id(object_id)
647 assert content_markdown ==
648 "Support this and our other Michigan!/usr/group videos and meetings. Learn more at http://mug.org/membership\n\nTwenty Years in Jail: FreeBSD's Jails, Then and Now\n\nJails started as a limited virtualization system, but over the last two years they've..."
651 "<p>Support this and our other Michigan!/usr/group videos and meetings. Learn more at <a href=\"http://mug.org/membership\">http://mug.org/membership</a></p><p>Twenty Years in Jail: FreeBSD’s Jails, Then and Now</p><p>Jails started as a limited virtualization system, but over the last two years they’ve…</p>"
653 assert object.data["mediaType"] == "text/html"
656 test "it remaps video URLs as attachments if necessary" do
658 Fetcher.fetch_object_from_id(
659 "https://peertube.moe/videos/watch/df5f464b-be8d-46fb-ad81-2d4c2d1630e3"
662 assert object.data["url"] ==
663 "https://peertube.moe/videos/watch/df5f464b-be8d-46fb-ad81-2d4c2d1630e3"
665 assert object.data["attachment"] == [
668 "mediaType" => "video/mp4",
672 "https://peertube.moe/static/webseed/df5f464b-be8d-46fb-ad81-2d4c2d1630e3-480.mp4",
673 "mediaType" => "video/mp4"
680 Fetcher.fetch_object_from_id(
681 "https://framatube.org/videos/watch/6050732a-8a7a-43d4-a6cd-809525a1d206"
684 assert object.data["attachment"] == [
687 "mediaType" => "video/mp4",
691 "https://framatube.org/static/webseed/6050732a-8a7a-43d4-a6cd-809525a1d206-1080.mp4",
692 "mediaType" => "video/mp4"
698 assert object.data["url"] ==
699 "https://framatube.org/videos/watch/6050732a-8a7a-43d4-a6cd-809525a1d206"
702 test "it accepts Flag activities" do
704 other_user = insert(:user)
706 {:ok, activity} = CommonAPI.post(user, %{status: "test post"})
707 object = Object.normalize(activity)
711 "id" => activity.data["id"],
712 "content" => "test post",
713 "published" => object.data["published"],
714 "actor" => AccountView.render("show.json", %{user: user})
718 "@context" => "https://www.w3.org/ns/activitystreams",
719 "cc" => [user.ap_id],
720 "object" => [user.ap_id, activity.data["id"]],
722 "content" => "blocked AND reported!!!",
723 "actor" => other_user.ap_id
726 assert {:ok, activity} = Transmogrifier.handle_incoming(message)
728 assert activity.data["object"] == [user.ap_id, note_obj]
729 assert activity.data["content"] == "blocked AND reported!!!"
730 assert activity.data["actor"] == other_user.ap_id
731 assert activity.data["cc"] == [user.ap_id]
734 test "it correctly processes messages with non-array to field" do
738 "@context" => "https://www.w3.org/ns/activitystreams",
739 "to" => "https://www.w3.org/ns/activitystreams#Public",
742 "content" => "blah blah blah",
744 "attributedTo" => user.ap_id,
747 "actor" => user.ap_id
750 assert {:ok, activity} = Transmogrifier.handle_incoming(message)
752 assert ["https://www.w3.org/ns/activitystreams#Public"] == activity.data["to"]
755 test "it correctly processes messages with non-array cc field" do
759 "@context" => "https://www.w3.org/ns/activitystreams",
760 "to" => user.follower_address,
761 "cc" => "https://www.w3.org/ns/activitystreams#Public",
764 "content" => "blah blah blah",
766 "attributedTo" => user.ap_id,
769 "actor" => user.ap_id
772 assert {:ok, activity} = Transmogrifier.handle_incoming(message)
774 assert ["https://www.w3.org/ns/activitystreams#Public"] == activity.data["cc"]
775 assert [user.follower_address] == activity.data["to"]
778 test "it accepts Move activities" do
779 old_user = insert(:user)
780 new_user = insert(:user)
783 "@context" => "https://www.w3.org/ns/activitystreams",
785 "actor" => old_user.ap_id,
786 "object" => old_user.ap_id,
787 "target" => new_user.ap_id
790 assert :error = Transmogrifier.handle_incoming(message)
792 {:ok, _new_user} = User.update_and_set_cache(new_user, %{also_known_as: [old_user.ap_id]})
794 assert {:ok, %Activity{} = activity} = Transmogrifier.handle_incoming(message)
795 assert activity.actor == old_user.ap_id
796 assert activity.data["actor"] == old_user.ap_id
797 assert activity.data["object"] == old_user.ap_id
798 assert activity.data["target"] == new_user.ap_id
799 assert activity.data["type"] == "Move"
803 describe "`handle_incoming/2`, Mastodon format `replies` handling" do
804 setup do: clear_config([:activitypub, :note_replies_output_limit], 5)
805 setup do: clear_config([:instance, :federation_incoming_replies_max_depth])
809 "test/fixtures/mastodon-post-activity.json"
813 items = get_in(data, ["object", "replies", "first", "items"])
814 assert length(items) > 0
816 %{data: data, items: items}
819 test "schedules background fetching of `replies` items if max thread depth limit allows", %{
823 Pleroma.Config.put([:instance, :federation_incoming_replies_max_depth], 10)
825 {:ok, _activity} = Transmogrifier.handle_incoming(data)
828 job_args = %{"op" => "fetch_remote", "id" => id, "depth" => 1}
829 assert_enqueued(worker: Pleroma.Workers.RemoteFetcherWorker, args: job_args)
833 test "does NOT schedule background fetching of `replies` beyond max thread depth limit allows",
835 Pleroma.Config.put([:instance, :federation_incoming_replies_max_depth], 0)
837 {:ok, _activity} = Transmogrifier.handle_incoming(data)
839 assert all_enqueued(worker: Pleroma.Workers.RemoteFetcherWorker) == []
843 describe "`handle_incoming/2`, Pleroma format `replies` handling" do
844 setup do: clear_config([:activitypub, :note_replies_output_limit], 5)
845 setup do: clear_config([:instance, :federation_incoming_replies_max_depth])
850 {:ok, activity} = CommonAPI.post(user, %{status: "post1"})
853 CommonAPI.post(user, %{status: "reply1", in_reply_to_status_id: activity.id})
856 CommonAPI.post(user, %{status: "reply2", in_reply_to_status_id: activity.id})
858 replies_uris = Enum.map([reply1, reply2], fn a -> a.object.data["id"] end)
860 {:ok, federation_output} = Transmogrifier.prepare_outgoing(activity.data)
862 Repo.delete(activity.object)
863 Repo.delete(activity)
865 %{federation_output: federation_output, replies_uris: replies_uris}
868 test "schedules background fetching of `replies` items if max thread depth limit allows", %{
869 federation_output: federation_output,
870 replies_uris: replies_uris
872 Pleroma.Config.put([:instance, :federation_incoming_replies_max_depth], 1)
874 {:ok, _activity} = Transmogrifier.handle_incoming(federation_output)
876 for id <- replies_uris do
877 job_args = %{"op" => "fetch_remote", "id" => id, "depth" => 1}
878 assert_enqueued(worker: Pleroma.Workers.RemoteFetcherWorker, args: job_args)
882 test "does NOT schedule background fetching of `replies` beyond max thread depth limit allows",
883 %{federation_output: federation_output} do
884 Pleroma.Config.put([:instance, :federation_incoming_replies_max_depth], 0)
886 {:ok, _activity} = Transmogrifier.handle_incoming(federation_output)
888 assert all_enqueued(worker: Pleroma.Workers.RemoteFetcherWorker) == []
892 describe "prepare outgoing" do
893 test "it inlines private announced objects" do
896 {:ok, activity} = CommonAPI.post(user, %{status: "hey", visibility: "private"})
898 {:ok, announce_activity} = CommonAPI.repeat(activity.id, user)
900 {:ok, modified} = Transmogrifier.prepare_outgoing(announce_activity.data)
902 assert modified["object"]["content"] == "hey"
903 assert modified["object"]["actor"] == modified["object"]["attributedTo"]
906 test "it turns mentions into tags" do
908 other_user = insert(:user)
911 CommonAPI.post(user, %{status: "hey, @#{other_user.nickname}, how are ya? #2hu"})
913 with_mock Pleroma.Notification,
914 get_notified_from_activity: fn _, _ -> [] end do
915 {:ok, modified} = Transmogrifier.prepare_outgoing(activity.data)
917 object = modified["object"]
919 expected_mention = %{
920 "href" => other_user.ap_id,
921 "name" => "@#{other_user.nickname}",
926 "href" => Pleroma.Web.Endpoint.url() <> "/tags/2hu",
931 refute called(Pleroma.Notification.get_notified_from_activity(:_, :_))
932 assert Enum.member?(object["tag"], expected_tag)
933 assert Enum.member?(object["tag"], expected_mention)
937 test "it adds the sensitive property" do
940 {:ok, activity} = CommonAPI.post(user, %{status: "#nsfw hey"})
941 {:ok, modified} = Transmogrifier.prepare_outgoing(activity.data)
943 assert modified["object"]["sensitive"]
946 test "it adds the json-ld context and the conversation property" do
949 {:ok, activity} = CommonAPI.post(user, %{status: "hey"})
950 {:ok, modified} = Transmogrifier.prepare_outgoing(activity.data)
952 assert modified["@context"] ==
953 Pleroma.Web.ActivityPub.Utils.make_json_ld_header()["@context"]
955 assert modified["object"]["conversation"] == modified["context"]
958 test "it sets the 'attributedTo' property to the actor of the object if it doesn't have one" do
961 {:ok, activity} = CommonAPI.post(user, %{status: "hey"})
962 {:ok, modified} = Transmogrifier.prepare_outgoing(activity.data)
964 assert modified["object"]["actor"] == modified["object"]["attributedTo"]
967 test "it strips internal hashtag data" do
970 {:ok, activity} = CommonAPI.post(user, %{status: "#2hu"})
973 "href" => Pleroma.Web.Endpoint.url() <> "/tags/2hu",
978 {:ok, modified} = Transmogrifier.prepare_outgoing(activity.data)
980 assert modified["object"]["tag"] == [expected_tag]
983 test "it strips internal fields" do
986 {:ok, activity} = CommonAPI.post(user, %{status: "#2hu :firefox:"})
988 {:ok, modified} = Transmogrifier.prepare_outgoing(activity.data)
990 assert length(modified["object"]["tag"]) == 2
992 assert is_nil(modified["object"]["emoji"])
993 assert is_nil(modified["object"]["like_count"])
994 assert is_nil(modified["object"]["announcements"])
995 assert is_nil(modified["object"]["announcement_count"])
996 assert is_nil(modified["object"]["context_id"])
999 test "it strips internal fields of article" do
1000 activity = insert(:article_activity)
1002 {:ok, modified} = Transmogrifier.prepare_outgoing(activity.data)
1004 assert length(modified["object"]["tag"]) == 2
1006 assert is_nil(modified["object"]["emoji"])
1007 assert is_nil(modified["object"]["like_count"])
1008 assert is_nil(modified["object"]["announcements"])
1009 assert is_nil(modified["object"]["announcement_count"])
1010 assert is_nil(modified["object"]["context_id"])
1011 assert is_nil(modified["object"]["likes"])
1014 test "the directMessage flag is present" do
1015 user = insert(:user)
1016 other_user = insert(:user)
1018 {:ok, activity} = CommonAPI.post(user, %{status: "2hu :moominmamma:"})
1020 {:ok, modified} = Transmogrifier.prepare_outgoing(activity.data)
1022 assert modified["directMessage"] == false
1024 {:ok, activity} = CommonAPI.post(user, %{status: "@#{other_user.nickname} :moominmamma:"})
1026 {:ok, modified} = Transmogrifier.prepare_outgoing(activity.data)
1028 assert modified["directMessage"] == false
1031 CommonAPI.post(user, %{
1032 status: "@#{other_user.nickname} :moominmamma:",
1033 visibility: "direct"
1036 {:ok, modified} = Transmogrifier.prepare_outgoing(activity.data)
1038 assert modified["directMessage"] == true
1041 test "it strips BCC field" do
1042 user = insert(:user)
1043 {:ok, list} = Pleroma.List.create("foo", user)
1045 {:ok, activity} = CommonAPI.post(user, %{status: "foobar", visibility: "list:#{list.id}"})
1047 {:ok, modified} = Transmogrifier.prepare_outgoing(activity.data)
1049 assert is_nil(modified["bcc"])
1052 test "it can handle Listen activities" do
1053 listen_activity = insert(:listen)
1055 {:ok, modified} = Transmogrifier.prepare_outgoing(listen_activity.data)
1057 assert modified["type"] == "Listen"
1059 user = insert(:user)
1061 {:ok, activity} = CommonAPI.listen(user, %{"title" => "lain radio episode 1"})
1063 {:ok, _modified} = Transmogrifier.prepare_outgoing(activity.data)
1067 describe "user upgrade" do
1068 test "it upgrades a user to activitypub" do
1071 nickname: "rye@niu.moe",
1073 ap_id: "https://niu.moe/users/rye",
1074 follower_address: User.ap_followers(%User{nickname: "rye@niu.moe"})
1077 user_two = insert(:user)
1078 Pleroma.FollowingRelationship.follow(user_two, user, :follow_accept)
1080 {:ok, activity} = CommonAPI.post(user, %{status: "test"})
1081 {:ok, unrelated_activity} = CommonAPI.post(user_two, %{status: "test"})
1082 assert "http://localhost:4001/users/rye@niu.moe/followers" in activity.recipients
1084 user = User.get_cached_by_id(user.id)
1085 assert user.note_count == 1
1087 {:ok, user} = Transmogrifier.upgrade_user_from_ap_id("https://niu.moe/users/rye")
1088 ObanHelpers.perform_all()
1090 assert user.ap_enabled
1091 assert user.note_count == 1
1092 assert user.follower_address == "https://niu.moe/users/rye/followers"
1093 assert user.following_address == "https://niu.moe/users/rye/following"
1095 user = User.get_cached_by_id(user.id)
1096 assert user.note_count == 1
1098 activity = Activity.get_by_id(activity.id)
1099 assert user.follower_address in activity.recipients
1105 "https://cdn.niu.moe/accounts/avatars/000/033/323/original/fd7f8ae0b3ffedc9.jpeg"
1114 "https://cdn.niu.moe/accounts/headers/000/033/323/original/850b3448fa5fd477.png"
1119 refute "..." in activity.recipients
1121 unrelated_activity = Activity.get_by_id(unrelated_activity.id)
1122 refute user.follower_address in unrelated_activity.recipients
1124 user_two = User.get_cached_by_id(user_two.id)
1125 assert User.following?(user_two, user)
1126 refute "..." in User.following(user_two)
1130 describe "actor rewriting" do
1131 test "it fixes the actor URL property to be a proper URI" do
1133 "url" => %{"href" => "http://example.com"}
1136 rewritten = Transmogrifier.maybe_fix_user_object(data)
1137 assert rewritten["url"] == "http://example.com"
1141 describe "actor origin containment" do
1142 test "it rejects activities which reference objects with bogus origins" do
1144 "@context" => "https://www.w3.org/ns/activitystreams",
1145 "id" => "http://mastodon.example.org/users/admin/activities/1234",
1146 "actor" => "http://mastodon.example.org/users/admin",
1147 "to" => ["https://www.w3.org/ns/activitystreams#Public"],
1148 "object" => "https://info.pleroma.site/activity.json",
1149 "type" => "Announce"
1152 assert capture_log(fn ->
1153 {:error, _} = Transmogrifier.handle_incoming(data)
1154 end) =~ "Object containment failed"
1157 test "it rejects activities which reference objects that have an incorrect attribution (variant 1)" do
1159 "@context" => "https://www.w3.org/ns/activitystreams",
1160 "id" => "http://mastodon.example.org/users/admin/activities/1234",
1161 "actor" => "http://mastodon.example.org/users/admin",
1162 "to" => ["https://www.w3.org/ns/activitystreams#Public"],
1163 "object" => "https://info.pleroma.site/activity2.json",
1164 "type" => "Announce"
1167 assert capture_log(fn ->
1168 {:error, _} = Transmogrifier.handle_incoming(data)
1169 end) =~ "Object containment failed"
1172 test "it rejects activities which reference objects that have an incorrect attribution (variant 2)" do
1174 "@context" => "https://www.w3.org/ns/activitystreams",
1175 "id" => "http://mastodon.example.org/users/admin/activities/1234",
1176 "actor" => "http://mastodon.example.org/users/admin",
1177 "to" => ["https://www.w3.org/ns/activitystreams#Public"],
1178 "object" => "https://info.pleroma.site/activity3.json",
1179 "type" => "Announce"
1182 assert capture_log(fn ->
1183 {:error, _} = Transmogrifier.handle_incoming(data)
1184 end) =~ "Object containment failed"
1188 describe "reserialization" do
1189 test "successfully reserializes a message with inReplyTo == nil" do
1190 user = insert(:user)
1193 "@context" => "https://www.w3.org/ns/activitystreams",
1194 "to" => ["https://www.w3.org/ns/activitystreams#Public"],
1198 "to" => ["https://www.w3.org/ns/activitystreams#Public"],
1203 "attributedTo" => user.ap_id
1205 "actor" => user.ap_id
1208 {:ok, activity} = Transmogrifier.handle_incoming(message)
1210 {:ok, _} = Transmogrifier.prepare_outgoing(activity.data)
1213 test "successfully reserializes a message with AS2 objects in IR" do
1214 user = insert(:user)
1217 "@context" => "https://www.w3.org/ns/activitystreams",
1218 "to" => ["https://www.w3.org/ns/activitystreams#Public"],
1222 "to" => ["https://www.w3.org/ns/activitystreams#Public"],
1227 "attributedTo" => user.ap_id,
1229 %{"name" => "#2hu", "href" => "http://example.com/2hu", "type" => "Hashtag"},
1230 %{"name" => "Bob", "href" => "http://example.com/bob", "type" => "Mention"}
1233 "actor" => user.ap_id
1236 {:ok, activity} = Transmogrifier.handle_incoming(message)
1238 {:ok, _} = Transmogrifier.prepare_outgoing(activity.data)
1242 test "Rewrites Answers to Notes" do
1243 user = insert(:user)
1245 {:ok, poll_activity} =
1246 CommonAPI.post(user, %{
1248 poll: %{options: ["suya", "suya.", "suya.."], expires_in: 10}
1251 poll_object = Object.normalize(poll_activity)
1252 # TODO: Replace with CommonAPI vote creation when implemented
1254 File.read!("test/fixtures/mastodon-vote.json")
1256 |> Kernel.put_in(["to"], user.ap_id)
1257 |> Kernel.put_in(["object", "inReplyTo"], poll_object.data["id"])
1258 |> Kernel.put_in(["object", "to"], user.ap_id)
1260 {:ok, %Activity{local: false} = activity} = Transmogrifier.handle_incoming(data)
1261 {:ok, data} = Transmogrifier.prepare_outgoing(activity.data)
1263 assert data["object"]["type"] == "Note"
1266 describe "fix_explicit_addressing" do
1268 user = insert(:user)
1272 test "moves non-explicitly mentioned actors to cc", %{user: user} do
1273 explicitly_mentioned_actors = [
1274 "https://pleroma.gold/users/user1",
1275 "https://pleroma.gold/user2"
1279 "actor" => user.ap_id,
1280 "to" => explicitly_mentioned_actors ++ ["https://social.beepboop.ga/users/dirb"],
1283 Enum.map(explicitly_mentioned_actors, fn href ->
1284 %{"type" => "Mention", "href" => href}
1288 fixed_object = Transmogrifier.fix_explicit_addressing(object)
1289 assert Enum.all?(explicitly_mentioned_actors, &(&1 in fixed_object["to"]))
1290 refute "https://social.beepboop.ga/users/dirb" in fixed_object["to"]
1291 assert "https://social.beepboop.ga/users/dirb" in fixed_object["cc"]
1294 test "does not move actor's follower collection to cc", %{user: user} do
1296 "actor" => user.ap_id,
1297 "to" => [user.follower_address],
1301 fixed_object = Transmogrifier.fix_explicit_addressing(object)
1302 assert user.follower_address in fixed_object["to"]
1303 refute user.follower_address in fixed_object["cc"]
1306 test "removes recipient's follower collection from cc", %{user: user} do
1307 recipient = insert(:user)
1310 "actor" => user.ap_id,
1311 "to" => [recipient.ap_id, "https://www.w3.org/ns/activitystreams#Public"],
1312 "cc" => [user.follower_address, recipient.follower_address]
1315 fixed_object = Transmogrifier.fix_explicit_addressing(object)
1317 assert user.follower_address in fixed_object["cc"]
1318 refute recipient.follower_address in fixed_object["cc"]
1319 refute recipient.follower_address in fixed_object["to"]
1323 describe "fix_summary/1" do
1324 test "returns fixed object" do
1325 assert Transmogrifier.fix_summary(%{"summary" => nil}) == %{"summary" => ""}
1326 assert Transmogrifier.fix_summary(%{"summary" => "ok"}) == %{"summary" => "ok"}
1327 assert Transmogrifier.fix_summary(%{}) == %{"summary" => ""}
1331 describe "fix_in_reply_to/2" do
1332 setup do: clear_config([:instance, :federation_incoming_replies_max_depth])
1335 data = Poison.decode!(File.read!("test/fixtures/mastodon-post-activity.json"))
1339 test "returns not modified object when hasn't containts inReplyTo field", %{data: data} do
1340 assert Transmogrifier.fix_in_reply_to(data) == data
1343 test "returns object with inReplyToAtomUri when denied incoming reply", %{data: data} do
1344 Pleroma.Config.put([:instance, :federation_incoming_replies_max_depth], 0)
1347 Map.put(data["object"], "inReplyTo", "https://shitposter.club/notice/2827873")
1349 modified_object = Transmogrifier.fix_in_reply_to(object_with_reply)
1350 assert modified_object["inReplyTo"] == "https://shitposter.club/notice/2827873"
1351 assert modified_object["inReplyToAtomUri"] == "https://shitposter.club/notice/2827873"
1354 Map.put(data["object"], "inReplyTo", %{"id" => "https://shitposter.club/notice/2827873"})
1356 modified_object = Transmogrifier.fix_in_reply_to(object_with_reply)
1357 assert modified_object["inReplyTo"] == %{"id" => "https://shitposter.club/notice/2827873"}
1358 assert modified_object["inReplyToAtomUri"] == "https://shitposter.club/notice/2827873"
1361 Map.put(data["object"], "inReplyTo", ["https://shitposter.club/notice/2827873"])
1363 modified_object = Transmogrifier.fix_in_reply_to(object_with_reply)
1364 assert modified_object["inReplyTo"] == ["https://shitposter.club/notice/2827873"]
1365 assert modified_object["inReplyToAtomUri"] == "https://shitposter.club/notice/2827873"
1367 object_with_reply = Map.put(data["object"], "inReplyTo", [])
1368 modified_object = Transmogrifier.fix_in_reply_to(object_with_reply)
1369 assert modified_object["inReplyTo"] == []
1370 assert modified_object["inReplyToAtomUri"] == ""
1373 @tag capture_log: true
1374 test "returns modified object when allowed incoming reply", %{data: data} do
1379 "https://shitposter.club/notice/2827873"
1382 Pleroma.Config.put([:instance, :federation_incoming_replies_max_depth], 5)
1383 modified_object = Transmogrifier.fix_in_reply_to(object_with_reply)
1385 assert modified_object["inReplyTo"] ==
1386 "tag:shitposter.club,2017-05-05:noticeId=2827873:objectType=comment"
1388 assert modified_object["inReplyToAtomUri"] == "https://shitposter.club/notice/2827873"
1390 assert modified_object["context"] ==
1391 "tag:shitposter.club,2017-05-05:objectType=thread:nonce=3c16e9c2681f6d26"
1395 describe "fix_url/1" do
1396 test "fixes data for object when url is map" do
1400 "mimeType" => "video/mp4",
1401 "href" => "https://peede8d-46fb-ad81-2d4c2d1630e3-480.mp4"
1405 assert Transmogrifier.fix_url(object) == %{
1406 "url" => "https://peede8d-46fb-ad81-2d4c2d1630e3-480.mp4"
1410 test "fixes data for video object" do
1416 "mimeType" => "video/mp4",
1417 "href" => "https://peede8d-46fb-ad81-2d4c2d1630e3-480.mp4"
1421 "mimeType" => "video/mp4",
1422 "href" => "https://peertube46fb-ad81-2d4c2d1630e3-240.mp4"
1426 "mimeType" => "text/html",
1427 "href" => "https://peertube.-2d4c2d1630e3"
1431 "mimeType" => "text/html",
1432 "href" => "https://peertube.-2d4c2d16377-42"
1437 assert Transmogrifier.fix_url(object) == %{
1440 "href" => "https://peede8d-46fb-ad81-2d4c2d1630e3-480.mp4",
1441 "mimeType" => "video/mp4",
1446 "url" => "https://peertube.-2d4c2d1630e3"
1450 test "fixes url for not Video object" do
1456 "mimeType" => "text/html",
1457 "href" => "https://peertube.-2d4c2d1630e3"
1461 "mimeType" => "text/html",
1462 "href" => "https://peertube.-2d4c2d16377-42"
1467 assert Transmogrifier.fix_url(object) == %{
1469 "url" => "https://peertube.-2d4c2d1630e3"
1472 assert Transmogrifier.fix_url(%{"type" => "Text", "url" => []}) == %{
1478 test "retunrs not modified object" do
1479 assert Transmogrifier.fix_url(%{"type" => "Text"}) == %{"type" => "Text"}
1483 describe "get_obj_helper/2" do
1484 test "returns nil when cannot normalize object" do
1485 assert capture_log(fn ->
1486 refute Transmogrifier.get_obj_helper("test-obj-id")
1487 end) =~ "Unsupported URI scheme"
1490 @tag capture_log: true
1491 test "returns {:ok, %Object{}} for success case" do
1492 assert {:ok, %Object{}} =
1493 Transmogrifier.get_obj_helper("https://shitposter.club/notice/2827873")
1497 describe "fix_attachments/1" do
1498 test "returns not modified object" do
1499 data = Poison.decode!(File.read!("test/fixtures/mastodon-post-activity.json"))
1500 assert Transmogrifier.fix_attachments(data) == data
1503 test "returns modified object when attachment is map" do
1504 assert Transmogrifier.fix_attachments(%{
1506 "mediaType" => "video/mp4",
1507 "url" => "https://peertube.moe/stat-480.mp4"
1512 "mediaType" => "video/mp4",
1514 %{"href" => "https://peertube.moe/stat-480.mp4", "mediaType" => "video/mp4"}
1521 test "returns modified object when attachment is list" do
1522 assert Transmogrifier.fix_attachments(%{
1524 %{"mediaType" => "video/mp4", "url" => "https://pe.er/stat-480.mp4"},
1525 %{"mimeType" => "video/mp4", "href" => "https://pe.er/stat-480.mp4"}
1530 "mediaType" => "video/mp4",
1532 %{"href" => "https://pe.er/stat-480.mp4", "mediaType" => "video/mp4"}
1536 "mediaType" => "video/mp4",
1538 %{"href" => "https://pe.er/stat-480.mp4", "mediaType" => "video/mp4"}
1546 describe "fix_emoji/1" do
1547 test "returns not modified object when object not contains tags" do
1548 data = Poison.decode!(File.read!("test/fixtures/mastodon-post-activity.json"))
1549 assert Transmogrifier.fix_emoji(data) == data
1552 test "returns object with emoji when object contains list tags" do
1553 assert Transmogrifier.fix_emoji(%{
1555 %{"type" => "Emoji", "name" => ":bib:", "icon" => %{"url" => "/test"}},
1556 %{"type" => "Hashtag"}
1559 "emoji" => %{"bib" => "/test"},
1561 %{"icon" => %{"url" => "/test"}, "name" => ":bib:", "type" => "Emoji"},
1562 %{"type" => "Hashtag"}
1567 test "returns object with emoji when object contains map tag" do
1568 assert Transmogrifier.fix_emoji(%{
1569 "tag" => %{"type" => "Emoji", "name" => ":bib:", "icon" => %{"url" => "/test"}}
1571 "emoji" => %{"bib" => "/test"},
1572 "tag" => %{"icon" => %{"url" => "/test"}, "name" => ":bib:", "type" => "Emoji"}
1577 describe "set_replies/1" do
1578 setup do: clear_config([:activitypub, :note_replies_output_limit], 2)
1580 test "returns unmodified object if activity doesn't have self-replies" do
1581 data = Poison.decode!(File.read!("test/fixtures/mastodon-post-activity.json"))
1582 assert Transmogrifier.set_replies(data) == data
1585 test "sets `replies` collection with a limited number of self-replies" do
1586 [user, another_user] = insert_list(2, :user)
1588 {:ok, %{id: id1} = activity} = CommonAPI.post(user, %{status: "1"})
1590 {:ok, %{id: id2} = self_reply1} =
1591 CommonAPI.post(user, %{status: "self-reply 1", in_reply_to_status_id: id1})
1593 {:ok, self_reply2} =
1594 CommonAPI.post(user, %{status: "self-reply 2", in_reply_to_status_id: id1})
1596 # Assuming to _not_ be present in `replies` due to :note_replies_output_limit is set to 2
1597 {:ok, _} = CommonAPI.post(user, %{status: "self-reply 3", in_reply_to_status_id: id1})
1600 CommonAPI.post(user, %{
1601 status: "self-reply to self-reply",
1602 in_reply_to_status_id: id2
1606 CommonAPI.post(another_user, %{
1607 status: "another user's reply",
1608 in_reply_to_status_id: id1
1611 object = Object.normalize(activity)
1612 replies_uris = Enum.map([self_reply1, self_reply2], fn a -> a.object.data["id"] end)
1614 assert %{"type" => "Collection", "items" => ^replies_uris} =
1615 Transmogrifier.set_replies(object.data)["replies"]
1619 test "take_emoji_tags/1" do
1620 user = insert(:user, %{emoji: %{"firefox" => "https://example.org/firefox.png"}})
1622 assert Transmogrifier.take_emoji_tags(user) == [
1624 "icon" => %{"type" => "Image", "url" => "https://example.org/firefox.png"},
1625 "id" => "https://example.org/firefox.png",
1626 "name" => ":firefox:",
1628 "updated" => "1970-01-01T00:00:00Z"