Skip to content

Commit

Permalink
Merge pull request #7 from crazygooddigital/feature/embeddable_mode
Browse files Browse the repository at this point in the history
Embeddable mode plausible#213
  • Loading branch information
aymanterra authored Jan 20, 2021
2 parents 71c2a6d + 856968b commit 205c8c3
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion config/dev.exs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ config :plausible, PlausibleWeb.Endpoint,
accepts: ~w(html json)
],
server: true,
allow_embed: false,
session_cookie_extra: "SameSite=Lax",
debug_errors: true,
code_reloader: true,
check_origin: false,
Expand Down
2 changes: 1 addition & 1 deletion config/prod.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ config :plausible, PlausibleWeb.Endpoint,
cache_static_manifest: "priv/static/cache_manifest.json",
check_origin: false,
server: true,
allow_embed: false,
session_cookie_extra: "SameSite=Lax",
code_reloader: false
3 changes: 2 additions & 1 deletion lib/plausible_web/endpoint.ex
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ defmodule PlausibleWeb.Endpoint do
signing_salt: "3IL0ob4k",
# 5 years, this is super long but the SlidingSessionTimeout will log people out if they don't return for 2 weeks
max_age: 60 * 60 * 24 * 365 * 5,
extra: if(config[:allow_embed], do: "SameSite=None;Secure", else: "SameSite=Lax")
extra:
if(config[:session_cookie_extra], do: config[:session_cookie_extra], else: "SameSite=Lax")

plug CORSPlug
plug PlausibleWeb.Tracker
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<header class="relative">
<h2 class="text-lg leading-6 font-medium text-gray-900 dark:text-gray-100">Embeddable mode</h2>
<p class="mt-1 text-sm leading-5 text-gray-500 dark:text-gray-200">Embed your stats page inside an iframe in this domain only (<%= URI.encode_www_form(@site.domain) %>)</p>
<%= link(to: "https://docs.plausible.io/visibility", target: "_blank") do %>
<%= link(to: "https://docs.plausible.io/embeddable-mode", target: "_blank") do %>
<svg class="w-6 h-6 absolute top-0 right-0 text-gray-400" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z" clip-rule="evenodd"></path></svg>
<% end %>
</header>
Expand Down

0 comments on commit 205c8c3

Please sign in to comment.