1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Plugs.StaticFEPlug do
6 def init(options), do: options
8 def accepts_html?({"accept", a}), do: String.contains?(a, "text/html")
9 def accepts_html?({_, _}), do: false
12 with true <- Pleroma.Config.get([:instance, :static_fe], false),
13 {_, _} <- Enum.find(conn.req_headers, &accepts_html?/1) do
14 Pleroma.Web.StaticFE.StaticFEController.call(conn, :show)