Skip to content

Open source, privacy-first web analytics. Lightweight, cookie-free Google Analytics alternative. Self-hosted or cloud.

Selfhosted version improvements (#89)

Chandra Tungathurthi517d4db2623e
diff --git a/HOSTING.md b/HOSTING.md
index f5106c1c9c..2efcf9b87c 100644
--- a/HOSTING.md
+++ b/HOSTING.md
@@ -27,21 +27,37 @@ Total cost: $105/mo
Besides the DockerHub registry, one can build docker image from [Dockerfile](./Dockerfile).
#### Up and Running
-The repo supplies with a [Docker Compose](./docker-compose.yml) file, this serves as a sample for running Plausible with Docker.
-In this sample, the db migration is done by default on startup, so you need to clean the data up every time you run:
-
-First run
-```bash
-$ docker-compose up
-```
-
-subsequent runs--
-```bash
-$ docker-compose down
-$ docker volume rm plausible_db-data -f
-$ docker-compose up
-```
-
+The repo supplies with a [Docker Compose](./docker-compose.yml) file and the sample [environment variables](./plausible-variables.sample.env) , this serves as a sample for running Plausible with Docker.
+
+- Running the setup takes care of the initial migration steps, this needs to be executed only once, on the first run.
+ ```bash
+ docker-compose run --rm setup
+ docker-compose down
+ ```
+
+- After the setup, you can start plausible as --
+ ```bash
+ docker-compose up -d plausible
+ ```
+ after a successful startup (can take upto 5 mins), `plausible` is available at port `80`, navigate to [`http://localhost`](http://localhost).
+
+- stopping plausible --
+ ```bash
+ docker-compose down
+ ```
+- purging and removing everything --
+ ```bash
+ docker-compose down
+ docker volume rm plausible_event-data -f
+ docker volume rm plausible_db-data -f
+ ```
+Note:
+- #1 you need to stop plausible and restart plausible if you change the environment variables.
+- #2 With docker-compose, you need to remove the existing container and rebuild if you want your changes need to be reflected:
+ ```bash
+ docker rmi -f plausible_plausible:latest
+ docker-compose up -d plausible
+ ```
### Non-docker building
It is possible to create a release artifact by running a release.
@@ -95,6 +111,11 @@ Following are the variables that can be used to configure the availability of th
- The current running environment. _defaults to **prod**_
- APP_VERSION (*String*)
- The version of the app running. _defaults to current docker tag_
+- DISABLE_AUTH (*Boolean String*)
+ - Disables authentication completely, no registration, login will be shown. _defaults to `false`_
+ - Note: This option is **not recommended** for production deployments.
+- DISABLE_REGISTRATION
+ - Disables registration of new users, keep your admin credentials handy ;) _defaults to `false`_
### Default User Generation
For self-hosting, a default user is generated during the [Database Migration](#Database Migration) to access Plausible. To be noted that, a default user is a user whose trial period expires in 100 Years ;).
diff --git a/config/config.exs b/config/config.exs
index 6b399ddae5..7aab559e85 100644
--- a/config/config.exs
+++ b/config/config.exs
@@ -8,6 +8,15 @@ config :plausible,
ecto_repos: [Plausible.Repo],
environment: System.get_env("ENVIRONMENT", "dev")
+disable_auth = String.to_existing_atom(System.get_env("DISABLE_AUTH", "false"))
+
+config :plausible, :selfhost,
+ disable_authentication: disable_auth,
+ disable_registration:
+ if(disable_auth,
+ do: true,
+ else: String.to_existing_atom(System.get_env("DISABLE_REGISTRATION", "false"))
+ )
config :plausible, :clickhouse,
hostname: System.get_env("CLICKHOUSE_DATABASE_HOST", "localhost"),
@@ -74,7 +83,7 @@ config :plausible, :paddle,
config :plausible,
Plausible.Repo,
- pool_size: String.to_integer(System.get_env("DATABASE_POOL_SIZE", "10")),
+ pool_size: String.to_integer(System.get_env("DATABASE_POOLSIZE", "10")),
timeout: 300_000,
connect_timeout: 300_000,
handshake_timeout: 300_000,
@@ -144,7 +153,7 @@ case mailer_adapter do
ssl: System.get_env("SMTP_HOST_SSL_ENABLED") || true,
retries: System.get_env("SMTP_RETRIES") || 2,
no_mx_lookups: System.get_env("SMTP_MX_LOOKUPS_ENABLED") || true,
- auth: :always
+ auth: :if_available
"Bamboo.LocalAdapter" ->
config :plausible, Plausible.Mailer, adapter: :"Elixir.#{mailer_adapter}"
diff --git a/config/dev.exs b/config/dev.exs
index 5da1a09952..20e8660572 100644
--- a/config/dev.exs
+++ b/config/dev.exs
@@ -21,7 +21,9 @@ config :plausible, PlausibleWeb.Endpoint,
~r{priv/static/.*(js|css|png|jpeg|jpg|gif|svg)$},
~r{priv/gettext/.*(po)$},
~r{lib/plausible_web/views/.*(ex)$},
- ~r{lib/plausible_web/templates/.*(eex)$}
+ ~r{lib/plausible_web/templates/.*(eex)$},
+ ~r{lib/plausible_web/controllers/.*(ex)$},
+ ~r{lib/plausible_web/plugs/.*(ex)$}
]
]
diff --git a/config/releases.exs b/config/releases.exs
index af4362885b..2c571428f1 100644
--- a/config/releases.exs
+++ b/config/releases.exs
@@ -14,7 +14,7 @@ secret_key_base =
"/NJrhNtbyCVAsTyvtk1ZYCwfm981Vpo/0XrVwjJvemDaKC/vsvBRevLwsc6u8RCg"
)
-db_pool_size = String.to_integer(System.get_env("DATABASE_POOL_SIZE", "10"))
+db_pool_size = String.to_integer(System.get_env("DATABASE_POOLSIZE", "10"))
db_url =
System.get_env(
@@ -34,7 +34,7 @@ ck_host = System.get_env("CLICKHOUSE_DATABASE_HOST", "localhost")
ck_db = System.get_env("CLICKHOUSE_DATABASE_NAME", "plausible_dev")
ck_db_user = System.get_env("CLICKHOUSE_DATABASE_USER")
ck_db_pwd = System.get_env("CLICKHOUSE_DATABASE_PASSWORD")
-ck_db_pool = System.get_env("CLICKHOUSE_DATABASE_POOLSIZE") || 10
+ck_db_pool = String.to_integer(System.get_env("CLICKHOUSE_DATABASE_POOLSIZE", "10"))
### Mandatory params End
sentry_dsn = System.get_env("SENTRY_DSN")
@@ -52,6 +52,7 @@ custom_domain_server_ip = System.get_env("CUSTOM_DOMAIN_SERVER_IP")
custom_domain_server_user = System.get_env("CUSTOM_DOMAIN_SERVER_USER")
custom_domain_server_password = System.get_env("CUSTOM_DOMAIN_SERVER_PASSWORD")
geolite2_country_db = System.get_env("GEOLITE2_COUNTRY_DB")
+disable_auth = String.to_existing_atom(System.get_env("DISABLE_AUTH", "false"))
config :plausible,
admin_user: admin_user,
@@ -60,6 +61,14 @@ config :plausible,
environment: env,
mailer_email: mailer_email
+config :plausible, :selfhost,
+ disable_authentication: disable_auth,
+ disable_registration:
+ if(!disable_auth,
+ do: String.to_existing_atom(System.get_env("DISABLE_REGISTRATION", "false")),
+ else: false
+ )
+
config :plausible, PlausibleWeb.Endpoint,
url: [host: host, scheme: scheme],
http: [
diff --git a/docker-compose.yml b/docker-compose.yml
index d3e6275cf1..4c7c5ef732 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -6,8 +6,7 @@ services:
# As it says, this service is a fake smtp server which accepts SMTP connections
# the inbox is available at localhost:8025, in actuality, you need to use a proper smtp server
- fakesmtp_server:
- container_name: fakesmtp_server
+ fake_smtp:
image: mailhog/mailhog:v1.0.0
ports:
- 1025:1025
@@ -17,7 +16,6 @@ services:
plausible_db:
- container_name: plausible_db
image: postgres:12
command: ["postgres", "-c", "log_statement=all", "-c", "log_destination=stderr"]
volumes:
@@ -30,50 +28,44 @@ services:
- 5432:5432
plausible_events_db:
- container_name: plausible_events_db
- image: yandex/clickhouse-server
+ image: yandex/clickhouse-server:latest
volumes:
- event-data:/var/lib/clickhouse
ports:
- 8123:8123
plausible:
- container_name: plausible
build:
context: .
dockerfile: ./Dockerfile
- command: sh -c "sleep 10 && /entrypoint.sh db createdb && /entrypoint.sh db migrate &&/entrypoint.sh run"
- environment:
- - ENVIRONMENT=production
- - PORT=8080
- - SECRET_KEY_BASE=iYb1mP5cnmY+gUxo7C/h6XMigossPhzwd8/ic6LFnQ9Y58Fl1xduSWaPq0fHDdbn
- - SIGNING_SALT=PL/THF0VMOzuv1bOcldjDzYFBLryvXNs
- - HOST=localhost
- - DATABASE_URL=postgres://postgres:postgres@plausible_db:5432/plausible
- - DATABASE_TLS_ENABLED=false
- - ADMIN_USER_NAME=admin
- - ADMIN_USER_PWD=admin@1234!
- - APP_VERSION=test
- - MAILER_ADAPTER=Bamboo.SMTPAdapter
- - SMTP_HOST_ADDR=fakesmtp_server
- - SMTP_HOST_PORT=1025
- - SMTP_USER_PWD=password
- - SMTP_HOST_SSL_ENABLED=false
- - SMTP_MX_LOOKUPS_ENABLED=false
- - CLICKHOUSE_DATABASE_HOST=plausible_events_db
- - CLICKHOUSE_DATABASE_NAME=plausible_events_db
+ command: sh -c "sleep 10 && /entrypoint.sh run"
depends_on:
- - plausible_events_db
- plausible_db
- - fakesmtp_server
+ - plausible_events_db
+ - fake_smtp
ports:
- 80:8080
links:
- plausible_db
- plausible_events_db
- - fakesmtp_server
+ - fake_smtp
+ env_file:
+ - plausible-variables.sample.env
+
+
+ setup:
+ build:
+ context: .
+ dockerfile: ./Dockerfile
+ command: sh -c "sleep 10 && /entrypoint.sh db createdb && /entrypoint.sh db migrate"
+ depends_on:
+ - plausible_db
+ - plausible_events_db
+ links:
+ - plausible_db
+ - plausible_events_db
+ env_file:
+ - plausible-variables.sample.env
volumes:
diff --git a/lib/plausible/application.ex b/lib/plausible/application.ex
index 0535fe5135..bae4a97514 100644
--- a/lib/plausible/application.ex
+++ b/lib/plausible/application.ex
@@ -5,6 +5,7 @@ defmodule Plausible.Application do
def start(_type, _args) do
clickhouse_config = Application.get_env(:plausible, :clickhouse)
+
children = [
Plausible.Repo,
PlausibleWeb.Endpoint,
diff --git a/lib/plausible_release.ex b/lib/plausible_release.ex
index 3b7964788f..da2c9f70b8 100644
--- a/lib/plausible_release.ex
+++ b/lib/plausible_release.ex
@@ -14,17 +14,23 @@ defmodule Plausible.Release do
Application.get_env(:plausible, :admin_pwd)}
)
- {:ok, admin} = Plausible.Auth.create_user(admin_user, admin_email)
- # set the password
- {:ok, admin} = Plausible.Auth.User.set_password(admin, admin_pwd) |> Repo.update()
- # bump-up the trail period
- admin
- |> Ecto.Changeset.cast(%{trial_expiry_date: Timex.today() |> Timex.shift(years: 100)}, [
- :trial_expiry_date
- ])
- |> Repo.update()
-
- IO.puts("Admin user created successful!")
+ case Plausible.Auth.find_user_by(email: admin_email) do
+ nil ->
+ {:ok, admin} = Plausible.Auth.create_user(admin_user, admin_email)
+ # set the password
+ {:ok, admin} = Plausible.Auth.User.set_password(admin, admin_pwd) |> Repo.update()
+ # bump-up the trail period
+ admin
+ |> Ecto.Changeset.cast(%{trial_expiry_date: Timex.today() |> Timex.shift(years: 100)}, [
+ :trial_expiry_date
+ ])
+ |> Repo.update()
+
+ IO.puts("Admin user created successful!")
+
+ _ ->
+ IO.puts("Admin user already exists. I won't override, bailing")
+ end
end
def migrate do
diff --git a/lib/plausible_web/controllers/api/external_controller.ex b/lib/plausible_web/controllers/api/external_controller.ex
index 31b9148008..30b8ff5f58 100644
--- a/lib/plausible_web/controllers/api/external_controller.ex
+++ b/lib/plausible_web/controllers/api/external_controller.ex
@@ -78,16 +78,17 @@ defmodule PlausibleWeb.Api.ExternalController do
if forwarded_for do
String.split(forwarded_for, ",")
|> Enum.map(&String.trim/1)
- |> List.first
+ |> List.first()
else
to_string(:inet_parse.ntoa(conn.remote_ip))
end
end
defp visitor_country(conn) do
- result = get_ip(conn)
- |> Geolix.lookup()
- |> Map.get(:country)
+ result =
+ get_ip(conn)
+ |> Geolix.lookup()
+ |> Map.get(:country)
if result && result.country do
result.country.iso_code
diff --git a/lib/plausible_web/controllers/auth_controller.ex b/lib/plausible_web/controllers/auth_controller.ex
index 99bf4dda93..6ad16ca569 100644
--- a/lib/plausible_web/controllers/auth_controller.ex
+++ b/lib/plausible_web/controllers/auth_controller.ex
@@ -11,12 +11,17 @@ defmodule PlausibleWeb.AuthController do
when action in [:user_settings, :save_settings, :delete_me, :password_form, :set_password]
def register_form(conn, _params) do
- changeset = Plausible.Auth.User.changeset(%Plausible.Auth.User{})
+ if Keyword.fetch!(Application.get_env(:plausible, :selfhost), :disable_registration) do
+ conn
+ |> redirect(to: "/login")
+ else
+ changeset = Plausible.Auth.User.changeset(%Plausible.Auth.User{})
- render(conn, "register_form.html",
- changeset: changeset,
- layout: {PlausibleWeb.LayoutView, "focus.html"}
- )
+ render(conn, "register_form.html",
+ changeset: changeset,
+ layout: {PlausibleWeb.LayoutView, "focus.html"}
+ )
+ end
end
def register(conn, %{"user" => params}) do
diff --git a/lib/plausible_web/controllers/page_controller.ex b/lib/plausible_web/controllers/page_controller.ex
index 7f71678562..e41cb15114 100644
--- a/lib/plausible_web/controllers/page_controller.ex
+++ b/lib/plausible_web/controllers/page_controller.ex
@@ -1,96 +1,14 @@
defmodule PlausibleWeb.PageController do
use PlausibleWeb, :controller
use Plausible.Repo
-
- @demo_referrers [
- {"indiehackers.com", 56},
- {"Github", 23},
- {"Twitter", 17},
- {"Reddit", 8},
- {"Google", 6},
- {"DuckDuckGo", 4},
- {"Bing", 2}
- ]
-
- @demo_pages [
- {"/", 140},
- {"/plausible.io", 63},
- {"/blog", 41},
- {"/register", 13},
- {"/login", 7},
- {"/blog/google-analytics-and-privacy", 4},
- {"/blog/launching-plausible", 2}
- ]
+ plug PlausibleWeb.AutoAuthPlug
def index(conn, _params) do
if conn.assigns[:current_user] do
user = conn.assigns[:current_user] |> Repo.preload(:sites)
render(conn, "sites.html", sites: user.sites)
else
- render(conn, "index.html",
- demo_referrers: @demo_referrers,
- demo_pages: @demo_pages,
- landing_nav: true
- )
- end
- end
-
- defmodule Token do
- use Joken.Config
- end
-
- defp sign_token!(user) do
- claims = %{
- id: user.id,
- email: user.email,
- name: user.name
- }
-
- signer = Joken.Signer.create("HS256", "4d1d2ae6-4595-4d0b-b98a-8ca5b1f2095a")
- {:ok, token, _} = Token.generate_and_sign(claims, signer)
- token
- end
-
- def feedback(conn, _params) do
- if conn.assigns[:current_user] do
- token = sign_token!(conn.assigns[:current_user])
- redirect(conn, external: "https://plausible.nolt.io/sso/#{token}")
- else
- redirect(conn, external: "https://plausible.nolt.io")
- end
- end
-
- def roadmap(conn, _params) do
- if conn.assigns[:current_user] do
- token = sign_token!(conn.assigns[:current_user])
-
- redirect(conn,
- external:
- "https://plausible.nolt.io/sso/#{token}?returnUrl=https://plausible.nolt.io/roadmap"
- )
- else
- redirect(conn, external: "https://plausible.nolt.io/roadmap")
+ render(conn, "index.html" )
end
end
-
- def contact_form(conn, _params) do
- render(conn, "contact_form.html")
- end
-
- def submit_contact_form(conn, %{"text" => text, "email" => email}) do
- PlausibleWeb.Email.feedback(email, text) |> Plausible.Mailer.send_email()
- render(conn, "contact_thanks.html")
- end
-
- def privacy(conn, _params) do
- render(conn, "privacy.html")
- end
-
- def data_policy(conn, _params) do
- render(conn, "data_policy.html")
- end
-
- def terms(conn, _params) do
- render(conn, "terms.html")
- end
end
diff --git a/lib/plausible_web/controllers/tracker_controller.ex b/lib/plausible_web/controllers/tracker_controller.ex
index fec800500a..50e3349c55 100644
--- a/lib/plausible_web/controllers/tracker_controller.ex
+++ b/lib/plausible_web/controllers/tracker_controller.ex
@@ -1,9 +1,23 @@
defmodule PlausibleWeb.TrackerController do
use PlausibleWeb, :controller
require EEx
- EEx.function_from_file(:defp, :render_plausible, Application.app_dir(:plausible, "priv/tracker/js/plausible.js"), [:base_url])
- EEx.function_from_file(:defp, :render_p, Application.app_dir(:plausible, "priv/tracker/js/p.js"), [:base_url])
- @max_age 3600 # 1 hour
+
+ EEx.function_from_file(
+ :defp,
+ :render_plausible,
+ Application.app_dir(:plausible, "priv/tracker/js/plausible.js"),
+ [:base_url]
+ )
+
+ EEx.function_from_file(
+ :defp,
+ :render_p,
+ Application.app_dir(:plausible, "priv/tracker/js/p.js"),
+ [:base_url]
+ )
+
+ #  1 hour
+ @max_age 3600
def plausible(conn, _params) do
send_js(conn, render_plausible(base_url()))
diff --git a/lib/plausible_web/email.ex b/lib/plausible_web/email.ex
index 657043eadb..41b5fbfafc 100644
--- a/lib/plausible_web/email.ex
+++ b/lib/plausible_web/email.ex
@@ -100,18 +100,6 @@ defmodule PlausibleWeb.Email do
|> render("trial_over_email.html", user: user)
end
- def feedback(from, text) do
- from = if from == "", do: "[email protected]", else: from
-
- base_email()
- |> from("[email protected]")
- |> put_param("ReplyTo", from)
- |> tag("feedback")
- |> subject("New feedback submission")
- |> text_body(text)
- end
-
def weekly_report(email, site, assigns) do
base_email()
|> to(email)
diff --git a/lib/plausible_web/plugs/auto_auth_plug.ex b/lib/plausible_web/plugs/auto_auth_plug.ex
new file mode 100644
index 0000000000..5de238d5ed
--- /dev/null
+++ b/lib/plausible_web/plugs/auto_auth_plug.ex
@@ -0,0 +1,26 @@
+defmodule PlausibleWeb.AutoAuthPlug do
+ import Plug.Conn
+ alias PlausibleWeb.AuthController
+
+ def init(options) do
+ options
+ end
+
+ def call(conn, _opts) do
+ cond do
+ Keyword.fetch!(Application.get_env(:plausible, :selfhost), :disable_authentication) ->
+ conn
+ |> AuthController.login(%{
+ "email" => Application.fetch_env!(:plausible, :admin_email),
+ "password" => Application.fetch_env!(:plausible, :admin_pwd)
+ })
+ |> halt
+
+ true ->
+ Plug.Conn.put_session(conn, :login_dest, conn.request_path)
+ |> Phoenix.Controller.redirect(to: "/login")
+ |> halt
+
+ end
+ end
+end
diff --git a/lib/plausible_web/router.ex b/lib/plausible_web/router.ex
index b170f1b45e..3080d13dd7 100644
--- a/lib/plausible_web/router.ex
+++ b/lib/plausible_web/router.ex
@@ -92,13 +92,6 @@ defmodule PlausibleWeb.Router do
get "/auth/google/callback", AuthController, :google_auth_callback
get "/", PageController, :index
- get "/privacy", PageController, :privacy
- get "/terms", PageController, :terms
- get "/data-policy", PageController, :data_policy
- get "/feedback", PageController, :feedback
- get "/roadmap", PageController, :roadmap
- get "/contact", PageController, :contact_form
- post "/contact", PageController, :submit_contact_form
get "/billing/change-plan", BillingController, :change_plan_form
get "/billing/change-plan/preview/:plan_id", BillingController, :change_plan_preview
diff --git a/lib/plausible_web/templates/auth/login_form.html.eex b/lib/plausible_web/templates/auth/login_form.html.eex
index 211fbfcc08..0214fb4fe2 100644
--- a/lib/plausible_web/templates/auth/login_form.html.eex
+++ b/lib/plausible_web/templates/auth/login_form.html.eex
@@ -16,7 +16,9 @@
<p class="text-gray-500 text-xs my-2">Forgot password? <a href="/password/request-reset" class="underline text-gray-800">Click here</a> to reset it.</p>
</div>
<%= submit "Login →", class: "button mt-4 w-full" %>
- <p class="text-center text-gray-500 text-xs mt-4">
- Don't have an account? <%= link("Register", to: "/register") %> instead.
- </p>
+ <%= if !Keyword.fetch!(Application.get_env(:plausible, :selfhost),:disable_registration) do %>
+ <p class="text-center text-gray-500 text-xs mt-4">
+ Don't have an account? <%= link("Register", to: "/register") %> instead.
+ </p>
+ <% end %>
<% end %>
diff --git a/lib/plausible_web/templates/layout/_footer.html.eex b/lib/plausible_web/templates/layout/_footer.html.eex
index 1c14f79ca7..7e722e4087 100644
--- a/lib/plausible_web/templates/layout/_footer.html.eex
+++ b/lib/plausible_web/templates/layout/_footer.html.eex
@@ -5,14 +5,13 @@
<p class="mt-2">Made by <a href="https://twitter.com/ukutaht" class="light-text underline">@ukutaht</a> in London, UK</p>
</div>
<ul class="text-center md:text-left my-4 md:m-0">
- <li>Read our <a href="/blog/" class="light-text font-medium mr-4 underline">Blog</a></li>
- <li>Study the <%= link("Documentation", to: "https://docs.#{base_domain()}",target: "_blank",class: "light-text font-medium mr-4 underline") %></li>
- <li>Check out the <%= link("Live Demo", to: "/plausible.io",class: "light-text font-medium underline") %></li>
+ <li>Read our <a href="https://plausible.io/blog" class="light-text font-medium mr-4 underline">Blog</a></li>
+ <li>Study the <%= link("Documentation", to: "https://docs.plausible.io/",target: "_blank",class: "light-text font-medium mr-4 underline") %></li>
+ <li>Check out the <%= link("Live Demo", to: "https://plausible.io/plausible.io",class: "light-text font-medium underline") %></li>
</ul>
<ul class="text-center md:text-left my-4 md:m-0">
- <li>Give us <a href="/feedback" target="_blank" class="light-text font-medium mr-4 underline">Feedback</a></li>
- <li>We have a <a href="/roadmap" target="_blank" class="light-text font-medium mr-4 underline">Public roadmap</a></li>
- <li>Contact us <a href="/contact" class="light-text font-medium mr-4 underline">via email</a></li>
+ <li>Having trouble? Raise an <a href="https://github.com/plausible/analytics/issues" target="_blank" class="light-text font-medium mr-4 underline">issue</a></li>
+ <li>Contact us via <a href="https://plausible.io/contact" class="light-text font-medium mr-4 underline">form</a></li>
</ul>
</div>
</footer>
diff --git a/lib/plausible_web/templates/layout/app.html.eex b/lib/plausible_web/templates/layout/app.html.eex
index 5641bf4c20..c92e392a13 100644
--- a/lib/plausible_web/templates/layout/app.html.eex
+++ b/lib/plausible_web/templates/layout/app.html.eex
@@ -50,15 +50,31 @@
</div>
</li>
</ul>
- <% true -> %>
+ <% Keyword.fetch!(Application.get_env(:plausible, :selfhost), :disable_authentication) -> %>
<ul class="flex" x-show="!document.cookie.includes('logged_in=true')">
<li>
- <div class="inline-flex">
- <a href="/login" class="font-medium text-gray-500 hover:text-gray-900 focus:outline-none focus:text-gray-900 transition duration-150 ease-in-out">Login</a>
- </div>
- <div class="inline-flex rounded shadow ml-6">
- <a href="/register" class="inline-flex items-center justify-center px-5 py-2 border border-transparent text-base leading-6 font-medium rounded-md text-white bg-indigo-600 hover:bg-indigo-500 focus:outline-none focus:shadow-outline transition duration-150 ease-in-out">Start free trial</a>
- </div>
+ <div class="inline-flex rounded shadow ml-6">
+ <a href="/" class="inline-flex items-center justify-center px-5 py-2 border border-transparent text-base leading-6 font-medium rounded-md text-white bg-indigo-600 hover:bg-indigo-500 focus:outline-none focus:shadow-outline transition duration-150 ease-in-out">My Sites</a>
+ </div>
+ </li>
+ </ul>
+ <% Keyword.fetch!(Application.get_env(:plausible, :selfhost), :disable_registration) -> %>
+ <ul class="flex" x-show="!document.cookie.includes('logged_in=true')">
+ <li>
+ <div class="inline-flex">
+ <a href="/login" class="font-medium text-gray-500 hover:text-gray-900 focus:outline-none focus:text-gray-900 transition duration-150 ease-in-out">Login</a>
+ </div>
+ </li>
+ </ul>
+ <% true -> %>
+ <ul class="flex" x-show="!document.cookie.includes('logged_in=true')">
+ <li>
+ <div class="inline-flex">
+ <a href="/login" class="font-medium text-gray-500 hover:text-gray-900 focus:outline-none focus:text-gray-900 transition duration-150 ease-in-out">Login</a>
+ </div>
+ <div class="inline-flex rounded shadow ml-6">
+ <a href="/register" class="inline-flex items-center justify-center px-5 py-2 border border-transparent text-base leading-6 font-medium rounded-md text-white bg-indigo-600 hover:bg-indigo-500 focus:outline-none focus:shadow-outline transition duration-150 ease-in-out">Sign up</a>
+ </div>
</li>
</ul>
<% end %>
diff --git a/lib/plausible_web/templates/page/contact_form.html.eex b/lib/plausible_web/templates/page/contact_form.html.eex
deleted file mode 100644
index 3b7d88dd66..0000000000
--- a/lib/plausible_web/templates/page/contact_form.html.eex
+++ /dev/null
@@ -1,16 +0,0 @@
-<div class="w-full max-w-md mx-auto mt-8">
- <%= form_for @conn, "/contact", [class: "bg-white shadow-md rounded px-8 py-6 mb-4 mt-16"], fn f -> %>
- <h1 class="text-xl font-black">Contact us</h1>
- <p class="text-gray-600 mt-2">Please get in touch with any questions and thoughts, we'll get back to you as soon as possible!</p>
- <%= textarea f, :text, rows: 4, class: "transition bg-gray-100 appearance-none border border-transparent rounded w-full p-2 text-gray-700 leading-normal appearance-none focus:outline-none focus:bg-white focus:border-gray-300 text-xs mt-4" %>
- <%= if @conn.assigns[:current_user] do %>
- <%= hidden_input f, :email, value: @conn.assigns[:current_user].email %>
- <% else %>
- <div class="my-4">
- <%= label f, :email, "Your email (optional)", class: "block text-gray-700 text-sm font-bold mb-2" %>
- <%= email_input f, :email, class: "transition bg-gray-100 appearance-none border border-transparent rounded w-full p-2 text-gray-700 leading-normal appearance-none focus:outline-none focus:bg-white focus:border-gray-300", placeholder: "[email protected]" %>
- </div>
- <% end %>
- <%= submit "Send", class: "button mt-4 w-full" %>
- <% end %>
-</div>
diff --git a/lib/plausible_web/templates/page/contact_thanks.html.eex b/lib/plausible_web/templates/page/contact_thanks.html.eex
deleted file mode 100644
index 0aabd64d5d..0000000000
--- a/lib/plausible_web/templates/page/contact_thanks.html.eex
+++ /dev/null
@@ -1,4 +0,0 @@
-<div class="max-w-md mx-auto bg-white shadow-md rounded px-8 pt-6 pb-8 mb-4 mt-16">
- <h2 class="text-xl font-black">Message submitted!</h2>
- <div class="my-4">Thank you for getting in touch.</div>
-</div>
diff --git a/lib/plausible_web/templates/page/data_policy.html.eex b/lib/plausible_web/templates/page/data_policy.html.eex
deleted file mode 100644
index 35ce52c392..0000000000
--- a/lib/plausible_web/templates/page/data_policy.html.eex
+++ /dev/null
@@ -1,39 +0,0 @@
-<div class="container max-w-2xl pt-12 pb-32 leading-normal text-lg">
-
-<h1 class="text-2xl font-black">Data policy</h1>
-
-<div class="my-4">
-Plausible aims to track overall trends in your website traffic, not individual visitors. With privacy in mind, we don’t collect or store any data beyond what is absolutely necessary. Here is a list of what we collect and store about your website visitors.
-</div>
-
-<div class="my-4">
- <h4 class="mb-1 font-bold">User-Agent</h4>
- We use the <code>User-Agent</code> header to figure out what browsers and operating systems your visitors are using.
-</div>
-
-<div class="my-4">
- <h4 class="mb-1 font-bold">Referer</h4>
- Plausible uses the referrer string to show which other websites are driving traffic to the site you’re tracking.
-</div>
-
-<div class="my-4">
- <h4 class="mb-1 font-bold">Page URLs</h4>
- We track the pathname of each pageview to be able to show the Top Pages report.
-</div>
-
-<div class="my-4">
- <h4 class="mb-1 font-bold">Window inner width</h4>
- We use <code>window.innerWidth</code> to determine the actual size of the open browser window, rather than the full width of the device. This is more accurate and makes fingerprinting harder.
-</div>
-
-<div class="my-4 mt-8">
- <h4 class="mb-1 font-bold">We don’t store IP addresses</h4>
- We never store IP addresses in our database or logs. The IP address is used to look up the visitor country, which we store to show the Top Countries report. The IP address is discarded.
-</div>
-
-<div class="my-8">
- <h3 class="mb-2 font-bold">Cookie policy</h3>
- Plausible installs a first-party cookie to be able to differentiate between a new visitor and a returning visitor. This cookie contains a random identifier that is sent along with each pageview request. On the backend, this allows us to aggregate and show unique visitors and total pageviews separately.
- </div>
- <%= link("Back to homepage", to: "/", class: "text-indigo-500") %>
-</div>
diff --git a/lib/plausible_web/templates/page/index.html.eex b/lib/plausible_web/templates/page/index.html.eex
index 9aeddba81d..82eab43361 100644
--- a/lib/plausible_web/templates/page/index.html.eex
+++ b/lib/plausible_web/templates/page/index.html.eex
@@ -1,695 +1,3 @@
-<div class="relative bg-gray-50 overflow-hidden">
- <div class="hidden sm:block sm:absolute sm:inset-y-0 sm:h-full sm:w-full">
- <div class="relative h-full max-w-screen-xl mx-auto">
- <svg class="absolute right-full transform translate-y-1/4 translate-x-1/4 lg:translate-x-1/2" width="404" height="784" fill="none" viewBox="0 0 404 784">
- <defs>
- <pattern id="f210dbf6-a58d-4871-961e-36d5016a0f49" x="0" y="0" width="20" height="20" patternUnits="userSpaceOnUse">
- <rect x="0" y="0" width="4" height="4" class="text-gray-200" fill="currentColor" />
- </pattern>
- </defs>
- <rect width="404" height="784" fill="url(#f210dbf6-a58d-4871-961e-36d5016a0f49)" />
- </svg>
- <svg class="absolute left-full transform -translate-y-3/4 -translate-x-1/4 md:-translate-y-1/2 lg:-translate-x-1/2" width="404" height="784" fill="none" viewBox="0 0 404 784">
- <defs>
- <pattern id="5d0dd344-b041-4d26-bec4-8d33ea57ec9b" x="0" y="0" width="20" height="20" patternUnits="userSpaceOnUse">
- <rect x="0" y="0" width="4" height="4" class="text-gray-200" fill="currentColor" />
- </pattern>
- </defs>
- <rect width="404" height="784" fill="url(#5d0dd344-b041-4d26-bec4-8d33ea57ec9b)" />
- </svg>
- </div>
- </div>
-
- <div class="relative container pb-12 lg:pb-16 xl:pb-20">
- <div class="mt-10 mx-auto max-w-screen-xl px-4 sm:mt-12 sm:px-6 md:mt-16 lg:mt-20 xl:mt-28">
- <div class="text-center">
- <h1 class="text-3xl tracking-tight leading-10 font-extrabold text-gray-900 sm:text-4xl sm:leading-none md:text-5xl">
- Simple and privacy-friendly
- <br class="xl:hidden" />
- <span class="text-indigo-600">alternative to Google Analytics</span>
- </h1>
- <p class="mt-3 max-w-md mx-auto text-base text-gray-500 sm:text-lg md:mt-5 md:text-xl md:max-w-3xl">
- Plausible is a lightweight and open-source website analytics tool. It doesn’t use cookies and is fully compliant with GDPR, CCPA and PECR.
- </p>
- <div class="mt-5 max-w-md mx-auto sm:flex sm:justify-center md:mt-8">
- <div class="rounded-md shadow">
- <a href="/register" class="w-full flex items-center justify-center px-8 py-3 border border-transparent text-base leading-6 font-medium rounded-md text-white bg-indigo-600 hover:bg-indigo-500 focus:outline-none focus:shadow-outline-indigo transition duration-150 ease-in-out md:py-4 md:text-lg md:px-10">
- Get started
- </a>
- </div>
- <div class="mt-3 rounded-md shadow sm:mt-0 sm:ml-3">
- <a href="/plausible.io" class="w-full flex items-center justify-center px-8 py-3 border border-transparent text-base leading-6 font-medium rounded-md text-indigo-600 bg-white hover:text-indigo-500 focus:outline-none focus:shadow-outline-blue transition duration-150 ease-in-out md:py-4 md:text-lg md:px-10">
- Live demo
- </a>
- </div>
- </div>
- </div>
- </div>
- </div>
-</div>
-
-<div class="relative">
- <div class="max-w-5xl mx-auto rounded shadow-2xl" style="margin-bottom: -36rem">
- <%= img_tag(PlausibleWeb.Router.Helpers.static_path(@conn, "/images/screenshot.png")) %>
- </div>
-</div>
-
-<div class="py-24 bg-white">
- <div style="padding-top: 36rem;"></div>
- <div class="container mx-auto">
- <div class="lg:text-center">
- <h2 class="mt-2 text-3xl leading-8 font-extrabold tracking-tight text-gray-900 sm:text-4xl sm:leading-10">
- Why use Plausible?
- </h2>
- <p class="mt-4 max-w-2xl text-xl leading-7 text-gray-500 lg:mx-auto">
- Plausible is built for privacy-conscious website owners. Here’s what makes it a great Google Analytics alternative
- </p>
- </div>
-
- <div class="mt-16">
- <ul class="md:grid md:grid-cols-2 md:col-gap-8 md:row-gap-16">
- <li>
- <div class="flex">
- <div class="flex-shrink-0">
- <div class="flex items-center justify-center h-12 w-12 rounded-md bg-indigo-500 text-white">
- <svg class="h-6 w-6" stroke="currentColor" fill="none" viewBox="0 0 24 24">
- <path d="M13 7H21M21 7V15M21 7L13 15L9 11L3 17" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
- </svg>
- </div>
- </div>
- <div class="ml-4">
- <h3 class="text-lg leading-6 font-medium text-gray-900">Check website traffic and site analytics in 1 minute</h3>
- <p class="mt-2 text-base leading-6 text-gray-500">
- Plausible is simple and it cuts through the noise. No layers of menus, no need
- for custom reports. Get all the important insights on one single page. No training necessary.
- </p>
- </div>
- </div>
- </li>
-
- <li class="mt-10 md:mt-0">
- <div class="flex">
- <div class="flex-shrink-0">
- <div class="flex items-center justify-center h-12 w-12 rounded-md bg-indigo-500 text-white">
- <svg class="h-6 w-6" stroke="currentColor" fill="none" viewBox="0 0 24 24">
- <path d="M13 10V3L4 14H11L11 21L20 10L13 10Z" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
- </svg>
- </div>
- </div>
- <div class="ml-4">
- <h3 class="text-lg leading-6 font-medium text-gray-900">Lightweight script which keeps your site speed fast</h3>
- <p class="mt-2 text-base leading-6 text-gray-500">
- Plausible script is 14 times smaller than Google Analytics script. You will reduce your page weight and your site will load faster.
- </p>
- </div>
- </div>
- </li>
-
- <li class="mt-10 md:mt-0">
- <div class="flex">
- <div class="flex-shrink-0">
- <div class="flex items-center justify-center h-12 w-12 rounded-md bg-indigo-500 text-white">
- <svg class="h-6 w-6" stroke="currentColor" fill="none" viewBox="0 0 24 24">
- <path d="M16 7C16 9.20914 14.2091 11 12 11C9.79086 11 8 9.20914 8 7C8 4.79086 9.79086 3 12 3C14.2091 3 16 4.79086 16 7Z" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
- <path d="M12 14C8.13401 14 5 17.134 5 21H19C19 17.134 15.866 14 12 14Z" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
- </svg>
- </div>
- </div>
- <div class="ml-4">
- <h3 class="text-lg leading-6 font-medium text-gray-900">Doesn’t track nor collect any personal data</h3>
- <p class="mt-2 text-base leading-6 text-gray-500">
- Plausible respects the privacy of your visitors. Your traffic data is not used for any other purposes. You fully own and control it. See our data policy for details.
- </p>
- </div>
- </div>
- </li>
-
- <li class="mt-10 md:mt-0">
- <div class="flex">
- <div class="flex-shrink-0">
- <div class="flex items-center justify-center h-12 w-12 rounded-md bg-indigo-500 text-white">
- <svg class="h-6 w-6" stroke="currentColor" fill="none" viewBox="0 0 24 24">
- <path d="M9 12L11 14L15 10M20.6179 5.98434C20.4132 5.99472 20.2072 5.99997 20 5.99997C16.9265 5.99997 14.123 4.84453 11.9999 2.94434C9.87691 4.84446 7.07339 5.99985 4 5.99985C3.79277 5.99985 3.58678 5.9946 3.38213 5.98422C3.1327 6.94783 3 7.95842 3 9.00001C3 14.5915 6.82432 19.2898 12 20.622C17.1757 19.2898 21 14.5915 21 9.00001C21 7.95847 20.8673 6.94791 20.6179 5.98434Z" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
- </svg>
- </div>
- </div>
- <div class="ml-4">
- <h3 class="text-lg leading-6 font-medium text-gray-900">No cookie banners or GDPR/CCPA consent needed</h3>
- <p class="mt-2 text-base leading-6 text-gray-500">
- Plausible does not use cookies and is fully compliant with GDPR, CCPA, PECR and other privacy regulations out of the box.
- </p>
- </div>
- </div>
- </li>
-
- <li class="mt-10 md:mt-0">
- <div class="flex">
- <div class="flex-shrink-0">
- <div class="flex items-center justify-center h-12 w-12 rounded-md bg-indigo-500 text-white">
- <svg class="h-6 w-6" stroke="currentColor" fill="none" viewBox="0 0 24 24">
- <path d="M3 21V17M3 17V5C3 3.89543 3.89543 3 5 3H11.5L12.5 4H21L18 10L21 16H12.5L11.5 15H5C3.89543 15 3 15.8954 3 17ZM12 3.5V9" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
- </svg>
- </div>
- </div>
- <div class="ml-4">
- <h3 class="text-lg leading-6 font-medium text-gray-900">Define key goals and track conversions</h3>
- <p class="mt-2 text-base leading-6 text-gray-500">
- Set custom events or page URLs as your goals and see how they convert over time to understand and identify the trends that matter.
- </p>
- </div>
- </div>
- </li>
-
- <li class="mt-10 md:mt-0">
- <div class="flex">
- <div class="flex-shrink-0">
- <div class="flex items-center justify-center h-12 w-12 rounded-md bg-indigo-500 text-white">
- <svg class="h-6 w-6" stroke="currentColor" fill="none" viewBox="0 0 24 24">
- <path d="M3 8L10.8906 13.2604C11.5624 13.7083 12.4376 13.7083 13.1094 13.2604L21 8M5 19H19C20.1046 19 21 18.1046 21 17V7C21 5.89543 20.1046 5 19 5H5C3.89543 5 3 5.89543 3 7V17C3 18.1046 3.89543 19 5 19Z" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
- </svg>
- </div>
- </div>
- <div class="ml-4">
- <h3 class="text-lg leading-6 font-medium text-gray-900">Get weekly or monthly reports directly into your inbox</h3>
- <p class="mt-2 text-base leading-6 text-gray-500">
- Keep an eye on your traffic with automated email reports. Email reports can be scheduled to be sent to multiple recipients.
- </p>
- </div>
- </div>
- </li>
-
- <li class="mt-10 md:mt-0">
- <div class="flex">
- <div class="flex-shrink-0">
- <div class="flex items-center justify-center h-12 w-12 rounded-md bg-indigo-500 text-white">
- <svg class="h-6 w-6" stroke="currentColor" fill="none" viewBox="0 0 24 24">
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 12a9 9 0 01-9 9m9-9a9 9 0 00-9-9m9 9H3m9 9a9 9 0 01-9-9m9 9c1.657 0 3-4.03 3-9s-1.343-9-3-9m0 18c-1.657 0-3-4.03-3-9s1.343-9 3-9m-9 9a9 9 0 019-9"/>
- </svg>
- </div>
- </div>
- <div class="ml-4">
- <h3 class="text-lg leading-6 font-medium text-gray-900">Open your web analytics to everyone</h3>
- <p class="mt-2 text-base leading-6 text-gray-500">
- Your stats are private by default but you can choose to be transparent and make them public so anyone with your custom link can view them.
- </p>
- </div>
- </div>
- </li>
-
- <li class="mt-10 md:mt-0">
- <div class="flex">
- <div class="flex-shrink-0">
- <div class="flex items-center justify-center h-12 w-12 rounded-md bg-indigo-500 text-white">
- <svg class="h-6 w-6" stroke="currentColor" fill="none" viewBox="0 0 24 24">
- <path d="M12 15V17M6 21H18C19.1046 21 20 20.1046 20 19V13C20 11.8954 19.1046 11 18 11H6C4.89543 11 4 11.8954 4 13V19C4 20.1046 4.89543 21 6 21ZM16 11V7C16 4.79086 14.2091 3 12 3C9.79086 3 8 4.79086 8 7V11H16Z" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
- </svg>
- </div>
- </div>
- <div class="ml-4">
- <h3 class="text-lg leading-6 font-medium text-gray-900">Share the stats privately with your clients</h3>
- <p class="mt-2 text-base leading-6 text-gray-500">
- You can share your stats privately by generating a shared link. This link is impossible to guess but
- you can add password protection for extra security.
- </p>
- </div>
- </div>
- </li>
-
- </ul>
- </div>
- </div>
-</div>
-
-<div class="py-16 bg-gray-50 overflow-hidden lg:py-24">
- <div class="relative container mx-auto px-4 sm:px-6 lg:px-8">
- <svg class="hidden lg:block absolute left-full transform -translate-x-1/2 -translate-y-1/4" width="404" height="784" fill="none" viewBox="0 0 404 784">
- <defs>
- <pattern id="b1e6e422-73f8-40a6-b5d9-c8586e37e0e7" x="0" y="0" width="20" height="20" patternUnits="userSpaceOnUse">
- <rect x="0" y="0" width="4" height="4" class="text-gray-200" fill="currentColor" />
- </pattern>
- </defs>
- <rect width="404" height="784" fill="url(#b1e6e422-73f8-40a6-b5d9-c8586e37e0e7)" />
- </svg>
-
- <div class="relative lg:grid lg:grid-cols-2 lg:gap-8 lg:items-center">
- <div class="relative">
- <h2 class="text-3xl leading-9 font-extrabold text-gray-900 tracking-tight sm:text-4xl sm:leading-10">
- Simple analytics at a glance
- </h2>
- <p class="mt-3 text-lg leading-7 text-gray-500">
- Google Analytics is overkill for most site owners. Plausible is easy to use and understand with no training or prior experience.
- </p>
-
- <ul class="mt-10">
- <li>
- <div class="flex">
- <div class="flex-shrink-0">
- <div class="flex items-center justify-center h-12 w-12 rounded-md bg-indigo-500 text-white">
- <svg class="h-6 w-6" stroke="currentColor" fill="none" viewBox="0 0 24 24">
- <path d="M12 6V4M12 6C10.8954 6 10 6.89543 10 8C10 9.10457 10.8954 10 12 10M12 6C13.1046 6 14 6.89543 14 8C14 9.10457 13.1046 10 12 10M6 18C7.10457 18 8 17.1046 8 16C8 14.8954 7.10457 14 6 14M6 18C4.89543 18 4 17.1046 4 16C4 14.8954 4.89543 14 6 14M6 18V20M6 14V4M12 10V20M18 18C19.1046 18 20 17.1046 20 16C20 14.8954 19.1046 14 18 14M18 18C16.8954 18 16 17.1046 16 16C16 14.8954 16.8954 14 18 14M18 18V20M18 14V4" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
- </svg>
- </div>
- </div>
- <div class="ml-4">
- <h3 class="text-lg leading-6 font-medium text-gray-900">Unique visitors, total page views and the bounce rate</h3>
- <p class="mt-2 text-base leading-6 text-gray-500">
- Choose the time range that you want to analyze. The visitor numbers are automatically presented on an hourly, daily or monthly graph.
- </p>
- </div>
- </div>
- </li>
- <li class="mt-10">
- <div class="flex">
- <div class="flex-shrink-0">
- <div class="flex items-center justify-center h-12 w-12 rounded-md bg-indigo-500 text-white">
- <svg class="h-6 w-6" stroke="currentColor" fill="none" viewBox="0 0 24 24">
- <path d="M9 5H7C5.89543 5 5 5.89543 5 7V19C5 20.1046 5.89543 21 7 21H17C18.1046 21 19 20.1046 19 19V7C19 5.89543 18.1046 5 17 5H15M9 5C9 6.10457 9.89543 7 11 7H13C14.1046 7 15 6.10457 15 5M9 5C9 3.89543 9.89543 3 11 3H13C14.1046 3 15 3.89543 15 5M12 12H15M12 16H15M9 12H9.01M9 16H9.01" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
- </svg>
- </div>
- </div>
- <div class="ml-4">
- <h3 class="text-lg leading-6 font-medium text-gray-900">Top referral sources and most visited pages</h3>
- <p class="mt-2 text-base leading-6 text-gray-500">
- Answer the most important question about your website – where are your visitors coming from and what are they viewing?
- </p>
- </div>
- </div>
- </li>
- <li class="mt-10">
- <div class="flex">
- <div class="flex-shrink-0">
- <div class="flex items-center justify-center h-12 w-12 rounded-md bg-indigo-500 text-white">
- <svg class="h-6 w-6" stroke="currentColor" fill="none" viewBox="0 0 24 24">
- <path d="M17.6569 16.6569C16.7202 17.5935 14.7616 19.5521 13.4138 20.8999C12.6327 21.681 11.3677 21.6814 10.5866 20.9003C9.26234 19.576 7.34159 17.6553 6.34315 16.6569C3.21895 13.5327 3.21895 8.46734 6.34315 5.34315C9.46734 2.21895 14.5327 2.21895 17.6569 5.34315C20.781 8.46734 20.781 13.5327 17.6569 16.6569Z" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
- <path d="M15 11C15 12.6569 13.6569 14 12 14C10.3431 14 9 12.6569 9 11C9 9.34315 10.3431 8 12 8C13.6569 8 15 9.34315 15 11Z" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
- </svg>
- </div>
- </div>
- <div class="ml-4">
- <h3 class="text-lg leading-6 font-medium text-gray-900">Visitor location and device stats</h3>
- <p class="mt-2 text-base leading-6 text-gray-500">
- See the list of countries your traffic is coming from. See the device, browser and operating system your visitors are using. All the basics in a completely anonymous way.
- </p>
- </div>
- </div>
- </li>
- </ul>
- </div>
-
- <div class="mt-10 -mx-4 relative lg:mt-0 lg:pl-8">
- <svg class="absolute left-1/2 transform -translate-x-1/2 translate-y-16 lg:hidden" width="784" height="404" fill="none" viewBox="0 0 784 404">
- <defs>
- <pattern id="ca9667ae-9f92-4be7-abcb-9e3d727f2941" x="0" y="0" width="20" height="20" patternUnits="userSpaceOnUse">
- <rect x="0" y="0" width="4" height="4" class="text-gray-200" fill="currentColor" />
- </pattern>
- </defs>
- <rect width="784" height="404" fill="url(#ca9667ae-9f92-4be7-abcb-9e3d727f2941)" />
- </svg>
- <%= img_tag(PlausibleWeb.Router.Helpers.static_path(@conn, "/images/screenshot-countries.png"), class: "relative mx-auto shadow-xl", alt: "Screenshot of referrers") %>
- </div>
- </div>
- </div>
-</div>
-
-<div class="bg-white pt-12">
- <div class="container mx-auto py-12 lg:py-16">
- <div class="lg:grid lg:grid-cols-2 lg:gap-8 lg:items-center">
- <div class="mt-8 grid grid-cols-2 gap-0.5 md:grid-cols-3 lg:mt-0 lg:grid-cols-2">
- <div class="col-span-1 flex justify-center py-8 px-8 bg-gray-50">
- <img class="max-h-12" src="https://upload.wikimedia.org/wikipedia/commons/2/20/WordPress_logo.svg" alt="Wordpress" />
- </div>
- <div class="col-span-1 flex justify-center py-8 px-8 bg-gray-50">
- <%= img_tag(PlausibleWeb.Router.Helpers.static_path(@conn, "/images/icon/ghost.svg"), class: "max-h-12", alt: "Ghost") %>
- </div>
- <div class="col-span-1 flex justify-center py-8 px-8 bg-gray-50">
- <img class="max-h-8 mt-2" src="https://static1.squarespace.com/static/ta/579a2a93c534a544b31573c3/30/assets/pages/logomark/images/icons/icon-squarespace.svg?20181219" alt="Wix" />
- </div>
- <div class="col-span-1 flex justify-center py-8 px-8 bg-gray-50">
- <img class="max-h-8 mt-2" src="https://upload.wikimedia.org/wikipedia/en/7/76/Wix.com_website_logo.svg" alt="Wix" />
- </div>
- <div class="col-span-1 flex justify-center py-8 px-8 bg-gray-50">
- <img class="max-h-12" src="https://upload.wikimedia.org/wikipedia/commons/7/7e/Weebly_logo.svg" alt="Weebly" />
- </div>
- <div class="col-span-1 flex justify-center py-8 px-8 bg-gray-50">
- <img class="max-h-12" src="https://upload.wikimedia.org/wikipedia/commons/e/e5/Google_Search_Console.svg" alt="Google Search Console" />
- </div>
- </div>
- <div class="mt-12 lg:mt-0 lg:px-8">
- <h2 class="text-3xl leading-9 font-extrabold text-gray-900 tracking-tight sm:text-4xl sm:leading-10">
- Integrates seamlessly with your favourite tools
- </h2>
- <p class="mt-3 max-w-3xl text-lg leading-7 text-gray-500">
- Plausible is simple to set up and integrate with popular tools such as WordPress, Ghost, Squarespace, Wix, Weebly and Google Search Console.
- </p>
- </div>
- </div>
- </div>
-</div>
-
-<div class="py-12 bg-white overflow-hidden md:py-20 lg:py-24">
- <div class="relative max-w-screen-xl mx-auto px-4 sm:px-6 lg:px-8">
- <svg class="absolute top-full right-full transform translate-x-1/3 -translate-y-1/4 lg:translate-x-1/2 xl:-translate-y-1/2" width="404" height="404" fill="none" viewBox="0 0 404 404">
- <defs>
- <pattern id="ad119f34-7694-4c31-947f-5c9d249b21f3" x="0" y="0" width="20" height="20" patternUnits="userSpaceOnUse">
- <rect x="0" y="0" width="4" height="4" class="text-gray-200" fill="currentColor" />
- </pattern>
- </defs>
- <rect width="404" height="404" fill="url(#ad119f34-7694-4c31-947f-5c9d249b21f3)" />
- </svg>
-
- <div class="relative">
- <blockquote class="mt-8">
- <div class="max-w-3xl mx-auto text-center text-2xl leading-9 font-medium text-gray-900">
- <p>
- &ldquo;Plausible is focused on exactly what I need: clear insights into my site visitors, without getting in my way.
- </p>
- </div>
- <footer class="mt-8">
- <div class="md:flex md:items-center md:justify-center">
- <div class="md:flex-shrink-0">
- <%= img_tag(PlausibleWeb.Router.Helpers.static_path(@conn, "/images/testimonials/felipe.jpg"), class: "mx-auto h-10 w-10 rounded-full", alt: "Image of Felipe Sere") %>
- </div>
- <div class="mt-3 text-center md:mt-0 md:ml-4 md:flex md:items-center">
- <div class="text-base leading-6 font-medium text-gray-900">Felipe Sere</div>
-
- <svg class="hidden md:block mx-1 h-5 w-5 text-indigo-600" fill="currentColor" viewBox="0 0 20 20">
- <path d="M11 0h3L9 20H6l5-20z" />
- </svg>
-
- <div class="text-base leading-6 font-medium text-gray-500">Software Engineer, 8th Light</div>
- </div>
- </div>
- </footer>
- </blockquote>
- </div>
- </div>
-</div>
-
-<div class="bg-gray-900">
- <div class="pt-12 sm:pt-16 lg:pt-24">
- <div class="max-w-screen-xl mx-auto text-center px-4 sm:px-6 lg:px-8">
- <div class="max-w-3xl mx-auto lg:max-w-none">
- <p class="text-lg leading-6 font-semibold text-gray-300 uppercase tracking-wider">
- Pricing
- </p>
- <h2 class="mt-2 text-3xl leading-9 font-extrabold text-white sm:text-4xl sm:leading-10 lg:text-5xl lg:leading-none">
- Simple, traffic-based pricing
- </h2>
- <p class="mt-2 text-xl leading-7 text-gray-300">
- Sign up for 30-day unlimited trial. No credit card required.
- </p>
- </div>
- </div>
- </div>
- <div class="mt-8 pb-12 bg-gray-50 sm:mt-12 sm:pb-16 lg:mt-16 lg:pb-24">
- <div class="relative">
- <div class="absolute inset-0 h-3/4 bg-gray-900"></div>
- <div class="relative z-10 max-w-screen-xl mx-auto px-4 sm:px-6 lg:px-8">
- <div class="max-w-md mx-auto lg:max-w-5xl xl:max-w-6xl lg:grid lg:grid-cols-3 lg:gap-5">
- <div class="rounded-lg shadow-lg overflow-hidden">
- <div class="px-6 py-8 bg-white sm:p-10 sm:pb-6">
- <div>
- <span class="inline-flex px-4 py-1 rounded-full text-sm leading-5 font-semibold tracking-wide uppercase bg-indigo-100 text-indigo-600">
- Personal
- </span>
- </div>
- <div class="mt-4 flex items-baseline text-6xl leading-none font-extrabold">
- $6
- <span class="ml-1 text-2xl leading-8 font-medium text-gray-500">
- /mo
- </span>
- </div>
- </div>
- <div class="px-6 pt-6 pb-8 bg-gray-50 sm:p-10 sm:pt-6">
- <ul>
- <li class="flex items-start">
- <div class="flex-shrink-0">
- <svg class="h-6 w-6 text-green-500" stroke="currentColor" fill="none" viewBox="0 0 24 24">
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"/>
- </svg>
- </div>
- <p class="ml-3 text-base leading-6 text-gray-700">
- Up to <b>10k pageviews per month</b>
- </p>
- </li>
- <li class="mt-4 flex items-start">
- <div class="flex-shrink-0">
- <svg class="h-6 w-6 text-green-500" stroke="currentColor" fill="none" viewBox="0 0 24 24">
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"/>
- </svg>
- </div>
- <p class="ml-3 text-base leading-6 text-gray-700">
- Unlimited websites
- </p>
- </li>
- <li class="mt-4 flex items-start">
- <div class="flex-shrink-0">
- <svg class="h-6 w-6 text-green-500" stroke="currentColor" fill="none" viewBox="0 0 24 24">
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"/>
- </svg>
- </div>
- <p class="ml-3 text-base leading-6 text-gray-700">
- 100% Data ownership
- </p>
- </li>
- <li class="mt-4 flex items-start">
- <div class="flex-shrink-0">
- <svg class="h-6 w-6 text-green-500" stroke="currentColor" fill="none" viewBox="0 0 24 24">
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"/>
- </svg>
- </div>
- <p class="ml-3 text-base leading-6 text-gray-700">
- Email support
- </p>
- </li>
- </ul>
- <div class="mt-6 rounded-md shadow">
- <a href="/register" class="flex items-center justify-center px-5 py-3 border border-transparent text-base leading-6 font-medium rounded-md text-white bg-gray-900 hover:bg-gray-800 focus:outline-none focus:shadow-outline transition duration-150 ease-in-out">
- Get started
- </a>
- </div>
- </div>
- </div>
- <div class="mt-4 rounded-lg shadow-lg overflow-hidden lg:mt-0">
- <div class="px-6 py-8 bg-white sm:p-10 sm:pb-6">
- <div>
- <span class="inline-flex px-4 py-1 rounded-full text-sm leading-5 font-semibold tracking-wide uppercase bg-indigo-100 text-indigo-600">
- Startup
- </span>
- </div>
- <div class="mt-4 flex items-baseline text-6xl leading-none font-extrabold">
- $12
- <span class="ml-1 text-2xl leading-8 font-medium text-gray-500">
- /mo
- </span>
- </div>
- </div>
- <div class="px-6 pt-6 pb-8 bg-gray-50 sm:p-10 sm:pt-6">
- <ul>
- <li class="flex items-start">
- <div class="flex-shrink-0">
- <svg class="h-6 w-6 text-green-500" stroke="currentColor" fill="none" viewBox="0 0 24 24">
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"/>
- </svg>
- </div>
- <p class="ml-3 text-base leading-6 text-gray-700">
- Up to <b>100k pageviews per month</b>
- </p>
- </li>
- <li class="mt-4 flex items-start">
- <div class="flex-shrink-0">
- <svg class="h-6 w-6 text-green-500" stroke="currentColor" fill="none" viewBox="0 0 24 24">
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"/>
- </svg>
- </div>
- <p class="ml-3 text-base leading-6 text-gray-700">
- Unlimited websites
- </p>
- </li>
- <li class="mt-4 flex items-start">
- <div class="flex-shrink-0">
- <svg class="h-6 w-6 text-green-500" stroke="currentColor" fill="none" viewBox="0 0 24 24">
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"/>
- </svg>
- </div>
- <p class="ml-3 text-base leading-6 text-gray-700">
- 100% data ownership
- </p>
- </li>
- <li class="mt-4 flex items-start">
- <div class="flex-shrink-0">
- <svg class="h-6 w-6 text-green-500" stroke="currentColor" fill="none" viewBox="0 0 24 24">
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"/>
- </svg>
- </div>
- <p class="ml-3 text-base leading-6 text-gray-700">
- Priority support
- </p>
- </li>
- </ul>
- <div class="mt-6 rounded-md shadow">
- <a href="/register" class="flex items-center justify-center px-5 py-3 border border-transparent text-base leading-6 font-medium rounded-md text-white bg-gray-900 hover:bg-gray-800 focus:outline-none focus:shadow-outline transition duration-150 ease-in-out">
- Get started
- </a>
- </div>
- </div>
- </div>
- <div class="mt-4 rounded-lg shadow-lg overflow-hidden lg:mt-0">
- <div class="px-6 py-8 bg-white sm:p-10 sm:pb-6">
- <div>
- <span class="inline-flex px-4 py-1 rounded-full text-sm leading-5 font-semibold tracking-wide uppercase bg-indigo-100 text-indigo-600">
- Business
- </span>
- </div>
- <div class="mt-4 flex items-baseline text-6xl leading-none font-extrabold">
- $36
- <span class="ml-1 text-2xl leading-8 font-medium text-gray-500">
- /mo
- </span>
- </div>
- </div>
- <div class="px-6 pt-6 pb-8 bg-gray-50 sm:p-10 sm:pt-6">
- <ul>
- <li class="flex items-start">
- <div class="flex-shrink-0">
- <svg class="h-6 w-6 text-green-500" stroke="currentColor" fill="none" viewBox="0 0 24 24">
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"/>
- </svg>
- </div>
- <p class="ml-3 text-base leading-6 text-gray-700">
- Up to <b>1m pageviews per month</b>
- </p>
- </li>
- <li class="mt-4 flex items-start">
- <div class="flex-shrink-0">
- <svg class="h-6 w-6 text-green-500" stroke="currentColor" fill="none" viewBox="0 0 24 24">
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"/>
- </svg>
- </div>
- <p class="ml-3 text-base leading-6 text-gray-700">
- Unlimited websites
- </p>
- </li>
- <li class="mt-4 flex items-start">
- <div class="flex-shrink-0">
- <svg class="h-6 w-6 text-green-500" stroke="currentColor" fill="none" viewBox="0 0 24 24">
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"/>
- </svg>
- </div>
- <p class="ml-3 text-base leading-6 text-gray-700">
- 100% data ownership
- </p>
- </li>
- <li class="mt-4 flex items-start">
- <div class="flex-shrink-0">
- <svg class="h-6 w-6 text-green-500" stroke="currentColor" fill="none" viewBox="0 0 24 24">
- <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"/>
- </svg>
- </div>
- <p class="ml-3 text-base leading-6 text-gray-700">
- Priority support
- </p>
- </li>
- </ul>
- <div class="mt-6 rounded-md shadow">
- <a href="/register" class="flex items-center justify-center px-5 py-3 border border-transparent text-base leading-6 font-medium rounded-md text-white bg-gray-900 hover:bg-gray-800 focus:outline-none focus:shadow-outline transition duration-150 ease-in-out">
- Get started
- </a>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
-</div>
-
-<div class="bg-gray-50">
- <div class="container mx-auto pt-12 pb-16 sm:pt-16 sm:pb-20 px-4 sm:px-6 lg:pt-20 lg:pb-28 lg:px-8">
- <h2 class="text-3xl leading-9 font-extrabold text-gray-900">
- Frequently asked questions
- </h2>
- <div class="mt-6 border-t-2 border-gray-100 pt-10">
- <dl class="md:grid md:grid-cols-2 md:gap-8">
- <div>
- <div>
- <h3 class="text-lg leading-6 font-medium text-gray-900">
- 1. Can I use Plausible on more than one website?
- </h3>
- <div class="mt-2">
- <p class="text-base leading-6 text-gray-500">
- Yes. You can add as many websites as you want under a single account. You will be charged for the total pageviews on all of your websites combined. For example, on the 10k plan you can either have 10 websites that each get 1000 pageviews per month, or one website that gets 10,000 pageviews per month.
- </p>
- </div>
- </div>
- <div class="mt-12">
- <h3 class="text-lg leading-6 font-medium text-gray-900">
- 2. What happens if I go over my plan limit?
- </h3>
- <div class="mt-2">
- <p class="text-base leading-6 text-gray-500">
- You don't have to pay for a one-time spike in traffic, but if you go over your plan limit for 2 months in a row, we will contact you to discuss upgrade options.
- </p>
- </div>
- </div>
- <div class="mt-12">
- <h3 class="text-lg leading-6 font-medium text-gray-900">
- 3. Is Plausible open-source?
- </h3>
- <div class="mt-2">
- <p class="text-base leading-6 text-gray-500">
- Plausible is fully open-source and available <%= link("on Github", to: "https://github.com/plausible-insights/plausible", class: "text-indigo-600") %> so you can check out the code. We welcome feedback, have a public roadmap and are available to you via email.
- </p>
- </div>
- </div>
- </div>
- <div class="mt-12 md:mt-0">
- <div class="">
- <h3 class="text-lg leading-6 font-medium text-gray-900">
- 4. Why is Plausible not free like Google Analytics?
- </h3>
- <div class="mt-2">
- <p class="text-base leading-6 text-gray-500">
- Google Analytics is free because Google has built their company and their wealth by collecting and analyzing huge amounts of personal information from web users and using these personal and behavioral insights to sell advertisements.<br /><br />
-
- With Plausible, you 100% own and control all of your website data. This data is not being shared with or sold to any third-parties. Since we don't make money from targeted advertisement, we must ask for a small fee to keep the servers running.
- </p>
- </div>
- </div>
- <div class="mt-12">
- <h3 class="text-lg leading-6 font-medium text-gray-900">
- 5. How do you make sure my visitors' privacy is protected?
- </h3>
- <div class="mt-2">
- <p class="text-base leading-6 text-gray-500">
- We take painstaking care to not collect or store any personal information that could be tied back to the visitor. You own your data and we will never sell it or use it in nefarious ways. <%= link("Read more about our data policy", to: "/data-policy", class: "text-indigo-600") %>.
- </p>
- </div>
- </div>
- </div>
- </dl>
- </div>
- </div>
-</div>
-
-<div class="bg-gray-50 pb-12">
- <div class="container mx-auto py-12 px-4 sm:px-6 lg:py-16 lg:px-8 lg:flex lg:items-center lg:justify-between">
- <h3 class="text-3xl leading-9 font-extrabold tracking-tight text-gray-900 sm:text-4xl sm:leading-10">
- Ready to dive in?
- <br />
- <span class="text-indigo-600">Start your free trial today.</span>
- </h3>
- <div class="mt-8 flex lg:flex-shrink-0 lg:mt-0">
- <div class="inline-flex rounded-md shadow">
- <a href="/register" class="inline-flex items-center justify-center px-5 py-3 border border-transparent text-base leading-6 font-medium rounded-md text-white bg-indigo-600 hover:bg-indigo-500 focus:outline-none focus:shadow-outline transition duration-150 ease-in-out">
- Get started
- </a>
- </div>
- <div class="ml-3 inline-flex rounded-md shadow">
- <a href="/plausible.io" class="inline-flex items-center justify-center px-5 py-3 border border-transparent text-base leading-6 font-medium rounded-md text-indigo-600 bg-white hover:text-indigo-500 focus:outline-none focus:shadow-outline transition duration-150 ease-in-out">
- Live demo
- </a>
- </div>
- </div>
- </div>
+<div class="relative bg-gray-50 overflow-hidden text-center">
+ You will be redirected... If it doesn't work, please click login.
</div>
diff --git a/lib/plausible_web/templates/page/privacy.html.eex b/lib/plausible_web/templates/page/privacy.html.eex
deleted file mode 100644
index 31db64ae2e..0000000000
--- a/lib/plausible_web/templates/page/privacy.html.eex
+++ /dev/null
@@ -1,11 +0,0 @@
-<div class="max-w-md mx-auto py-12 just-text">
-<h1 class="text-xl font-black mb-4">Privacy Policy</h1>
-<p>Your privacy is important to us. It is Plausible Analytics' policy to respect your privacy regarding any information we may collect from you across our website, <%= link(plausible_url(), to: plausible_url()) %>, and other sites we own and operate.</p>
-<p>We only ask for personal information when we truly need it to provide a service to you. We collect it by fair and lawful means, with your knowledge and consent. We also let you know why we’re collecting it and how it will be used.</p>
-<p>We only retain collected information for as long as necessary to provide you with your requested service. What data we store, we’ll protect within commercially acceptable means to prevent loss and theft, as well as unauthorised access, disclosure, copying, use or modification.</p>
-<p>We don’t share any personally identifying information publicly or with third-parties, except when required to by law.</p>
-<p>Our website may link to external sites that are not operated by us. Please be aware that we have no control over the content and practices of these sites, and cannot accept responsibility or liability for their respective privacy policies.</p>
-<p>You are free to refuse our request for your personal information, with the understanding that we may be unable to provide you with some of your desired services.</p>
-<p>Your continued use of our website will be regarded as acceptance of our practices around privacy and personal information. If you have any questions about how we handle user data and personal information, feel free to contact us.</p>
-<p>This policy is effective as of 25 January 2019.</p>
-</div>
diff --git a/lib/plausible_web/templates/page/sites.html.eex b/lib/plausible_web/templates/page/sites.html.eex
deleted file mode 100644
index 786a1870b7..0000000000
--- a/lib/plausible_web/templates/page/sites.html.eex
+++ /dev/null
@@ -1,22 +0,0 @@
-<div class="pt-16"></div>
-<div class="max-w-xl mx-auto flex flex-col sm:flex-row justify-between">
- <h1 class="text-2xl font-black">My websites</h1>
- <a href="/sites/new" class="button w-full my-2 sm:my-0 sm:w-auto">+ Add a website</a>
-</div>
-<div class="flex items-center justify-center w-full py-8 mb-16">
- <div class="overflow-hidden bg-white rounded max-w-xl w-full shadow-md leading-normal">
- <%= for site <- @sites do %>
- <div class="w-full relative">
- <a href="/<%= URI.encode_www_form(site.domain) %>" class="block hover:bg-gray-100 group p-4 border-b no-underline flex justify-between transition">
- <p class="w-full font-bold text-lg mb-1 text-gray-800"><%= site.domain %></p>
- </a>
- <%= link(to: "/#{URI.encode_www_form(site.domain)}/settings", class: "flex absolute hover:bg-gray-100 transition rounded py-2 px-5", style: "top: 12px; right: 6px;") do %>
- <div>
- <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-settings -mt-px"><circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"/></svg>
- </div>
- <p class="ml-1 text-gray-800 font-medium">Settings</p>
- <% end %>
- </div>
- <% end %>
- </div>
-</div>
diff --git a/lib/plausible_web/templates/page/terms.html.eex b/lib/plausible_web/templates/page/terms.html.eex
deleted file mode 100644
index 448957e2af..0000000000
--- a/lib/plausible_web/templates/page/terms.html.eex
+++ /dev/null
@@ -1,33 +0,0 @@
-<div class="max-w-2xl mx-auto leading-normal py-12 just-text">
- <h1 class="text-2xl font-black mb-4">Terms of Service</h1>
- <h3 class="text-lg font-black">1. Terms</h3>
- <p>By accessing the website at <%= link(plausible_url(), to: plausible_url()) %>, you are agreeing to be bound by these terms of service, all applicable laws and regulations, and agree that you are responsible for compliance with any applicable local laws. If you do not agree with any of these terms, you are prohibited from using or accessing this site. The materials contained in this website are protected by applicable copyright and trademark law.</p>
- <h3 class="text-lg font-black">2. Use License</h3>
- <ol type="a" class="list-decimal pl-4">
- <li>Permission is granted to temporarily download one copy of the materials (information or software) on Plausible Insights' website for personal, non-commercial transitory viewing only. This is the grant of a license, not a transfer of title, and under this license you may not:
- <ol type="i" class="list-decimal pl-4">
- <li>modify or copy the materials;</li>
- <li>use the materials for any commercial purpose, or for any public display (commercial or non-commercial);</li>
- <li>attempt to decompile or reverse engineer any software contained on Plausible Insights' website;</li>
- <li>remove any copyright or other proprietary notations from the materials; or</li>
- <li>transfer the materials to another person or "mirror" the materials on any other server.</li>
- </ol>
- </li>
- <li>This license shall automatically terminate if you violate any of these restrictions and may be terminated by Plausible Insights at any time. Upon terminating your viewing of these materials or upon the termination of this license, you must destroy any downloaded materials in your possession whether in electronic or printed format.</li>
- </ol>
- <h3 class="text-lg font-black">3. Disclaimer</h3>
- <ol type="a">
- <li>The materials on Plausible Insights' website are provided on an 'as is' basis. Plausible Insights makes no warranties, expressed or implied, and hereby disclaims and negates all other warranties including, without limitation, implied warranties or conditions of merchantability, fitness for a particular purpose, or non-infringement of intellectual property or other violation of rights.</li>
- <li>Further, Plausible Insights does not warrant or make any representations concerning the accuracy, likely results, or reliability of the use of the materials on its website or otherwise relating to such materials or on any sites linked to this site.</li>
- </ol>
- <h3 class="text-lg font-black">4. Limitations</h3>
- <p>In no event shall Plausible Insights or its suppliers be liable for any damages (including, without limitation, damages for loss of data or profit, or due to business interruption) arising out of the use or inability to use the materials on Plausible Insights' website, even if Plausible Insights or a Plausible Insights authorized representative has been notified orally or in writing of the possibility of such damage. Because some jurisdictions do not allow limitations on implied warranties, or limitations of liability for consequential or incidental damages, these limitations may not apply to you.</p>
- <h3 class="text-lg font-black">5. Accuracy of materials</h3>
- <p>The materials appearing on Plausible Insights' website could include technical, typographical, or photographic errors. Plausible Insights does not warrant that any of the materials on its website are accurate, complete or current. Plausible Insights may make changes to the materials contained on its website at any time without notice. However Plausible Insights does not make any commitment to update the materials.</p>
- <h3 class="text-lg font-black">6. Links</h3>
- <p>Plausible Insights has not reviewed all of the sites linked to its website and is not responsible for the contents of any such linked site. The inclusion of any link does not imply endorsement by Plausible Insights of the site. Use of any such linked website is at the user's own risk.</p>
- <h3 class="text-lg font-black">7. Modifications</h3>
- <p>Plausible Insights may revise these terms of service for its website at any time without notice. By using this website you are agreeing to be bound by the then current version of these terms of service.</p>
- <h3 class="text-lg font-black">8. Governing Law</h3>
- <p>These terms and conditions are governed by and construed in accordance with the laws of Estonia and you irrevocably submit to the exclusive jurisdiction of the courts in that State or location.</p>
-</div>
diff --git a/mix.exs b/mix.exs
index 8e7c03aa97..69f19f77b1 100644
--- a/mix.exs
+++ b/mix.exs
@@ -81,7 +81,6 @@ defmodule Plausible.MixProject do
{:excoveralls, "~> 0.10", only: :test},
{:double, "~> 0.7.0", only: :test},
{:junit_formatter, "~> 3.1", only: [:test]},
- {:joken, "~> 2.0"},
{:php_serializer, "~> 0.9.0"},
{:csv, "~> 2.3"},
{:oauther, "~> 1.1"},
diff --git a/plausible-variables.sample.env b/plausible-variables.sample.env
new file mode 100644
index 0000000000..eb06acb9c3
--- /dev/null
+++ b/plausible-variables.sample.env
@@ -0,0 +1,22 @@
+ENVIRONMENT=production
+PORT=8080
+SECRET_KEY_BASE=iYb1mP5cnmY+gUxo7C/h6XMigossPhzwd8/ic6LFnQ9Y58Fl1xduSWaPq0fHDdbn
+SIGNING_SALT=PL/THF0VMOzuv1bOcldjDzYFBLryvXNs
+HOST=localhost
+DATABASE_URL=postgres://postgres:postgres@plausible_db:5432/plausible
+DATABASE_TLS_ENABLED=false
+ADMIN_USER_NAME=admin
+ADMIN_USER_PWD=admin@1234!
+APP_VERSION=test
+MAILER_ADAPTER=Bamboo.SMTPAdapter
+SMTP_HOST_ADDR=fakesmtp_server
+SMTP_HOST_PORT=1025
+SMTP_USER_PWD=password
+SMTP_HOST_SSL_ENABLED=false
+SMTP_MX_LOOKUPS_ENABLED=false
+CLICKHOUSE_DATABASE_HOST=plausible_events_db
+CLICKHOUSE_DATABASE_NAME=plausible_events_db
+DISABLE_AUTH=false
+DISABLE_REGISTRATION=false
\ No newline at end of file
diff --git a/test/plausible_web/controllers/admin_auth_controller_test.exs b/test/plausible_web/controllers/admin_auth_controller_test.exs
new file mode 100644
index 0000000000..328991604d
--- /dev/null
+++ b/test/plausible_web/controllers/admin_auth_controller_test.exs
@@ -0,0 +1,49 @@
+defmodule PlausibleWeb.AdminAuthControllerTest do
+ use PlausibleWeb.ConnCase
+
+ describe "GET /" do
+ test "no landing page", %{conn: conn} do
+ set_config(disable_authentication: false)
+ conn = get(conn, "/")
+ assert redirected_to(conn) == "/login"
+ end
+
+ test "disable authentication", %{conn: conn} do
+ set_config(disable_authentication: true)
+
+ admin_user =
+ Plausible.Auth.find_user_by(email: Application.get_env(:plausible, :admin_email))
+
+ # goto landing page
+ conn = get(conn, "/")
+ assert get_session(conn, :current_user_id) == admin_user.id
+ assert redirected_to(conn) == "/sites"
+
+ # trying logging out
+ conn = post(conn, "/logout")
+ assert redirected_to(conn) == "/"
+ conn = get(conn, "/")
+ assert redirected_to(conn) == "/sites"
+ end
+
+ test "disable registration", %{conn: conn} do
+ set_config(disable_registration: true)
+ conn = get(conn, "/register")
+ assert redirected_to(conn) == "/login"
+ end
+ end
+
+ def set_config(config) do
+ updated_config =
+ Keyword.merge(
+ [disable_authentication: false, disable_registration: false],
+ config
+ )
+
+ Application.put_env(
+ :plausible,
+ :selfhost,
+ updated_config
+ )
+ end
+end
diff --git a/test/plausible_web/controllers/api/external_controller_test.exs b/test/plausible_web/controllers/api/external_controller_test.exs
index 8d3e25c854..8f7a705ed9 100644
--- a/test/plausible_web/controllers/api/external_controller_test.exs
+++ b/test/plausible_web/controllers/api/external_controller_test.exs
@@ -399,7 +399,6 @@ defmodule PlausibleWeb.Api.ExternalControllerTest do
assert pageview["country_code"] == "US"
end
-
test "responds 400 when required fields are missing", %{conn: conn} do
params = %{}
diff --git a/test/plausible_web/controllers/page_controller_test.exs b/test/plausible_web/controllers/page_controller_test.exs
deleted file mode 100644
index 9018d30036..0000000000
--- a/test/plausible_web/controllers/page_controller_test.exs
+++ /dev/null
@@ -1,10 +0,0 @@
-defmodule PlausibleWeb.PageControllerTest do
- use PlausibleWeb.ConnCase
-
- describe "GET /" do
- test "shows the landing page", %{conn: conn} do
- conn = get(conn, "/")
- assert html_response(conn, 200) =~ "Plausible"
- end
- end
-end
diff --git a/test/support/clickhouse_setup.ex b/test/support/clickhouse_setup.ex
index d15dfd0a09..6a1658fa37 100644
--- a/test/support/clickhouse_setup.ex
+++ b/test/support/clickhouse_setup.ex
@@ -237,7 +237,7 @@ defmodule Plausible.Test.ClickhouseSetup do
referrer: "",
is_bounce: false,
start: ~N[2019-01-01 03:00:00]
- },
+ }
])
end
end
diff --git a/test/test_helper.exs b/test/test_helper.exs
index 3b76c7e3e4..ed3e319740 100644
--- a/test/test_helper.exs
+++ b/test/test_helper.exs
@@ -1,6 +1,7 @@
{:ok, _} = Application.ensure_all_started(:ex_machina)
ExUnit.configure(formatters: [JUnitFormatter, ExUnit.CLIFormatter])
Plausible.Test.ClickhouseSetup.run()
+Plausible.Release.init_admin()
ExUnit.start()
Application.ensure_all_started(:double)
Ecto.Adapters.SQL.Sandbox.mode(Plausible.Repo, :manual)