projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add unit test for Pleroma API app controller
[akkoma]
/
lib
/
pleroma
/
web.ex
diff --git
a/lib/pleroma/web.ex
b/lib/pleroma/web.ex
index 24751faba4a3928158cc7c288586e96470259392..5761e3b385c61d9b7adb5a6d538b4cb2d52e361c 100644
(file)
--- a/
lib/pleroma/web.ex
+++ b/
lib/pleroma/web.ex
@@
-62,6
+62,14
@@
defmodule Pleroma.Web do
)
end
)
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 <-
# 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
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
end