From be051bcadc383fa65165c06cb057c21984ffa9fa Mon Sep 17 00:00:00 2001 From: aszlig Date: Thu, 2 Apr 2015 16:55:59 +0200 Subject: [PATCH 1/3] plain-reload.tt: Properly escape tail content. We're just implicitly escaping the tail content by not using .load() but explicitly setting the text content using .text(), so that escaping isn't needed on our side. This should get rid of a few formatting errors and possibly XSS if someone manages to place JS code in the tail of a build and manages to lurk a user to that tail output. Signed-off-by: aszlig --- src/root/plain-reload.tt | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/root/plain-reload.tt b/src/root/plain-reload.tt index f078b6aa..7448d8ff 100644 --- a/src/root/plain-reload.tt +++ b/src/root/plain-reload.tt @@ -9,11 +9,19 @@ [% IF reload %] [% END %] From c2515982416549d64a9189f6d5ea1068e43c4be4 Mon Sep 17 00:00:00 2001 From: aszlig Date: Thu, 2 Apr 2015 17:29:48 +0200 Subject: [PATCH 2/3] plain-reload: Constrain tail output to 50 lines. There are quite a lot of build outputs which have lines with a length exceeding the width of the taillog
 and thus visually produce more
lines than 50. This causes the tail "box" to change height frequently
and to get to the bottom you need to scroll down.

We now set a fixed line-height to 120% of the font size and cap the
maximum height based on that value (50 * 1.2 = 60). It's probably not
nice to override the line-height, but max-lines is currently only
available using browser-specific property names. But after all it's just
for the tail output, if people complain about the line-height, we can
still change it :-)

Signed-off-by: aszlig 
---
 src/root/plain-reload.tt      | 1 +
 src/root/static/css/hydra.css | 6 ++++++
 2 files changed, 7 insertions(+)

diff --git a/src/root/plain-reload.tt b/src/root/plain-reload.tt
index 7448d8ff..687c7b7a 100644
--- a/src/root/plain-reload.tt
+++ b/src/root/plain-reload.tt
@@ -15,6 +15,7 @@ function injectTail() {
         dataType: "text",
         success: function (tail) {
             $("#contents").text(tail);
+            $("#contents").scrollTop($("#contents").get(0).scrollHeight);
         }
     });
 }
diff --git a/src/root/static/css/hydra.css b/src/root/static/css/hydra.css
index d55dcd7c..d8f848bb 100644
--- a/src/root/static/css/hydra.css
+++ b/src/root/static/css/hydra.css
@@ -119,3 +119,9 @@ span.keep-whitespace {
 .build-status {
     max-width: none; /* don't apply responsive design to status images */
 }
+
+pre.taillog {
+    line-height: 1.2em;
+    max-height: 60em;
+    overflow: hidden;
+}

From 7a48ad375a9b71e7438970f5473b5c7e7059f927 Mon Sep 17 00:00:00 2001
From: aszlig 
Date: Fri, 3 Apr 2015 00:00:27 +0200
Subject: [PATCH 3/3] plain-reload: Scroll down at document load.

When visiting the tail-reload page, for a short amount of time the
"unscrolled" version is shown. To circumvent that, let's scroll down
immediately at the first possibility to fill the gap between the loading
of the document and the first AJAX request coming in.

Signed-off-by: aszlig 
---
 src/root/plain-reload.tt | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/root/plain-reload.tt b/src/root/plain-reload.tt
index 687c7b7a..c6ab6830 100644
--- a/src/root/plain-reload.tt
+++ b/src/root/plain-reload.tt
@@ -9,18 +9,23 @@
 
 [% IF reload %]