aboutsummaryrefslogtreecommitdiff
path: root/lib/pleroma/plugs/federating_plug.ex
blob: 4108d90af267631dbdcedf805396941888bc7430 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
defmodule Pleroma.Web.FederatingPlug do
  import Plug.Conn

  def init(options) do
    options
  end

  def call(conn, opts) do
    if Keyword.get(Application.get_env(:pleroma, :instance), :federating) do
      conn
    else
      conn
      |> put_status(404)
      |> Phoenix.Controller.render(Pleroma.Web.ErrorView, "404.json")
      |> halt()
    end
  end
end