Custom ssh,telnet port with oxidized (#15255)

* Custom ssh,telnet,http port with oxidized

* Lint fixes

* copy paste minors
This commit is contained in:
Wheel
2023-09-04 03:15:51 +02:00
committed by GitHub
parent 2b10956f0b
commit a6ccb596df
5 changed files with 53 additions and 5 deletions

View File

@@ -192,9 +192,10 @@ class DeviceController extends Controller
}
// Web
$http_port = $device->attribs->firstWhere('attrib_type', 'override_device_http_port') ? ':' . $device->attribs->firstWhere('attrib_type', 'override_device_http_port')->attrib_value : '';
$device_links['web'] = [
'icon' => 'fa-globe',
'url' => 'https://' . $device->hostname,
'url' => 'https://' . $device->hostname . $http_port,
'title' => __('Web'),
'external' => true,
'onclick' => 'http_fallback(this); return false;',
@@ -212,9 +213,10 @@ class DeviceController extends Controller
}
// SSH
$ssh_port = $device->attribs->firstWhere('attrib_type', 'override_device_ssh_port') ? ':' . $device->attribs->firstWhere('attrib_type', 'override_device_ssh_port')->attrib_value : '';
$ssh_url = Config::has('gateone.server')
? Config::get('gateone.server') . '?ssh=ssh://' . (Config::get('gateone.use_librenms_user') ? Auth::user()->username . '@' : '') . $device['hostname'] . '&location=' . $device['hostname']
: 'ssh://' . $device->hostname;
: 'ssh://' . $device->hostname . $ssh_port;
$device_links['ssh'] = [
'icon' => 'fa-lock',
'url' => $ssh_url,
@@ -223,9 +225,10 @@ class DeviceController extends Controller
];
// Telnet
$telnet_port = $device->attribs->firstWhere('attrib_type', 'override_device_telnet_port') ? ':' . $device->attribs->firstWhere('attrib_type', 'override_device_telnet_port')->attrib_value : '';
$device_links['telnet'] = [
'icon' => 'fa-terminal',
'url' => 'telnet://' . $device->hostname,
'url' => 'telnet://' . $device->hostname . $telnet_port,
'title' => __('Telnet'),
'external' => true,
];