rails_cloudflare_turnstile 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c3b543d92247d908f023acb3692d21ae1661286d52893c9cdb096267351c81d7
4
- data.tar.gz: 41d7ccc2db8a762e1ccda597b9c8420ea119301daa69088647862070913f1568
3
+ metadata.gz: ced7870d2e2f5040778d90a722840d38af2c2a1ea808be79da000102c97b8a02
4
+ data.tar.gz: ffe59fd158ef7f8d1d1582921a61073baeaf1ef494fa69780a2365bd75879f30
5
5
  SHA512:
6
- metadata.gz: e87c6866d696a0c44e01e12b86a99bacb4ab713eb3be92f3ae9370dc513ff7ddb414602143134eb585a8d099ccb4d28b76b98e0ea5f19a8c445471fad4d8488c
7
- data.tar.gz: 7ddac5f036c1830c0e87041b54ecba4f7d0ea9acc22ff6120ab65de3f0123cd3bc0c6190670009c2e4665deda01946b799cf047f344d93df396635f888c8d771
6
+ metadata.gz: 4ba4e023af03055a4599cda446580aebe0b8ab97337cea03a1bc9955bbe26d3370eb7eef95bd44eb2267a22695938fb9bedc464c5c20bfe90024d7c026c49682
7
+ data.tar.gz: a9a9fbd0ea7c851349870c36635f7b5b70461c43d60eb2761d28a9438c6e19cd1b1f831908e995af7b7b4a7fa03d9049ed91ec2f2aa0ece241189bdcf53a7539
data/CHANGELOG.md CHANGED
@@ -1,6 +1,15 @@
1
1
  ChangeLog
2
2
  =========
3
3
 
4
+ 0.4.0
5
+ -----
6
+ - add the ability to use explicit-render mode by passing `explicit: true` to `cloudflare_turnstile_script_tag` (thanks @adillari)
7
+ - adds the ability to set custom CSS classes on the turnstile element by passing `container_class:` to the `cloudflare_turnstile` helper (thanks @adillari)
8
+
9
+ 0.3.1 (unreleased)
10
+ ------------------
11
+ - bump rack dependency to address CVE
12
+
4
13
  0.3.0
5
14
  -----
6
15
  - drop support for Ruby 3.1
@@ -1,3 +1,3 @@
1
1
  module RailsCloudflareTurnstile
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.0"
3
3
  end
@@ -2,21 +2,23 @@
2
2
 
3
3
  module RailsCloudflareTurnstile
4
4
  module ViewHelpers
5
- def cloudflare_turnstile(action: "other", data_callback: nil, **html_options)
5
+ def cloudflare_turnstile(action: "other", data_callback: nil, container_class: nil, **html_options)
6
+ container_class = ["cloudflare-turnstile", container_class].compact.join(" ")
7
+
6
8
  if RailsCloudflareTurnstile.enabled?
7
- content_tag(:div, class: "cloudflare-turnstile") do
9
+ content_tag(:div, class: container_class) do
8
10
  concat turnstile_div(action, data_callback: data_callback, **html_options)
9
11
  end
10
12
  elsif RailsCloudflareTurnstile.mock_enabled?
11
- content_tag(:div, class: "cloudflare-turnstile") do
13
+ content_tag(:div, class: container_class) do
12
14
  concat mock_turnstile_div(action, data_callback: data_callback, **html_options)
13
15
  end
14
16
  end
15
17
  end
16
18
 
17
- def cloudflare_turnstile_script_tag(async: true, defer: true)
19
+ def cloudflare_turnstile_script_tag(async: true, defer: true, explicit: false)
18
20
  if RailsCloudflareTurnstile.enabled?
19
- content_tag(:script, src: js_src, async: async, defer: defer, data: {turbo_track: "reload", turbo_temporary: true}) do
21
+ content_tag(:script, src: js_src(explicit:), async: async, defer: defer, data: {turbo_track: "reload", turbo_temporary: true}) do
20
22
  ""
21
23
  end
22
24
  elsif RailsCloudflareTurnstile.mock_enabled?
@@ -51,8 +53,12 @@ module RailsCloudflareTurnstile
51
53
  RailsCloudflareTurnstile.configuration.site_key
52
54
  end
53
55
 
54
- def js_src
55
- "https://challenges.cloudflare.com/turnstile/v0/api.js"
56
+ def js_src(explicit: false)
57
+ if explicit
58
+ "https://challenges.cloudflare.com/turnstile/v0/api.js?render=explicit"
59
+ else
60
+ "https://challenges.cloudflare.com/turnstile/v0/api.js"
61
+ end
56
62
  end
57
63
 
58
64
  def mock_js
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_cloudflare_turnstile
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Brown