move to 2.5.5
[anni] / lib / pleroma / web / pleroma_api / controllers / instances_controller.ex
1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
4
5 defmodule Pleroma.Web.PleromaAPI.InstancesController do
6   use Pleroma.Web, :controller
7
8   alias Pleroma.Instances
9
10   plug(Pleroma.Web.ApiSpec.CastAndValidate)
11
12   defdelegate open_api_operation(action), to: Pleroma.Web.ApiSpec.PleromaInstancesOperation
13
14   def show(conn, _params) do
15     unreachable =
16       Instances.get_consistently_unreachable()
17       |> Map.new(fn {host, date} -> {host, to_string(date)} end)
18
19     json(conn, %{"unreachable" => unreachable})
20   end
21 end