I did some fixes to terminal that includes:
addressing the scrolling (http://forum.primefaces.org/viewtopic.php?f=3&t=24355) - if the output of the command is multiline and goes beyond the visible area, it's not in view unless manually scrolled.
sanitizing input on the echoing of previous command (typing <script>alert('something')</script> won't cause popup and will be echoed correctly)
and also additional handle method, that allows the commands to output to the terminal while they are running via the socket component, not just once the commands ends (it feels weird for longer running commands when nothing is happening).
Terminal bug fixes/improvements
-
- Prime
- Posts: 18616
- Joined: 05 Jan 2009, 00:21
- Location: Cybertron
- Contact:
Thank you, I think Thomas is reviewing already.
The changes in the PR are following
fixes and issue where if command outputted multiple lines of text, beyond the current visible window, the terminal didn't scroll down until there was a user input (key pressed)
fixes an issue where the user input was not sanitized and echoed to the terminal, allowing to user insert something like <script> window.alert("something"); </script> producing a security hole (you can try this in the primefaces showcase mock osx)
allows the terminal to be used along with the <p:socket> to allow async output of text to the terminal for longer running commands
the other changes in the processCommand function are related to the handle function - without it the prompt would stay visible and the async output would appear above it, which is different from standard terminal - so the changes hide the prompt dialog on command submission and unhide it on final return from the command execution
Code: Select all
this.content.prevObject[0].scrollTop = this.content.prevObject[0].scrollHeight;
Code: Select all
$('#command' + outputid).text(this.input.val());
Code: Select all
handle: function (content) {
var commandResponseContainer = $("<div></div>");
commandResponseContainer.append('<div class="ui-terminal-command">' + content + "</div>").appendTo(this.content);
this.content.prevObject[0].scrollTop = this.content.prevObject[0].scrollHeight;
}
the other changes in the processCommand function are related to the handle function - without it the prompt would stay visible and the async output would appear above it, which is different from standard terminal - so the changes hide the prompt dialog on command submission and unhide it on final return from the command execution
-
- Information
-
Who is online
Users browsing this forum: No registered users and 27 guests