bandshell 0.0.13 → 0.0.14

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 'haml'
3
+ require 'erb'
4
4
  require 'json'
5
5
  require 'net/http'
6
6
  require 'ipaddress'
@@ -31,8 +31,6 @@ class ConcertoConfigServer < Sinatra::Base
31
31
  IPAddress.parse("::1")
32
32
  ]
33
33
 
34
- set :haml, { :format => :html5, :layout => :main }
35
-
36
34
  helpers do
37
35
  # Get the return value of the method on obj if obj supports the method.
38
36
  # Otherwise return the empty string.
@@ -162,7 +160,7 @@ class ConcertoConfigServer < Sinatra::Base
162
160
  if network_ok
163
161
  # Everything's up and running, we just don't know what
164
162
  # our URL should be.
165
- haml :setup
163
+ erb :setup
166
164
  else
167
165
  # The network settings are not sane, we don't have an IP.
168
166
  # Redirect the user to the network configuration page to
@@ -191,7 +189,7 @@ class ConcertoConfigServer < Sinatra::Base
191
189
  # render a page indicating that the concerto_url is no good.
192
190
  # this page redirects to / every 5 seconds
193
191
  get '/problem' do
194
- haml :problem
192
+ erb :problem
195
193
  end
196
194
 
197
195
  get '/netconfig' do
@@ -211,7 +209,7 @@ class ConcertoConfigServer < Sinatra::Base
211
209
 
212
210
  # view will grab what it can from our existing
213
211
  # connection/addressing methods using value_from().
214
- haml :netsettings, :locals => {
212
+ erb :netsettings, :locals => {
215
213
  :connection_method => cm,
216
214
  :addressing_method => am
217
215
  }
@@ -296,7 +294,7 @@ class ConcertoConfigServer < Sinatra::Base
296
294
 
297
295
  get '/password' do
298
296
  protected!
299
- haml :password
297
+ erb :password
300
298
  end
301
299
 
302
300
  post '/password' do
@@ -315,7 +313,7 @@ class ConcertoConfigServer < Sinatra::Base
315
313
  #Requires ffi, sys-uptime, and sys-proctable gems
316
314
  get '/player_status' do
317
315
  @proctable = ProcTable.ps
318
- haml :player_status
316
+ erb :player_status
319
317
  end
320
318
 
321
319
  end
@@ -0,0 +1,11 @@
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>
@@ -0,0 +1,89 @@
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>
@@ -0,0 +1,15 @@
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>
@@ -0,0 +1,6 @@
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 %>
@@ -0,0 +1,17 @@
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>
@@ -0,0 +1,33 @@
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
+
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.13
4
+ version: 0.0.14
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -28,7 +28,7 @@ dependencies:
28
28
  - !ruby/object:Gem::Version
29
29
  version: '0'
30
30
  - !ruby/object:Gem::Dependency
31
- name: haml
31
+ name: erb
32
32
  requirement: !ruby/object:Gem::Requirement
33
33
  none: false
34
34
  requirements:
@@ -120,12 +120,12 @@ files:
120
120
  - lib/bandshell/netconfig.rb
121
121
  - lib/bandshell/config_store.rb
122
122
  - lib/bandshell/application/config.ru
123
- - lib/bandshell/application/views/main.haml
124
- - lib/bandshell/application/views/password.haml
125
- - lib/bandshell/application/views/setup.haml
126
- - lib/bandshell/application/views/netsettings.haml
127
- - lib/bandshell/application/views/problem.haml
128
- - lib/bandshell/application/views/player_status.haml
123
+ - lib/bandshell/application/views/netsettings.erb
124
+ - lib/bandshell/application/views/setup.erb
125
+ - lib/bandshell/application/views/player_status.erb
126
+ - lib/bandshell/application/views/problem.erb
127
+ - lib/bandshell/application/views/layout.erb
128
+ - lib/bandshell/application/views/password.erb
129
129
  - lib/bandshell/application/app.rb
130
130
  - lib/bandshell/application/public/network.js
131
131
  - lib/bandshell/application/public/stylesheet.css
@@ -1,6 +0,0 @@
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
@@ -1,64 +0,0 @@
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
-
@@ -1,9 +0,0 @@
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'}
@@ -1,8 +0,0 @@
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/
@@ -1,15 +0,0 @@
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
@@ -1,25 +0,0 @@
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
-