dacpclient 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 20b7236a5ab83767fe89d6cf209479bfcf82a74f
4
- data.tar.gz: 3a0efd4010272d54cf56881037302194488529d3
3
+ metadata.gz: 7cff4d4d1619ceb0c95d8b580555e2e52654a5d0
4
+ data.tar.gz: 9386ed35980f41b0c13d4a7984cc8e8380bc8dff
5
5
  SHA512:
6
- metadata.gz: b4fd7451d4e3a7fe559ba64656388c16ff9cc84aa67a75ba69951adf55ed448b75182d9f0ccfefbe9e068b7ba020b697ff5b123a3f0feff765df8c92bae394d4
7
- data.tar.gz: addcdeb4add40740e95c31631cfea95c0d93b0705db10b05bb581f29e35f882521b5e9a102979480466ecf274e1310ba94b0713efcc136588ef3b85405361ac5
6
+ metadata.gz: 9c3b18e11267e973a749e6914cdc49d208272320b9f3894e00a2a2ec47d681ecd740a34ef01d690f9dd30034142d680232f37865afa230d81415fdfb8fedbcba
7
+ data.tar.gz: 89f07f9edb793880e2c04da6aafa0dd780457499abfa2251cb95cb33df644982e0bc5f91f5cd284119ce97e8e980cc6dee220aaa46db7091725103be7967e9eb
@@ -13,7 +13,7 @@ module DACPClient
13
13
  @name = client.name
14
14
  @port = port
15
15
  @host = host
16
- @pair = client.get_guid
16
+ @pair = client.guid
17
17
  @pin = [0, 0, 0, 0]
18
18
  @device_type = 'iPod'
19
19
  super port, host
@@ -34,21 +34,20 @@ module DACPClient
34
34
 
35
35
  def self.generate_pin_challenge(pair, pin)
36
36
  pin_string = pin.map { |i| "#{i}\x00" }.join
37
- Digest::MD5.hexdigest(pair + pin_string).upcase
37
+ Digest::MD5.hexdigest(pair + pin_string)
38
38
  end
39
39
 
40
40
  def serve(client)
41
- code = client.gets.match(/pairingcode=([^&]*)/)[1]
42
- correct = code == @expected
43
- if correct
41
+ if client.gets =~ /pairingcode=#{@expected}/i
44
42
  client.print "HTTP/1.1 200 OK\r\n" +
45
43
  "Content-Length: #{@pairing_string.length}\r\n\r\n"
46
44
  client.print @pairing_string
45
+ client.close
46
+ stop
47
47
  else
48
48
  client.print "HTTP/1.1 404 Not Found\r\nContent-Length: 0\r\n\r\n"
49
+ client.close
49
50
  end
50
- client.close
51
- stop if correct
52
51
  end
53
52
 
54
53
  private
@@ -1,4 +1,4 @@
1
1
  # The DACPClient module
2
2
  module DACPClient
3
- VERSION = '0.2.3'
3
+ VERSION = '0.2.4'
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dacpclient
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jurriaan Pruis