],
id: :cachex_idem
),
- worker(Pleroma.Web.Federator, []),
worker(Pleroma.Web.Federator.RetryQueue, []),
- worker(Pleroma.Gopher.Server, []),
+ worker(Pleroma.Web.Federator, []),
- worker(Pleroma.Stats, [])
+ worker(Pleroma.Stats, []),
+ worker(Pleroma.Web.Push, [])
] ++
- if @env == :test,
- do: [],
- else:
- [worker(Pleroma.Web.Streamer, [])] ++
- if(
- !chat_enabled(),
- do: [],
- else: [worker(Pleroma.Web.ChatChannel.ChatChannelState, [])]
- )
+ streamer_child() ++
+ chat_child() ++
+ [
+ # Start the endpoint when the application starts
+ supervisor(Pleroma.Web.Endpoint, []),
+ worker(Pleroma.Gopher.Server, [])
+ ]
# See http://elixir-lang.org/docs/stable/elixir/Supervisor.html
# for other strategies and supported options
def call(%{assigns: %{user: %User{}}} = conn, _), do: conn
def call(conn, _) do
- token =
- case get_req_header(conn, "authorization") do
- ["Bearer " <> header] -> header
- _ -> get_session(conn, :oauth_token)
- end
-
- with token when not is_nil(token) <- token,
- %Token{user_id: user_id} = token <- Repo.get_by(Token, token: token),
- %User{} = user <- Repo.get(User, user_id),
- false <- !!user.info["deactivated"] do
+ with {:ok, token} <- fetch_token(conn),
+ {:ok, user} <- fetch_user(token) do
- assign(conn, :user, user)
+ conn
+ |> assign(:token, token)
+ |> assign(:user, user)
else
_ -> conn
end