Open source, privacy-first web analytics. Lightweight, cookie-free Google Analytics alternative. Self-hosted or cloud.
TypeScript analyticsanalytics-dashboardclickhouseelixirgoogle-analyticsmarketingopen-source-analyticsphoenixplausible-analyticspostgresqlprivacyprivacy-friendlyself-hostedsimple-analyticsstatisticstailwindcssweb-analyticswebsite-analyticswebsite-statswebsite-tracking
Show database library in info endpoint
Uku Taht32116fe2c984
diff --git a/lib/plausible_web/controllers/api/external_controller.ex b/lib/plausible_web/controllers/api/external_controller.exindex 7b13eb90be..070d776307 100644--- a/lib/plausible_web/controllers/api/external_controller.ex+++ b/lib/plausible_web/controllers/api/external_controller.ex@@ -55,6 +55,34 @@ defmodule PlausibleWeb.Api.ExternalController do})end+ def info(conn, _params) do+ version_file = Application.app_dir(:plausible, "priv/static/version.json")++ version =+ with {:ok, file} <- File.read(version_file),+ {:ok, json} <- Jason.decode(file) do+ json+ else+ _ -> %{}+ end++ geo_database =+ case Geolix.metadata([:geolocation]) do+ %{geolocation: %{database_type: type}} ->+ type++ _ ->+ "(not configured)"+ end++ info =+ Map.merge(version, %{+ geo_database: geo_database+ })++ json(conn, info)+ end+defp parse_user_agent(conn) douser_agent = Plug.Conn.get_req_header(conn, "user-agent") |> List.first()diff --git a/lib/plausible_web/router.ex b/lib/plausible_web/router.exindex a66abf7b2d..ac04b287da 100644--- a/lib/plausible_web/router.ex+++ b/lib/plausible_web/router.ex@@ -113,6 +113,7 @@ defmodule PlausibleWeb.Router dopost "/event", Api.ExternalController, :eventget "/error", Api.ExternalController, :errorget "/health", Api.ExternalController, :health+ get "/info", Api.ExternalController, :infopost "/paddle/webhook", Api.PaddleController, :webhook