HOTFIX: add domain blacklist

This commit is contained in:
Uku Taht 2021-09-28 21:26:36 +02:00
parent bd7de59a9c
commit 015dcfa051
2 changed files with 8 additions and 2 deletions

View File

@ -129,6 +129,11 @@ log_level =
|> get_var_from_path_or_env("LOG_LEVEL", "warn")
|> String.to_existing_atom()
domain_blacklist =
config_dir
|> get_var_from_path_or_env("DOMAIN_BLACKLIST", "")
|> String.split(",")
is_selfhost =
config_dir
|> get_var_from_path_or_env("SELFHOST", "true")
@ -174,7 +179,8 @@ config :plausible,
site_limit: site_limit,
site_limit_exempt: site_limit_exempt,
is_selfhost: is_selfhost,
custom_script_name: custom_script_name
custom_script_name: custom_script_name,
domain_blacklist: domain_blacklist
config :plausible, :selfhost,
disable_authentication: disable_auth,

View File

@ -71,7 +71,7 @@ defmodule PlausibleWeb.Api.ExternalController do
ua = parse_user_agent(conn)
if is_bot?(ua) do
if is_bot?(ua) || params["domain"] in Application.get_env(:plausible, :domain_blacklist) do
:ok
else
uri = params["url"] && URI.parse(params["url"])