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