diff --git a/public_html/admin/index.php b/public_html/admin/index.php index 4a33f0cce1cc22a2aaea8e08e0546c991ed97fcc..84ce99ed721881572723597c4c27116c942de2a2 100644 --- a/public_html/admin/index.php +++ b/public_html/admin/index.php @@ -12,6 +12,7 @@ * admin: list all defined redirections * ---------------------------------------------------------------------- * 2022-02-03 v0.1 <axel.hahn@iml.unibe.ch> initial version + * 2022-05-21 v0.2 <axel.hahn@iml.unibe.ch> optical changes; use debugredirect=1 if url is a local domain * ---------------------------------------------------------------------- */ @@ -61,7 +62,7 @@ if (!$oR->isEnabled()){ $sUrl=(isset($_GET['url']) && $_GET['url']) ? $_GET['url'] : ''; if ($sUrl){ - $sResult=$oR->httpGet($sUrl.'?debugredirect=1',1); + $sResult=$oR->httpGet($sUrl,1); echo '<h2>Response of a http HEAD request to '.$aIco['url'].' <a href="'.$sUrl.'">'.$sUrl.'</a></h2>' . $oR->renderHttpResponseHeader($sResult, 1) ; @@ -80,7 +81,6 @@ if (!$oR->isEnabled()){ exit(0); } - $sMyIp=gethostbyname($_SERVER['SERVER_NAME']); if(!$sMyIp){ $sErrors.='<li>Ip address of current host ['.$_SERVER['SERVER_NAME'].'] was not found.</li>'; @@ -130,7 +130,9 @@ if (!$oR->isEnabled()){ .'<td>' .'<span style="display: none">'.$sHost.'</span>' .$aIco['type_'.$aCfg['type']] - .' <a href="?url=http://'.$sHost.'/" title="click to test http://'.$sHost.'/" onclick="showInOverlay(this); return false;">'.$sHost.'</a></td>' + .' <a href="?url=http://'.$sHost.'/' + .($aCfg['ip']===$sMyIp ? '?debugredirect=1' : '' ) + .'" title="click to test http://'.$sHost.'/" onclick="showInOverlay(this); return false;">'.$sHost.'</a></td>' .'<td>' .($aCfg['ip'] ? ($aCfg['ip']===$sMyIp @@ -142,7 +144,7 @@ if (!$oR->isEnabled()){ .'<td>' .($aCfg['type']=="config" ? '<a href="?cfgfile=redirects_'.$sHost.'.json" onclick="showInOverlay(this); return false;" title="show config for host '.$sHost.'">'.$aCfg['type'].'</a> ' - : $aCfg['type'] + : '<a href="?cfgfile=redirects_'.$aCfg['target'].'.json" onclick="showInOverlay(this); return false;" title="show config for alias '.$sHost.' pointing to host '.$aCfg['target'].'">'.$aCfg['type'].'</a> ' ) . '</td>' ; diff --git a/public_html/admin/main.css b/public_html/admin/main.css index 55c639c29df54fd87fddcd6416395acebf62b5ca..54004d495cabdec76a02d7a2d22a940d64197941 100644 --- a/public_html/admin/main.css +++ b/public_html/admin/main.css @@ -2,14 +2,15 @@ a{color:royalblue;} body{background: #f8f8f8; color: #234; font-family: arial; margin: 0;} h1{background:rgba(0,0,0,0.05); margin: 0 0 1em;; padding: 0.5em;} h1 a{color:#234; text-decoration: none;} -h2{background:rgba(0,0,0,0.02); color:#458; margin: 1em 0 0.5em; border-top: 2px solid #fff; border-left: 5px solid #fff; border-top-left-radius: 0.5em; padding: 0.5em; } +h2{background: #d0e0e8; color:#458; margin: 1em 0 0.5em; border-top: 2px solid #fff; border-left: 5px solid #fff; border-top-left-radius: 0.5em; padding: 0.5em; } -pre{background: rgba(0,0,0,0.02);padding: 0.3em 1em; border: 1px solid rgba(0,0,0,0.1); margin-bottom: 2em;} +pre{background: rgba(0,0,0,0.02);padding: 0.3em 1em; border: 1px solid rgba(0,0,0,0.1); margin: 2em 0 3em;; border-bottom: 2px solid rgba(0,0,0,0.2);} tr:hover{background: #f4f0f8 !important;} .content{margin: 0 1em;} .error{background: #fcc;} +.warning{color:#651; background:#fec;} .cfgtype-alias{color:#89a;} .http-301::after{color:#a55; content: ' (Moved Permanently)'} @@ -18,14 +19,15 @@ tr:hover{background: #f4f0f8 !important;} .type-direct{color:#383; } .type-regex{color:#838; } -.status{padding: 0.5em 1em; position: relative;top: -0.8em; border: 2px solid; border-left: 1.5em solid;} +.status{padding: 0.5em 1em; position: relative;top: -0.8em; border-left: 2px solid; border-left_: 1.5em solid;font-size: 125%;} .status-ok{color:#080; background:#cec; } .status-redirect{color:#651; background:#fec;} .status-error{color:#800; background:#ecc;} -.location{background:#fec;} +.location{background:#cde; border: 1px solid rgba(0,0,0,0.2); font-size: 125%; color:#236;} +.location::before{content:' > '; color:#800; background-color: #fff;} .debug{color:#197;} .overlay{position: fixed; margin: 0; width: 100%; height: 100%; top: 0; left: 0; background: rgba(0,0,0,0.3);overflow: scroll; display: none;} -.overlay>div{margin: 3% 10%; background: #fff; padding: 1em;box-shadow: 0 0 3em #000; } +.overlay>div{margin: 3% 10%; background: #f8f8f8; padding: 1em;box-shadow: 0 0 3em #000; } diff --git a/public_html/classes/redirect.admin.class.php b/public_html/classes/redirect.admin.class.php index 333cea8e67862ec731b8568b7e4c040b8423fa4c..b98b634ac6d5d10f3556a75e581cca321ef6bb34 100644 --- a/public_html/classes/redirect.admin.class.php +++ b/public_html/classes/redirect.admin.class.php @@ -16,6 +16,7 @@ require_once 'redirect.class.php'; * 2020-05-11 v1.4 ah rewrite as class * 2022-02-03 v1.5 ah add method isEnabled * 2022-05-23 v1.6 ah add http head check+render output; + * 2022-05-31 v1.7 ah optical changes */ /** @@ -31,7 +32,6 @@ class redirectadmin extends redirect { CURLOPT_FOLLOWLOCATION => true, CURLOPT_RETURNTRANSFER => true, CURLOPT_USERAGENT => strip_tags($this->sAbout), - // CURLOPT_USERPWD => isset($this->aProfileEffective['userpwd']) ? $this->aProfileEffective['userpwd'] : false, CURLOPT_VERBOSE => false, CURLOPT_ENCODING => 'gzip, deflate', // to fetch encoding CURLOPT_HTTPHEADER => array( @@ -43,10 +43,6 @@ class redirectadmin extends redirect { // TODO: this is unsafe .. better: let the user configure it CURLOPT_SSL_VERIFYHOST => false, CURLOPT_SSL_VERIFYPEER => false, - // CURLOPT_SSL_VERIFYSTATUS => false, - // v0.22 cookies - CURLOPT_COOKIEJAR => $this->sCcookieFilename, - CURLOPT_COOKIEFILE => $this->sCcookieFilename, CURLOPT_TIMEOUT => 5, ); return $aReturn; @@ -102,7 +98,7 @@ class redirectadmin extends redirect { $sReturn=($iHops>0 ? 'Found hops: <strong>'.$iHops.'</strong>' - .($iHops>1 ? ' ⚠️ Verify your redirect to skip unneeded hops.' : '' ).'<br><br>' + .($iHops>1 ? ' <span class="warning"> ⚠️ Verify your redirect to skip unneeded hops.</span>' : '' ).'<br><br>' : '' ).$sReturn ;