private_captcha 0.0.7 → 0.0.8
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: 197d99d169be8deaededceb9f733525d5d2d6287844cdf40a052fcb4a062a520
|
|
4
|
+
data.tar.gz: 8212225b2743d98bc0d621c5fdbe7dcb0ad3df2ed1ba2cd3da1741ce644045cc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d694537643e19067f691ad44ad07a22c278243130221dd43e085a236c7daf6434149707942fe6caea276fd8ded36dd242554969ad2485a243a60a48151452a88
|
|
7
|
+
data.tar.gz: 32c341e9ae6c0f57cdbb5e009a1183effa018f8987e58ba8ae4407f7594e8ec8e30809d4e735440d979dd33e44efcacba78639921b49f640d14ce52efc11c1e3
|
|
@@ -24,7 +24,7 @@ module PrivateCaptcha
|
|
|
24
24
|
@logger = @config.logger || Logger.new(IO::NULL)
|
|
25
25
|
end
|
|
26
26
|
|
|
27
|
-
# rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity
|
|
27
|
+
# rubocop:disable-next Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity
|
|
28
28
|
def verify(solution, max_backoff_seconds: nil, attempts: nil, sitekey: nil)
|
|
29
29
|
raise EmptySolutionError if solution.nil? || solution.empty?
|
|
30
30
|
|
|
@@ -73,7 +73,6 @@ module PrivateCaptcha
|
|
|
73
73
|
|
|
74
74
|
response
|
|
75
75
|
end
|
|
76
|
-
# rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity
|
|
77
76
|
|
|
78
77
|
def verify_request(request, form_field: nil, sitekey: nil)
|
|
79
78
|
field = form_field || @config.form_field
|
|
@@ -99,7 +98,7 @@ module PrivateCaptcha
|
|
|
99
98
|
domain.delete_suffix('/')
|
|
100
99
|
end
|
|
101
100
|
|
|
102
|
-
# rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
|
101
|
+
# rubocop:disable-next Metrics/AbcSize, Metrics/MethodLength
|
|
103
102
|
def do_verify(solution, sitekey: nil)
|
|
104
103
|
request = Net::HTTP::Post.new(@endpoint)
|
|
105
104
|
request['X-Api-Key'] = @config.api_key
|
|
@@ -149,7 +148,6 @@ module PrivateCaptcha
|
|
|
149
148
|
raise RetriableError, e
|
|
150
149
|
end
|
|
151
150
|
end
|
|
152
|
-
# rubocop:enable Metrics/AbcSize, Metrics/MethodLength
|
|
153
151
|
|
|
154
152
|
def parse_retry_after(header)
|
|
155
153
|
return nil if header.nil? || header.empty?
|
|
@@ -5,7 +5,7 @@ require 'rack'
|
|
|
5
5
|
module PrivateCaptcha
|
|
6
6
|
# Middleware provides Rack middleware for automatic captcha verification
|
|
7
7
|
class Middleware
|
|
8
|
-
# rubocop:disable Metrics/AbcSize
|
|
8
|
+
# rubocop:disable-next Metrics/AbcSize
|
|
9
9
|
def initialize(app, api_key:, **options)
|
|
10
10
|
@app = app
|
|
11
11
|
@client = Client.new do |config|
|
|
@@ -18,9 +18,8 @@ module PrivateCaptcha
|
|
|
18
18
|
config.logger = options[:logger] if options[:logger]
|
|
19
19
|
end
|
|
20
20
|
end
|
|
21
|
-
# rubocop:enable Metrics/AbcSize
|
|
22
21
|
|
|
23
|
-
# rubocop:disable Metrics/MethodLength
|
|
22
|
+
# rubocop:disable-next Metrics/MethodLength
|
|
24
23
|
def call(env)
|
|
25
24
|
request = Rack::Request.new(env)
|
|
26
25
|
|
|
@@ -36,6 +35,5 @@ module PrivateCaptcha
|
|
|
36
35
|
|
|
37
36
|
@app.call(env)
|
|
38
37
|
end
|
|
39
|
-
# rubocop:enable Metrics/MethodLength
|
|
40
38
|
end
|
|
41
39
|
end
|
|
@@ -39,7 +39,8 @@ module PrivateCaptcha
|
|
|
39
39
|
attr_accessor :success, :code, :origin, :timestamp
|
|
40
40
|
attr_reader :trace_id, :attempt
|
|
41
41
|
|
|
42
|
-
def initialize(success: false, code: VERIFY_NO_ERROR, origin: nil, timestamp: nil, edge_token: nil,
|
|
42
|
+
def initialize(success: false, code: VERIFY_NO_ERROR, origin: nil, timestamp: nil, edge_token: nil,
|
|
43
|
+
trace_id: nil, attempt: 0)
|
|
43
44
|
@success = success
|
|
44
45
|
@code = code
|
|
45
46
|
@origin = origin
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: private_captcha
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.8
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Taras Kushnir
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-10-
|
|
11
|
+
date: 2026-10-29 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rack
|