1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2018 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Mix.Tasks.Pleroma.Relay do
7 alias Mix.Tasks.Pleroma.Common
8 alias Pleroma.Web.ActivityPub.Relay
10 @shortdoc "Manages remote relays"
14 ## Follow a remote relay
16 ``mix pleroma.relay follow <relay_url>``
18 Example: ``mix pleroma.relay follow https://example.org/relay``
20 ## Unfollow a remote relay
22 ``mix pleroma.relay unfollow <relay_url>``
24 Example: ``mix pleroma.relay unfollow https://example.org/relay``
26 def run(["follow", target]) do
27 Common.start_pleroma()
29 with {:ok, _activity} <- Relay.follow(target) do
30 # put this task to sleep to allow the genserver to push out the messages
33 {:error, e} -> Common.shell_error("Error while following #{target}: #{inspect(e)}")
37 def run(["unfollow", target]) do
38 Common.start_pleroma()
40 with {:ok, _activity} <- Relay.unfollow(target) do
41 # put this task to sleep to allow the genserver to push out the messages
44 {:error, e} -> Common.shell_error("Error while following #{target}: #{inspect(e)}")