mirror of
https://git.rape.pet/ulith/amputoma.git
synced 2025-02-24 21:53:59 +01:00

grep -rl '# Copyright © .* Pleroma' * | xargs sed -i 's;Copyright © .* Pleroma .*;Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>;'
32 lines
731 B
Elixir
32 lines
731 B
Elixir
# Pleroma: A lightweight social networking server
|
|
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
defmodule Pleroma.Web.Plugs.FederatingPlug do
|
|
import Plug.Conn
|
|
|
|
def init(options) do
|
|
options
|
|
end
|
|
|
|
def call(conn, _opts) do
|
|
if federating?() do
|
|
conn
|
|
else
|
|
fail(conn)
|
|
end
|
|
end
|
|
|
|
def federating?, do: Pleroma.Config.get([:instance, :federating])
|
|
|
|
# Definition for the use in :if_func / :unless_func plug options
|
|
def federating?(_conn), do: federating?()
|
|
|
|
defp fail(conn) do
|
|
conn
|
|
|> put_status(404)
|
|
|> Phoenix.Controller.put_view(Pleroma.Web.ErrorView)
|
|
|> Phoenix.Controller.render("404.json")
|
|
|> halt()
|
|
end
|
|
end
|