provide instance thumbnail at /api/v1/instance (debug)
[akkoma] / lib / pleroma / web / ostatus / ostatus.ex
index b0d2dda5d2456afeab7d9fbd3620776339ae78b7..c35ba42bee6d5bc263d72da8769bbc1128eee5cd 100644 (file)
@@ -7,7 +7,6 @@ defmodule Pleroma.Web.OStatus do
 
   alias Pleroma.{Repo, User, Web, Object, Activity}
   alias Pleroma.Web.ActivityPub.ActivityPub
-  alias Pleroma.Web.ActivityPub.Utils
   alias Pleroma.Web.{WebFinger, Websub}
   alias Pleroma.Web.OStatus.{FollowHandler, NoteHandler, DeleteHandler}
 
@@ -23,6 +22,10 @@ defmodule Pleroma.Web.OStatus do
     "#{user.ap_id}/salmon"
   end
 
+  def remote_follow_path do
+    "#{Web.base_url}/ostatus_subscribe?acct={uri}"
+  end
+
   def handle_incoming(xml_string) do
     with doc when doc != :error <- parse_document(xml_string) do
       entries = :xmerl_xpath.string('//entry', doc)
@@ -112,7 +115,7 @@ defmodule Pleroma.Web.OStatus do
     with id when not is_nil(id) <- string_from_xpath("//activity:object[1]/id", entry),
          %Activity{} = activity <- Activity.get_create_activity_by_object_ap_id(id) do
       {:ok, activity}
-    else e ->
+    else _ ->
         Logger.debug("Couldn't get, will try to fetch")
         with href when not is_nil(href) <- string_from_xpath("//activity:object[1]/link[@type=\"text/html\"]/@href", entry),
              {:ok, [favorited_activity]} <- fetch_activity_from_url(href) do
@@ -160,8 +163,7 @@ defmodule Pleroma.Web.OStatus do
     Get the cw that mastodon uses.
   """
   def get_cw(entry) do
-    with scope when not is_nil(scope) <- string_from_xpath("//mastodon:scope", entry),
-         cw when not is_nil(cw) <- string_from_xpath("/*/summary", entry) do
+    with cw when not is_nil(cw) <- string_from_xpath("/*/summary", entry) do
       cw
     else _e -> nil
     end
@@ -191,7 +193,7 @@ defmodule Pleroma.Web.OStatus do
          false <- new_data == old_data do
       change = Ecto.Changeset.change(user, new_data)
       Repo.update(change)
-    else e ->
+    else _ ->
       {:ok, user}
     end
   end