raindrops RubyGem user+dev discussion/patches/pulls/bugs/help
 help / Atom feed
* [PATCH] Watcher: Use relative paths in HTML links
@ 2012-11-30  0:37 Lawrence Pit
  2012-11-30  1:30 ` Eric Wong
  0 siblings, 1 reply; 2+ messages in thread
From: Lawrence Pit @ 2012-11-30  0:37 UTC (permalink / raw)
  To: raindrops

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

---
  lib/raindrops/watcher.rb | 10 +++++-----
  1 file 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>" \
--
1.7.11.1


^ permalink raw reply	[flat|threaded] 2+ messages in thread

* Re: [PATCH] Watcher: Use relative paths in HTML links
  2012-11-30  0:37 [PATCH] Watcher: Use relative paths in HTML links Lawrence Pit
@ 2012-11-30  1:30 ` Eric Wong
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Wong @ 2012-11-30  1:30 UTC (permalink / raw)
  To: raindrops

Lawrence Pit <lawrence.pit@gmail.com> wrote:
> 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/

Thanks,
Signed-off-by: Eric Wong <normalperson@yhbt.net>

Pushed as commit a8be099aabc0661e2074e1bd4aa42fbb5139ae0d
to git://bogomips.org/raindrops.git

I suppose it's time for a 1.0.0 release soonish.  I'll wait a bit and
see if there's any more fixes/improvements to get in...

I'm not sure if I'll have time/motivation for unix_diag support myself
this year: http://mid.gmane.org/20120301023751.GA22900@dcvr.yhbt.net


^ permalink raw reply	[flat|threaded] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-30  0:37 [PATCH] Watcher: Use relative paths in HTML links Lawrence Pit
2012-11-30  1:30 ` Eric Wong

raindrops RubyGem user+dev discussion/patches/pulls/bugs/help

Archives are clonable:
	git clone --mirror https://bogomips.org/raindrops-public
	git clone --mirror http://ou63pmih66umazou.onion/raindrops-public

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.lang.ruby.raindrops
	nntp://ou63pmih66umazou.onion/inbox.comp.lang.ruby.raindrops

 note: .onion URLs require Tor: https://www.torproject.org/
       or Tor2web: https://www.tor2web.org/

AGPL code for this site: git clone https://public-inbox.org/ public-inbox