diff --git a/.github/workflows/build-public-images-ghcr.yml b/.github/workflows/build-public-images-ghcr.yml index 0fdbba79c..7794b31c2 100644 --- a/.github/workflows/build-public-images-ghcr.yml +++ b/.github/workflows/build-public-images-ghcr.yml @@ -51,7 +51,7 @@ jobs: cache-from: type=gha cache-to: type=gha,mode=max build-args: | - MIX_ENV=small + MIX_ENV=ce BUILD_METADATA=${{ steps.meta.outputs.json }} ERL_FLAGS=+JPperf true diff --git a/.github/workflows/build-public-images.yml b/.github/workflows/build-public-images.yml index 0d12f6331..e88c932b9 100644 --- a/.github/workflows/build-public-images.yml +++ b/.github/workflows/build-public-images.yml @@ -46,7 +46,7 @@ jobs: cache-from: type=gha cache-to: type=gha,mode=max build-args: | - MIX_ENV=small + MIX_ENV=ce BUILD_METADATA=${{ steps.meta.outputs.json }} ERL_FLAGS=+JMsingle true diff --git a/.github/workflows/elixir.yml b/.github/workflows/elixir.yml index a84c53136..30dbb3a3e 100644 --- a/.github/workflows/elixir.yml +++ b/.github/workflows/elixir.yml @@ -10,7 +10,7 @@ concurrency: cancel-in-progress: true env: - CACHE_VERSION: v7 + CACHE_VERSION: v8 PERSISTENT_CACHE_DIR: cached jobs: @@ -19,7 +19,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - mix_env: ['test', 'small_test'] + mix_env: ['test', 'ce_test'] postgres_image: ['postgres:15', 'postgres:16'] env: MIX_ENV: ${{ matrix.mix_env }} @@ -97,7 +97,7 @@ jobs: - run: mix test --include slow --include minio --max-failures 1 --warnings-as-errors if: env.MIX_ENV == 'test' - run: mix test --include slow --max-failures 1 --warnings-as-errors - if: env.MIX_ENV == 'small_test' + if: env.MIX_ENV == 'ce_test' static: name: Static checks (format, credo, dialyzer) diff --git a/Dockerfile b/Dockerfile index 5915fe3cc..617d10e30 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,7 @@ #### Builder FROM hexpm/elixir:1.16.0-erlang-26.2.1-alpine-3.18.4 as buildcontainer -ARG MIX_ENV=small +ARG MIX_ENV=ce # preparation ENV MIX_ENV=$MIX_ENV @@ -60,7 +60,7 @@ LABEL maintainer="plausible.io " ARG BUILD_METADATA={} ENV BUILD_METADATA=$BUILD_METADATA ENV LANG=C.UTF-8 -ARG MIX_ENV=small +ARG MIX_ENV=ce ENV MIX_ENV=$MIX_ENV RUN adduser -S -H -u 999 -G nogroup plausible -g 'Plausible Analytics' diff --git a/config/runtime.exs b/config/runtime.exs index ad64d357f..77007ba01 100644 --- a/config/runtime.exs +++ b/config/runtime.exs @@ -6,11 +6,11 @@ if config_env() in [:dev, :test] do Envy.load(["config/.env.#{config_env()}"]) end -if config_env() == :small_dev do +if config_env() == :ce_dev do Envy.load(["config/.env.dev"]) end -if config_env() == :small_test do +if config_env() == :ce_test do Envy.load(["config/.env.test"]) end diff --git a/lib/plausible.ex b/lib/plausible.ex index a8fe326fa..27e4b6538 100644 --- a/lib/plausible.ex +++ b/lib/plausible.ex @@ -3,7 +3,7 @@ defmodule Plausible do Build-related macros """ - @small_builds [:small, :small_test, :small_dev] + @ce_builds [:ce, :ce_test, :ce_dev] defmacro __using__(_) do quote do @@ -12,16 +12,16 @@ defmodule Plausible do end end - defmacro on_full_build(clauses) do - do_on_full_build(clauses) + defmacro on_ee(clauses) do + do_on_ee(clauses) end - def do_on_full_build(do: block) do - do_on_full_build(do: block, else: nil) + def do_on_ee(do: block) do + do_on_ee(do: block, else: nil) end - def do_on_full_build(do: do_block, else: else_block) do - if Mix.env() not in @small_builds do + def do_on_ee(do: do_block, else: else_block) do + if Mix.env() not in @ce_builds do quote do unquote(do_block) end @@ -32,21 +32,21 @@ defmodule Plausible do end end - defmacro full_build?() do - full_build? = Mix.env() not in @small_builds + defmacro ee?() do + ee? = Mix.env() not in @ce_builds # Tricking dialyzer as per: # https://github.com/elixir-lang/elixir/blob/v1.12.3/lib/elixir/lib/gen_server.ex#L771-L778 quote do - :erlang.phash2(1, 1) == 0 and unquote(full_build?) + :erlang.phash2(1, 1) == 0 and unquote(ee?) end end - defmacro small_build?() do - small_build? = Mix.env() in @small_builds + defmacro ce_build?() do + ce_build? = Mix.env() in @ce_builds quote do - unquote(small_build?) + unquote(ce_build?) end end end diff --git a/lib/plausible/application.ex b/lib/plausible/application.ex index f197ec6a0..9c47ec7a1 100644 --- a/lib/plausible/application.ex +++ b/lib/plausible/application.ex @@ -7,7 +7,7 @@ defmodule Plausible.Application do require Logger def start(_type, _args) do - on_full_build(do: Plausible.License.ensure_valid_license()) + on_ee(do: Plausible.License.ensure_valid_license()) children = [ Plausible.Cache.Stats, diff --git a/lib/plausible/auth/auth.ex b/lib/plausible/auth/auth.ex index 41cc124f8..4eaf5df78 100644 --- a/lib/plausible/auth/auth.ex +++ b/lib/plausible/auth/auth.ex @@ -57,7 +57,7 @@ defmodule Plausible.Auth do ) end - on_full_build do + on_ee do def is_super_admin?(nil), do: false def is_super_admin?(%Plausible.Auth.User{id: id}), do: is_super_admin?(id) diff --git a/lib/plausible/auth/user.ex b/lib/plausible/auth/user.ex index 80fa87992..03f288121 100644 --- a/lib/plausible/auth/user.ex +++ b/lib/plausible/auth/user.ex @@ -252,7 +252,7 @@ defmodule Plausible.Auth.User do end defp trial_expiry() do - on_full_build do + on_ee do Timex.today() |> Timex.shift(days: 30) else Timex.today() |> Timex.shift(years: 100) @@ -260,7 +260,7 @@ defmodule Plausible.Auth.User do end defp set_email_verification_status(user) do - on_full_build do + on_ee do change(user, email_verified: false) else selfhosted_config = Application.get_env(:plausible, :selfhost) diff --git a/lib/plausible/auth/user_admin.ex b/lib/plausible/auth/user_admin.ex index 19cdcdd5a..c219897ba 100644 --- a/lib/plausible/auth/user_admin.ex +++ b/lib/plausible/auth/user_admin.ex @@ -126,7 +126,7 @@ defmodule Plausible.Auth.UserAdmin do end end - on_full_build do + on_ee do defp usage_link(user) do path = PlausibleWeb.Router.Helpers.admin_path(PlausibleWeb.Endpoint, :usage, user.id) {:safe, ~s(Usage)} diff --git a/lib/plausible/billing/quota.ex b/lib/plausible/billing/quota.ex index cd8a10446..a6505e5df 100644 --- a/lib/plausible/billing/quota.ex +++ b/lib/plausible/billing/quota.ex @@ -45,7 +45,7 @@ defmodule Plausible.Billing.Quota do end end - on_full_build do + on_ee do @limit_sites_since ~D[2021-05-05] @site_limit_for_trials 10 @team_member_limit_for_trials 3 @@ -349,7 +349,7 @@ defmodule Plausible.Billing.Quota do stats_api_usage = from a in Plausible.Auth.ApiKey, where: a.user_id == ^user.id queries = - on_full_build do + on_ee do funnels_usage_query = from f in "funnels", inner_join: os in subquery(owned_sites_query(user)), @@ -378,7 +378,7 @@ defmodule Plausible.Billing.Quota do props_exist = is_list(site.allowed_event_props) && site.allowed_event_props != [] funnels_exist = - on_full_build do + on_ee do Plausible.Repo.exists?(from f in Plausible.Funnel, where: f.site_id == ^site.id) else false diff --git a/lib/plausible/exports.ex b/lib/plausible/exports.ex index dbabcd7ff..efaa2102b 100644 --- a/lib/plausible/exports.ex +++ b/lib/plausible/exports.ex @@ -59,7 +59,7 @@ defmodule Plausible.Exports do } end - Plausible.on_full_build do + Plausible.on_ee do defp sampled(table) do Plausible.Stats.Sampling.add_query_hint(from(table)) end diff --git a/lib/plausible/goal/schema.ex b/lib/plausible/goal/schema.ex index b4c0967bb..99e335f95 100644 --- a/lib/plausible/goal/schema.ex +++ b/lib/plausible/goal/schema.ex @@ -9,7 +9,7 @@ defmodule Plausible.Goal do field :event_name, :string field :page_path, :string - on_full_build do + on_ee do field :currency, Ecto.Enum, values: Money.Currency.known_current_currencies() many_to_many :funnels, Plausible.Funnel, join_through: Plausible.Funnel.Step else @@ -22,7 +22,7 @@ defmodule Plausible.Goal do timestamps() end - @fields [:id, :site_id, :event_name, :page_path] ++ on_full_build(do: [:currency], else: []) + @fields [:id, :site_id, :event_name, :page_path] ++ on_ee(do: [:currency], else: []) def changeset(goal, attrs \\ %{}) do goal @@ -77,7 +77,7 @@ defmodule Plausible.Goal do end defp maybe_drop_currency(changeset) do - if full_build?() and get_field(changeset, :page_path) do + if ee?() and get_field(changeset, :page_path) do delete_change(changeset, :currency) else changeset diff --git a/lib/plausible/goals.ex b/lib/plausible/goals.ex index 32e88419c..867836e45 100644 --- a/lib/plausible/goals.ex +++ b/lib/plausible/goals.ex @@ -22,7 +22,7 @@ defmodule Plausible.Goals do Repo.transaction(fn -> case insert_goal(site, params, upsert?) do {:ok, :insert, goal} -> - on_full_build do + on_ee do now = Keyword.get(opts, :now, DateTime.utc_now()) # credo:disable-for-next-line Credo.Check.Refactor.Nesting if Plausible.Goal.Revenue.revenue?(goal) do @@ -95,7 +95,7 @@ defmodule Plausible.Goals do order_by: [desc: g.id], preload: [:site] - if opts[:preload_funnels?] == true and full_build?() do + if opts[:preload_funnels?] == true and ee?() do from(g in query, left_join: assoc(g, :funnels), group_by: g.id, @@ -128,7 +128,7 @@ defmodule Plausible.Goals do where: g.site_id == ^site_id ) - goal_query = on_full_build(do: preload(goal_query, funnels: :steps), else: goal_query) + goal_query = on_ee(do: preload(goal_query, funnels: :steps), else: goal_query) result = Multi.new() diff --git a/lib/plausible/ingestion/event.ex b/lib/plausible/ingestion/event.ex index 6dd680f61..eff04ae2e 100644 --- a/lib/plausible/ingestion/event.ex +++ b/lib/plausible/ingestion/event.ex @@ -290,7 +290,7 @@ defmodule Plausible.Ingestion.Event do defp put_props(%__MODULE__{} = event), do: event defp put_revenue(event) do - on_full_build do + on_ee do attrs = Plausible.Ingestion.Event.Revenue.get_revenue_attrs(event) update_event_attrs(event, attrs) else diff --git a/lib/plausible/ingestion/request.ex b/lib/plausible/ingestion/request.ex index c5f6818e4..fa2218611 100644 --- a/lib/plausible/ingestion/request.ex +++ b/lib/plausible/ingestion/request.ex @@ -42,7 +42,7 @@ defmodule Plausible.Ingestion.Request do field :pathname, :string field :props, :map - on_full_build do + on_ee do field :revenue_source, :map end @@ -95,7 +95,7 @@ defmodule Plausible.Ingestion.Request do end end - on_full_build do + on_ee do defp put_revenue_source(changeset, request_body) do Plausible.Ingestion.Request.Revenue.put_revenue_source(changeset, request_body) end diff --git a/lib/plausible/plugins/api/token.ex b/lib/plausible/plugins/api/token.ex index 4f64ccbe8..7fe3c2f2d 100644 --- a/lib/plausible/plugins/api/token.ex +++ b/lib/plausible/plugins/api/token.ex @@ -64,7 +64,7 @@ defmodule Plausible.Plugins.API.Token do can scan repositories for accidental secret commits. """ def prefix() do - on_full_build do + on_ee do env = Application.get_env(:plausible, :environment) case env do diff --git a/lib/plausible/s3.ex b/lib/plausible/s3.ex index 12be32fc2..44834688d 100644 --- a/lib/plausible/s3.ex +++ b/lib/plausible/s3.ex @@ -59,7 +59,7 @@ defmodule Plausible.S3 do # to make ClickHouse see MinIO in dev and test envs we replace # the host in the S3 URL with whatever's set in S3_CLICKHOUSE_HOST env var - if Mix.env() in [:dev, :test, :small_dev, :small_test] do + if Mix.env() in [:dev, :test, :ce_dev, :ce_test] do defp extract_s3_url(presigned_url) do [s3_url, _] = String.split(presigned_url, "?") diff --git a/lib/plausible/site/memberships/accept_invitation.ex b/lib/plausible/site/memberships/accept_invitation.ex index 44f9e20ac..bffe63105 100644 --- a/lib/plausible/site/memberships/accept_invitation.ex +++ b/lib/plausible/site/memberships/accept_invitation.ex @@ -106,7 +106,7 @@ defmodule Plausible.Site.Memberships.AcceptInvitation do |> downgrade_previous_owner(site, user) |> Multi.insert_or_update(:membership, membership) |> Multi.run(:update_locked_sites, fn _, _ -> - on_full_build do + on_ee do # At this point this function should be guaranteed to unlock # the site, via `Invitations.ensure_can_take_ownership/2`. :unlocked = Billing.SiteLocker.update_sites_for(user, send_email?: false) diff --git a/lib/plausible/site/memberships/invitations.ex b/lib/plausible/site/memberships/invitations.ex index 5c2bbe453..c8569aad3 100644 --- a/lib/plausible/site/memberships/invitations.ex +++ b/lib/plausible/site/memberships/invitations.ex @@ -64,7 +64,7 @@ defmodule Plausible.Site.Memberships.Invitations do :ok end - on_full_build do + on_ee do @spec ensure_can_take_ownership(Site.t(), Auth.User.t()) :: :ok | {:error, Quota.over_limits_error() | :no_plan} def ensure_can_take_ownership(site, new_owner) do diff --git a/lib/plausible/stats.ex b/lib/plausible/stats.ex index b37e8fe77..3a5f33a7b 100644 --- a/lib/plausible/stats.ex +++ b/lib/plausible/stats.ex @@ -31,7 +31,7 @@ defmodule Plausible.Stats do CurrentVisitors.current_visitors(site) end - on_full_build do + on_ee do def funnel(site, query, funnel) do include_sentry_replay_info() Plausible.Stats.Funnel.funnel(site, query, funnel) diff --git a/lib/plausible/stats/aggregate.ex b/lib/plausible/stats/aggregate.ex index 68b96183a..66005446b 100644 --- a/lib/plausible/stats/aggregate.ex +++ b/lib/plausible/stats/aggregate.ex @@ -5,7 +5,7 @@ defmodule Plausible.Stats.Aggregate do import Ecto.Query alias Plausible.Stats.{Query, Util} - @revenue_metrics on_full_build(do: Plausible.Stats.Goal.Revenue.revenue_metrics(), else: []) + @revenue_metrics on_ee(do: Plausible.Stats.Goal.Revenue.revenue_metrics(), else: []) @event_metrics [ :visitors, @@ -20,7 +20,7 @@ defmodule Plausible.Stats.Aggregate do def aggregate(site, query, metrics) do {currency, metrics} = - on_full_build do + on_ee do Plausible.Stats.Goal.Revenue.get_revenue_tracking_currency(site, query, metrics) else {nil, metrics} @@ -214,7 +214,7 @@ defmodule Plausible.Stats.Aggregate do defp maybe_round_value(entry), do: entry - on_full_build do + on_ee do defp cast_revenue_metrics_to_money(results, revenue_goals) do Plausible.Stats.Goal.Revenue.cast_revenue_metrics_to_money(results, revenue_goals) end diff --git a/lib/plausible/stats/base.ex b/lib/plausible/stats/base.ex index 463461bf8..4481c6bf3 100644 --- a/lib/plausible/stats/base.ex +++ b/lib/plausible/stats/base.ex @@ -44,7 +44,7 @@ defmodule Plausible.Stats.Base do where: e.timestamp >= ^first_datetime and e.timestamp < ^last_datetime ) - on_full_build do + on_ee do q = Plausible.Stats.Sampling.add_query_hint(q, query) end @@ -147,7 +147,7 @@ defmodule Plausible.Stats.Base do from s in q, where: s.start >= ^first_datetime and s.start < ^last_datetime end - on_full_build do + on_ee do sessions_q = Plausible.Stats.Sampling.add_query_hint(sessions_q, query) end @@ -237,7 +237,7 @@ defmodule Plausible.Stats.Base do } end - on_full_build do + on_ee do defp select_event_metric(:total_revenue) do %{total_revenue: Plausible.Stats.Goal.Revenue.total_revenue_query()} end diff --git a/lib/plausible/stats/breakdown.ex b/lib/plausible/stats/breakdown.ex index 190d4cc4f..7946b22f3 100644 --- a/lib/plausible/stats/breakdown.ex +++ b/lib/plausible/stats/breakdown.ex @@ -13,7 +13,7 @@ defmodule Plausible.Stats.Breakdown do @session_metrics [:visits, :bounce_rate, :visit_duration] - @revenue_metrics on_full_build(do: Plausible.Stats.Goal.Revenue.revenue_metrics(), else: []) + @revenue_metrics on_ee(do: Plausible.Stats.Goal.Revenue.revenue_metrics(), else: []) @event_metrics [:visitors, :pageviews, :events, :percentage] ++ @revenue_metrics @@ -38,7 +38,7 @@ defmodule Plausible.Stats.Breakdown do no_revenue = {nil, metrics -- @revenue_metrics} {revenue_goals, metrics} = - on_full_build do + on_ee do if Plausible.Billing.Feature.RevenueGoals.enabled?(site) do revenue_goals = Enum.filter(event_goals, &Plausible.Goal.Revenue.revenue?/1) metrics = if Enum.empty?(revenue_goals), do: metrics -- @revenue_metrics, else: metrics @@ -123,7 +123,7 @@ defmodule Plausible.Stats.Breakdown do def breakdown(site, query, "event:props:" <> custom_prop = property, metrics, pagination, opts) do {currency, metrics} = - on_full_build do + on_ee do Plausible.Stats.Goal.Revenue.get_revenue_tracking_currency(site, query, metrics) else {nil, metrics} @@ -786,7 +786,7 @@ defmodule Plausible.Stats.Breakdown do ]) end - on_full_build do + on_ee do defp cast_revenue_metrics_to_money(results, revenue_goals) do Plausible.Stats.Goal.Revenue.cast_revenue_metrics_to_money(results, revenue_goals) end diff --git a/lib/plausible/stats/clickhouse.ex b/lib/plausible/stats/clickhouse.ex index 139e92e99..52d2e889c 100644 --- a/lib/plausible/stats/clickhouse.ex +++ b/lib/plausible/stats/clickhouse.ex @@ -113,7 +113,7 @@ defmodule Plausible.Stats.Clickhouse do offset: ^offset ) - on_full_build do + on_ee do referrers = Plausible.Stats.Sampling.add_query_hint(referrers, 10_000_000) end @@ -193,7 +193,7 @@ defmodule Plausible.Stats.Clickhouse do order_by: [e.site_id, fragment("toStartOfHour(timestamp)")] ) - on_full_build do + on_ee do current_q = Plausible.Stats.Sampling.add_query_hint(current_q) end @@ -231,7 +231,7 @@ defmodule Plausible.Stats.Clickhouse do }, group_by: [e.site_id] - on_full_build do + on_ee do query = Plausible.Stats.Sampling.add_query_hint(query) end @@ -260,7 +260,7 @@ defmodule Plausible.Stats.Clickhouse do where: e.timestamp >= ^first_datetime and e.timestamp < ^last_datetime ) - on_full_build do + on_ee do q = Plausible.Stats.Sampling.add_query_hint(q, 10_000_000) end diff --git a/lib/plausible/stats/metrics.ex b/lib/plausible/stats/metrics.ex index b1c34f2bb..36a1c3743 100644 --- a/lib/plausible/stats/metrics.ex +++ b/lib/plausible/stats/metrics.ex @@ -17,7 +17,7 @@ defmodule Plausible.Stats.Metrics do :events, :conversion_rate, :time_on_page - ] ++ on_full_build(do: Plausible.Stats.Goal.Revenue.revenue_metrics(), else: []) + ] ++ on_ee(do: Plausible.Stats.Goal.Revenue.revenue_metrics(), else: []) @metric_mappings Enum.into(@all_metrics, %{}, fn metric -> {to_string(metric), metric} end) diff --git a/lib/plausible/stats/query.ex b/lib/plausible/stats/query.ex index 6af57aca8..ccbd537ff 100644 --- a/lib/plausible/stats/query.ex +++ b/lib/plausible/stats/query.ex @@ -29,7 +29,7 @@ defmodule Plausible.Stats.Query do |> put_imported_opts(site, params) |> maybe_drop_prop_filter(site) - on_full_build do + on_ee do query = Plausible.Stats.Sampling.put_threshold(query, params) end diff --git a/lib/plausible/stats/timeseries.ex b/lib/plausible/stats/timeseries.ex index 2efa6418b..38bc49eaa 100644 --- a/lib/plausible/stats/timeseries.ex +++ b/lib/plausible/stats/timeseries.ex @@ -18,7 +18,7 @@ defmodule Plausible.Stats.Timeseries do @typep value :: nil | integer() | float() @type results :: nonempty_list(%{required(:date) => Date.t(), required(metric()) => value()}) - @revenue_metrics on_full_build(do: Plausible.Stats.Goal.Revenue.revenue_metrics(), else: []) + @revenue_metrics on_ee(do: Plausible.Stats.Goal.Revenue.revenue_metrics(), else: []) @event_metrics [:visitors, :pageviews, :events, :conversion_rate] ++ @revenue_metrics @session_metrics [:visits, :bounce_rate, :visit_duration, :views_per_visit] @@ -29,7 +29,7 @@ defmodule Plausible.Stats.Timeseries do session_metrics = Enum.filter(metrics, &(&1 in @session_metrics)) {currency, event_metrics} = - on_full_build do + on_ee do Plausible.Stats.Goal.Revenue.get_revenue_tracking_currency(site, query, event_metrics) else {nil, event_metrics} @@ -249,7 +249,7 @@ defmodule Plausible.Stats.Timeseries do end) end - on_full_build do + on_ee do defp cast_revenue_metrics_to_money(results, revenue_goals) do Plausible.Stats.Goal.Revenue.cast_revenue_metrics_to_money(results, revenue_goals) end diff --git a/lib/plausible/users.ex b/lib/plausible/users.ex index 727e35bb4..03e4f8b88 100644 --- a/lib/plausible/users.ex +++ b/lib/plausible/users.ex @@ -12,7 +12,7 @@ defmodule Plausible.Users do alias Plausible.Repo @spec on_trial?(Auth.User.t()) :: boolean() - on_full_build do + on_ee do def on_trial?(%Auth.User{trial_expiry_date: nil}), do: false def on_trial?(user) do @@ -36,7 +36,7 @@ defmodule Plausible.Users do end @spec accept_traffic_until(Auth.User.t()) :: Date.t() - on_full_build do + on_ee do def accept_traffic_until(user) do user = with_subscription(user) diff --git a/lib/plausible_release.ex b/lib/plausible_release.ex index 057e3bc53..9d23382e7 100644 --- a/lib/plausible_release.ex +++ b/lib/plausible_release.ex @@ -12,7 +12,7 @@ defmodule Plausible.Release do ] def should_be_first_launch? do - on_full_build do + on_ee do false else not (_has_users? = Repo.exists?(Plausible.Auth.User)) diff --git a/lib/plausible_web/controllers/api/stats_controller.ex b/lib/plausible_web/controllers/api/stats_controller.ex index 6b9798d10..05ea63217 100644 --- a/lib/plausible_web/controllers/api/stats_controller.ex +++ b/lib/plausible_web/controllers/api/stats_controller.ex @@ -11,7 +11,7 @@ defmodule PlausibleWeb.Api.StatsController do require Logger - @revenue_metrics on_full_build(do: Plausible.Stats.Goal.Revenue.revenue_metrics(), else: []) + @revenue_metrics on_ee(do: Plausible.Stats.Goal.Revenue.revenue_metrics(), else: []) plug(:date_validation_plug) @@ -347,10 +347,10 @@ defmodule PlausibleWeb.Api.StatsController do top_stats_entry(results, comparison, "Unique visitors", :total_visitors), top_stats_entry(results, comparison, "Unique conversions", :visitors), top_stats_entry(results, comparison, "Total conversions", :events), - on_full_build do + on_ee do top_stats_entry(results, comparison, "Average revenue", :average_revenue, &format_money/1) end, - on_full_build do + on_ee do top_stats_entry(results, comparison, "Total revenue", :total_revenue, &format_money/1) end, top_stats_entry(results, comparison, "Conversion rate", :conversion_rate) @@ -450,7 +450,7 @@ defmodule PlausibleWeb.Api.StatsController do end end - on_full_build do + on_ee do def funnel(conn, %{"id" => funnel_id} = params) do site = Plausible.Repo.preload(conn.assigns.site, :owner) @@ -1347,7 +1347,7 @@ defmodule PlausibleWeb.Api.StatsController do end end - on_full_build do + on_ee do defdelegate format_revenue_metric(metric_value), to: PlausibleWeb.Controllers.API.Revenue defdelegate format_money(money), to: PlausibleWeb.Controllers.API.Revenue else diff --git a/lib/plausible_web/controllers/stats_controller.ex b/lib/plausible_web/controllers/stats_controller.ex index 8e331f8a7..bae2b0d6c 100644 --- a/lib/plausible_web/controllers/stats_controller.ex +++ b/lib/plausible_web/controllers/stats_controller.ex @@ -92,7 +92,7 @@ defmodule PlausibleWeb.StatsController do end end - on_full_build do + on_ee do defp list_funnels(site) do Plausible.Funnels.list(site) end @@ -366,7 +366,7 @@ defmodule PlausibleWeb.StatsController do end defp is_dbip() do - on_full_build do + on_ee do false else Plausible.Geo.database_type() diff --git a/lib/plausible_web/endpoint.ex b/lib/plausible_web/endpoint.ex index 0cc4c91b9..a29ef9283 100644 --- a/lib/plausible_web/endpoint.ex +++ b/lib/plausible_web/endpoint.ex @@ -36,7 +36,7 @@ defmodule PlausibleWeb.Endpoint do static_paths = ~w(css js images favicon.ico) static_paths = - on_full_build do + on_ee do # NOTE: The Cloud uses custom robots.txt from https://github.com/plausible/website: https://plausible.io/robots.txt static_paths else @@ -50,7 +50,7 @@ defmodule PlausibleWeb.Endpoint do only: static_paths ) - on_full_build do + on_ee do plug(Plug.Static, at: "/kaffy", from: :kaffy, diff --git a/lib/plausible_web/live/goal_settings/form.ex b/lib/plausible_web/live/goal_settings/form.ex index d9d39c420..c6c41a330 100644 --- a/lib/plausible_web/live/goal_settings/form.ex +++ b/lib/plausible_web/live/goal_settings/form.ex @@ -149,7 +149,7 @@ defmodule PlausibleWeb.Live.GoalSettings.Form do
Plausible.Goal.Revenue.currency_options() diff --git a/lib/plausible_web/live/register_form.ex b/lib/plausible_web/live/register_form.ex index 619504318..57e9d4c17 100644 --- a/lib/plausible_web/live/register_form.ex +++ b/lib/plausible_web/live/register_form.ex @@ -64,7 +64,7 @@ defmodule PlausibleWeb.Live.RegisterForm do ~H"""

- <%= if small_build?() or @live_action == :register_from_invitation_form do %> + <%= if ce_build?() or @live_action == :register_from_invitation_form do %> Register your Plausible Analytics account <% else %> Register your 30-day free trial @@ -158,7 +158,7 @@ defmodule PlausibleWeb.Live.RegisterForm do <% end %> <% submit_text = - if small_build?() or @invitation do + if ce_build?() or @invitation do "Create my account →" else "Start my free trial →" diff --git a/lib/plausible_web/live/sites.ex b/lib/plausible_web/live/sites.ex index 3ef7f2f19..11123732e 100644 --- a/lib/plausible_web/live/sites.ex +++ b/lib/plausible_web/live/sites.ex @@ -682,7 +682,7 @@ defmodule PlausibleWeb.Live.Sites do defp check_limits(invitation, _), do: %{invitation: invitation} defp check_features(%{role: :owner, site: site} = invitation, user) do - case Invitations.check_feature_access(site, user, small_build?()) do + case Invitations.check_feature_access(site, user, ce_build?()) do :ok -> %{invitation: invitation} diff --git a/lib/plausible_web/router.ex b/lib/plausible_web/router.ex index 6a4fd7660..7a41da2d5 100644 --- a/lib/plausible_web/router.ex +++ b/lib/plausible_web/router.ex @@ -10,7 +10,7 @@ defmodule PlausibleWeb.Router do plug :fetch_live_flash plug :put_secure_browser_headers plug PlausibleWeb.Plugs.NoRobots - on_full_build(do: nil, else: plug(PlausibleWeb.FirstLaunchPlug, redirect_to: "/register")) + on_ee(do: nil, else: plug(PlausibleWeb.FirstLaunchPlug, redirect_to: "/register")) plug PlausibleWeb.SessionTimeoutPlug, timeout_after_seconds: @two_weeks_in_seconds plug PlausibleWeb.AuthPlug plug PlausibleWeb.LastSeenPlug @@ -51,7 +51,7 @@ defmodule PlausibleWeb.Router do plug :accepts, ["json"] end - on_full_build do + on_ee do pipeline :flags do plug :accepts, ["html"] plug :put_secure_browser_headers @@ -66,20 +66,20 @@ defmodule PlausibleWeb.Router do forward "/sent-emails", Bamboo.SentEmailViewerPlug end - on_full_build do + on_ee do use Kaffy.Routes, scope: "/crm", pipe_through: [PlausibleWeb.Plugs.NoRobots, PlausibleWeb.CRMAuthPlug] end - on_full_build do + on_ee do scope "/crm", PlausibleWeb do pipe_through :flags get "/auth/user/:user_id/usage", AdminController, :usage end end - on_full_build do + on_ee do scope path: "/flags" do pipe_through :flags forward "/", FunWithFlags.UI.Router, namespace: "flags" @@ -129,7 +129,7 @@ defmodule PlausibleWeb.Router do scope "/api/stats", PlausibleWeb.Api do pipe_through :internal_stats_api - on_full_build do + on_ee do get "/:domain/funnels/:id", StatsController, :funnel end @@ -168,7 +168,7 @@ defmodule PlausibleWeb.Router do get "/timeseries", ExternalStatsController, :timeseries end - on_full_build do + on_ee do scope "/api/v1/sites", PlausibleWeb.Api do pipe_through [:public_api, PlausibleWeb.AuthorizeSitesApiPlug] @@ -352,7 +352,7 @@ defmodule PlausibleWeb.Router do get "/:website/settings/goals", SiteController, :settings_goals get "/:website/settings/properties", SiteController, :settings_props - on_full_build do + on_ee do get "/:website/settings/funnels", SiteController, :settings_funnels end diff --git a/lib/plausible_web/templates/auth/activate.html.heex b/lib/plausible_web/templates/auth/activate.html.heex index b406face6..a1c8e2aa6 100644 --- a/lib/plausible_web/templates/auth/activate.html.heex +++ b/lib/plausible_web/templates/auth/activate.html.heex @@ -45,7 +45,7 @@ method: :post ) %> to <%= @conn.assigns[:current_user].email %> - <%= if full_build?() do %> + <%= if ee?() do %>
  • Contact us diff --git a/lib/plausible_web/templates/auth/password_reset_request_success.html.heex b/lib/plausible_web/templates/auth/password_reset_request_success.html.heex index 846a7c03e..6897c6925 100644 --- a/lib/plausible_web/templates/auth/password_reset_request_success.html.heex +++ b/lib/plausible_web/templates/auth/password_reset_request_success.html.heex @@ -11,13 +11,13 @@ You might have used an email address that's not registered in our database. Please verify the email address associated with your Plausible account and attempt the password reset once more.
  • - + Certain that you're using the correct email address but still aren't receiving the password reset email? Please check your spam folder or ask on our community-supported forum. - + Certain that you're using the correct email address but still aren't receiving the password reset email? Please check your spam folder or - <%= if full_build?() do %> + <%= if ee?() do %>

    Subscription Plan

    diff --git a/lib/plausible_web/templates/auth/verify_2fa.html.heex b/lib/plausible_web/templates/auth/verify_2fa.html.heex index f16601890..fbe78db27 100644 --- a/lib/plausible_web/templates/auth/verify_2fa.html.heex +++ b/lib/plausible_web/templates/auth/verify_2fa.html.heex @@ -30,7 +30,7 @@ > Use recovery code
    - <%= if full_build?() do %> + <%= if ee?() do %>
    Lost your recovery codes? Contact us diff --git a/lib/plausible_web/templates/auth/verify_2fa_recovery_code.html.heex b/lib/plausible_web/templates/auth/verify_2fa_recovery_code.html.heex index 8c893acf5..8905c056e 100644 --- a/lib/plausible_web/templates/auth/verify_2fa_recovery_code.html.heex +++ b/lib/plausible_web/templates/auth/verify_2fa_recovery_code.html.heex @@ -46,7 +46,7 @@ Enter verification code - <%= if full_build?() do %> + <%= if ee?() do %>
    Lost your recovery codes? Contact us diff --git a/lib/plausible_web/templates/email/google_analytics_import.html.heex b/lib/plausible_web/templates/email/google_analytics_import.html.heex index a9879165c..1c4621c7d 100644 --- a/lib/plausible_web/templates/email/google_analytics_import.html.heex +++ b/lib/plausible_web/templates/email/google_analytics_import.html.heex @@ -22,7 +22,7 @@
    If all of the above is fine, please try to do the import once again. Sometimes the Google Analytics API just randomly returns empty data. It's intermittent and random. Trying to do the import again may return what you need. - <%= if full_build?() do %> + <%= if ee?() do %>

    Please reply to this email to let us know if you're still experiencing issues with the import. <% end %> diff --git a/lib/plausible_web/templates/error/server_error.html.heex b/lib/plausible_web/templates/error/server_error.html.heex index 24077e525..41cc9123f 100644 --- a/lib/plausible_web/templates/error/server_error.html.heex +++ b/lib/plausible_web/templates/error/server_error.html.heex @@ -22,14 +22,14 @@

    There has been a server error. - <%= if full_build?() do %> + <%= if ee?() do %> But don't worry, we're on it! <% end %>

    - <%= if assigns[:trace_id] && full_build?() do %> + <%= if assigns[:trace_id] && ee?() do %> If you would like to help, tell us what you were trying to do. Our development team will receive your report. <% else %> We have been notified. @@ -40,7 +40,7 @@

    - <%= if full_build?() do %> + <%= if ee?() do %> <%= if assigns[:trace_id] do %>
    <%= form_for :error, Routes.error_report_path(PlausibleWeb.Endpoint, :submit_error_report), fn f -> %> diff --git a/lib/plausible_web/templates/layout/_footer.html.heex b/lib/plausible_web/templates/layout/_footer.html.heex index bc51a1b6c..1bbfe32b0 100644 --- a/lib/plausible_web/templates/layout/_footer.html.heex +++ b/lib/plausible_web/templates/layout/_footer.html.heex @@ -14,12 +14,12 @@ ) %>

    - <%= if full_build?() do %> + <%= if ee?() do %> Made and hosted in the EU 🇪🇺
    Solely funded by our subscribers. <% end %> - <%= if small_build?() do %> + <%= if ce_build?() do %> This dashboard is running on self-managed infrastructure, not tested by Plausible Analytics. We cannot vouch for its performance or reliability. For official managed hosting, check out <.styled_link href="https://plausible.io"> plausible.io diff --git a/lib/plausible_web/templates/layout/_header.html.heex b/lib/plausible_web/templates/layout/_header.html.heex index de0402c7f..f5cd4d944 100644 --- a/lib/plausible_web/templates/layout/_header.html.heex +++ b/lib/plausible_web/templates/layout/_header.html.heex @@ -28,7 +28,7 @@ <% @conn.assigns[:current_user] -> %>

      - <%= if @conn.assigns[:current_user] && full_build?() do %> + <%= if @conn.assigns[:current_user] && ee?() do %>
    • <% end %>
    diff --git a/lib/plausible_web/templates/layout/_tracking.html.heex b/lib/plausible_web/templates/layout/_tracking.html.heex index e999cbc67..d5451dc75 100644 --- a/lib/plausible_web/templates/layout/_tracking.html.heex +++ b/lib/plausible_web/templates/layout/_tracking.html.heex @@ -1,4 +1,4 @@ -<%= on_full_build do %> +<%= on_ee do %> <%= if !@conn.assigns[:skip_plausible_tracking] do %>