akkoma/lib/pleroma/plugs/federating_plug.ex

20 lines
403 B
Elixir
Raw Normal View History

2018-11-05 07:19:03 -07:00
defmodule Pleroma.Web.FederatingPlug do
import Plug.Conn
def init(options) do
options
end
2018-12-09 02:12:48 -07:00
def call(conn, _opts) do
2018-11-05 07:19:03 -07:00
if Keyword.get(Application.get_env(:pleroma, :instance), :federating) do
conn
else
conn
|> put_status(404)
2018-12-16 09:49:42 -07:00
|> Phoenix.Controller.put_view(Pleroma.Web.ErrorView)
|> Phoenix.Controller.render("404.json")
2018-11-05 07:19:03 -07:00
|> halt()
end
end
end