git-fit 0.10.7 → 0.10.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: 32616b46febca2fefadfe46d783de032676821f74e82c0a65e85f3a0def488f1
4
- data.tar.gz: 4b409c0d20c049c50e804123d82639915e35b6df957c1543756e75e4a2d8d643
3
+ metadata.gz: d77e55927509eaeb9a31b55bc95e825dddeda642d5dde1f225364c2445c86c9a
4
+ data.tar.gz: df38a564d5a8cbaa4cd9fe724555cd5920f26f4aebd71f3312a3d7336ed5e75c
5
5
  SHA512:
6
- metadata.gz: 39a504dad06283e1a891552b775d0df401f2a038343323e1084379882739a9fe669841b7195c8fa28d0bea136ac62b8e61cccc5c1eac9fb3ce4aca800d156a69
7
- data.tar.gz: dfbb3028468e96f6b943d332856e27520b034d216504bbd6072e26e656700d9340b38991e83fc6b5d869cbdc9a745c2a1fa5e684c903425b18dc45e608eacfa9
6
+ metadata.gz: 5b668da6a97754df6678bfeeda396e36b0e96e6c60edc66183d04024e49c6bc036cd2f89c335149fd4a17998a150bdfbf87b27eede2db53af5772cd7227bfe79
7
+ data.tar.gz: 99544a41731bc28298c6d80bdfa2c36c770f2113bd9d524d680d8f15959c4725371341080a17082aa4fbfe3e7403d8b9e2f30351d4789fffd3be865e10bcbb03
@@ -33,7 +33,8 @@ module GitFit
33
33
  JSON_ACCEPT = 'application/json, text/plain, */*'
34
34
  LOGIN_DELAY_MIN = 30.0
35
35
  LOGIN_DELAY_MAX = 45.0
36
- TLS_FINGERPRINTS = %w[safari safari_ios chrome120 edge101 chrome].freeze
36
+ MOBILE_FINGERPRINT = 'safari18_0'
37
+ TLS_FINGERPRINTS = %w[safari18_0 safari17_0 chrome120 edge101 chrome124].freeze
37
38
  CURL_BINARY = 'curl-impersonate'
38
39
 
39
40
  module_function
@@ -89,7 +90,7 @@ module GitFit
89
90
  }
90
91
 
91
92
  status, = curl_request(
92
- impersonate: 'safari',
93
+ impersonate: MOBILE_FINGERPRINT,
93
94
  jar: jar,
94
95
  output: body,
95
96
  url: with_query(signin_url, get_params),
@@ -113,7 +114,7 @@ module GitFit
113
114
  )
114
115
 
115
116
  status, resp_body = curl_request(
116
- impersonate: 'safari',
117
+ impersonate: MOBILE_FINGERPRINT,
117
118
  jar: jar,
118
119
  output: body,
119
120
  url: with_query("#{sso}/mobile/api/login", login_params),
@@ -128,7 +129,7 @@ module GitFit
128
129
  if resp_type == 'MFA_REQUIRED'
129
130
  method = res.dig('customerMfaInfo', 'mfaLastMethodUsed') || 'email'
130
131
  res = handle_mfa(sso, method, login_params, post_headers, mfa_code,
131
- impersonate: 'safari', jar: jar, output: body)
132
+ impersonate: MOBILE_FINGERPRINT, jar: jar, output: body)
132
133
  resp_type = res.dig('responseStatus', 'type')
133
134
  end
134
135
 
@@ -298,7 +299,12 @@ module GitFit
298
299
  headers.each { |key, value| args += ['-H', "#{key}: #{value}"] }
299
300
  args += ['--data-raw', data] if data
300
301
  args += ['-w', "\n%{http_code}", '-o', output, url] # rubocop:disable Style/FormatStringToken
301
- out, = Open3.capture3(*args)
302
+ out, err, status = Open3.capture3(*args)
303
+ unless status.success? && File.exist?(output)
304
+ detail = err.strip.lines.first.to_s
305
+ raise GitFit::Sync::AuthError,
306
+ "#{CURL_BINARY} failed (exit #{status.exitstatus}, impersonate #{impersonate}): #{detail}"
307
+ end
302
308
  code = out.strip.split.last.to_i
303
309
  [code, File.read(output)]
304
310
  end
@@ -195,7 +195,8 @@ module GitFit
195
195
  raise GitFit::Sync::AuthError, 'playwright-ruby-client gem missing. bundle install, or use -A strategy'
196
196
  end
197
197
 
198
- Playwright.create do |playwright|
198
+ cli = _find_playwright_cli
199
+ Playwright.create(playwright_cli_executable_path: cli) do |playwright|
199
200
  browser = playwright.chromium.launch(headless: true, executable_path: chrome_path)
200
201
  begin
201
202
  yield browser
@@ -208,6 +209,30 @@ module GitFit
208
209
  rescue StandardError => e
209
210
  raise GitFit::Sync::AuthError, "Playwright launch failed: #{e.message}"
210
211
  end
212
+
213
+ def _find_playwright_cli
214
+ env_path = ENV['GIT_FIT_PLAYWRIGHT_CLI_PATH'].to_s.strip
215
+ return env_path unless env_path.empty?
216
+
217
+ %w[
218
+ node_modules/.bin/playwright-core
219
+ ].each do |relative|
220
+ dir = Dir.pwd
221
+ loop do
222
+ candidate = File.join(dir, relative)
223
+ return candidate if File.exist?(candidate)
224
+
225
+ parent = File.dirname(dir)
226
+ break if parent == dir
227
+
228
+ dir = parent
229
+ end
230
+ end
231
+
232
+ raise GitFit::Sync::AuthError,
233
+ 'playwright-core CLI not found. npm install playwright-core@1.62.1 in the project root, ' \
234
+ 'or set GIT_FIT_PLAYWRIGHT_CLI_PATH, or use -A strategy'
235
+ end
211
236
  end
212
237
  # rubocop:enable Metrics/ModuleLength
213
238
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GitFit
4
- VERSION = '0.10.7'
4
+ VERSION = '0.10.8'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git-fit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.7
4
+ version: 0.10.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lax