bandshell 1.0 → 1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bandshell/application/app.rb +8 -4
- data/lib/bandshell/hardware_api.rb +52 -47
- metadata +18 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4f98087fc1c8d04747df09f03de6bbc00e57ba2e
|
4
|
+
data.tar.gz: b0832fa74e5106bf33e8c7144df3ec53204dda8a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 897c2197b7a44f22579a896da40f3ceeec9ff01a3730d3799992e1781365ff14a24dc6632ec20aed29211f93bb736a6c99295fa4ea8f429b9891549aba9b3ace
|
7
|
+
data.tar.gz: bf6c27fa4301422f1ba43cabc1b24604078eabb6e3b29c2b1085d1d25504bc9ea66668b073f434ce67308f689e77f4e58c65bca65fcb1cf261ff4067f5df588c
|
@@ -155,12 +155,16 @@ class ConcertoConfigServer < Sinatra::Base
|
|
155
155
|
begin
|
156
156
|
# this will fail with Errno::something if server
|
157
157
|
# can't be reached
|
158
|
-
|
159
|
-
|
158
|
+
uri = URI(url)
|
159
|
+
Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http|
|
160
|
+
request = Net::HTTP::Get.new uri.request_uri
|
161
|
+
response = http.request request
|
160
162
|
# also bomb out if we don't get an OK response
|
161
163
|
# maybe demanding 200 is too strict here?
|
162
|
-
|
163
|
-
|
164
|
+
if response.code != "200"
|
165
|
+
fail
|
166
|
+
end
|
167
|
+
end
|
164
168
|
|
165
169
|
# if we get here we have a somewhat valid URL to go to
|
166
170
|
true
|
@@ -74,6 +74,16 @@ module Bandshell
|
|
74
74
|
@screen_url = nil
|
75
75
|
@screen_id =nil
|
76
76
|
end
|
77
|
+
|
78
|
+
def get_https_response(uri, options={})
|
79
|
+
Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http|
|
80
|
+
request = Net::HTTP::Get.new uri.request_uri
|
81
|
+
unless options[:user].nil? && options[:pass].nil?
|
82
|
+
request.basic_auth options[:user], options[:pass]
|
83
|
+
end
|
84
|
+
response = http.request request
|
85
|
+
end
|
86
|
+
end
|
77
87
|
|
78
88
|
# Get array of data about the screen from the server
|
79
89
|
# This can only succeed once we have obtained a valid auth token.
|
@@ -112,47 +122,42 @@ module Bandshell
|
|
112
122
|
end
|
113
123
|
end
|
114
124
|
|
115
|
-
|
116
125
|
def get_with_auth(uri, user, pass)
|
117
|
-
begin
|
118
|
-
|
119
|
-
req.basic_auth user, pass
|
120
|
-
res = Net::HTTP.start(uri.hostname, uri.port) { |http|
|
121
|
-
http.request(req)
|
122
|
-
}
|
126
|
+
begin
|
127
|
+
response = get_https_response(uri, {:user => user, :pass => pass})
|
123
128
|
rescue StandardError => ex
|
124
129
|
puts "get_with_auth: Failed to access concerto server:\n"+
|
125
130
|
" "+ex.message.chomp
|
126
|
-
|
131
|
+
response = nil
|
127
132
|
end
|
128
|
-
|
133
|
+
response
|
129
134
|
end
|
130
135
|
|
131
136
|
def request_temp_token!
|
132
137
|
begin
|
133
|
-
response =
|
138
|
+
response = get_https_response(frontend_api_uri)
|
139
|
+
|
140
|
+
if response.code != "200"
|
141
|
+
puts "request_temp_token: Unsuccessful request, HTTP "+response.code+"."
|
142
|
+
return false
|
143
|
+
end
|
144
|
+
|
145
|
+
data=JSON.parse(response.body)
|
146
|
+
if data.has_key? 'screen_temp_token'
|
147
|
+
# We modify the token by appending an "s".
|
148
|
+
# Concerto allows this and concerto-hardware will use it to
|
149
|
+
# recognize that the user is setting up a managed player in
|
150
|
+
# addition to a simple screen.
|
151
|
+
token = data['screen_temp_token'] + 's'
|
152
|
+
ConfigStore.write_config('auth_temp_token',token)
|
153
|
+
return true
|
154
|
+
end
|
155
|
+
return false
|
134
156
|
rescue StandardError => ex
|
135
157
|
puts "request_temp_token: Failed to access concerto server:\n"+
|
136
158
|
" "+ex.message.chomp
|
137
159
|
return false
|
138
160
|
end
|
139
|
-
|
140
|
-
if response.code != "200"
|
141
|
-
puts "request_temp_token: Unsuccessful request, HTTP "+response.code+"."
|
142
|
-
return false
|
143
|
-
end
|
144
|
-
|
145
|
-
data=JSON.parse(response.body)
|
146
|
-
if data.has_key? 'screen_temp_token'
|
147
|
-
# We modify the token by appending an "s".
|
148
|
-
# Concerto allows this and concerto-hardware will use it to
|
149
|
-
# recognize that the user is setting up a managed player in
|
150
|
-
# addition to a simple screen.
|
151
|
-
token = data['screen_temp_token'] + 's'
|
152
|
-
ConfigStore.write_config('auth_temp_token',token)
|
153
|
-
return true
|
154
|
-
end
|
155
|
-
return false
|
156
161
|
end
|
157
162
|
|
158
163
|
# If the temp token has been accepted, convert it into an auth token,
|
@@ -165,31 +170,31 @@ module Bandshell
|
|
165
170
|
return :stat_err if temp_token.empty? #should not happen
|
166
171
|
|
167
172
|
query = URI.join(frontend_api_uri,"?screen_temp_token="+temp_token)
|
173
|
+
begin
|
174
|
+
response = get_https_response(query)
|
175
|
+
|
176
|
+
if response.code != "200"
|
177
|
+
puts "check_temp_token: Unsuccessful request, HTTP "+response.code+"."
|
178
|
+
return :stat_serverr
|
179
|
+
end
|
180
|
+
|
181
|
+
data=JSON.parse(response.body)
|
182
|
+
if data.has_key? 'screen_auth_token'
|
183
|
+
ConfigStore.write_config('auth_token',data['screen_auth_token'])
|
184
|
+
ConfigStore.write_config('auth_temp_token','')
|
185
|
+
return :stat_success
|
186
|
+
elsif data.has_key? 'screen_temp_token'
|
187
|
+
# Indicates the API was accessed successfuly but the temp token
|
188
|
+
# has not been entered yet.
|
189
|
+
return :stat_success
|
190
|
+
end
|
191
|
+
return :stat_err
|
168
192
|
|
169
|
-
begin
|
170
|
-
response = Net::HTTP.get_response(query)
|
171
193
|
rescue StandardError => ex
|
172
194
|
puts "check_temp_token: Failed to access concerto server:\n"+
|
173
195
|
" "+ex.message.chomp
|
174
196
|
return :stat_serverr
|
175
|
-
end
|
176
|
-
|
177
|
-
if response.code != "200"
|
178
|
-
puts "check_temp_token: Unsuccessful request, HTTP "+response.code+"."
|
179
|
-
return :stat_serverr
|
180
|
-
end
|
181
|
-
|
182
|
-
data=JSON.parse(response.body)
|
183
|
-
if data.has_key? 'screen_auth_token'
|
184
|
-
ConfigStore.write_config('auth_token',data['screen_auth_token'])
|
185
|
-
ConfigStore.write_config('auth_temp_token','')
|
186
|
-
return :stat_success
|
187
|
-
elsif data.has_key? 'screen_temp_token'
|
188
|
-
# Indicates the API was accessed successfuly but the temp token
|
189
|
-
# has not been entered yet.
|
190
|
-
return :stat_success
|
191
|
-
end
|
192
|
-
return :stat_err
|
197
|
+
end
|
193
198
|
end
|
194
199
|
|
195
200
|
public
|
metadata
CHANGED
@@ -1,83 +1,83 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bandshell
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '1.
|
4
|
+
version: '1.1'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Concerto Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-04-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sinatra
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: sys-uptime
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: sys-proctable
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: ipaddress
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: daemons
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
description: Client-side tools for Concerto digital signage
|
@@ -88,6 +88,9 @@ executables:
|
|
88
88
|
extensions: []
|
89
89
|
extra_rdoc_files: []
|
90
90
|
files:
|
91
|
+
- bin/bandshell-timer.rb
|
92
|
+
- bin/bandshelld
|
93
|
+
- bin/concerto_netsetup
|
91
94
|
- lib/bandshell/application/app.rb
|
92
95
|
- lib/bandshell/application/config.ru
|
93
96
|
- lib/bandshell/application/public/favicon.ico
|
@@ -147,9 +150,6 @@ files:
|
|
147
150
|
- lib/bandshell/netconfig.rb
|
148
151
|
- lib/bandshell/player_info.rb
|
149
152
|
- lib/bandshell/screen_control.rb
|
150
|
-
- bin/bandshell-timer.rb
|
151
|
-
- bin/bandshelld
|
152
|
-
- bin/concerto_netsetup
|
153
153
|
homepage:
|
154
154
|
licenses: []
|
155
155
|
metadata: {}
|
@@ -159,17 +159,17 @@ require_paths:
|
|
159
159
|
- lib
|
160
160
|
required_ruby_version: !ruby/object:Gem::Requirement
|
161
161
|
requirements:
|
162
|
-
- -
|
162
|
+
- - ">="
|
163
163
|
- !ruby/object:Gem::Version
|
164
164
|
version: '0'
|
165
165
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
166
166
|
requirements:
|
167
|
-
- -
|
167
|
+
- - ">="
|
168
168
|
- !ruby/object:Gem::Version
|
169
169
|
version: '0'
|
170
170
|
requirements: []
|
171
171
|
rubyforge_project:
|
172
|
-
rubygems_version: 2.
|
172
|
+
rubygems_version: 2.2.2
|
173
173
|
signing_key:
|
174
174
|
specification_version: 4
|
175
175
|
summary: Concerto Client Tools
|