esrom/ui/lib/ui_web/controllers/page_controller.ex

21 lines
455 B
Elixir
Raw Normal View History

2019-07-13 18:16:46 +00:00
defmodule UiWeb.PageController do
use UiWeb, :controller
alias Phoenix.LiveView
2019-07-13 18:16:46 +00:00
def index(conn, _params) do
send_resp(conn, 204, "")
end
def instructions(conn, _params) do
render(conn, :instructions)
end
2019-10-25 14:30:13 +00:00
def morse(conn, _params) do
ip = case Plug.Conn.get_req_header(conn, "x-real-ip") do
[h|_tl] -> h
_ -> "0.0.0.0"
end
LiveView.Controller.live_render(conn, UiWeb.MorseLive, session: %{ip: ip})
end
2019-07-13 18:16:46 +00:00
end