diff --git a/public_html/admin/functions.js b/public_html/admin/functions.js index b5feeee70541c9c91792d2b95ca4ef8fea5bcf69..c7678982f6d440d5583aad5d481b387c693cccff 100644 --- a/public_html/admin/functions.js +++ b/public_html/admin/functions.js @@ -5,6 +5,7 @@ * * ---------------------------------------------------------------------- * 2022-05-23 ah v0.1 initial version + * 2025-01-13 ah v1.0 colorize clicked testlink in dependency of the result * ====================================================================== */ @@ -46,10 +47,13 @@ async function showInOverlay(oLink){ show(body); // colorize clicked link - var myspan=document.getElementsByClassName("status")[0]; - var myclass=myspan.className.replace("status ",""); - oLink.className=myclass; - oLink.title=myspan.innerText; + var spans=document.getElementsByClassName("status"); + if(spans){ + var myspan=spans[spans.length-1]; + var myclass=myspan.className.replace("status ",""); + oLink.className=myclass; + oLink.title=myspan.innerText; + } } else { show("HTTP-Error: " + response.status); } diff --git a/public_html/admin/index.php b/public_html/admin/index.php index 185914d25e921b7a67cf44faf8dacd7bad7e3291..daf645531b85d41ab89a4ac37542f54d1df048c0 100644 --- a/public_html/admin/index.php +++ b/public_html/admin/index.php @@ -115,11 +115,11 @@ if (!$oR->isEnabled()) { $sTdFirst = '<tr class="cfgtype-' . $aCfg['type'] . '">' . '<td>' . '<span style="display: none">' . $sHost . '</span>' + . '<nobr>'.$aIco['type_' . $aCfg['type']] . " $sHost</nobr>" . '<span style="float: right;">' . ' <a href="?url=http' . $sUrlpart . '" title="click to test http://' . $sHost . '/" onclick="showInOverlay(this); return false;">http</a> ' . ($bHttpOnly ? '' : '<a href="?url=https' . $sUrlpart . '" title="click to test https://' . $sHost . '/" onclick="showInOverlay(this); return false;">https</a>') . '</span>' - . $aIco['type_' . $aCfg['type']] . " $sHost" . '</td>' . '<td>' . ($aCfg['ip'] @@ -138,17 +138,19 @@ if (!$oR->isEnabled()) { ; if (isset($aCfg['redirects'])) { $iCount = 0; + foreach (['direct', 'regex'] as $sType) { if (count($aCfg['redirects'][$sType])) { foreach ($aCfg['redirects'][$sType] as $sFrom => $aTo) { $iCount++; + $sRelFrom = $sType == 'direct' ? $sFrom : ($aTo['link'] ?? false ); $sTable .= $sTdFirst . '<td class="type-' . $sType . '">' . $sType . '</td>' . '<td class="type-' . $sType . '">' - . ($sType == 'direct' + . ($sRelFrom ? '<span style="float: right;">' - . '<a href="?url=http://' . $sHost . $sFrom . '" title="click to test http://' . $sHost . '/' . $sFrom . '" onclick="showInOverlay(this); return false;">http</a> ' - . '<a href="?url=https://' . $sHost . $sFrom . '" title="click to test http://' . $sHost . '/' . $sFrom . '" onclick="showInOverlay(this); return false;">https</a> ' + . '<a href="?url=http://' . $sHost . $sRelFrom . '" title="click to test http://' . $sHost . '/' . $sRelFrom . '" onclick="showInOverlay(this); return false;">http</a> ' + . ($bHttpOnly ? '' : '<a href="?url=https://' . $sHost . $sRelFrom . '" title="click to test http://' . $sHost . '/' . $sRelFrom . '" onclick="showInOverlay(this); return false;">https</a> ') . '</span>' : '' ) diff --git a/public_html/admin/main.css b/public_html/admin/main.css index d8fd9f535634c3a1a9373040e24213b387d28175..b326d597a268f3c6ae4a075e3387ec96b44cbc2b 100644 --- a/public_html/admin/main.css +++ b/public_html/admin/main.css @@ -61,7 +61,7 @@ a{color: var(--link-color);} body { background: var(--body-bg); color: var(--body-color); - font-size: 1.2em; + font-size: 1.0em; font-family: arial; margin: 0; padding: 0; diff --git a/public_html/classes/redirect.admin.class.php b/public_html/classes/redirect.admin.class.php index 36e07590543d8724a937691feaf4f623be8c7833..b1b66cf9a491ebbca74f6be638ad6d9e731fa709 100644 --- a/public_html/classes/redirect.admin.class.php +++ b/public_html/classes/redirect.admin.class.php @@ -50,8 +50,8 @@ class redirectadmin extends redirect ], // TODO: this is unsafe .. better: let the user configure it - CURLOPT_SSL_VERIFYHOST => false, - CURLOPT_SSL_VERIFYPEER => false, + // CURLOPT_SSL_VERIFYHOST => true, + // CURLOPT_SSL_VERIFYPEER => false, CURLOPT_TIMEOUT => 5, ]; return $aReturn; @@ -79,16 +79,22 @@ class redirectadmin extends redirect $sHeader = ''; $sBody = ''; - $aResponse = explode("\r\n\r\n", $res, 2); - list($sHeader, $sBody) = count($aResponse) > 1 + + if($bHeaderOnly){ + $sHeader = $res; + $sBody = ''; + } else { + $aResponse = explode("\r\n\r\n", $res, 2); + list($sHeader, $sBody) = count($aResponse) > 1 ? $aResponse : [$aResponse[0], '']; + } $aResult = [ 'url' => $url, 'response_header' => $sHeader, 'response_body' => $sBody, - 'curlinfo' => curl_getinfo($ch), + // 'curlinfo' => curl_getinfo($ch), 'curlerrorcode' => curl_errno($ch), 'curlerrormsg' => curl_error($ch), ]; @@ -105,7 +111,7 @@ class redirectadmin extends redirect */ public function renderHttpResponseHeader(array $aResponse): string { - $sHeader=$aResponse['response_header']; + $sHeader=$aResponse['response_header']."\r\n\r\n".$aResponse['response_body']; $sReturn = $sHeader; // $sReturn.="<pre>".print_r($aResponse, 1)."</pre>";