extend reject MRF to check if originating instance is blocked
[akkoma] / lib / pleroma / web.ex
index 24751faba4a3928158cc7c288586e96470259392..5761e3b385c61d9b7adb5a6d538b4cb2d52e361c 100644 (file)
@@ -62,6 +62,14 @@ defmodule Pleroma.Web do
         )
       end
 
+      defp skip_auth(conn, _) do
+        skip_plug(conn, [OAuthScopesPlug, EnsurePublicOrAuthenticatedPlug])
+      end
+
+      defp skip_public_check(conn, _) do
+        skip_plug(conn, EnsurePublicOrAuthenticatedPlug)
+      end
+
       # Executed just before actual controller action, invokes before-action hooks (callbacks)
       defp action(conn, params) do
         with %{halted: false} = conn <-
@@ -231,20 +239,4 @@ defmodule Pleroma.Web do
   defmacro __using__(which) when is_atom(which) do
     apply(__MODULE__, which, [])
   end
-
-  def base_url do
-    Pleroma.Web.Endpoint.url()
-  end
-
-  # TODO: Change to Phoenix.Router.routes/1 for Phoenix 1.6.0+
-  def get_api_routes do
-    Pleroma.Web.Router.__routes__()
-    |> Enum.reject(fn r -> r.plug == Pleroma.Web.Fallback.RedirectController end)
-    |> Enum.map(fn r ->
-      r.path
-      |> String.split("/", trim: true)
-      |> List.first()
-    end)
-    |> Enum.uniq()
-  end
 end