Nolt sso (along with a better nav dropdown) (#3395)
* Add SSO link with signed JWT token * Falls back to Nolt URL without SSO if token cannot be generated * Add profile image (gravatar) to Nolt SSO link * Improve navbar dropdown * Add 'contact support' link to nav dropdown * Add CSS rule to prevent horizontal jumps * Dark mode styling * Close dropdown when link is clicked * Clarify links in dropdown * Clarify CSS comment * Use Alpine.data() over window * Rename suggestions_dropdown -> combo-box * Mix format * Make logout link look good on dark mode * Use proxy for gravatar * Do not use Gravatar proxy in self-hosted * Changelog * Add Github Repo link to nav dropdown * Make dialyzer happy * Add proxy for Gravatar * Update assets/css/app.css Co-authored-by: hq1 <hq@mtod.org> * Update lib/plausible_web/controllers/avatar_controller.ex Co-authored-by: hq1 <hq@mtod.org> * Fix alpine <> Liveview integration --------- Co-authored-by: hq1 <hq@mtod.org>pull/3431/head
parent
99efb93082
commit
97b24c0492
@ -0,0 +1,77 @@
|
||||
// Courtesy of Benjamin von Polheim:
|
||||
// https://blog.devgenius.io/build-a-performat-autocomplete-using-phoenix-liveview-and-alpine-js-8bcbbed17ba7
|
||||
|
||||
export default (id) => ({
|
||||
isOpen: false,
|
||||
id: id,
|
||||
focus: null,
|
||||
setFocus(f) {
|
||||
this.focus = f;
|
||||
},
|
||||
initFocus() {
|
||||
if (this.focus === null) {
|
||||
this.setFocus(this.leastFocusableIndex())
|
||||
}
|
||||
},
|
||||
open() {
|
||||
this.initFocus()
|
||||
this.isOpen = true
|
||||
},
|
||||
suggestionsCount() {
|
||||
return this.$refs.suggestions?.querySelectorAll('li').length
|
||||
},
|
||||
hasCreatableOption() {
|
||||
return this.$refs.suggestions?.querySelector('li').classList.contains("creatable")
|
||||
},
|
||||
leastFocusableIndex() {
|
||||
if (this.suggestionsCount() === 0) {
|
||||
return 0
|
||||
}
|
||||
return this.hasCreatableOption() ? 0 : 1
|
||||
},
|
||||
maxFocusableIndex() {
|
||||
return this.hasCreatableOption() ? this.suggestionsCount() - 1 : this.suggestionsCount()
|
||||
},
|
||||
nextFocusableIndex() {
|
||||
const currentFocus = this.focus
|
||||
return currentFocus + 1 > this.maxFocusableIndex() ? this.leastFocusableIndex() : currentFocus + 1
|
||||
},
|
||||
prevFocusableIndex() {
|
||||
const currentFocus = this.focus
|
||||
return currentFocus - 1 >= this.leastFocusableIndex() ? currentFocus - 1 : this.maxFocusableIndex()
|
||||
},
|
||||
close(e) {
|
||||
// Pressing Escape should not propagate to window,
|
||||
// so we'll only close the suggestions pop-up
|
||||
if (this.isOpen && e.key === "Escape") {
|
||||
e.stopPropagation()
|
||||
}
|
||||
this.isOpen = false
|
||||
},
|
||||
select() {
|
||||
this.$refs[`dropdown-${this.id}-option-${this.focus}`]?.click()
|
||||
this.close()
|
||||
document.getElementById(this.id).blur()
|
||||
},
|
||||
scrollTo(idx) {
|
||||
this.$refs[`dropdown-${this.id}-option-${idx}`]?.scrollIntoView(
|
||||
{ block: 'nearest', behavior: 'smooth', inline: 'start' }
|
||||
)
|
||||
},
|
||||
focusNext() {
|
||||
const nextIndex = this.nextFocusableIndex()
|
||||
|
||||
if (!this.isOpen) this.open()
|
||||
|
||||
this.setFocus(nextIndex)
|
||||
this.scrollTo(nextIndex)
|
||||
},
|
||||
focusPrev() {
|
||||
const prevIndex = this.prevFocusableIndex()
|
||||
|
||||
if (!this.isOpen) this.open()
|
||||
|
||||
this.setFocus(prevIndex)
|
||||
this.scrollTo(prevIndex)
|
||||
}
|
||||
})
|
||||
@ -0,0 +1,26 @@
|
||||
// From https://alpinejs.dev/component/dropdown
|
||||
|
||||
export default () => ({
|
||||
open: false,
|
||||
toggle() {
|
||||
if (this.open) {
|
||||
return this.close()
|
||||
}
|
||||
|
||||
this.$refs.button.focus()
|
||||
this.open = true
|
||||
},
|
||||
|
||||
close(focusAfter) {
|
||||
if (! this.open) return
|
||||
|
||||
this.open = false
|
||||
focusAfter && focusAfter.focus()
|
||||
},
|
||||
|
||||
onPanelClick(e) {
|
||||
if (e.target.tagName === 'A') {
|
||||
this.close()
|
||||
}
|
||||
}
|
||||
})
|
||||
@ -1,80 +0,0 @@
|
||||
// Courtesy of Benjamin von Polheim:
|
||||
// https://blog.devgenius.io/build-a-performat-autocomplete-using-phoenix-liveview-and-alpine-js-8bcbbed17ba7
|
||||
let suggestionsDropdown = function(id) {
|
||||
return {
|
||||
isOpen: false,
|
||||
id: id,
|
||||
focus: null,
|
||||
setFocus(f) {
|
||||
this.focus = f;
|
||||
},
|
||||
initFocus() {
|
||||
if (this.focus === null) {
|
||||
this.setFocus(this.leastFocusableIndex())
|
||||
}
|
||||
},
|
||||
open() {
|
||||
this.initFocus()
|
||||
this.isOpen = true
|
||||
},
|
||||
suggestionsCount() {
|
||||
return this.$refs.suggestions?.querySelectorAll('li').length
|
||||
},
|
||||
hasCreatableOption() {
|
||||
return this.$refs.suggestions?.querySelector('li').classList.contains("creatable")
|
||||
},
|
||||
leastFocusableIndex() {
|
||||
if (this.suggestionsCount() === 0) {
|
||||
return 0
|
||||
}
|
||||
return this.hasCreatableOption() ? 0 : 1
|
||||
},
|
||||
maxFocusableIndex() {
|
||||
return this.hasCreatableOption() ? this.suggestionsCount() - 1 : this.suggestionsCount()
|
||||
},
|
||||
nextFocusableIndex() {
|
||||
const currentFocus = this.focus
|
||||
return currentFocus + 1 > this.maxFocusableIndex() ? this.leastFocusableIndex() : currentFocus + 1
|
||||
},
|
||||
prevFocusableIndex() {
|
||||
const currentFocus = this.focus
|
||||
return currentFocus - 1 >= this.leastFocusableIndex() ? currentFocus - 1 : this.maxFocusableIndex()
|
||||
},
|
||||
close(e) {
|
||||
// Pressing Escape should not propagate to window,
|
||||
// so we'll only close the suggestions pop-up
|
||||
if (this.isOpen && e.key === "Escape") {
|
||||
e.stopPropagation()
|
||||
}
|
||||
this.isOpen = false
|
||||
},
|
||||
select() {
|
||||
this.$refs[`dropdown-${this.id}-option-${this.focus}`]?.click()
|
||||
this.close()
|
||||
document.getElementById(this.id).blur()
|
||||
},
|
||||
scrollTo(idx) {
|
||||
this.$refs[`dropdown-${this.id}-option-${idx}`]?.scrollIntoView(
|
||||
{ block: 'nearest', behavior: 'smooth', inline: 'start' }
|
||||
)
|
||||
},
|
||||
focusNext() {
|
||||
const nextIndex = this.nextFocusableIndex()
|
||||
|
||||
if (!this.isOpen) this.open()
|
||||
|
||||
this.setFocus(nextIndex)
|
||||
this.scrollTo(nextIndex)
|
||||
},
|
||||
focusPrev() {
|
||||
const prevIndex = this.prevFocusableIndex()
|
||||
|
||||
if (!this.isOpen) this.open()
|
||||
|
||||
this.setFocus(prevIndex)
|
||||
this.scrollTo(prevIndex)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
window.suggestionsDropdown = suggestionsDropdown
|
||||
@ -0,0 +1,38 @@
|
||||
defmodule PlausibleWeb.AvatarController do
|
||||
@moduledoc """
|
||||
This module proxies requests to BASE_URL/avatar/:hash to www.gravatar.com/avatar/:hash.
|
||||
|
||||
The purpose is to make use of Gravatar's convenient avatar service without exposing information
|
||||
that could be used for tracking the Plausible user. Compared to requesting the Gravatar directly
|
||||
from the browser, this proxy module protects the Plausible user from disclosing to Gravatar:
|
||||
1. The client IP address
|
||||
2. User-Agent
|
||||
3. Referer header which can be used to track which site the user is visiting (i.e. plausible.io or self-hosted URL)
|
||||
|
||||
The downside is the added latency from the request having to go through the Plausible server, rather than contacting the
|
||||
local CDN server operated by Gravatar's service.
|
||||
"""
|
||||
use PlausibleWeb, :controller
|
||||
alias Plausible.HTTPClient
|
||||
|
||||
@gravatar_base_url "https://www.gravatar.com"
|
||||
def avatar(conn, params) do
|
||||
url = Path.join(@gravatar_base_url, ["avatar/", params["hash"]]) <> "?s=150&d=identicon"
|
||||
|
||||
case HTTPClient.impl().get(url) do
|
||||
{:ok, %Finch.Response{status: 200, body: body, headers: headers}} ->
|
||||
conn
|
||||
|> forward_headers(headers)
|
||||
|> send_resp(200, body)
|
||||
|
||||
{:error, _} ->
|
||||
send_resp(conn, 400, "")
|
||||
end
|
||||
end
|
||||
|
||||
@forwarded_headers ["content-type", "cache-control", "expires"]
|
||||
defp forward_headers(conn, headers) do
|
||||
headers_to_forward = Enum.filter(headers, fn {k, _} -> k in @forwarded_headers end)
|
||||
%Plug.Conn{conn | resp_headers: headers_to_forward}
|
||||
end
|
||||
end
|
||||
@ -1,72 +0,0 @@
|
||||
<nav class="relative z-20 py-8">
|
||||
<div class="container">
|
||||
<nav class="relative flex items-center justify-between sm:h-10 md:justify-center">
|
||||
<div class="flex items-center flex-1 md:absolute md:inset-y-0 md:left-0">
|
||||
<div class="flex items-center justify-between">
|
||||
<a href="<%= home_dest(@conn) %>">
|
||||
<%= img_tag(PlausibleWeb.Router.Helpers.static_path(@conn, "/images/icon/plausible_logo_dark.png"), class: "h-8 w-auto sm:h-10 -mt-2 hidden dark:inline", alt: "Plausible logo", loading: "lazy")%>
|
||||
<%= img_tag(PlausibleWeb.Router.Helpers.static_path(@conn, "/images/icon/plausible_logo.png"), class: "h-8 w-auto sm:h-10 -mt-2 inline dark:hidden", alt: "Plausible logo", loading: "lazy") %>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="absolute inset-y-0 right-0 flex items-center justify-end w-2/3 sm:w-auto">
|
||||
<%= cond do %>
|
||||
<% @conn.assigns[:current_user] -> %>
|
||||
<ul class="flex w-full sm:w-auto">
|
||||
<%= if Application.get_env(:plausible, :is_selfhost) do %>
|
||||
<li class="hidden mr-6 sm:block">
|
||||
<%= link(to: "https://github.com/plausible/analytics", class: "font-bold rounded m-1 ml-0 p-1 hover:bg-gray-200 dark:hover:bg-gray-900 dark:text-gray-100", style: "line-height: 40px;", target: "_blank") do %>
|
||||
<svg class="inline w-4 h-4 mr-px -mt-1" role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>GitHub icon</title><path fill="currentColor" d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"/></svg>
|
||||
Repo
|
||||
<% end %>
|
||||
</li>
|
||||
<% end %>
|
||||
<%= if Plausible.Billing.on_trial?(@conn.assigns[:current_user]) && !Application.get_env(:plausible, :is_selfhost) do %>
|
||||
<li class="hidden mr-6 sm:block">
|
||||
<%= link(trial_notificaton(@conn.assigns[:current_user]), to: "/settings", class: "font-bold text-sm text-yellow-900 dark:text-yellow-900 rounded p-2 bg-yellow-100 dark:bg-yellow-100", style: "line-height: 40px;") %>
|
||||
</li>
|
||||
<% end %>
|
||||
<li class="hidden mr-6 sm:block">
|
||||
<%= link("Docs", to: "https://plausible.io/docs", class: "font-bold rounded m-1 p-1 hover:bg-gray-200 dark:hover:bg-gray-900 dark:text-gray-100", style: "line-height: 40px;", target: "_blank", rel: "noreferrer") %>
|
||||
</li>
|
||||
<li class="w-full sm:w-auto">
|
||||
<div class="relative font-bold rounded">
|
||||
<div data-dropdown-trigger class="flex items-center justify-end p-1 m-1 rounded cursor-pointer hover:bg-gray-200 dark:hover:bg-gray-900 dark:text-gray-100">
|
||||
<span class="pl-2 mr-2 truncate"><%= @conn.assigns[:current_user].name || @conn.assigns[:current_user].email %></span>
|
||||
<svg style="height: 18px; transform: translateY(2px); fill: #606f7b;" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" x="0px" y="0px" viewBox="0 0 512 640" enable-background="new 0 0 512 512" xml:space="preserve"><g><circle cx="256" cy="52.8" r="50.8"/><circle cx="256" cy="256" r="50.8"/><circle cx="256" cy="459.2" r="50.8"/></g></svg>
|
||||
</div>
|
||||
|
||||
<div data-dropdown style="top: 42px; right: 0px; width: 185px;" class="absolute right-0 hidden bg-white border border-gray-300 rounded shadow-md dropdown-content dark:bg-gray-800 dark:border-gray-500">
|
||||
<%= link("Settings", to: "/settings", class: "block py-2 px-2 border-b border-gray-300 dark:border-gray-500 hover:bg-gray-100 dark:hover:bg-gray-900 dark:text-gray-100") %>
|
||||
<%= link("Log out", to: "/logout", class: "block py-2 px-2 hover:bg-gray-100 dark:hover:bg-gray-900 dark:text-gray-100") %>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<%= if @conn.assigns[:current_user] && !Application.get_env(:plausible, :is_selfhost) do %>
|
||||
<li id="changelog-notification" class="relative py-2"></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<% Keyword.fetch!(Application.get_env(:plausible, :selfhost), :disable_registration) != false -> %>
|
||||
<ul class="flex" x-show="!document.cookie.includes('logged_in=true')">
|
||||
<li>
|
||||
<div class="inline-flex">
|
||||
<a href="/login" class="font-medium text-gray-500 dark:text-gray-200 hover:text-gray-900 focus:outline-none focus:text-gray-900 transition duration-150 ease-in-out">Login</a>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
<% true -> %>
|
||||
<ul class="flex" x-show="!document.cookie.includes('logged_in=true')">
|
||||
<li>
|
||||
<div class="inline-flex">
|
||||
<a href="/login" class="font-medium text-gray-500 dark:text-gray-200 hover:text-gray-900 focus:outline-none focus:text-gray-900 transition duration-150 ease-in-out">Login</a>
|
||||
</div>
|
||||
<div class="inline-flex ml-6 rounded shadow">
|
||||
<a href="/register" class="inline-flex items-center justify-center px-5 py-2 text-base font-medium text-white bg-indigo-600 border border-transparent leading-6 rounded-md hover:bg-indigo-500 focus:outline-none focus:ring transition duration-150 ease-in-out">Sign up</a>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
<% end %>
|
||||
</div>
|
||||
</nav>
|
||||
</div>
|
||||
</nav>
|
||||
@ -0,0 +1,121 @@
|
||||
<nav class="relative z-20 py-8">
|
||||
<div class="container">
|
||||
<nav class="relative flex items-center justify-between sm:h-10 md:justify-center">
|
||||
<div class="flex items-center flex-1 md:absolute md:inset-y-0 md:left-0">
|
||||
<a href={home_dest(@conn)}>
|
||||
<%= img_tag(
|
||||
PlausibleWeb.Router.Helpers.static_path(
|
||||
@conn,
|
||||
"/images/icon/plausible_logo_dark.png"
|
||||
),
|
||||
class: "h-8 w-auto sm:h-10 -mt-2 hidden dark:inline",
|
||||
alt: "Plausible logo",
|
||||
loading: "lazy"
|
||||
) %>
|
||||
<%= img_tag(
|
||||
PlausibleWeb.Router.Helpers.static_path(@conn, "/images/icon/plausible_logo.png"),
|
||||
class: "h-8 w-auto sm:h-10 -mt-2 inline dark:hidden",
|
||||
alt: "Plausible logo",
|
||||
loading: "lazy"
|
||||
) %>
|
||||
</a>
|
||||
</div>
|
||||
<div class="absolute inset-y-0 right-0 flex items-center justify-end">
|
||||
<%= cond do %>
|
||||
<% @conn.assigns[:current_user] -> %>
|
||||
<ul class="flex items-center w-full sm:w-auto">
|
||||
<%= if Plausible.Billing.on_trial?(@conn.assigns[:current_user]) && !Application.get_env(:plausible, :is_selfhost) do %>
|
||||
<li class="hidden mr-6 sm:block">
|
||||
<%= link(trial_notificaton(@conn.assigns[:current_user]),
|
||||
to: "/settings",
|
||||
class:
|
||||
"text-sm text-yellow-900 dark:text-yellow-900 rounded px-3 py-2 rounded-md bg-yellow-100 dark:bg-yellow-100"
|
||||
) %>
|
||||
</li>
|
||||
<% end %>
|
||||
<li class="w-full sm:w-auto">
|
||||
<.dropdown>
|
||||
<:button class="flex items-center gap-3 px-3 py-2 rounded-md hover:bg-gray-100 dark:hover:bg-gray-800">
|
||||
<span class="font-medium truncate dark:text-gray-100">
|
||||
<%= @conn.assigns[:current_user].name %>
|
||||
</span>
|
||||
<%= img_tag(Plausible.Auth.User.profile_img_url(@conn.assigns[:current_user]),
|
||||
class: "w-7 rounded-full"
|
||||
) %>
|
||||
</:button>
|
||||
<:panel class="absolute right-0 z-10 mt-2 w-60 origin-top-right divide-y divide-gray-100 dark:divide-gray-400 rounded-md bg-white dark:bg-gray-800 shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none">
|
||||
<div class="px-3.5 py-3" role="none">
|
||||
<p class="block text-sm text-gray-500 dark:text-gray-400" role="none">
|
||||
Signed in as
|
||||
</p>
|
||||
<p class="truncate font-medium text-gray-900 dark:text-gray-100" role="none">
|
||||
<%= @conn.assigns[:current_user].email %>
|
||||
</p>
|
||||
</div>
|
||||
<div class="py-1.5" role="none">
|
||||
<.dropdown_link href="/settings">Account Settings</.dropdown_link>
|
||||
<.dropdown_link new_tab href="https://plausible.io/docs">
|
||||
Help Center
|
||||
</.dropdown_link>
|
||||
<%= if Application.get_env(:plausible, :is_selfhost) do %>
|
||||
<.dropdown_link new_tab href="https://github.com/plausible/analytics">
|
||||
Github Repo
|
||||
</.dropdown_link>
|
||||
<% else %>
|
||||
<.dropdown_link new_tab href="https://plausible.io/contact">
|
||||
Contact Support
|
||||
</.dropdown_link>
|
||||
<.dropdown_link new_tab href="https://feedback.plausible.io">
|
||||
Feature Requests
|
||||
</.dropdown_link>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="py-1.5" role="none">
|
||||
<.dropdown_link href="/logout">Log Out</.dropdown_link>
|
||||
</div>
|
||||
</:panel>
|
||||
</.dropdown>
|
||||
</li>
|
||||
<%= if @conn.assigns[:current_user] && !Application.get_env(:plausible, :is_selfhost) do %>
|
||||
<li id="changelog-notification" class="relative py-2"></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<% Keyword.fetch!(Application.get_env(:plausible, :selfhost), :disable_registration) != false -> %>
|
||||
<ul class="flex" x-show="!document.cookie.includes('logged_in=true')">
|
||||
<li>
|
||||
<div class="inline-flex">
|
||||
<a
|
||||
href="/login"
|
||||
class="font-medium text-gray-500 dark:text-gray-200 hover:text-gray-900 focus:outline-none focus:text-gray-900 transition duration-150 ease-in-out"
|
||||
>
|
||||
Login
|
||||
</a>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
<% true -> %>
|
||||
<ul class="flex" x-show="!document.cookie.includes('logged_in=true')">
|
||||
<li>
|
||||
<div class="inline-flex">
|
||||
<a
|
||||
href="/login"
|
||||
class="font-medium text-gray-500 dark:text-gray-200 hover:text-gray-900 focus:outline-none focus:text-gray-900 transition duration-150 ease-in-out"
|
||||
>
|
||||
Login
|
||||
</a>
|
||||
</div>
|
||||
<div class="inline-flex ml-6 rounded shadow">
|
||||
<a
|
||||
href="/register"
|
||||
class="inline-flex items-center justify-center px-5 py-2 text-base font-medium text-white bg-indigo-600 border border-transparent leading-6 rounded-md hover:bg-indigo-500 focus:outline-none focus:ring transition duration-150 ease-in-out"
|
||||
>
|
||||
Sign up
|
||||
</a>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
<% end %>
|
||||
</div>
|
||||
</nav>
|
||||
</div>
|
||||
</nav>
|
||||
@ -0,0 +1,34 @@
|
||||
defmodule PlausibleWeb.AvatarControllerTest do
|
||||
use PlausibleWeb.ConnCase, async: true
|
||||
|
||||
import Mox
|
||||
setup :verify_on_exit!
|
||||
|
||||
describe "GET /avatar/:hash" do
|
||||
test "proxies the request to gravatar", %{conn: conn} do
|
||||
expect(
|
||||
Plausible.HTTPClient.Mock,
|
||||
:get,
|
||||
fn "https://www.gravatar.com/avatar/myhash?s=150&d=identicon" ->
|
||||
{:ok,
|
||||
%Finch.Response{
|
||||
status: 200,
|
||||
body: "avatar response body",
|
||||
headers: [
|
||||
{"content-type", "image/png"},
|
||||
{"cache-control", "max-age=300"},
|
||||
{"expires", "soon"}
|
||||
]
|
||||
}}
|
||||
end
|
||||
)
|
||||
|
||||
conn = get(conn, "/avatar/myhash")
|
||||
|
||||
assert response(conn, 200) =~ "avatar response body"
|
||||
assert {"content-type", "image/png"} in conn.resp_headers
|
||||
assert {"cache-control", "max-age=300"} in conn.resp_headers
|
||||
assert {"expires", "soon"} in conn.resp_headers
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
Reference in New Issue