1
0
Fork 0
mirror of https://framagit.org/framasoft/mobilizon.git synced 2024-12-22 07:52:43 +00:00

Add config option to disable federation

Closes #148

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2019-09-27 16:18:29 +02:00
parent bcda0fc428
commit 65b49e247f
No known key found for this signature in database
GPG key ID: A061B9DDE0CA0773
2 changed files with 11 additions and 7 deletions

View file

@ -17,6 +17,8 @@ config :mobilizon, :instance,
registrations_open: System.get_env("MOBILIZON_INSTANCE_REGISTRATIONS_OPEN") || false,
repository: Mix.Project.config()[:source_url],
allow_relay: true,
# Federation is to be activated with Mobilizon 1.0.0-beta.2
federating: false,
remote_limit: 100_000,
upload_limit: 16_000_000,
avatar_upload_limit: 2_000_000,

View file

@ -58,14 +58,16 @@ defmodule Mobilizon.Service.ActivityPub.Utils do
def maybe_federate(%Activity{local: true} = activity) do
Logger.debug("Maybe federate an activity")
priority =
case activity.data["type"] do
"Delete" -> 10
"Create" -> 1
_ -> 5
end
if Mobilizon.Config.get!([:instance, :federating]) do
priority =
case activity.data["type"] do
"Delete" -> 10
"Create" -> 1
_ -> 5
end
Federator.enqueue(:publish, activity, priority)
Federator.enqueue(:publish, activity, priority)
end
:ok
end