summaryrefslogtreecommitdiff
path: root/localwebsite
diff options
context:
space:
mode:
authorEvgeny Zinoviev <me@ch1p.io>2022-09-16 23:04:38 +0300
committerEvgeny Zinoviev <me@ch1p.io>2022-09-16 23:04:38 +0300
commit52544fdacd0d7dc24424c2aacaebe1c5df5577d8 (patch)
tree0d2a9e039164a7161ac7e2e20e9d480179008f77 /localwebsite
parent79c59138977ec4abd804e52217a4f6e5d307c65f (diff)
parentf228efad1e7c0b5080d1fa4cdaff2ae46b4276e7 (diff)
Merge branch 'master' of ch1p.io:homekit
Diffstat (limited to 'localwebsite')
-rw-r--r--localwebsite/classes/MyOpenWrtUtils.php2
-rw-r--r--localwebsite/config.php4
-rw-r--r--localwebsite/handlers/ModemHandler.php5
3 files changed, 9 insertions, 2 deletions
diff --git a/localwebsite/classes/MyOpenWrtUtils.php b/localwebsite/classes/MyOpenWrtUtils.php
index 6b70dbc..f83800a 100644
--- a/localwebsite/classes/MyOpenWrtUtils.php
+++ b/localwebsite/classes/MyOpenWrtUtils.php
@@ -119,7 +119,7 @@ class MyOpenWrtUtils {
$ip = array_shift($words);
array_pop($words);
$hostname = trim(implode(' ', $words));
- if (!$hostname)
+ if (!$hostname || $hostname == '*')
$hostname = '?';
return [
'time' => $time,
diff --git a/localwebsite/config.php b/localwebsite/config.php
index 10bbcb7..8ad472c 100644
--- a/localwebsite/config.php
+++ b/localwebsite/config.php
@@ -81,5 +81,7 @@ return [
'auth_pw_salt' => '',
'grafana_sensors_url' => '',
- 'grafana_inverter_url' => ''
+ 'grafana_inverter_url' => '',
+
+ 'dhcp_hostname_overrides' => [],
];
diff --git a/localwebsite/handlers/ModemHandler.php b/localwebsite/handlers/ModemHandler.php
index aca69a3..b54b82c 100644
--- a/localwebsite/handlers/ModemHandler.php
+++ b/localwebsite/handlers/ModemHandler.php
@@ -146,7 +146,12 @@ class ModemHandler extends RequestHandler
}
public function GET_routing_dhcp_page() {
+ $overrides = config::get('dhcp_hostname_overrides');
$leases = MyOpenWrtUtils::getDHCPLeases();
+ foreach ($leases as &$lease) {
+ if ($lease['hostname'] == '?' && array_key_exists($lease['mac'], $overrides))
+ $lease['hostname'] = $overrides[$lease['mac']];
+ }
$this->tpl->set([
'leases' => $leases
]);