Commit 8eb7dfe07051cd8a456c73f55f2fa8424dcc43a9:
rough in a restart interface
Branch: refs/heads/master
Author: Sam Ruby <[email protected]>
Committer: Sam Ruby <[email protected]>
Pusher: rubys <[email protected]>
------------------------------------------------------------
www/secmail/views/index.js.rb | +++ -
www/status/passenger.cgi | ++++++++++++ -
------------------------------------------------------------
53 changes: 50 additions, 3 deletions.
------------------------------------------------------------
diff --git a/www/secmail/views/index.js.rb b/www/secmail/views/index.js.rb
index ca079c2..0cb7c6a 100644
--- a/www/secmail/views/index.js.rb
+++ b/www/secmail/views/index.js.rb
@@ -28,9 +28,11 @@ def render
color = 'hidden' if message.status == :deleted
color = 'selected' if message.href == @selected
+ time = Date.new(Date.parse(message.time)).toLocaleString()
+
_tr class: color, onClick: self.selectRow, onDoubleClick: self.nav do
_td do
- _a message.time, href: "#{message.href}"
+ _a time, href: "#{message.href}", title: message.time
end
_td message.from
_td message.subject
diff --git a/www/status/passenger.cgi b/www/status/passenger.cgi
index f06cf95..2b04102 100755
--- a/www/status/passenger.cgi
+++ b/www/status/passenger.cgi
@@ -1,13 +1,58 @@
#!/usr/local/bin/ruby2.3.0
require 'open3'
+require 'wunderbar'
+
+if ENV['REQUEST_METHOD'] == 'POST'
+ # not implemented yet.
+ print "Status: 401 Unauthorized\r\n"
+ print "WWW-Authenticate: Basic realm=\"ASF Members and Officers\"\r\n\r\n"
+ exit
+end
+
output, error, status = Open3.capture3 '/usr/local/bin/ruby2.3.0',
Gem.bin_path('passenger', 'passenger-status')
-require 'wunderbar'
_html do
+ _style %{
+ input[type=submit] {
+ margin-left: 2em;
+ padding: 5px 15px;
+ background: #F00;
+ color: #FFF;
+ border: 2px solid #C00;
+ font-weight: bold;
+ font-size: larger;
+ border-radius: 5px;
+ cursor: pointer;
+ }
+ }
+
_h1 'Phusion Passenger Status'
- _pre output
+
+ sections = output.split(/^(---.*---)\n/)
+ _pre sections.shift
+
+ sections.each_slice(2) do |header, content|
+ _h2 header
+
+ if header.include? '--- Application groups ---'
+ content.split("\n\n").each do |app|
+ _pre app
+
+ path = app[/\A(\/.*):/, 1]
+ restart = File.join(path.untaint, "tmp/restart.txt") if path
+ if restart and File.exist? restart
+ _form method: 'post' do
+ _input type: 'hidden', value: restart
+ _input type: 'submit', value: 'restart'
+ end
+ end
+ end
+ else
+ _pre content
+ end
+ end
unless error.empty?
_h2 'STDERR'