From ad3c59577e7793aa535d115991ae5d346741c3d4 Mon Sep 17 00:00:00 2001 From: Laurent Cozic Date: Wed, 11 Jan 2017 11:46:04 +0100 Subject: [PATCH] Updated debug client to work with live server --- debug_client/css/style.css | 5 +++++ debug_client/index.php | 17 ++++++++--------- debug_client/views/page.php | 7 +++++++ 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/debug_client/css/style.css b/debug_client/css/style.css index 1b94a7d39..e0e5c59a2 100755 --- a/debug_client/css/style.css +++ b/debug_client/css/style.css @@ -73,3 +73,8 @@ td { width: 300px; display: inline-block; } + +.debug { + color: #777; + font-family: monospace; +} \ No newline at end of file diff --git a/debug_client/index.php b/debug_client/index.php index c2ca9edc6..049b3d19d 100755 --- a/debug_client/index.php +++ b/debug_client/index.php @@ -11,8 +11,11 @@ function initialize() { } function config($name) { + $host = $_SERVER['HTTP_HOST']; + $config = array( - 'baseUrl' => 'http://joplin.local', + 'host' => $host, + 'baseUrl' => $host == 'joplinclient.local' ? 'http://joplin.local' : 'https://joplin.cozic.net', 'clientId' => 'E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3E3', ); if (isset($config[$name])) return $config[$name]; @@ -53,6 +56,7 @@ function execRequest($method, $path, $query = array(), $data = null) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); if ($data) curl_setopt($ch, CURLOPT_POSTFIELDS, $data); if ($method != 'GET' && $method != 'POST') { curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method); @@ -131,6 +135,7 @@ if (isset($_POST['update_folder'])) $action = 'update_folder'; $pageParams = array( 'title' => ucfirst($action), 'contentHtml' => '', + 'baseUrl' => config('baseUrl'), ); switch ($action) { @@ -180,12 +185,6 @@ switch ($action) { } -echo renderView('page', $pageParams); +$pageParams['curlCommands'] = isset($_SESSION['curlCommands']) ? $_SESSION['curlCommands'] : array(); -echo '
';
-$curlCommands = isset($_SESSION['curlCommands']) ? $_SESSION['curlCommands'] : array();
-for ($i = count($curlCommands) - 1; $i >= 0; $i--) {
-	$cmd = $curlCommands[$i];
-	echo $cmd . "\n";
-}
-echo '
'; \ No newline at end of file +echo renderView('page', $pageParams); \ No newline at end of file diff --git a/debug_client/views/page.php b/debug_client/views/page.php index d83ba6817..d80e77ce0 100755 --- a/debug_client/views/page.php +++ b/debug_client/views/page.php @@ -8,5 +8,12 @@ Home

+
+
+

Base URL:

+ = 0; $i--): $cmd = $curlCommands[$i]; ?> +
+ +
\ No newline at end of file