From 0c6e6f39feff1748efb928ffb380177b78df66d4 Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Fri, 17 Mar 2017 19:05:54 -0400 Subject: [PATCH] Fix multiple clients causing all consoles to refresh --- CHANGELOG.md | 1 + .../themes/pterodactyl/js/frontend/console.js | 18 ++++++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 358fc0e45..7ab4382c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ This project follows [Semantic Versioning](http://semver.org) guidelines. * `[pre.4]` — Fixes non-admin users being unable to create personal API keys. * Fixes bug where daemon was unable to register that certain games had fully booted and were ready to play on. * Fixes bug causing MySQL user accounts to be corrupted when resetting a password via the panel. +* `[pre.4]` — Multiple clients refreshing the console no longer clears the console for all parties involved... sorry about that. ### Added * Ability to assign multiple allocations at once when creating a new server. diff --git a/public/themes/pterodactyl/js/frontend/console.js b/public/themes/pterodactyl/js/frontend/console.js index 3977379c5..f36311623 100644 --- a/public/themes/pterodactyl/js/frontend/console.js +++ b/public/themes/pterodactyl/js/frontend/console.js @@ -24,6 +24,7 @@ var Console = (function () { var terminalQueue; var terminal; + var recievedInitialLog = false; var cpuChart; var cpuData; @@ -159,11 +160,12 @@ var Console = (function () { function addSocketListeners() { // Update Listings on Initial Status Socket.on('initial status', function (data) { - updateServerPowerControls(data.status); + if (! recievedInitialLog) { + updateServerPowerControls(data.status); - terminal.clear(); - if (data.status === 1 || data.status === 2) { - Socket.emit('send server log'); + if (data.status === 1 || data.status === 2) { + Socket.emit('send server log'); + } } }); @@ -172,6 +174,14 @@ var Console = (function () { updateServerPowerControls(data.status); }); + Socket.on('server log', function (data) { + if (! recievedInitialLog) { + terminal.clear(); + terminalQueue.push(data); + recievedInitialLog = true; + } + }); + Socket.on('console', function (data) { terminalQueue.push(data.line); });