raindrops RubyGem user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
From: "Lawrence Pit" <lawrence.pit@gmail.com>
To: raindrops@librelist.org
Subject: [PATCH] Watcher: Use relative paths in HTML links
Date: Fri, 30 Nov 2012 11:37:08 +1100	[thread overview]
Message-ID: <E0DBF1B7-7249-42A4-98D1-E8002133D69E@gmail.com> (raw)
In-Reply-To: <E0DBF1B7-7249-42A4-98D1-E8002133D69E@gmail.com>

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


       reply	other threads:[~2012-11-30  0:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-30  0:37 Lawrence Pit [this message]
2012-11-30  1:30 ` Eric Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://yhbt.net/raindrops/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E0DBF1B7-7249-42A4-98D1-E8002133D69E@gmail.com \
    --to=lawrence.pit@gmail.com \
    --cc=raindrops@librelist.org \
    --subject='Re: [PATCH] Watcher: Use relative paths in HTML links' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Code repositories for project(s) associated with this inbox:

	../../raindrops.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).