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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fa68befac51923cd3175a3a806994532b758c51f37e910a6687582b758401b21
4
- data.tar.gz: 91908d8bde3e077cacbe9369cab913d34233baa41ee3ba84d1ad134df099aea9
3
+ metadata.gz: b26a1fe41faf2fc522f8c3edfa99d1630302e42f6b27c70d57ef2bd18d68141b
4
+ data.tar.gz: a4cd3a79a966b15dd86abb2bb432ec514b799a7cb18c259fe663d7a0b446e68c
5
5
  SHA512:
6
- metadata.gz: fa5a8eaafdd4072ceb5e60739d51db17364073c6b25edaccba093c457194687b7c012f6bf5e5b80be7444a593467a05f6fd090ede343cb5a1920abc17871620a
7
- data.tar.gz: 8ab2b74ec0f43f2c59b477b451fdcfc4544d17f30c386528b4700e34578fe29c505fcb4b0427af0e765ed2609bd7f30ec0dbd1e00f15d516bdd7825de18e59db
6
+ metadata.gz: 44f4c61f9ee07d73c42537269b82467cd6feea576249d3c726a85cf77a779a0243868947af930baddd4458d0310330c62843eff956602156193fdfedd44df7ed
7
+ data.tar.gz: 491185d8692844b7fca37e5881054b6f25ac20e58f369ecda969a260d1f66f520a6ff297d4b86c444d483cc25e63cf496c76b6c6cba192c19a077a815d201802
data/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  [![Lint Status](https://github.com/vkononov/cloudflare-turnstile-rails/actions/workflows/lint.yml/badge.svg)](https://github.com/vkononov/cloudflare-turnstile-rails/actions/workflows/lint.yml)
6
6
  [![Test Status](https://github.com/vkononov/cloudflare-turnstile-rails/actions/workflows/test.yml/badge.svg)](https://github.com/vkononov/cloudflare-turnstile-rails/actions/workflows/test.yml)
7
7
 
8
- A lightweight Rails gem for effortless Cloudflare Turnstile integration with Turbo support and CSP compliance.
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
- res = Net::HTTP.start(uri.host, uri.port, use_ssl: true) { |http| http.request(request) }
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
@@ -1,7 +1,7 @@
1
1
  module Cloudflare
2
2
  module Turnstile
3
3
  module Rails
4
- VERSION = '0.9.1'.freeze
4
+ VERSION = '0.9.2'.freeze
5
5
  end
6
6
  end
7
7
  end
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.1
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, handling script
27
- injection, CSP-nonce support, and automatic Turbo/Turbolinks reinitialization.
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.6.7
75
+ rubygems_version: 3.7.2
76
76
  specification_version: 4
77
- summary: Simple Cloudflare Turnstile integration for Ruby on Rails.
77
+ summary: Cloudflare Turnstile gem for Rails with built-in Turbo and Turbolinks support
78
+ and CSP compliance
78
79
  test_files: []