1 defmodule Mix.Tasks.Pleroma.Relay do
3 alias Pleroma.Web.ActivityPub.Relay
4 alias Mix.Tasks.Pleroma.Common
6 @shortdoc "Manages remote relays"
10 ## Follow a remote relay
12 ``mix pleroma.relay follow <relay_url>``
14 Example: ``mix pleroma.relay follow https://example.org/relay``
16 ## Unfollow a remote relay
18 ``mix pleroma.relay unfollow <relay_url>``
20 Example: ``mix pleroma.relay unfollow https://example.org/relay``
22 def run(["follow", target]) do
23 Common.start_pleroma()
25 with {:ok, activity} <- Relay.follow(target) do
26 # put this task to sleep to allow the genserver to push out the messages
29 {:error, e} -> Mix.shell().error("Error while following #{target}: #{inspect(e)}")
33 def run(["unfollow", target]) do
34 Common.start_pleroma()
36 with {:ok, activity} <- Relay.unfollow(target) do
37 # put this task to sleep to allow the genserver to push out the messages
40 {:error, e} -> Mix.shell().error("Error while following #{target}: #{inspect(e)}")