mirror of
https://github.com/plausible/analytics.git
synced 2024-12-23 09:33:19 +03:00
117eef000d
* Bump deps * Bump stack * Fix deprecation warnings * Fix VCR cassettes mismatch due to OTP-18414 Co-authored-by: Adrian Gruntkowski <adrian.gruntkowski@gmail.com> * Format & fix flaky tests * Handle raw IPv4 hostnames; test public suffix TLD * Configure locus db cache_dir So that maxmind unavailability doesn't affect application startup. PERSISTENT_CACHE_DIR env var is used to point locus at the GeoIP DB file. * WIP: Remove ExVCR * Fix test env config * Fixup exvcr * Remove exvcr from deps * Add convert script * Remove exvcr cassettes * Remove convert script * Rename test * Update moduledoc * Update dockerfile * Bump CI cache * Tag more slow tests, why not? * Use charlist for locus cache option * Pin nodejs * Merge google tests, make them async --------- Co-authored-by: Adrian Gruntkowski <adrian.gruntkowski@gmail.com>
31 lines
767 B
Elixir
31 lines
767 B
Elixir
defmodule Mix.Tasks.GenerateReferrerFavicons do
|
|
use Mix.Task
|
|
use Plausible.Repo
|
|
require Logger
|
|
|
|
@dialyzer {:nowarn_function, run: 1}
|
|
# coveralls-ignore-start
|
|
|
|
def run(_) do
|
|
entries =
|
|
:yamerl_constr.file(Application.app_dir(:plausible, "priv/ref_inspector/referers.yml"))
|
|
|> List.first()
|
|
|> Enum.map(fn {_key, val} -> val end)
|
|
|> Enum.concat()
|
|
|
|
domains =
|
|
Enum.reduce(entries, %{}, fn {key, val}, domains ->
|
|
domain =
|
|
Enum.into(val, %{})[~c"domains"]
|
|
|> List.first()
|
|
|
|
Map.put_new(domains, List.to_string(key), List.to_string(domain))
|
|
end)
|
|
|
|
File.write!(
|
|
Application.app_dir(:plausible, "priv/referer_favicon_domains.json"),
|
|
Jason.encode!(domains)
|
|
)
|
|
end
|
|
end
|