.formatter.exs Procfile assets/css/app.css assets/css/app.scss assets/css/phoenix.css assets/js/app.js assets/js/socket.js config/config.exs config/dev.exs config/prod.exs config/test.exs coveralls.json elixir_buildpack.config lib/chat.ex lib/chat/application.ex lib/chat/message.ex lib/chat/repo.ex lib/chat_web.ex lib/chat_web/channels/room_channel.ex lib/chat_web/channels/user_socket.ex lib/chat_web/controllers/page_controller.ex lib/chat_web/endpoint.ex lib/chat_web/gettext.ex lib/chat_web/router.ex lib/chat_web/telemetry.ex lib/chat_web/templates/layout/app.html.eex lib/chat_web/templates/page/index.html.eex lib/chat_web/views/error_helpers.ex lib/chat_web/views/error_view.ex lib/chat_web/views/layout_view.ex lib/chat_web/views/page_view.ex mix.exs mix.lock priv/gettext/en/LC_MESSAGES/errors.po priv/gettext/errors.pot priv/repo/migrations/.formatter.exs priv/repo/migrations/20200607184409_create_messages.exs priv/repo/seeds.exs priv/static/favicon.ico test/chat_web/channels/room_channel_test.exs test/chat_web/controllers/page_controller_test.exs test/chat_web/views/error_view_test.exs test/chat_web/views/layout_view_test.exs test/chat_web/views/page_view_test.exs test/support/channel_case.ex test/support/conn_case.ex test/support/data_case.ex test/test_helper.exs <<<<<< network # path=./cover/excoveralls.json {"source_files":[{"coverage":[null,null,null,null,null,null,null,null,null],"name":"lib/chat.ex","source":"defmodule Chat do\n @moduledoc \"\"\"\n Chat keeps the contexts that define your domain\n and business logic.\n\n Contexts are also responsible for managing your data, regardless\n if it comes from the database, an external API or others.\n \"\"\"\nend"},{"coverage":[null,null,null,null,null,5,null,null,null,null,null,null,null,null,null,null,2,null,null,null,null,null,5,5,null,null],"name":"lib/chat/message.ex","source":"defmodule Chat.Message do\n use Ecto.Schema\n import Ecto.Changeset\n import Ecto.Query\n\n schema \"messages\" do\n field(:message, :string)\n field(:name, :string)\n\n timestamps()\n end\n\n @doc false\n def changeset(message, attrs) do\n message\n |> cast(attrs, [:name, :message])\n |> validate_required([:name, :message])\n end\n\n def get_messages(limit \\\\ 20) do\n Chat.Message\n |> limit(^limit)\n |> order_by(desc: :inserted_at)\n |> Chat.Repo.all()\n end\nend"},{"coverage":[null,null,null,null,null],"name":"lib/chat/repo.ex","source":"defmodule Chat.Repo do\n use Ecto.Repo,\n otp_app: :chat,\n adapter: Ecto.Adapters.Postgres\nend"},{"coverage":[null,null,null,null,null,null,5,5,null,null,null,null,null,null,1,null,null,null,null,null,null,1,1,1,null,null,null,null,null,null,null,null,null,null,null,null,5,1,1,1,null,null,null,null,5,null,null,null],"name":"lib/chat_web/channels/room_channel.ex","source":"defmodule ChatWeb.RoomChannel do\n use ChatWeb, :channel\n\n @impl true\n def join(\"room:lobby\", _payload, socket) do\n # if authorized?(payload) do\n send(self(), :after_join)\n {:ok, socket}\n # else\n # {:error, %{reason: \"unauthorized\"}}\n # end\n end\n\n def handle_in(\"ping\", payload, socket) do\n {:reply, {:ok, payload}, socket}\n end\n\n # Channels can be used in a request/response fashion\n # by sending replies to requests from the client\n @impl true\n def handle_in(\"shout\", payload, socket) do\n Chat.Message.changeset(%Chat.Message{}, payload) |> Chat.Repo.insert()\n broadcast(socket, \"shout\", payload)\n {:noreply, socket}\n end\n\n # Add authorization logic here as required.\n # Auth coming soon via: https://github.com/dwyl/phoenix-chat-example/issues/54\n # defp authorized?(_payload) do\n # true\n # end\n\n @impl true\n def handle_info(:after_join, socket) do\n Chat.Message.get_messages()\n |> Enum.reverse()\n |> Enum.each(fn msg ->\n push(socket, \"shout\", %{\n name: msg.name,\n message: msg.message\n })\n end)\n\n # :noreply\n {:noreply, socket}\n end\n\nend"},{"coverage":[null,null,null,null,1,null,null,null,null,1,null,null],"name":"lib/chat_web/controllers/page_controller.ex","source":"defmodule ChatWeb.PageController do\n use ChatWeb, :controller\n\n def index(conn, _params) do\n render(conn, \"index.html\")\n end\n\n # see: github.com/dwyl/ping\n def ping(conn, params) do\n Ping.render_pixel(conn, params)\n end\nend"},{"coverage":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],"name":"lib/chat_web/endpoint.ex","source":"defmodule ChatWeb.Endpoint do\n use Phoenix.Endpoint, otp_app: :chat\n\n # The session will be stored in the cookie and signed,\n # this means its contents can be read but not tampered with.\n # Set :encryption_salt if you would also like to encrypt it.\n @session_options [\n store: :cookie,\n key: \"_chat_key\",\n signing_salt: \"qiJSSPUp\"\n ]\n\n socket \"/socket\", ChatWeb.UserSocket,\n websocket: true,\n longpoll: false\n\n socket \"/live\", Phoenix.LiveView.Socket, websocket: [connect_info: [session: @session_options]]\n\n # Serve at \"/\" the static files from \"priv/static\" directory.\n #\n # You should set gzip to true if you are running phx.digest\n # when deploying your static files in production.\n plug Plug.Static,\n at: \"/\",\n from: :chat,\n gzip: false,\n only: ~w(assets fonts images favicon.ico robots.txt)\n\n # Code reloading can be explicitly enabled under the\n # :code_reloader configuration of your endpoint.\n if code_reloading? do\n socket \"/phoenix/live_reload/socket\", Phoenix.LiveReloader.Socket\n plug Phoenix.LiveReloader\n plug Phoenix.CodeReloader\n plug Phoenix.Ecto.CheckRepoStatus, otp_app: :chat\n end\n\n plug Phoenix.LiveDashboard.RequestLogger,\n param_key: \"request_logger\",\n cookie_key: \"request_logger\"\n\n plug Plug.RequestId\n plug Plug.Telemetry, event_prefix: [:phoenix, :endpoint]\n\n plug Plug.Parsers,\n parsers: [:urlencoded, :multipart, :json],\n pass: [\"*/*\"],\n json_decoder: Phoenix.json_library()\n\n plug Plug.MethodOverride\n plug Plug.Head\n plug Plug.Session, @session_options\n plug ChatWeb.Router\nend"},{"coverage":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],"name":"lib/chat_web/gettext.ex","source":"defmodule ChatWeb.Gettext do\n @moduledoc \"\"\"\n A module providing Internationalization with a gettext-based API.\n\n By using [Gettext](https://hexdocs.pm/gettext),\n your module gains a set of macros for translations, for example:\n\n import ChatWeb.Gettext\n\n # Simple translation\n gettext(\"Here is the string to translate\")\n\n # Plural translation\n ngettext(\"Here is the string to translate\",\n \"Here are the strings to translate\",\n 3)\n\n # Domain-based translation\n dgettext(\"errors\", \"Here is the error message to translate\")\n\n See the [Gettext Docs](https://hexdocs.pm/gettext) for detailed usage.\n \"\"\"\n use Gettext, otp_app: :chat\nend"},{"coverage":[null,null,null,null,null,null,null,null,null,null,null,null,null,2,null,null],"name":"lib/chat_web/views/error_view.ex","source":"defmodule ChatWeb.ErrorView do\n use ChatWeb, :view\n\n # If you want to customize a particular status code\n # for a certain format, you may uncomment below.\n # def render(\"500.html\", _assigns) do\n # \"Internal Server Error\"\n # end\n\n # By default, Phoenix returns the status message from\n # the template name. For example, \"404.html\" becomes\n # \"Not Found\".\n def template_not_found(template, _assigns) do\n Phoenix.Controller.status_message_from_template(template)\n end\nend"},{"coverage":[null,null,null],"name":"lib/chat_web/views/layout_view.ex","source":"defmodule ChatWeb.LayoutView do\n use ChatWeb, :view\nend"},{"coverage":[null,null,null],"name":"lib/chat_web/views/page_view.ex","source":"defmodule ChatWeb.PageView do\n use ChatWeb, :view\nend"}]}<<<<<< EOF