diff --git a/lib/chronoscope/nts.ex b/lib/chronoscope/nts.ex index 5866dde..09193a7 100644 --- a/lib/chronoscope/nts.ex +++ b/lib/chronoscope/nts.ex @@ -12,6 +12,7 @@ defmodule Chronoscope.NTS do @registry Application.compile_env(:chronoscope, :registry, Registry) @genserver Application.compile_env(:chronoscope, :gen_server, GenServer) @dynamic_supervisor Application.compile_env(:chronoscope, :dynamic_supervisor, DynamicSupervisor) + @topic "nts-servers" def healthy?() do true @@ -37,6 +38,7 @@ defmodule Chronoscope.NTS do %{host: host, port: port} |> client_pid() |> @genserver.call(:key_establishment) + |> tap(fn _ -> ChronoscopeWeb.Endpoint.broadcast(@topic, "", "") end) end defp client_pid(server) do diff --git a/lib/chronoscope_web/live/index_live.ex b/lib/chronoscope_web/live/index_live.ex index de8ec66..995671d 100644 --- a/lib/chronoscope_web/live/index_live.ex +++ b/lib/chronoscope_web/live/index_live.ex @@ -10,7 +10,7 @@ defmodule ChronoscopeWeb.IndexLive do {:ok, assign(socket, %{servers: NTS.list()})} end - def handle_info(%{topic: @topic, payload: servers}, socket) do - {:noreply, assign(socket, %{servers: servers})} + def handle_info(%{topic: @topic}, socket) do + {:noreply, assign(socket, %{servers: NTS.list()})} end end diff --git a/lib/chronoscope_web/live/index_live.html.heex b/lib/chronoscope_web/live/index_live.html.heex index cc7b4c5..b4f3152 100644 --- a/lib/chronoscope_web/live/index_live.html.heex +++ b/lib/chronoscope_web/live/index_live.html.heex @@ -1,21 +1,27 @@
+ | Host | -+ | Status | -+ | Algorithm | -+ | Cookies | -+ | Cookie Length | ++ Certificate Expiration + | ++ Last Check + | <%= response.cookie_length %> | ++ <%= response.cert_expiration %> + | ++ <%= server.last_key_establishment %> + | <% else %>@@ -54,6 +66,11 @@ | - | - | - | +- | + ++ <%= server.last_key_establishment %> + | <% end %> diff --git a/test/chronoscope/gemini_test.exs b/test/chronoscope/gemini_test.exs index 9cb0a79..af0ac15 100644 --- a/test/chronoscope/gemini_test.exs +++ b/test/chronoscope/gemini_test.exs @@ -8,7 +8,6 @@ defmodule Chronoscope.GeminiTest do import Mox - setup :verify_on_exit! describe "Chronoscope.Gemini.healthy?()" do test "is healthy" do diff --git a/test/chronoscope_web/controllers/page_controller_test.exs b/test/chronoscope_web/controllers/page_controller_test.exs index e11c7c9..6b920f1 100644 --- a/test/chronoscope_web/controllers/page_controller_test.exs +++ b/test/chronoscope_web/controllers/page_controller_test.exs @@ -1,8 +1,17 @@ defmodule ChronoscopeWeb.PageControllerTest do use ChronoscopeWeb.ConnCase, async: true + alias Chronoscope.DynamicSupervisorMock + + import Mox + + setup :verify_on_exit! + test "GET /", %{conn: conn} do + DynamicSupervisorMock + |> expect(:which_children, fn _ -> [] end) + conn = get(conn, ~p"/") - assert html_response(conn, 200) =~ "Peace of mind from prototype to production" + assert html_response(conn, 200) =~ "Chronoscope" end end
---|