|
|
|
|
@ -51,7 +51,7 @@ defmodule PlausibleWeb.Api.ExternalController do
|
|
|
|
|
name: params["name"],
|
|
|
|
|
hostname: strip_www(uri && uri.host),
|
|
|
|
|
domain: strip_www(params["domain"]) || strip_www(uri && uri.host),
|
|
|
|
|
pathname: uri && escape_quote(uri.path),
|
|
|
|
|
pathname: uri && (uri.path || "/"),
|
|
|
|
|
country_code: country_code,
|
|
|
|
|
fingerprint: calculate_fingerprint(conn, params),
|
|
|
|
|
operating_system: ua && os_name(ua),
|
|
|
|
|
@ -160,8 +160,6 @@ defmodule PlausibleWeb.Api.ExternalController do
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
defp escape_quote(s), do: String.replace(s, "'", "''")
|
|
|
|
|
|
|
|
|
|
defp clean_uri(uri) do
|
|
|
|
|
uri = URI.parse(String.trim(uri))
|
|
|
|
|
if uri.scheme in ["http", "https"] do
|
|
|
|
|
|