Add way to disable federation.
This commit is contained in:
parent
e98aeabbde
commit
0e20d5529a
|
@ -49,7 +49,8 @@
|
||||||
name: "Pleroma",
|
name: "Pleroma",
|
||||||
email: "example@example.com",
|
email: "example@example.com",
|
||||||
limit: 5000,
|
limit: 5000,
|
||||||
registrations_open: true
|
registrations_open: true,
|
||||||
|
federating: true
|
||||||
|
|
||||||
config :pleroma, :media_proxy,
|
config :pleroma, :media_proxy,
|
||||||
enabled: false,
|
enabled: false,
|
||||||
|
|
|
@ -7,6 +7,8 @@ defmodule Pleroma.Web.Federator do
|
||||||
@websub Application.get_env(:pleroma, :websub)
|
@websub Application.get_env(:pleroma, :websub)
|
||||||
@ostatus Application.get_env(:pleroma, :ostatus)
|
@ostatus Application.get_env(:pleroma, :ostatus)
|
||||||
@httpoison Application.get_env(:pleroma, :httpoison)
|
@httpoison Application.get_env(:pleroma, :httpoison)
|
||||||
|
@instance Application.get_env(:pleroma, :instance)
|
||||||
|
@federating Keyword.get(@instance, :federating)
|
||||||
@max_jobs 10
|
@max_jobs 10
|
||||||
|
|
||||||
def start_link do
|
def start_link do
|
||||||
|
@ -80,10 +82,12 @@ def handle(type, _) do
|
||||||
end
|
end
|
||||||
|
|
||||||
def enqueue(type, payload, priority \\ 1) do
|
def enqueue(type, payload, priority \\ 1) do
|
||||||
if Mix.env == :test do
|
if @federating do
|
||||||
handle(type, payload)
|
if Mix.env == :test do
|
||||||
else
|
handle(type, payload)
|
||||||
GenServer.cast(__MODULE__, {:enqueue, type, payload, priority})
|
else
|
||||||
|
GenServer.cast(__MODULE__, {:enqueue, type, payload, priority})
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,9 @@ defmodule Pleroma.Web.Router do
|
||||||
|
|
||||||
alias Pleroma.{Repo, User, Web.Router}
|
alias Pleroma.{Repo, User, Web.Router}
|
||||||
|
|
||||||
|
@instance Application.get_env(:pleroma, :instance)
|
||||||
|
@federating Keyword.get(@instance, :federating)
|
||||||
|
|
||||||
def user_fetcher(username) do
|
def user_fetcher(username) do
|
||||||
{:ok, Repo.get_by(User, %{nickname: username})}
|
{:ok, Repo.get_by(User, %{nickname: username})}
|
||||||
end
|
end
|
||||||
|
@ -228,20 +231,25 @@ def user_fetcher(username) do
|
||||||
get "/objects/:uuid", OStatus.OStatusController, :object
|
get "/objects/:uuid", OStatus.OStatusController, :object
|
||||||
get "/activities/:uuid", OStatus.OStatusController, :activity
|
get "/activities/:uuid", OStatus.OStatusController, :activity
|
||||||
get "/notice/:id", OStatus.OStatusController, :notice
|
get "/notice/:id", OStatus.OStatusController, :notice
|
||||||
|
|
||||||
get "/users/:nickname/feed", OStatus.OStatusController, :feed
|
get "/users/:nickname/feed", OStatus.OStatusController, :feed
|
||||||
get "/users/:nickname", OStatus.OStatusController, :feed_redirect
|
get "/users/:nickname", OStatus.OStatusController, :feed_redirect
|
||||||
post "/users/:nickname/salmon", OStatus.OStatusController, :salmon_incoming
|
|
||||||
post "/push/hub/:nickname", Websub.WebsubController, :websub_subscription_request
|
if @federating do
|
||||||
get "/push/subscriptions/:id", Websub.WebsubController, :websub_subscription_confirmation
|
post "/users/:nickname/salmon", OStatus.OStatusController, :salmon_incoming
|
||||||
post "/push/subscriptions/:id", Websub.WebsubController, :websub_incoming
|
post "/push/hub/:nickname", Websub.WebsubController, :websub_subscription_request
|
||||||
|
get "/push/subscriptions/:id", Websub.WebsubController, :websub_subscription_confirmation
|
||||||
|
post "/push/subscriptions/:id", Websub.WebsubController, :websub_incoming
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
scope "/.well-known", Pleroma.Web do
|
if @federating do
|
||||||
pipe_through :well_known
|
scope "/.well-known", Pleroma.Web do
|
||||||
|
pipe_through :well_known
|
||||||
|
|
||||||
get "/host-meta", WebFinger.WebFingerController, :host_meta
|
get "/host-meta", WebFinger.WebFingerController, :host_meta
|
||||||
get "/webfinger", WebFinger.WebFingerController, :webfinger
|
get "/webfinger", WebFinger.WebFingerController, :webfinger
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
scope "/", Pleroma.Web.MastodonAPI do
|
scope "/", Pleroma.Web.MastodonAPI do
|
||||||
|
|
Loading…
Reference in New Issue