mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Device management fall back to http if https isn't available.
Adds a slight delay on management clicking, may be blocked by popup blocker...
This commit is contained in:
@@ -191,7 +191,7 @@ foreach (dbFetchRows($sql, $param) as $device) {
|
||||
$actions .= '<div class="col-xs-1"><a href="ssh://' . $device['hostname'] . '"><i class="fa fa-lock fa-lg icon-theme" title="SSH to ' . $device['hostname'] . '"></i></a></div>
|
||||
';
|
||||
}
|
||||
$actions .= '<div class="col-xs-1"><a href="https://' . $device['hostname'] . '" target="_blank" rel="noopener"><i class="fa fa-globe fa-lg icon-theme" title="Launch browser https://' . $device['hostname'] . '"></i></a></div>
|
||||
$actions .= '<div class="col-xs-1"><a href="https://' . $device['hostname'] . '" onclick="http_fallback(this); return false;" target="_blank" rel="noopener"><i class="fa fa-globe fa-lg icon-theme" title="Launch browser https://' . $device['hostname'] . '"></i></a></div>
|
||||
</div>
|
||||
</div>
|
||||
';
|
||||
|
@@ -420,3 +420,24 @@ function update_location(id, latlng, callback) {
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
function http_fallback(link) {
|
||||
var url = link.getAttribute('href');
|
||||
console.log(url);
|
||||
try {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open('GET', url, false);
|
||||
xhr.timeout = 2000;
|
||||
xhr.send(null);
|
||||
|
||||
if (xhr.status !== 200) {
|
||||
url = url.replace(/^https:\/\//, 'http://');
|
||||
}
|
||||
} catch (e) {
|
||||
// console.log(e);
|
||||
url = url.replace(/^https:\/\//, 'http://');
|
||||
}
|
||||
|
||||
window.open(url, '_blank');
|
||||
return false;
|
||||
}
|
||||
|
@@ -137,7 +137,7 @@ foreach ((array)$config['webui']['custom_css'] as $custom_css) {
|
||||
}
|
||||
?>
|
||||
<script src="js/select2.min.js"></script>
|
||||
<script src="js/librenms.js?ver=20181130"></script>
|
||||
<script src="js/librenms.js?ver=20181205"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
<!-- Begin
|
||||
|
@@ -454,7 +454,7 @@ if (device_permitted($vars['device']) || $permitted_by_port) {
|
||||
<button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown"><i class="fa fa-cog fa-lg icon-theme" aria-hidden="true"></i>
|
||||
<span class="caret"></span></button>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="https://'.$device['hostname'].'" target="_blank" rel="noopener"><i class="fa fa-globe fa-lg icon-theme" aria-hidden="true"></i> Web</a></li>';
|
||||
<li><a href="https://'.$device['hostname'].'" onclick="http_fallback(this); return false;" target="_blank" rel="noopener"><i class="fa fa-globe fa-lg icon-theme" aria-hidden="true"></i> Web</a></li>';
|
||||
if (isset($config['gateone']['server'])) {
|
||||
if ($config['gateone']['use_librenms_user'] == true) {
|
||||
echo '<li><a href="' . $config['gateone']['server'] . '?ssh=ssh://' . LegacyAuth::user()->username . '@' . $device['hostname'] . '&location=' . $device['hostname'] .'" target="_blank" rel="noopener"><i class="fa fa-lock fa-lg icon-theme" aria-hidden="true"></i> SSH</a></li>';
|
||||
|
@@ -69,7 +69,7 @@
|
||||
<script src="js/lazyload.js"></script>
|
||||
@endif
|
||||
<script src="{{ asset('js/select2.min.js') }}"></script>
|
||||
<script src="{{ asset('js/librenms.js?ver=20181130') }}"></script>
|
||||
<script src="{{ asset('js/librenms.js?ver=20181205') }}"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
<!-- Begin
|
||||
|
Reference in New Issue
Block a user