about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorLawrence Pit <lawrence.pit@gmail.com>2012-11-30 11:37:08 +1100
committerEric Wong <normalperson@yhbt.net>2012-11-30 01:25:23 +0000
commita8be099aabc0661e2074e1bd4aa42fbb5139ae0d (patch)
tree19cbf0430af3369f39cecfcce213e029f86baf06
parentdd72d3f180483957dd5c5d7a9369e9ee72fe14fa (diff)
downloadraindrops-a8be099aabc0661e2074e1bd4aa42fbb5139ae0d.tar.gz
When I mount Raindrops::Watcher like so:

   map "/_raindrops" do
     run Raindrops::Watcher.new
   end

Then in the HTML output links use an absolute path instead of relative
to the path /_raindrops/

Cheers,
Lawrence

Signed-off-by: Eric Wong <normalperson@yhbt.net>
-rw-r--r--lib/raindrops/watcher.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/raindrops/watcher.rb b/lib/raindrops/watcher.rb
index 43c30ef..b7199a1 100644
--- a/lib/raindrops/watcher.rb
+++ b/lib/raindrops/watcher.rb
@@ -260,7 +260,7 @@ class Raindrops::Watcher
       headers.map { |k,v|
         "<tr><td>#{k.gsub(/^X-/, '')}</td><td>#{v}</td></tr>"
       }.join << "</table><pre>#{escape_html agg}</pre>" \
-      "<form action='/reset/#{escape addr}' method='post'>" \
+      "<form action='../reset/#{escape addr}' method='post'>" \
       "<input type='submit' name='x' value='reset' /></form>" \
       "</body>"
     headers["Content-Type"] = "text/html"
@@ -346,14 +346,14 @@ class Raindrops::Watcher
       end.map do |addr,stats|
         e_addr = escape addr
         "<tr>" \
-          "<td><a href='/tail/#{e_addr}.txt' " \
+          "<td><a href='tail/#{e_addr}.txt' " \
             "title='&quot;tail&quot; output in real time'" \
             ">#{escape_html addr}</a></td>" \
-          "<td><a href='/active/#{e_addr}.html' " \
+          "<td><a href='active/#{e_addr}.html' " \
             "title='show active connection stats'>#{stats.active}</a></td>" \
-          "<td><a href='/queued/#{e_addr}.html' " \
+          "<td><a href='queued/#{e_addr}.html' " \
             "title='show queued connection stats'>#{stats.queued}</a></td>" \
-          "<td><form action='/reset/#{e_addr}' method='post'>" \
+          "<td><form action='reset/#{e_addr}' method='post'>" \
             "<input title='reset statistics' " \
               "type='submit' name='x' value='x' /></form></td>" \
         "</tr>" \