mirror of
https://github.com/plausible/analytics.git
synced 2024-12-25 10:33:01 +03:00
97b24c0492
* 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>
35 lines
980 B
Elixir
35 lines
980 B
Elixir
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
|