onetime-up 0.8.0 → 0.8.1

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: 4c1dc14a9677195dcc44ddb5f2f0ab15a310c2289a143d97aa2097d62e4f056f
4
- data.tar.gz: ebb13a2e7050fffc000a18befa1d7ef456151a23f30d9dcc0d75b5ce084e20b6
3
+ metadata.gz: 44363e304d46201be0d1362d29b83afc834932fca947814d8ff641e852906122
4
+ data.tar.gz: cca803e708264e825b106274a6e07732991c84e2c6c1036d77997ca26a5671cc
5
5
  SHA512:
6
- metadata.gz: 021a70dcfccc65e85f3510c02e620b351302275db33989571edb809af2956e359cbdfdf0254dd2128631c7c2751c2243b9663a97f1ee9443903cc6307ce252df
7
- data.tar.gz: 44786b8cd1a188dd8fefa88766083da6fbb000de5d44465e66ed00832dc1334b3dab2e831b7bc065395a2a1fc138745fdeef0277d9f75353b78a7ca269b6cb16
6
+ metadata.gz: 0f4e96784f5e441a3d9625b56a0f8a5a318a27bd12109535f2e50ee5dd5e89ee9e7b35f21334062952f19ad3059d7b2ca08c95144d2f6206f5f203e21fb7f62e
7
+ data.tar.gz: f4eccb25d18d9c504b9f8c06a12b7a11520b9a8e0022d296caacde3e7ca1651e5017972c853feb74e7814b2608b4103415fa709749e639711ddbc2a5ed626a41
data/CHANGELOG.md CHANGED
@@ -8,6 +8,10 @@
8
8
  - Restore `apiversion` path handling for callers that pass an API version explicitly
9
9
  - Add safer CLI response handling for changed or partial API responses
10
10
  - Accept secret URLs from root and regional onetimesecret.com hosts
11
+ - `generate` no longer hangs when stdin is an idle open pipe (e.g. ssh, cron)
12
+ - Accept secret URLs with a trailing slash
13
+ - `-H` takes precedence over `ONETIME_HOST`
14
+ - Report non-JSON API responses with their HTTP status instead of a backtrace
11
15
 
12
16
  ## [0.6.0] - 2026-01-18
13
17
 
data/lib/onetime/api.rb CHANGED
@@ -146,7 +146,7 @@ module Onetime
146
146
  return value unless uri.host && uri.path
147
147
  return value unless accepted_secret_host?(uri.host, api_base_uri)
148
148
 
149
- match = uri.path.match(%r{\A/secret/([a-zA-Z0-9]+)\z})
149
+ match = uri.path.match(%r{\A/secret/([a-zA-Z0-9]+)/?\z})
150
150
  match ? match[1] : value
151
151
  rescue URI::InvalidURIError
152
152
  value
@@ -41,9 +41,10 @@ module Onetime
41
41
  end
42
42
 
43
43
  def configure_api!
44
- OT::API.base_uri @parsed.base_uri if @parsed.base_uri
45
44
  OT::API.debug_output @stderr if @parsed.debug
46
45
  @api = OT::API.new(@parsed.custid, @parsed.apikey)
46
+ # Set after API.new, which applies ONETIME_HOST, so that -H takes precedence.
47
+ OT::API.base_uri @parsed.base_uri if @parsed.base_uri
47
48
  end
48
49
 
49
50
  def run_status
@@ -119,7 +120,8 @@ module Onetime
119
120
  extras = @parsed.argv
120
121
  raise Error, "generate takes no arguments (got: %s). Did you mean: onetime share < %s" % [extras.join(' '), extras.first]
121
122
  end
122
- if !@stdin.tty? && !@stdin.eof?
123
+ # Non-blocking check: an idle pipe that is never closed (ssh, cron) must not hang.
124
+ if !@stdin.tty? && IO.select([@stdin], nil, nil, 0) && !@stdin.eof?
123
125
  raise Error, 'generate does not read stdin. Did you mean: onetime share'
124
126
  end
125
127
  opts = { ttl: @parsed.ttl, recipient: @parsed.recipients }
@@ -189,15 +191,19 @@ module Onetime
189
191
  end
190
192
 
191
193
  def api_get(path)
192
- res = @api.get(path)
193
- check_response!(res)
194
- res
194
+ request { @api.get(path) }
195
195
  end
196
196
 
197
197
  def api_post(path, params)
198
- res = @api.post(path, params)
198
+ request { @api.post(path, params) }
199
+ end
200
+
201
+ def request
202
+ res = yield
199
203
  check_response!(res)
200
204
  res
205
+ rescue JSON::ParserError
206
+ raise Error, "Unexpected non-JSON response (HTTP #{@api.response.code})"
201
207
  end
202
208
 
203
209
  def check_response!(res)
@@ -1,3 +1,3 @@
1
1
  module Onetime
2
- VERSION = "0.8.0"
2
+ VERSION = "0.8.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: onetime-up
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Delano Mandelbaum
8
8
  - Saverio Miroddi
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-05-13 00:00:00.000000000 Z
11
+ date: 2026-10-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -91,7 +91,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
91
91
  - !ruby/object:Gem::Version
92
92
  version: 2.0.0
93
93
  requirements: []
94
- rubygems_version: 4.0.9
94
+ rubygems_version: 4.0.20
95
95
  specification_version: 4
96
96
  summary: Command-line tool and library for onetimesecret.com API (API v2)
97
97
  test_files: []