bandshell 0.0.15 → 0.0.20

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  require 'rubygems'
2
2
  require 'sinatra/base'
3
- require 'erb'
3
+ require 'haml'
4
4
  require 'json'
5
5
  require 'net/http'
6
6
  require 'ipaddress'
@@ -13,6 +13,9 @@ class ConcertoConfigServer < Sinatra::Base
13
13
  # set paths relative to this file's location
14
14
  set :root, File.dirname(__FILE__)
15
15
 
16
+ # listen on all IPv4 and IPv6 interfaces
17
+ set :bind, '::'
18
+
16
19
  # push these over to netconfig.rb?
17
20
  # Our list of available physical-layer connection methods...
18
21
  CONNECTION_METHODS = [
@@ -31,6 +34,8 @@ class ConcertoConfigServer < Sinatra::Base
31
34
  IPAddress.parse("::1")
32
35
  ]
33
36
 
37
+ set :haml, { :format => :html5, :layout => :main }
38
+
34
39
  helpers do
35
40
  # Get the return value of the method on obj if obj supports the method.
36
41
  # Otherwise return the empty string.
@@ -160,12 +165,12 @@ class ConcertoConfigServer < Sinatra::Base
160
165
  if network_ok
161
166
  # Everything's up and running, we just don't know what
162
167
  # our URL should be.
163
- erb :setup
168
+ haml :setup
164
169
  else
165
170
  # The network settings are not sane, we don't have an IP.
166
171
  # Redirect the user to the network configuration page to
167
172
  # take care of this.
168
- #redirect '/netconfig'
173
+ redirect '/netconfig'
169
174
  end
170
175
  end
171
176
 
@@ -189,7 +194,7 @@ class ConcertoConfigServer < Sinatra::Base
189
194
  # render a page indicating that the concerto_url is no good.
190
195
  # this page redirects to / every 5 seconds
191
196
  get '/problem' do
192
- erb :problem
197
+ haml :problem
193
198
  end
194
199
 
195
200
  get '/netconfig' do
@@ -209,7 +214,7 @@ class ConcertoConfigServer < Sinatra::Base
209
214
 
210
215
  # view will grab what it can from our existing
211
216
  # connection/addressing methods using value_from().
