cloudflare-turnstile-rails 0.9.1 → 0.9.2
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 +4 -4
- data/README.md +1 -1
- data/lib/cloudflare/turnstile/rails/verification.rb +17 -1
- data/lib/cloudflare/turnstile/rails/version.rb +1 -1
- metadata +6 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b26a1fe41faf2fc522f8c3edfa99d1630302e42f6b27c70d57ef2bd18d68141b
|
|
4
|
+
data.tar.gz: a4cd3a79a966b15dd86abb2bb432ec514b799a7cb18c259fe663d7a0b446e68c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 44f4c61f9ee07d73c42537269b82467cd6feea576249d3c726a85cf77a779a0243868947af930baddd4458d0310330c62843eff956602156193fdfedd44df7ed
|
|
7
|
+
data.tar.gz: 491185d8692844b7fca37e5881054b6f25ac20e58f369ecda969a260d1f66f520a6ff297d4b86c444d483cc25e63cf496c76b6c6cba192c19a077a815d201802
|
data/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
[](https://github.com/vkononov/cloudflare-turnstile-rails/actions/workflows/lint.yml)
|
|
6
6
|
[](https://github.com/vkononov/cloudflare-turnstile-rails/actions/workflows/test.yml)
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Cloudflare Turnstile gem for Ruby on Rails with built-in Turbo and Turbolinks support and CSP compliance.
|
|
9
9
|
|
|
10
10
|
Supports `Rails >= 5.0` with `Ruby >= 2.6.0`.
|
|
11
11
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
require 'net/http'
|
|
2
|
+
require 'openssl'
|
|
2
3
|
|
|
3
4
|
require_relative 'constants/cloudflare'
|
|
4
5
|
|
|
@@ -64,7 +65,22 @@ module Cloudflare
|
|
|
64
65
|
request = Net::HTTP::Post.new(uri.request_uri, 'Content-Type': 'application/x-www-form-urlencoded')
|
|
65
66
|
request.set_form_data(body)
|
|
66
67
|
|
|
67
|
-
|
|
68
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
|
69
|
+
http.use_ssl = true
|
|
70
|
+
http.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
|
71
|
+
http.cert_store = OpenSSL::X509::Store.new
|
|
72
|
+
http.cert_store.set_default_paths
|
|
73
|
+
|
|
74
|
+
begin
|
|
75
|
+
res = http.request(request)
|
|
76
|
+
rescue Net::OpenTimeout, Net::ReadTimeout => e
|
|
77
|
+
raise ConfigurationError, "Turnstile verification timed out: #{e.message}"
|
|
78
|
+
rescue OpenSSL::SSL::SSLError => e
|
|
79
|
+
raise ConfigurationError, "SSL verification failed: #{e.message}"
|
|
80
|
+
rescue SocketError, Errno::ECONNREFUSED => e
|
|
81
|
+
raise ConfigurationError, "Network error during Turnstile verification: #{e.message}"
|
|
82
|
+
end
|
|
83
|
+
|
|
68
84
|
begin
|
|
69
85
|
json = JSON.parse(res.body)
|
|
70
86
|
rescue JSON::ParserError
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: cloudflare-turnstile-rails
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.9.
|
|
4
|
+
version: 0.9.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Vadim Kononov
|
|
@@ -23,8 +23,8 @@ dependencies:
|
|
|
23
23
|
- - ">="
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
25
|
version: '5.0'
|
|
26
|
-
description: Integrates Cloudflare Turnstile into Rails applications,
|
|
27
|
-
|
|
26
|
+
description: Integrates Cloudflare Turnstile into Ruby on Rails applications, transparently
|
|
27
|
+
reloads on Turbo and Turbolinks events, and embeds CSP-nonce-compliant scripts.
|
|
28
28
|
email:
|
|
29
29
|
- vadim@konoson.com
|
|
30
30
|
executables: []
|
|
@@ -72,7 +72,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
72
72
|
- !ruby/object:Gem::Version
|
|
73
73
|
version: '0'
|
|
74
74
|
requirements: []
|
|
75
|
-
rubygems_version: 3.
|
|
75
|
+
rubygems_version: 3.7.2
|
|
76
76
|
specification_version: 4
|
|
77
|
-
summary:
|
|
77
|
+
summary: Cloudflare Turnstile gem for Rails with built-in Turbo and Turbolinks support
|
|
78
|
+
and CSP compliance
|
|
78
79
|
test_files: []
|