mirror of
https://github.com/plausible/analytics.git
synced 2024-12-23 17:44:43 +03:00
Verification: prioritize domain mismatch over multiple snippets (#4146)
This commit is contained in:
parent
0381bc6121
commit
78c5762761
@ -187,6 +187,10 @@ defmodule Plausible.Verification.Diagnostics do
|
|||||||
error(@errors.proxy_general)
|
error(@errors.proxy_general)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def interpret(%__MODULE__{data_domain_mismatch?: true}, "https://" <> domain) do
|
||||||
|
error(@errors.different_data_domain, domain: domain)
|
||||||
|
end
|
||||||
|
|
||||||
def interpret(
|
def interpret(
|
||||||
%__MODULE__{snippets_found_in_head: count_head, snippets_found_in_body: count_body},
|
%__MODULE__{snippets_found_in_head: count_head, snippets_found_in_body: count_body},
|
||||||
_url
|
_url
|
||||||
@ -238,10 +242,6 @@ defmodule Plausible.Verification.Diagnostics do
|
|||||||
error(@errors.snippet_in_body)
|
error(@errors.snippet_in_body)
|
||||||
end
|
end
|
||||||
|
|
||||||
def interpret(%__MODULE__{data_domain_mismatch?: true}, "https://" <> domain) do
|
|
||||||
error(@errors.different_data_domain, domain: domain)
|
|
||||||
end
|
|
||||||
|
|
||||||
def interpret(
|
def interpret(
|
||||||
%__MODULE__{
|
%__MODULE__{
|
||||||
plausible_installed?: false,
|
plausible_installed?: false,
|
||||||
|
@ -671,6 +671,27 @@ defmodule Plausible.Verification.ChecksTest do
|
|||||||
|
|
||||||
assert_receive :redirect_sent
|
assert_receive :redirect_sent
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@many_snippets_with_domain_mismatch """
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<script defer data-domain="example.org" src="https://plausible.io/js/script.js"></script>
|
||||||
|
<script defer data-domain="example.org" src="https://plausible.io/js/script.js"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
Hello
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
"""
|
||||||
|
|
||||||
|
test "prioritizes data-domain mismatch over multiple snippets" do
|
||||||
|
stub_fetch_body(200, @many_snippets_with_domain_mismatch)
|
||||||
|
stub_installation()
|
||||||
|
|
||||||
|
run_checks()
|
||||||
|
|> Checks.interpret_diagnostics()
|
||||||
|
|> assert_error(@errors.different_data_domain, domain: "example.com")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
defp run_checks(extra_opts \\ []) do
|
defp run_checks(extra_opts \\ []) do
|
||||||
|
Loading…
Reference in New Issue
Block a user