X-Git-Url: https://git.squeep.com/?a=blobdiff_plain;f=lib%2Fmix%2Ftasks%2Fpleroma%2Frelay.ex;h=c3312507e93786dcbebe0194177d84f9fc112c38;hb=98058bd06e95f7414d59ae61f072a385c27e6962;hp=c7324fff6f9bacea358dc0b6addac3989202f7ba;hpb=29807ef6a5b43a528ffca08b4f721b251f331c8d;p=akkoma
diff --git a/lib/mix/tasks/pleroma/relay.ex b/lib/mix/tasks/pleroma/relay.ex
index c7324fff6..c3312507e 100644
--- a/lib/mix/tasks/pleroma/relay.ex
+++ b/lib/mix/tasks/pleroma/relay.ex
@@ -1,33 +1,15 @@
# Pleroma: A lightweight social networking server
-# Copyright © 2017-2018 Pleroma Authors
+# Copyright © 2017-2020 Pleroma Authors
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Mix.Tasks.Pleroma.Relay do
use Mix.Task
import Mix.Pleroma
- alias Pleroma.User
alias Pleroma.Web.ActivityPub.Relay
@shortdoc "Manages remote relays"
- @moduledoc """
- Manages remote relays
+ @moduledoc File.read!("docs/administration/CLI_tasks/relay.md")
- ## Follow a remote relay
-
- ``mix pleroma.relay follow ``
-
- Example: ``mix pleroma.relay follow https://example.org/relay``
-
- ## Unfollow a remote relay
-
- ``mix pleroma.relay unfollow ``
-
- Example: ``mix pleroma.relay unfollow https://example.org/relay``
-
- ## List relay subscriptions
-
- ``mix pleroma.relay list``
- """
def run(["follow", target]) do
start_pleroma()
@@ -53,15 +35,10 @@ defmodule Mix.Tasks.Pleroma.Relay do
def run(["list"]) do
start_pleroma()
- with %User{} = user <- Relay.get_actor() do
- user.following
- |> Enum.each(fn entry ->
- URI.parse(entry)
- |> Map.get(:host)
- |> shell_info()
- end)
+ with {:ok, list} <- Relay.list(true) do
+ list |> Enum.each(&shell_info(&1))
else
- e -> shell_error("Error while fetching relay subscription list: #{inspect(e)}")
+ {:error, e} -> shell_error("Error while fetching relay subscription list: #{inspect(e)}")
end
end
end