rails_cloudflare_turnstile 0.3.0 → 0.4.1
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1fa6aa3cea22a3b9c2e3be003a80c150bb619b6366b6d88e34536bc40c12e14f
|
4
|
+
data.tar.gz: 3dc30ec33c6f76e8924009b8e8c751c0ec1871ba4a9764cf082f3eaee39d83c0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a4aa9005cb2c58a5004df9902faaf7935acea917a91c28d8508eb9c91aeb7e8302243f39066a0a4ba6ccd0f7c37bcf6f0f030c3ccfb1eaaeddb2bd5a96146135
|
7
|
+
data.tar.gz: 5345c04fa070b63b318344129f6d2b4c118017642de3ae7654bab6101fc4e8fecc5200f6ae36c9cec237ba25e9368cd4ca43b253521ded174e1a9e0569ba3c20
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,20 @@
|
|
1
1
|
ChangeLog
|
2
2
|
=========
|
3
3
|
|
4
|
+
0.4.1
|
5
|
+
-----
|
6
|
+
- bump net-imap, nokogiri, rack and rack-session dependencies to address CVEs
|
7
|
+
- fix for normal widget size (thanks @yenshirak)
|
8
|
+
|
9
|
+
0.4.0
|
10
|
+
-----
|
11
|
+
- add the ability to use explicit-render mode by passing `explicit: true` to `cloudflare_turnstile_script_tag` (thanks @adillari)
|
12
|
+
- adds the ability to set custom CSS classes on the turnstile element by passing `container_class:` to the `cloudflare_turnstile` helper (thanks @adillari)
|
13
|
+
|
14
|
+
0.3.1 (unreleased)
|
15
|
+
------------------
|
16
|
+
- bump rack dependency to address CVE
|
17
|
+
|
4
18
|
0.3.0
|
5
19
|
-----
|
6
20
|
- drop support for Ruby 3.1
|
@@ -16,7 +16,7 @@ module RailsCloudflareTurnstile
|
|
16
16
|
# Timeout for operations with Cloudflare
|
17
17
|
attr_accessor :timeout
|
18
18
|
|
19
|
-
# size for the widget (:
|
19
|
+
# size for the widget (:normal, :compact, or :flexible)
|
20
20
|
attr_accessor :size
|
21
21
|
|
22
22
|
# theme for the widget (:auto, :light, or :dark)
|
@@ -33,7 +33,7 @@ module RailsCloudflareTurnstile
|
|
33
33
|
@enabled = nil
|
34
34
|
@mock_enabled = nil
|
35
35
|
@timeout = 5.0
|
36
|
-
@size = :
|
36
|
+
@size = :normal
|
37
37
|
@theme = :auto
|
38
38
|
@validation_url = "https://challenges.cloudflare.com/turnstile/v0/siteverify"
|
39
39
|
end
|
@@ -42,7 +42,7 @@ module RailsCloudflareTurnstile
|
|
42
42
|
raise "Must set site key" if @site_key.nil?
|
43
43
|
raise "Must set secret key" if @secret_key.nil?
|
44
44
|
@size = @size.to_sym
|
45
|
-
raise "Size must be one of ':
|
45
|
+
raise "Size must be one of ':normal', ':compact' or ':flexible'" unless [:normal, :compact, :flexible].include? @size
|
46
46
|
raise "Theme must be one of :auto, :light, or :dark" unless [:auto, :light, :dark].include? @theme
|
47
47
|
end
|
48
48
|
|
@@ -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:
|
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:
|
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
|
-
|
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,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_cloudflare_turnstile
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Brown
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: rails
|
@@ -92,7 +92,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
92
92
|
- !ruby/object:Gem::Version
|
93
93
|
version: '0'
|
94
94
|
requirements: []
|
95
|
-
rubygems_version: 3.6.
|
95
|
+
rubygems_version: 3.6.7
|
96
96
|
specification_version: 4
|
97
97
|
summary: Rails extension for Cloudflare's Turnstile CAPTCHA alternative
|
98
98
|
test_files: []
|