From 0d67d23cb6ead7e30bf883a528bfd953f6bcc4d7 Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Wed, 23 Oct 2019 19:19:38 +0200 Subject: [PATCH] quickShell support for ws_proxy_url --- pandora_console/extensions/quick_shell.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/pandora_console/extensions/quick_shell.php b/pandora_console/extensions/quick_shell.php index 68837d1b80..793c754f72 100644 --- a/pandora_console/extensions/quick_shell.php +++ b/pandora_console/extensions/quick_shell.php @@ -74,10 +74,11 @@ function quickShell() config_update_value('ws_port', 8080); } - if (isset($config['ws_url']) === false) { + if (isset($config['ws_proxy_url']) === false) { $ws_url = 'http://'.$config['ws_host'].':'.$config['ws_port']; } else { - $ws_url = $config['ws_url']; + preg_match('/\/\/(.*)/', $config['ws_proxy_url'], $matches); + $ws_url = 'ws://'.$matches[1]; } // Gotty settings. Internal communication (WS). @@ -196,7 +197,8 @@ function quickShell() return; } - $test = file_get_contents($ws_url); + // If rediretion is enabled, we will try to connect to http:// or https:// endpoint. + $test = get_headers($ws_url); if ($test === false) { if (empty($wiz) === true) { $wiz = new Wizard(); @@ -236,9 +238,8 @@ function quickShell() $new .= " + window.location.host + ':"; $new .= $config['ws_port'].'/'.$method."';"; } else { - $new = "var url = (httpsEnabled ? 'wss://' : 'ws://') + "; - $new .= 'window.location.host + '; - $new .= "'".$config['ws_proxy_url'].'/'.$method."';"; + $new = "var url = '"; + $new .= $config['ws_proxy_url'].'/'.$method."';"; } // Update url.