mirror of
https://github.com/Akkadius/glass-isc-dhcp.git
synced 2025-07-27 23:54:32 +02:00
Prevents split error
if dhcp leases contain malformed data split would have caused errors
This commit is contained in:
parent
bb7117ca0f
commit
0347920fdb
@ -10,7 +10,7 @@ router.get('/', function (req, res, next) {
|
|||||||
|
|
||||||
/* Mac OUI Lookup */
|
/* Mac OUI Lookup */
|
||||||
var mac_oui = "";
|
var mac_oui = "";
|
||||||
if (typeof dhcp_lease_data[key].mac.split(":").join("") !== "undefined") {
|
if (typeof dhcp_lease_data[key].mac !== "undefined") {
|
||||||
mac_oui = dhcp_lease_data[key].mac.split(":").join("").toUpperCase().slice(0, 6);
|
mac_oui = dhcp_lease_data[key].mac.split(":").join("").toUpperCase().slice(0, 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -41,4 +41,4 @@ router.get('/', function (req, res, next) {
|
|||||||
res.send(JSON.stringify(stat_data));
|
res.send(JSON.stringify(stat_data));
|
||||||
});
|
});
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router;
|
||||||
|
@ -49,11 +49,14 @@ router.post('/', function(req, res, next) {
|
|||||||
table_row = table_row + '<td>' + (dhcp_lease_data[key].host ? dhcp_lease_data[key].host : '') + '</td>';
|
table_row = table_row + '<td>' + (dhcp_lease_data[key].host ? dhcp_lease_data[key].host : '') + '</td>';
|
||||||
table_row = table_row + '<td>' + human_time(dhcp_lease_data[key].start * 1000) + '</td>';
|
table_row = table_row + '<td>' + human_time(dhcp_lease_data[key].start * 1000) + '</td>';
|
||||||
table_row = table_row + '<td>' + human_time(dhcp_lease_data[key].end * 1000) + '</td>';
|
table_row = table_row + '<td>' + human_time(dhcp_lease_data[key].end * 1000) + '</td>';
|
||||||
table_row = table_row + '<td>' +
|
if (typeof dhcp_lease_data[key].mac !== "undefined" ) {
|
||||||
|
table_row = table_row + '<td>' +
|
||||||
'<button class="btn btn-default waves-effect option_data" lease="' + dhcp_lease_data[key].mac.split(":").join("") + '">Show</button>' +
|
'<button class="btn btn-default waves-effect option_data" lease="' + dhcp_lease_data[key].mac.split(":").join("") + '">Show</button>' +
|
||||||
'<pre style="display:none;margin-top:10px" id="' + dhcp_lease_data[key].mac.split(":").join("") + '">' + JSON.stringify(dhcp_lease_data[key].options, null, 2) + '</pre>' +
|
'<pre style="display:none;margin-top:10px" id="' + dhcp_lease_data[key].mac.split(":").join("") + '">' + JSON.stringify(dhcp_lease_data[key].options, null, 2) + '</pre>' +
|
||||||
'</td>';
|
'</td>';
|
||||||
|
} else {
|
||||||
|
table_row = table_row + '<td></td>';
|
||||||
|
}
|
||||||
table_data = table_data + '<tr>' + table_row + '</tr>';
|
table_data = table_data + '<tr>' + table_row + '</tr>';
|
||||||
|
|
||||||
count++;
|
count++;
|
||||||
@ -69,4 +72,4 @@ router.post('/', function(req, res, next) {
|
|||||||
res.send(table_data);
|
res.send(table_data);
|
||||||
});
|
});
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user