terminalwire 0.1.15 → 0.1.16

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: 7368802178d36d058c4502624e50e831358e6b4bc47bbb40a18a8837063443a7
4
- data.tar.gz: eaeedd98707062d3a639250cb53e3dd619bcd3d63b1e2a6ee51d916edb5da9df
3
+ metadata.gz: 20d25d091ee29d5953cfc70935227461ed75ec3d52c5b4cbff96db9e4b30ea7a
4
+ data.tar.gz: 80325aea9d946a9050ab4d9a97003186aba8a826e04ccefa23783a6fcfeea4dc
5
5
  SHA512:
6
- metadata.gz: e0fb8c62c74528e3de4701ebced6e3e794d973ca67eddfdc140a645e9ecc676ae994095a3d08b4da731f3c87bf258018818d55562325016b4f4eee6dd9f17a6f
7
- data.tar.gz: d27e62fdcf8582293fb89395acd0e9e9282c616fbb8eb9b8592f95b1a931465011ab9d006b11afa23d1719e1c97e0a61b9ffcb74619aec03f3f1a2286b57e2b6
6
+ metadata.gz: cc79939e4328e469df0a13f5ec34ed0e99c5f7206712a8480916b55005b95fcf544de98884d33f306fcb16a02fa4868aa09f302087e3015c02c80d42c8429a75
7
+ data.tar.gz: 0e00b629b2ae76adddef05725f2f3fb8b1550e55b513fdd77317a978f2a416a0876af450ac47da4c0ee011fb8239623e37f7887bc0bd627ac2cb258b0779077a
@@ -19,15 +19,10 @@ class Terminalwire::Authority
19
19
  if @url.port == @url.default_port
20
20
  @url.host
21
21
  else
22
- "#{@url.host}:#{@url.port}"
22
+ "#{url.host}:#{url.port}"
23
23
  end
24
24
  end
25
25
 
26
- # Useful for identifying the authority in UI without the protocol.
27
- def name
28
- [domain, path].join
29
- end
30
-
31
26
  # Make sure there's always a / at the end of the path.
32
27
  def path
33
28
  path_keys.join(PATH_SEPERATOR).prepend(PATH_SEPERATOR)
@@ -145,8 +145,7 @@ module Terminalwire::Client
145
145
  end
146
146
 
147
147
  def authority_path
148
- # TODO: Change this so it's per endpoint and not domain
149
- root_path.join("authorities/#{authority.domain}")
148
+ root_path.join("authorities/#{authority}")
150
149
  end
151
150
 
152
151
  def storage_path
@@ -159,7 +158,7 @@ module Terminalwire::Client
159
158
 
160
159
  def serialize
161
160
  {
162
- authority: @authority.to_s,
161
+ authority: @authority,
163
162
  schemes: @schemes.serialize,
164
163
  paths: @paths.serialize,
165
164
  storage_path: storage_path.to_s,
@@ -204,13 +203,23 @@ module Terminalwire::Client
204
203
  end
205
204
 
206
205
  def self.from_url(url)
207
- authority = Terminalwire::Authority.new(url:)
206
+ url = URI(url)
208
207
 
209
- case authority.domain
208
+ case url.host
210
209
  when RootPolicy::HOST
211
- RootPolicy.new authority:
210
+ RootPolicy.new
212
211
  else
213
- Policy.new authority:
212
+ Policy.new authority: url_authority(url)
213
+ end
214
+ end
215
+
216
+ def self.url_authority(url)
217
+ # I had to lift this from URI::HTTP because `ws://` doesn't
218
+ # have an authority method.
219
+ if url.port == url.default_port
220
+ url.host
221
+ else
222
+ "#{url.host}:#{url.port}"
214
223
  end
215
224
  end
216
225
  end
@@ -53,6 +53,15 @@ module Terminalwire
53
53
  end
54
54
  end
55
55
 
56
+ # Extracted from HTTP. This is so we can
57
+ def self.authority(url)
58
+ if url.port == url.default_port
59
+ url.host
60
+ else
61
+ "#{url.host}:#{url.port}"
62
+ end
63
+ end
64
+
56
65
  def self.websocket(url:, arguments: ARGV, entitlement: nil)
57
66
  url = URI(url)
58
67
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Terminalwire
4
- VERSION = "0.1.15"
4
+ VERSION = "0.1.16"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: terminalwire
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.15
4
+ version: 0.1.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brad Gessler
@@ -199,7 +199,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
199
199
  - !ruby/object:Gem::Version
200
200
  version: '0'
201
201
  requirements: []
202
- rubygems_version: 3.5.9
202
+ rubygems_version: 3.5.16
203
203
  signing_key:
204
204
  specification_version: 4
205
205
  summary: Ship a CLI for your web app. No API required.