diff --git a/frontend/module/instance/model.php b/frontend/module/instance/model.php index 8e8a0290..5c49af96 100644 --- a/frontend/module/instance/model.php +++ b/frontend/module/instance/model.php @@ -438,6 +438,22 @@ public function canDo($action, $instance) } } + /** + * Get URL for visiting instance service. + * + * @param object $instance + * @access public + * @return string + */ + public function url($instance) + { + $url = "//" . $instance->domain; + $port = getenv('APP_HTTPS_PORT'); + if($port and $port != '443') $url .= ":$port/"; + + return $url; + } + /** * Create third domain. * @@ -1562,7 +1578,7 @@ public function printIconActions($instance) if($instance->domain) { $disableVisit = !$this->canDo('visit', $instance); - $actionHtml .= html::a('//' . $instance->domain, '', '_blank', "title='{$this->lang->instance->visit}' class='btn btn-lg btn-action btn-link'" . ($disableVisit ? ' disabled style="pointer-events: none;"' : '')); + $actionHtml .= html::a($this->url($instance), '', '_blank', "title='{$this->lang->instance->visit}' class='btn btn-lg btn-action btn-link'" . ($disableVisit ? ' disabled style="pointer-events: none;"' : '')); } echo $actionHtml; @@ -1591,7 +1607,7 @@ public function printTextActions($instance) if($instance->domain) { $disableVisit = !$this->canDo('visit', $instance); - $actionHtml .= html::a('//' . $instance->domain, $this->lang->instance->visit, '_blank', "title='{$this->lang->instance->visit}' class='btn btn-primary label-lg'" . ($disableVisit ? ' disabled style="pointer-events: none;"' : '')); + $actionHtml .= html::a($this->url($instance), $this->lang->instance->visit, '_blank', "title='{$this->lang->instance->visit}' class='btn btn-primary label-lg'" . ($disableVisit ? ' disabled style="pointer-events: none;"' : '')); } echo $actionHtml; diff --git a/frontend/module/space/view/browsebycard.html.php b/frontend/module/space/view/browsebycard.html.php index ae56ed16..c8448cf1 100644 --- a/frontend/module/space/view/browsebycard.html.php +++ b/frontend/module/space/view/browsebycard.html.php @@ -41,7 +41,7 @@
instance->canDo('visit', $instance);?> - domain, $lang->instance->visit, '_blank', "class='btn btn-primary' title='{$lang->instance->visit}'". ($canVisit ? '' : ' disabled style="pointer-events: none;"'));?> + instance->url($instance), $lang->instance->visit, '_blank', "class='btn btn-primary' title='{$lang->instance->visit}'". ($canVisit ? '' : ' disabled style="pointer-events: none;"'));?> latestVersion)):?> id", '', true), "" . $lang->space->upgrade, '', "class='btn btn-link iframe' title='{$lang->space->upgrade}' data-width='500' data-app='space'");?> diff --git a/frontend/module/system/control.php b/frontend/module/system/control.php index 900dc4dc..e7bbc572 100644 --- a/frontend/module/system/control.php +++ b/frontend/module/system/control.php @@ -487,7 +487,7 @@ public function ajaxLdapInfo() $password = openssl_decrypt($ldapSetting->auth->password, 'DES-ECB', $secretKey); if(!$password) $password = openssl_decrypt($ldapSetting->auth->password, 'DES-ECB', $ldapInstance->createdAt); // Secret key was createdAt field value less v2.2. - $this->send(array('result' => 'success', 'message' => '', 'data' => array('domain' => $ldapInstance->domain, 'account' => $ldapSetting->auth->username, 'pass' => $password))); + $this->send(array('result' => 'success', 'message' => '', 'data' => array('domain' => $this->instance->url($ldapInstance), 'account' => $ldapSetting->auth->username, 'pass' => $password))); } /** @@ -504,8 +504,13 @@ public function ajaxOssInfo() $minioInstance->spaceData->k8space = 'cne-system'; $ossAccount = $this->loadModel('cne')->getDefaultAccount($minioInstance, '', 'minio'); + $ossDomain = $this->cne->getDomain($minioInstance, '', 'minio'); - if($ossAccount and $ossAccount) return $this->send(array('result' => 'success', 'message' => '', 'data' => array('account' => $ossAccount, 'domain' => $ossDomain))); + $ossDomain->domain = $ossDomain->access_host; + + $url = $this->loadModel('instance')->url($ossDomain); + + if($ossAccount and $ossAccount) return $this->send(array('result' => 'success', 'message' => '', 'data' => array('account' => $ossAccount, 'url' => $url))); $this->send(array('result' => 'fail', 'message' => $this->lang->system->errors->failGetOssAccount)); } diff --git a/frontend/module/system/js/ossview.js b/frontend/module/system/js/ossview.js index b03be4c8..66c388bc 100644 --- a/frontend/module/system/js/ossview.js +++ b/frontend/module/system/js/ossview.js @@ -9,7 +9,7 @@ $(function() { $('#ossAdmin').text(res.data.account.username); $('#ossPassword').val(res.data.account.password); - $('#ossVisitUrl').attr('href', '//' + res.data.domain.access_host); + $('#ossVisitUrl').attr('href', res.data.url); $('#ossAccountModal').modal('show'); } });