From 897338bfa75cfaa991fd6d898b77bcafa088d816 Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Sat, 18 Nov 2017 16:50:08 -0600 Subject: [PATCH] Show socketio error messages --- app/Traits/Controllers/JavascriptInjection.php | 1 + .../themes/pterodactyl/js/frontend/server.socket.js | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/app/Traits/Controllers/JavascriptInjection.php b/app/Traits/Controllers/JavascriptInjection.php index c6efc86ac..8b41fca9d 100644 --- a/app/Traits/Controllers/JavascriptInjection.php +++ b/app/Traits/Controllers/JavascriptInjection.php @@ -51,6 +51,7 @@ trait JavascriptInjection 'uuidShort' => $server->uuidShort, 'daemonSecret' => $token, ], + 'server_token' => $token, 'node' => [ 'fqdn' => $server->node->fqdn, 'scheme' => $server->node->scheme, diff --git a/public/themes/pterodactyl/js/frontend/server.socket.js b/public/themes/pterodactyl/js/frontend/server.socket.js index d81c9eaf1..ef6986168 100644 --- a/public/themes/pterodactyl/js/frontend/server.socket.js +++ b/public/themes/pterodactyl/js/frontend/server.socket.js @@ -57,6 +57,17 @@ var Server = (function () { 'query': 'token=' + Pterodactyl.server.daemonSecret, }); + Socket.on('error', function (err) { + if(typeof notifySocketError !== 'object') { + notifySocketError = $.notify({ + message: 'There was an error attempting to establish a WebSocket connection to the Daemon. This panel will not work as expected.

' + err, + }, { + type: 'danger', + delay: 0, + }); + } + }); + Socket.io.on('connect_error', function (err) { if(typeof notifySocketError !== 'object') { notifySocketError = $.notify({