Runtime configured router
This commit is contained in:
parent
bd97b3614f
commit
6fe23c5458
8 changed files with 67 additions and 35 deletions
18
lib/pleroma/plugs/federating_plug.ex
Normal file
18
lib/pleroma/plugs/federating_plug.ex
Normal file
|
|
@ -0,0 +1,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
|
||||
Loading…
Add table
Add a link
Reference in a new issue