Prevent accidental DoS of users if server sends a rapid feed of data to the console.
Configurable speed in environment file.
This commit is contained in:
parent
55c9f0f2f2
commit
045864aa96
3 changed files with 39 additions and 2 deletions
|
@ -4,6 +4,8 @@ APP_KEY=SomeRandomString3232RandomString
|
|||
APP_THEME=default
|
||||
APP_TIMEZONE=UTC
|
||||
APP_CLEAR_TASKLOG=720
|
||||
CONSOLE_PUSH_FREQ=250
|
||||
CONSOLE_PUSH_COUNT=10
|
||||
|
||||
DB_HOST=localhost
|
||||
DB_PORT=3306
|
||||
|
|
|
@ -271,3 +271,17 @@ li.btn.btn-default.pill:active,li.btn.btn-default.pill:focus,li.btn.btn-default.
|
|||
.fuelux .wizard .steps-container {
|
||||
background-color: #eee;
|
||||
}
|
||||
|
||||
#consoleThrottled {
|
||||
z-index: 999;
|
||||
top: 0px;
|
||||
opacity: 0.6;
|
||||
left: 0;
|
||||
position: absolute;
|
||||
margin: 0 15px;
|
||||
border-radius: 4px 4px 0 0;
|
||||
}
|
||||
|
||||
#consoleThrottled:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
|
|
|
@ -48,7 +48,11 @@
|
|||
<div class="panel-body">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div id="terminal"></div>
|
||||
<div class="alert alert-info hidden" id="consoleThrottled">
|
||||
The console is currently being throttled due to the speed at which data is being sent. Messages are being queued and will appear as the queue is worked through.
|
||||
</div>
|
||||
<div id="terminal">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-12" style="text-align:center;">
|
||||
<hr />
|
||||
|
@ -364,10 +368,27 @@ $(window).load(function () {
|
|||
});
|
||||
|
||||
// New Console Data Recieved
|
||||
var outputQueue = [];
|
||||
socket.on('console', function (data) {
|
||||
terminal.echo(data.line);
|
||||
outputQueue.push(data.line);
|
||||
});
|
||||
|
||||
window.setInterval(pushOutputQueue, {{ env('CONSOLE_PUSH_FREQ', 250) }});
|
||||
function pushOutputQueue()
|
||||
{
|
||||
if (outputQueue.length > {{ env('CONSOLE_PUSH_COUNT', 10) }}) {
|
||||
$('#consoleThrottled').removeClass('hidden');
|
||||
} else {
|
||||
$('#consoleThrottled').addClass('hidden');
|
||||
}
|
||||
|
||||
for (var i = 0; i < {{ env('CONSOLE_PUSH_COUNT', 10) }}; i++)
|
||||
{
|
||||
terminal.echo(outputQueue[0]);
|
||||
outputQueue.shift();
|
||||
}
|
||||
}
|
||||
|
||||
// Update Listings on Initial Status
|
||||
socket.on('initial_status', function (data) {
|
||||
currentStatus = data.status;
|
||||
|
|
Loading…
Reference in a new issue