1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Web.Plugs.StaticFEPlug do
7 alias Pleroma.Web.StaticFE.StaticFEController
9 def init(options), do: options
12 if enabled?() and requires_html?(conn) and not_logged_in?(conn) do
14 |> StaticFEController.call(:show)
21 defp enabled?, do: Pleroma.Config.get([:static_fe, :enabled], false)
23 defp requires_html?(conn) do
24 Phoenix.Controller.get_format(conn) == "html"
27 defp not_logged_in?(%{assigns: %{user: %Pleroma.User{}}}), do: false
28 defp not_logged_in?(_), do: true