Move /litepub-1.0.jsonld to /schemas/litepub-0.1.jsonld
[akkoma] / lib / pleroma / web / activity_pub / utils.ex
index 266667f8109720ee05ae35374800147eaddf3b31..152bb5a8d6156b3697e251d287b30f1a7e27574e 100644 (file)
@@ -37,6 +37,11 @@ defmodule Pleroma.Web.ActivityPub.Utils do
       recipient_in_collection(ap_id, params["bcc"]) ->
         true
 
+      # if the message is unaddressed at all, then assume it is directly addressed
+      # to the recipient
+      !params["to"] && !params["cc"] && !params["bto"] && !params["bcc"] ->
+        true
+
       true ->
         false
     end
@@ -65,18 +70,7 @@ defmodule Pleroma.Web.ActivityPub.Utils do
     %{
       "@context" => [
         "https://www.w3.org/ns/activitystreams",
-        "https://w3id.org/security/v1",
-        %{
-          "manuallyApprovesFollowers" => "as:manuallyApprovesFollowers",
-          "sensitive" => "as:sensitive",
-          "Hashtag" => "as:Hashtag",
-          "ostatus" => "http://ostatus.org#",
-          "atomUri" => "ostatus:atomUri",
-          "inReplyToAtomUri" => "ostatus:inReplyToAtomUri",
-          "conversation" => "ostatus:conversation",
-          "toot" => "http://joinmastodon.org/ns#",
-          "Emoji" => "toot:Emoji"
-        }
+        "#{Web.base_url()}/schemas/litepub-0.1.jsonld"
       ]
     }
   end
@@ -170,7 +164,7 @@ defmodule Pleroma.Web.ActivityPub.Utils do
   Inserts a full object if it is contained in an activity.
   """
   def insert_full_object(%{"object" => %{"type" => type} = object_data})
-      when is_map(object_data) and type in ["Article", "Note", "Video"] do
+      when is_map(object_data) and type in ["Article", "Note", "Video", "Page"] do
     with {:ok, _} <- Object.create(object_data) do
       :ok
     end