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
Add non-catch-all version of dashboard route (#6327)
Uku Tahta08c881eb87c
diff --git a/lib/plausible_web/router.ex b/lib/plausible_web/router.exindex 613929d534..4fac6d95cb 100644--- a/lib/plausible_web/router.ex+++ b/lib/plausible_web/router.ex@@ -734,6 +734,7 @@ defmodule PlausibleWeb.Router doput "/:domain/settings", SiteController, :update_settingsget "/:domain/export", StatsController, :csv_export+ get "/:domain", StatsController, :statsget "/:domain/*path", StatsController, :statsendenddiff --git a/test/plausible_web/components/billing/billing_test.exs b/test/plausible_web/components/billing/billing_test.exsindex 93ee24f79c..400af2c072 100644--- a/test/plausible_web/components/billing/billing_test.exs+++ b/test/plausible_web/components/billing/billing_test.exs@@ -330,7 +330,7 @@ defmodule PlausibleWeb.Components.BillingTest do)assert element_exists?(html, "[data-test-id='total-pageviews-dashboard-link']")- assert html =~ "/my-site.example.com/?period=custom"+ assert html =~ "/my-site.example.com?period=custom"endtest "renders no total link when no domain is provided" do@@ -354,8 +354,8 @@ defmodule PlausibleWeb.Components.BillingTest dohtml = render_monthly_pageview_usage(usage, 10_000)- assert html =~ "/example.com/?period=custom"- assert html =~ "/app.example.com/?period=custom"+ assert html =~ "/example.com?period=custom"+ assert html =~ "/app.example.com?period=custom"endtest "dashboard links include the billing cycle date range" do@@ -367,7 +367,7 @@ defmodule PlausibleWeb.Components.BillingTest do)assert html =~- "/my-site.example.com/?period=custom&from=2024-01-01&to=2024-01-31"+ "/my-site.example.com?period=custom&from=2024-01-01&to=2024-01-31"endenddiff --git a/test/plausible_web/controllers/invitation_controller_test.exs b/test/plausible_web/controllers/invitation_controller_test.exsindex ad3440f0fa..319afa46f4 100644--- a/test/plausible_web/controllers/invitation_controller_test.exs+++ b/test/plausible_web/controllers/invitation_controller_test.exs@@ -20,7 +20,7 @@ defmodule PlausibleWeb.Site.InvitationControllerTest doassert Phoenix.Flash.get(conn.assigns.flash, :success) =="You now have access to #{site.domain}"- assert redirected_to(conn) == "/#{URI.encode_www_form(site.domain)}/"+ assert redirected_to(conn) == Routes.stats_path(PlausibleWeb.Endpoint, :stats, site.domain)refute Repo.exists?(from(i in Plausible.Teams.Invitation, where: i.email == ^user.email))@@ -53,7 +53,7 @@ defmodule PlausibleWeb.Site.InvitationControllerTest doinvitation = invite_guest(site, user.email, role: :editor, inviter: owner)c1 = post(conn, "/sites/invitations/#{invitation.invitation_id}/accept")- assert redirected_to(c1) == "/#{URI.encode_www_form(site.domain)}/"+ assert redirected_to(c1) == Routes.stats_path(PlausibleWeb.Endpoint, :stats, site.domain)assert Phoenix.Flash.get(c1.assigns.flash, :success) =="You now have access to #{site.domain}"@@ -78,7 +78,8 @@ defmodule PlausibleWeb.Site.InvitationControllerTest doconn = post(conn, "/sites/invitations/#{transfer.transfer_id}/accept")- assert redirected_to(conn, 302) == "/#{URI.encode_www_form(site.domain)}/"+ assert redirected_to(conn, 302) ==+ Routes.stats_path(PlausibleWeb.Endpoint, :stats, site.domain)assert Phoenix.Flash.get(conn.assigns.flash, :success) =~"You now have access to"@@ -140,7 +141,8 @@ defmodule PlausibleWeb.Site.InvitationControllerTest doconn = post(conn, "/sites/invitations/#{transfer.transfer_id}/accept")- assert redirected_to(conn, 302) == "/#{URI.encode_www_form(site.domain)}/"+ assert redirected_to(conn, 302) ==+ Routes.stats_path(PlausibleWeb.Endpoint, :stats, site.domain)assert Phoenix.Flash.get(conn.assigns.flash, :success) =~"You now have access to"@@ -208,7 +210,8 @@ defmodule PlausibleWeb.Site.InvitationControllerTest do"/sites/invitations/#{transfer.transfer_id}/accept?skip_site_members_transfer=true")- assert redirected_to(conn, 302) == "/#{URI.encode_www_form(site.domain)}/"+ assert redirected_to(conn, 302) ==+ Routes.stats_path(PlausibleWeb.Endpoint, :stats, site.domain)assert Phoenix.Flash.get(conn.assigns.flash, :success) =~"You now have access to"diff --git a/test/plausible_web/controllers/site_controller_test.exs b/test/plausible_web/controllers/site_controller_test.exsindex 7f227bdbce..e603dceb62 100644--- a/test/plausible_web/controllers/site_controller_test.exs+++ b/test/plausible_web/controllers/site_controller_test.exs@@ -638,7 +638,7 @@ defmodule PlausibleWeb.SiteControllerTest do}})- assert redirected_to(conn) == "/example.com/"+ assert redirected_to(conn) == "/example.com"endenddiff --git a/test/plausible_web/live/customer_support/sites_test.exs b/test/plausible_web/live/customer_support/sites_test.exsindex 66e49f3843..e647710901 100644--- a/test/plausible_web/live/customer_support/sites_test.exs+++ b/test/plausible_web/live/customer_support/sites_test.exs@@ -28,7 +28,10 @@ defmodule PlausibleWeb.Live.CustomerSupport.SitesTest do~s|a[href$="#{URI.encode_www_form(site.domain)}/settings/general"]|)- assert element_exists?(html, ~s|a[href="/#{URI.encode_www_form(site.domain)}/"]|)+ assert element_exists?(+ html,+ ~s|a[href="#{Routes.stats_path(PlausibleWeb.Endpoint, :stats, site.domain)}"]|+ )endtest "404", %{conn: conn} dodiff --git a/test/plausible_web/live/customer_support/teams_test.exs b/test/plausible_web/live/customer_support/teams_test.exsindex fb273ca570..196979266e 100644--- a/test/plausible_web/live/customer_support/teams_test.exs+++ b/test/plausible_web/live/customer_support/teams_test.exs@@ -178,7 +178,7 @@ defmodule PlausibleWeb.Live.CustomerSupport.TeamsTest dohtml = render(lv)text = text(html)- assert element_exists?(html, ~s|a[href="/primary.example.com%2Ftest/"]|)+ assert element_exists?(html, ~s|a[href="/primary.example.com%2Ftest"]|)assert element_exists?(html, ~s|a[href="/primary.example.com%2Ftest/settings/general"]|)assert text =~ "primary.example.com/test"diff --git a/test/plausible_web/live/verification_test.exs b/test/plausible_web/live/verification_test.exsindex 959af2645b..4580e932e9 100644--- a/test/plausible_web/live/verification_test.exs+++ b/test/plausible_web/live/verification_test.exs@@ -195,7 +195,7 @@ defmodule PlausibleWeb.Live.VerificationTest dobuild(:pageview)])- assert_redirect(lv, "/#{URI.encode_www_form(site.domain)}/")+ assert_redirect(lv, Routes.stats_path(PlausibleWeb.Endpoint, :stats, site.domain))end@tag :ce_build_only@@ -207,7 +207,7 @@ defmodule PlausibleWeb.Live.VerificationTest dopopulate_stats(site, [build(:pageview)])- assert_redirect(lv, "/#{URI.encode_www_form(site.domain)}/")+ assert_redirect(lv, Routes.stats_path(PlausibleWeb.Endpoint, :stats, site.domain))endfor {installation_type_param, expected_text, saved_installation_type} <- [