2018-12-23 21:04:54 +01:00
|
|
|
# Pleroma: A lightweight social networking server
|
2018-12-31 16:41:47 +01:00
|
|
|
# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
|
2018-12-23 21:04:54 +01:00
|
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2018-11-05 15:19:03 +01:00
|
|
|
defmodule Pleroma.Web.FederatingPlug do
|
|
|
|
import Plug.Conn
|
|
|
|
|
|
|
|
def init(options) do
|
|
|
|
options
|
|
|
|
end
|
|
|
|
|
2018-12-09 10:12:48 +01:00
|
|
|
def call(conn, _opts) do
|
2018-11-05 15:19:03 +01:00
|
|
|
if Keyword.get(Application.get_env(:pleroma, :instance), :federating) do
|
|
|
|
conn
|
|
|
|
else
|
|
|
|
conn
|
|
|
|
|> put_status(404)
|
2018-12-16 17:49:42 +01:00
|
|
|
|> Phoenix.Controller.put_view(Pleroma.Web.ErrorView)
|
|
|
|
|> Phoenix.Controller.render("404.json")
|
2018-11-05 15:19:03 +01:00
|
|
|
|> halt()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|