Current section

43 Versions

Jump to

Compare versions

9 files changed
+71 additions
-14 deletions
  @@ -1,5 +1,10 @@
1 1 # CHANGELOG
2 2
3 + ## v0.2.10 (2020-10-13)
4 +
5 + * Support `:request_logger_cookie_domain` configuration
6 + * Support latest `telemetry_metrics` package
7 +
3 8 ## v0.2.9 (2020-09-28)
4 9
5 10 * Update `phoenix_live_view` to 0.14.7
  @@ -113,7 +113,7 @@ scope "/" do
113 113 end
114 114 ```
115 115
116 - If you are running your application behind a proxy or a webserver, you also have to make sure they are configured for allowing WebSocket upgrades. For example, [here is an article](https://dennisreimann.de/articles/phoenix-nginx-config.html) on how to configure Nginx with Phoenix and WebSockets.
116 + If you are running your application behind a proxy or a webserver, you also have to make sure they are configured for allowing WebSocket upgrades. For example, [here is an article](https://web.archive.org/web/20171104012240/https://dennisreimann.de/articles/phoenix-nginx-config.html) on how to configure Nginx with Phoenix and WebSockets.
117 117
118 118 Finally, you will also want to configure your `config/prod.exs` and use your domain name under the `check_origin` configuration:
  @@ -66,10 +66,10 @@
66 66 {<<"name">>,<<"telemetry_metrics">>},
67 67 {<<"optional">>,false},
68 68 {<<"repository">>,<<"hexpm">>},
69 - {<<"requirement">>,<<"~> 0.4.0 or ~> 0.5.0">>}],
69 + {<<"requirement">>,<<"~> 0.4.0 or ~> 0.5.0 or ~> 0.6.0">>}],
70 70 [{<<"app">>,<<"phoenix_html">>},
71 71 {<<"name">>,<<"phoenix_html">>},
72 72 {<<"optional">>,false},
73 73 {<<"repository">>,<<"hexpm">>},
74 74 {<<"requirement">>,<<"~> 2.14.1 or ~> 2.15">>}]]}.
75 - {<<"version">>,<<"0.2.9">>}.
75 + {<<"version">>,<<"0.2.10">>}.
  @@ -116,7 +116,7 @@ defmodule Phoenix.LiveDashboard.TableComponent do
116 116 end
117 117
118 118 defp sortable_dirs(columns, field) do
119 - case Enum.find(columns, & &1[:field] == field) do
119 + case Enum.find(columns, &(&1[:field] == field)) do
120 120 %{sortable: :desc} -> ~w(desc asc)
121 121 %{sortable: :asc} -> ~w(asc desc)
122 122 end
  @@ -6,7 +6,10 @@ defmodule Phoenix.LiveDashboard.RequestLoggerPage do
6 6
7 7 @impl true
8 8 def mount(%{"stream" => stream}, session, socket) do
9 - %{"request_logger" => {param_key, cookie_key}} = session
9 + %{
10 + "request_logger" => {param_key, cookie_key},
11 + "cookie_domain" => cookie_domain
12 + } = session
10 13
11 14 if connected?(socket) do
12 15 # TODO: Remove || once we support Phoenix v1.5+
  @@ -20,6 +23,7 @@ defmodule Phoenix.LiveDashboard.RequestLoggerPage do
20 23 stream: stream,
21 24 param_key: param_key,
22 25 cookie_key: cookie_key,
26 + cookie_domain: read_cookie_domain(socket, cookie_domain),
23 27 cookie_enabled: false,
24 28 autoscroll_enabled: true,
25 29 messages_present: false
  @@ -135,6 +139,7 @@ defmodule Phoenix.LiveDashboard.RequestLoggerPage do
135 139 <div phx-hook="PhxRequestLoggerCookie" id="request-logger-cookie-buttons"
136 140 data-cookie-key=<%=@cookie_key %>
137 141 data-cookie-value=<%=sign(@socket, @cookie_key, @stream) %>
142 + <%= if @cookie_domain do %>data-cookie-domain="<%=@cookie_domain %>"<% end %>
138 143 data-cookie-enabled="<%= @cookie_enabled %>">
139 144
140 145 <%= if @cookie_enabled do %>
  @@ -177,4 +182,10 @@ defmodule Phoenix.LiveDashboard.RequestLoggerPage do
177 182 </div>
178 183 """
179 184 end
185 +
186 + defp read_cookie_domain(socket, :parent) do
187 + socket.host_uri.host |> String.split(".", parts: 2) |> List.last()
188 + end
189 +
190 + defp read_cookie_domain(_socket, domain), do: domain
180 191 end
Loading more files…