projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge pull request 'metrics' (#375) from stats into develop
[akkoma]
/
lib
/
pleroma
/
web.ex
diff --git
a/lib/pleroma/web.ex
b/lib/pleroma/web.ex
index c3aa3949274d279ed1fd94962cbe3c555038aa6d..24560d4a3da91cc4eab96b910e1329b4ede068b4 100644
(file)
--- a/
lib/pleroma/web.ex
+++ b/
lib/pleroma/web.ex
@@
-35,9
+35,10
@@
defmodule Pleroma.Web do
import Plug.Conn
import Pleroma.Web.Gettext
import Plug.Conn
import Pleroma.Web.Gettext
- import Pleroma.Web.Router.Helpers
import Pleroma.Web.TranslationHelpers
import Pleroma.Web.TranslationHelpers
+ alias Pleroma.Web.Router.Helpers, as: Routes
+
plug(:set_put_layout)
defp set_put_layout(conn, _) do
plug(:set_put_layout)
defp set_put_layout(conn, _) do
@@
-55,15
+56,27
@@
defmodule Pleroma.Web do
plug_module.skip_plug(conn)
rescue
UndefinedFunctionError ->
plug_module.skip_plug(conn)
rescue
UndefinedFunctionError ->
- raise "`#{plug_module}` is not skippable. Append `use Pleroma.Web, :plug` to its code."
+ reraise(
+ "`#{plug_module}` is not skippable. Append `use Pleroma.Web, :plug` to its code.",
+ __STACKTRACE__
+ )
end
end
)
end
end
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
# Executed just before actual controller action, invokes before-action hooks (callbacks)
defp action(conn, params) do
- with %{halted: false} = conn <- maybe_drop_authentication_if_oauth_check_ignored(conn),
+ with %{halted: false} = conn <-
+ maybe_drop_authentication_if_oauth_check_ignored(conn),
%{halted: false} = conn <- maybe_perform_public_or_authenticated_check(conn),
%{halted: false} = conn <- maybe_perform_authenticated_check(conn),
%{halted: false} = conn <- maybe_halt_on_missing_oauth_scopes_check(conn) do
%{halted: false} = conn <- maybe_perform_public_or_authenticated_check(conn),
%{halted: false} = conn <- maybe_perform_authenticated_check(conn),
%{halted: false} = conn <- maybe_halt_on_missing_oauth_scopes_check(conn) do
@@
-130,7
+143,8
@@
defmodule Pleroma.Web do
import Pleroma.Web.ErrorHelpers
import Pleroma.Web.Gettext
import Pleroma.Web.ErrorHelpers
import Pleroma.Web.Gettext
- import Pleroma.Web.Router.Helpers
+
+ alias Pleroma.Web.Router.Helpers, as: Routes
require Logger
require Logger
@@
-228,8
+242,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
end
end