cfsolve 0.1.4-aarch64-linux-gnu → 0.1.5-aarch64-linux-gnu

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.
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Cfsolve
4
- VERSION = "0.1.4"
5
- UPSTREAM_REVISION = "78459e222bc77e4234f7608849df3b40970bc324"
4
+ VERSION = "0.1.5"
5
+ UPSTREAM_REVISION = "82b19a39f8366b02c9eaf54b1c09ce97870ba981"
6
6
  end
data/lib/cfsolve.rb CHANGED
@@ -14,7 +14,7 @@ module Cfsolve
14
14
 
15
15
  # Reusable browser configuration. Each call runs with its own connections and cookies.
16
16
  class Browser
17
- DEFAULT_PROFILE = File.expand_path("../cfsolve/profiles/chrome-157-macos.json", __FILE__).freeze
17
+ DEFAULT_PROFILE = File.expand_path("../cfsolve/profiles/safari-26-ios.json", __FILE__).freeze
18
18
  EXECUTABLE = File.expand_path("../cfsolve/cfsolve-engine", __FILE__).freeze
19
19
  ERRORS = {
20
20
  "configuration" => ConfigurationError,
@@ -73,23 +73,34 @@ module Cfsolve
73
73
 
74
74
  request[:configuration] = JSON.parse(@configuration)
75
75
  request[:timeout] = timeout
76
+ Timeout.timeout(timeout, TimeoutError, "The solver exceeded its deadline") do
77
+ attempts = 0
78
+ begin
79
+ attempts += 1
80
+ execute(request)
81
+ rescue UnsupportedError
82
+ retry if attempts < 3
83
+ raise
84
+ end
85
+ end
86
+ end
87
+
88
+ def execute(request)
76
89
  child_input, input = IO.pipe
77
90
  output, child_output = IO.pipe
78
91
  pid = Process.spawn(EXECUTABLE, in: child_input, out: child_output, err: File::NULL)
79
92
  status = nil
80
93
  child_input.close
81
94
  child_output.close
82
- Timeout.timeout(timeout, TimeoutError, "The solver exceeded its deadline") do
83
- input.write(JSON.generate(request))
84
- input.close
85
- result = JSON.parse(output.read)
86
- _, status = Process.wait2(pid)
87
- raise Error, "The solver process failed" unless status.success?
88
- if (error = result["error"])
89
- raise ERRORS.fetch(error.fetch("kind"), Error), error.fetch("message")
90
- end
91
- result
95
+ input.write(JSON.generate(request))
96
+ input.close
97
+ result = JSON.parse(output.read)
98
+ _, status = Process.wait2(pid)
99
+ raise Error, "The solver process failed" unless status.success?
100
+ if (error = result["error"])
101
+ raise ERRORS.fetch(error.fetch("kind"), Error), error.fetch("message")
92
102
  end
103
+ result
93
104
  rescue Errno::ENOENT
94
105
  raise ConfigurationError, "The cfsolve executable is missing; reinstall the gem", cause: nil
95
106
  rescue JSON::ParserError, IOError, Errno::EPIPE
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cfsolve
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: aarch64-linux-gnu
6
6
  authors:
7
7
  - Oliver Morgan
@@ -574,8 +574,6 @@ files:
574
574
  - UPSTREAM.md
575
575
  - lib/cfsolve.rb
576
576
  - lib/cfsolve/cfsolve-engine
577
- - lib/cfsolve/profiles/chrome-157-macos.json
578
- - lib/cfsolve/profiles/chrome-157-macos/answers.json
579
577
  - lib/cfsolve/profiles/safari-26-ios.json
580
578
  - lib/cfsolve/profiles/safari-26-ios/answers.json
581
579
  - lib/cfsolve/profiles/safari-26-ios/challenge-page-answers.json