212
- erb :netsettings, :locals => {
217
+ haml :netsettings, :locals => {
213
218
  :connection_method => cm,
214
219
  :addressing_method => am
215
220
  }
@@ -294,7 +299,7 @@ class ConcertoConfigServer < Sinatra::Base
294
299
 
295
300
  get '/password' do
296
301
  protected!
297
- erb :password
302
+ haml :password
298
303
  end
299
304
 
300
305
  post '/password' do
@@ -313,7 +318,7 @@ class ConcertoConfigServer < Sinatra::Base
313
318
  #Requires ffi, sys-uptime, and sys-proctable gems
314
319
  get '/player_status' do
315
320
  @proctable = ProcTable.ps
316
- erb :player_status
321
+ haml :player_status
317
322
  end
318
323
 
319
324
  end
@@ -0,0 +1,6 @@
1
+ %htmlt
2
+ %head
3
+ %title="Concerto Player Network Configuration"
4
+ %script{:src=>"https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.js"}
5
+ %link{:rel=>"stylesheet", :type=>"text/css", :href=>"/stylesheet.css"}
6
+ %body=yield
@@ -0,0 +1,64 @@
1
+ %script{:src=>"network.js"}
2
+ %a{:href=>"/setup"}="Back to setup"
3
+ %h1="Concerto Player Network Configuration"
4
+ %form{:method=>"post"}
5
+ %h2="Connection Type"
6
+ %select#connection_type{:name=>"connection_type"}
7
+ / list out our available connection methods as options
8
+ / set the html selected flag on the one that is currently
9
+ / selected in the config
10
+ - CONNECTION_METHODS.each do |cm|
11
+ %option{:value=>cm.basename,
12
+ :selected=>(cm==connection_method.class)}=cm.description
13
+ #connection
14
+ #WiredConnection
15
+ %h3="Wired Connection Settings"
16
+ %p
17
+ %label{:for=>"WiredConnection_interface_name"}="Interface Name"
18
+ %select#interface_name{:name=>"WiredConnection/interface_name"}
19
+ %option{:value=>""}="Auto Select"
20
+ / list out available interfaces and their MAC addresses
21
+ / preselect one if there was one chosen in config
22
+ - Bandshell::WiredConnection.interfaces.each do |iface|
23
+ %option{:value=>iface.name, :selected=>value_from(connection_method, :interface_name)==iface.name}="#{iface.name} - #{iface.mac}"
24
+ #WirelessConnection
25
+ %h3="Wireless Connection Settings (no encryption)"
26
+ %p
27
+ %label{:for=>"WirelessConnection_interface_name"}="Interface Name"
28
+ %select#interface_name{:name=>"WirelessConnection/interface_name"}
29
+ %option{:value=>""}="Auto Select"
30
+ / same as above but with the wireless interfaces
31
+ - Bandshell::WirelessConnection.interfaces.each do |iface|
32
+ %option{:value=>iface.name, :selected=>value_from(connection_method, :interface_name) == iface.name}="#{iface.name} - #{iface.mac}"
33
+ %p
34
+ %label{:for=>"WirelessConnection_ssid"}="SSID"
35
+ %input{:type=>"text", :name=>"WirelessConnection/ssid",
36
+ :value=>value_from(connection_method, :ssid)}
37
+ %h2="IP Address"
38
+ %select#addressing_type{:name=>"addressing_type"}
39
+ - ADDRESSING_METHODS.each do |am|
40
+ %option{:value=>am.basename,
41
+ :selected=>(am==addressing_method.class)}=am.description
42
+ #address
43
+ #DHCPAddressing
44
+ #StaticAddressing
45
+ %h3="Static Address Settings"
46
+ %p
47
+ %label{:for=>"StaticAddressing_address"}="Address"
48
+ %input{:type=>"text", :name=>"StaticAddressing/address",
49
+ :value=>value_from(addressing_method, :address)}
50
+ %p
51
+ %label{:for=>"StaticAddressing_netmask"}="Netmask"
52
+ %input{:type=>"text", :name=>"StaticAddressing/netmask",
53
+ :value=>value_from(addressing_method, :netmask)}
54
+ %p
55
+ %label{:for=>"StaticAddressing_gateway"}="Gateway"
56
+ %input{:type=>"text", :name=>"StaticAddressing/gateway",
57
+ :value=>value_from(addressing_method, :gateway)}
58
+ %p
59
+ %label{:for=>"StaticAddressing_address"}="Nameservers (separate with commas or spaces)"
60
+ %input{:type=>"text", :name=>"StaticAddressing/nameservers_flat",
61
+ :value=>value_from(addressing_method, :nameservers_flat)}
62
+
63
+ %input{:type=>"submit"}
64
+
@@ -0,0 +1,9 @@
1
+ %form{:method=>'post'}
2
+ %p
3
+ %label{:for=>'newpass'} New Password
4
+ %input{:type=>'password', :name=>'newpass'}
5
+ %p
6
+ %label{:for=>'newpass_confirm'} Confirm Password
7
+ %input{:type=>'password', :name=>'newpass_confirm'}
8
+ %p
9
+ %input{:type=>'submit', :value=>'Change Password'}
@@ -0,0 +1,8 @@
1
+ System Uptime: #{Uptime.uptime}
2
+
3
+ System Processes:
4
+ %br/
5
+ - for p in @proctable
6
+ %b= p.comm
7
+ (PID #{p.pid.to_s})
8
+ %br/
@@ -0,0 +1,15 @@
1
+ %script{:src=>"problem.js"}
2
+ .error
3
+ %p
4
+ %img{:src=>"trollface.png"}
5
+
6
+ %h1 Problem?
7
+ %p
8
+ Due to technical difficulties, this Concerto screen is currently not
9
+ operational. Please check again soon.
10
+ %p
11
+ ==The Concerto installation at #{concerto_url} could not be reached.
12
+ %p
13
+ If the URL needs to be changed, go back to
14
+ %a{:href=>"/setup"}
15
+ Player Configuration
@@ -0,0 +1,25 @@
1
+ %h1 Welcome to Concerto Player
2
+ %p
3
+ You're seeing this because your Concerto player has not yet been configured.
4
+ We need the URL of your Concerto instance before we can get up and running.
5
+
6
+ %form{:method=>'post'}
7
+ %p
8
+ %label{:for=>'url'} URL
9
+ %input{:type=>'text', :name=>'url'}
10
+ %input{:type=>'submit', :value=>'Here it is!'}
11
+
12
+ %p
13
+ The IPv4 address of this screen appears to be:
14
+ =my_ip
15
+ %p
16
+ ==This page can be accessed remotely via http://#{my_ip}/setup
17
+ %p
18
+ Username is root, default password is 'default'.
19
+ %p
20
+ Also, you may want to
21
+ %a{:href=>'/netconfig'} change network settings
22
+ or
23
+ %a{:href=>'/password'} change the configuration password.
24
+
25
+
@@ -5,7 +5,13 @@ require 'tempfile'
5
5
  module Bandshell
6
6
  module LiveImage
7
7
  def self.mountpoint
8
- '/live/image'
8
+ if File.exist? '/etc/concerto/medium_path'
9
+ IO.read('/etc/concerto/medium_path').chomp
10
+ else
11
+ # sane default for Debian Live-based systems
12
+ # (as of 2013-04-24)
13
+ '/lib/live/mount/medium'
14
+ end
9
15
  end
10
16
 
11
17
  def self.readonly?
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bandshell
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.15
4
+ version: 0.0.20
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-04-19 00:00:00.000000000 Z
12
+ date: 2013-04-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sinatra
@@ -27,6 +27,22 @@ dependencies:
27
27
  - - ! '>='
28
28
  - !ruby/object:Gem::Version
29
29
  version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: haml
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
30
46
  - !ruby/object:Gem::Dependency
31
47
  name: sys-uptime
32
48
  requirement: !ruby/object:Gem::Requirement
@@ -100,21 +116,21 @@ executables:
100
116
  extensions: []
101
117
  extra_rdoc_files: []
102
118
  files:
119
+ - lib/bandshell/config_store.rb
103
120
  - lib/bandshell/live_image.rb
104
121
  - lib/bandshell/netconfig.rb
105
- - lib/bandshell/config_store.rb
106
122
  - lib/bandshell/application/config.ru
107
- - lib/bandshell/application/views/netsettings.erb
108
- - lib/bandshell/application/views/setup.erb
109
- - lib/bandshell/application/views/player_status.erb
110
- - lib/bandshell/application/views/problem.erb
111
- - lib/bandshell/application/views/layout.erb
112
- - lib/bandshell/application/views/password.erb
113
- - lib/bandshell/application/app.rb
123
+ - lib/bandshell/application/views/main.haml
124
+ - lib/bandshell/application/views/setup.haml
125
+ - lib/bandshell/application/views/password.haml
126
+ - lib/bandshell/application/views/netsettings.haml
127
+ - lib/bandshell/application/views/problem.haml
128
+ - lib/bandshell/application/views/player_status.haml
114
129
  - lib/bandshell/application/public/network.js
115
130
  - lib/bandshell/application/public/stylesheet.css
116
131
  - lib/bandshell/application/public/problem.js
117
132
  - lib/bandshell/application/public/trollface.png
133
+ - lib/bandshell/application/app.rb
118
134
  - bin/concerto_configserver
119
135
  - bin/concerto_netsetup
120
136
  - bin/bandshelld
@@ -143,3 +159,4 @@ signing_key:
143
159
  specification_version: 3
144
160
  summary: Concerto Client Tools
145
161
  test_files: []
162
+ has_rdoc:
@@ -1,11 +0,0 @@
1
- <html>
2
- <head>
3
- <title>Concerto Player Network Configuration</title>
4
- <!-- this probably should not be relied upon long term... -->
5
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.js"></script>
6
- <link rel="stylesheet" type="text/css" href="stylesheet.css" />
7
- </head>
8
- <body>
9
- <%= yield %>
10
- </body>
11
- </html>
@@ -1,89 +0,0 @@
1
- <script src="network.js"></script>
2
- <a href="/setup">Back to setup</a>
3
- <h1>Concerto Player Network Configuration</h1>
4
- <form method="post">
5
- <h2>Connection Type</h2>
6
- <select id="connection_type" name="connection_type" />
7
- <% CONNECTION_METHODS.each do |cm| %>
8
- <option value="<%= cm.basename %>"
9
- <%= cm==connection_method.class?"selected":"" %>>
10
- <%= cm.description %>
11
- </option>
12
- <% end %>
13
- </select>
14
- <div id="connection">
15
- <div id="WiredConnection">
16
- <h3>Wired Connection Settings</h3>
17
- <p>
18
- <label for="WiredConnection_interface_name">Interface Name</label>
19
- <select id="interface_name" name="WiredConnection/interface_name">
20
- <option value="">Auto Select</option>
21
- <% Bandshell::WiredConnection.interfaces.each do |iface| %>
22
- <option
23
- value="<%=iface.name%>"
24
- <%= value_from(connection_method, :interface_name)==iface.name?"selected":"" %>
25
- >
26
- <%= iface.name %> - <% iface.mac %>
27
- </option>
28
- <% end %>
29
- </select>
30
- </p>
31
- </div>
32
-
33
- <div id="WirelessConnection">
34
- <h3>Wireless Connection Settings (no encryption)</h3>
35
- <p>
36
- <label for="WirelessConnection/interface_name">Interface Name</label>
37
- <!-- FIXME both shouldn't have same ID -->
38
- <select id="interface_name" name="WirelessConnection/interface_name">
39
- <option value="">Auto Select</option>
40
- <% Bandshell::WirelessConnection.interfaces.each do |iface| %>
41
- <option
42
- value="<%=iface.name%>"
43
- <%=value_from(connection_method, :interface_name) == iface?"selected":""%>
44
- >
45
- <%= iface.name %> - <%= iface.mac %>
46
- </option>
47
- <% end %>
48
- </select>
49
- </p>
50
- <p>
51
- <label for="WirelessConnection_ssid">SSID</label>
52
- <input type="text" name="WirelessConnection/ssid"
53
- value="<%=value_from(connection_method, :ssid)%>" />
54
- </p>
55
- </div>
56
- </div>
57
-
58
- <div id="address">
59
- <div id="DHCPAddressing"></div>
60
- <div id="StaticAddressing">
61
- <h3>Static Address Settings</h3>
62
- <p>
63
- <label for="StaticAddressing_address">Address</label>
64
- <input type="text" name="StaticAddressing/address"
65
- value="<%=value_from(addressing_method, :address %>" />
66
- </p>
67
-
68
- <p>
69
- <label for="StaticAddressing_netmask">Netmask</label>
70
- <input type="text" name="StaticAddressing/netmask"
71
- value="<%=value_from(addressing_method, :netmask %>" />
72
- </p>
73
-
74
- <p>
75
- <label for="StaticAddressing_netmask">Gateway</label>
76
- <input type="text" name="StaticAddressing/gateway"
77
- value="<%=value_from(addressing_method, :gateway %>" />
78
- </p>
79
-
80
- <p>
81
- <label for="StaticAddressing_netmask">Nameservers (separate with commas or spaces)</label>
82
- <input type="text" name="StaticAddressing/nameservers_flat"
83
- value="<%=value_from(addressing_method, :nameservers_flat %>" />
84
- </p>
85
-
86
- </div>
87
- </div>
88
- <input type="submit" />
89
- </form>
@@ -1,15 +0,0 @@
1
- <form method="post">
2
- <p>
3
- <label for="newpass">New Password</label>
4
- <input type="password" name="newpass" />
5
- </p>
6
-
7
- <p>
8
- <label for="newpass_confirm">Confirm Password</label>
9
- <input type="password" name="newpass_confirm" />
10
- </p>
11
-
12
- <p>
13
- <input type="submit" value="Change Password" />
14
- </p>
15
- </form>
@@ -1,6 +0,0 @@
1
- System Uptime: <%= Uptime.uptime %>
2
-
3
- System Processes: <br />
4
- <% @proctable.each do |p| %>
5
- <b><%= p.comm %></b> (PID <%= p.pid.to_s %>)<br />
6
- <% end %>
@@ -1,17 +0,0 @@
1
- <script src="problem.js"></script>
2
- <div class="error">
3
- <p>
4
- <img src="trollface.png" />
5
- </p>
6
- <h1>Problem?</h1>
7
- <p>
8
- Due to technical difficulties, this Concerto screen is currently not
9
- operational. Please check again soon.
10
- </p>
11
- <p>
12
- The Concerto installation at <%= concerto_url %> could not be reached.
13
- </p>
14
- <p>
15
- <a href="/setup">Player Configuration</a>
16
- </p>
17
- </div>
@@ -1,33 +0,0 @@
1
- <h1>Welcome to Concerto Player</h1>
2
- <p>
3
- You're seeing this because your Concerto player has not yet been configured.
4
- We need the URL of your Concerto instance before we can get up and running.
5
- </p>
6
-
7
- <form method="post">
8
- <p>
9
- <label for="url">URL</label>
10
- <input type="text" name="url" />
11
- <input type="submit" value="OK" />
12
- </p>
13
- </form>
14
-
15
- <p>
16
- The IPv4 address of this screen appears to be: <%= my_ip %>
17
- </p>
18
-
19
- <p>
20
- This page can be accessed remotely via http://<%= my_ip %>/setup
21
- </p>
22
-
23
- <p>
24
- Username is root, default password is 'default'.
25
- </p>
26
-
27
- <p>
28
- Also, you may want to
29
- <a href="/netconfig">change network settings</a> or
30
- <a href="/password">change the configuration password.</a>
31
- </p>
32
-
33
-