1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Mix.Tasks.Pleroma.Relay do
9 alias Pleroma.Web.ActivityPub.Relay
11 @shortdoc "Manages remote relays"
12 @moduledoc File.read!("docs/administration/CLI_tasks/relay.md")
14 def run(["follow", target]) do
17 with {:ok, _activity} <- Relay.follow(target) do
18 # put this task to sleep to allow the genserver to push out the messages
21 {:error, e} -> shell_error("Error while following #{target}: #{inspect(e)}")
25 def run(["unfollow", target]) do
28 with {:ok, _activity} <- Relay.unfollow(target) do
29 # put this task to sleep to allow the genserver to push out the messages
32 {:error, e} -> shell_error("Error while following #{target}: #{inspect(e)}")
39 with %User{following: following} = _user <- Relay.get_actor() do
41 |> Enum.map(fn entry -> URI.parse(entry).host end)
43 |> Enum.each(&shell_info(&1))
45 e -> shell_error("Error while fetching relay subscription list: #{inspect(e)}")