diff --git a/net/wol/src/opnsense/mvc/app/controllers/OPNsense/Wol/Api/WolController.php b/net/wol/src/opnsense/mvc/app/controllers/OPNsense/Wol/Api/WolController.php
index e56554a27..c6d3255f6 100644
--- a/net/wol/src/opnsense/mvc/app/controllers/OPNsense/Wol/Api/WolController.php
+++ b/net/wol/src/opnsense/mvc/app/controllers/OPNsense/Wol/Api/WolController.php
@@ -66,27 +66,40 @@ class WolController extends ApiMutableModelControllerBase
{
$this->delBase('wolentry', $uuid);
}
+
public function searchHostAction()
{
- return $this->searchBase('wolentry', array("interface", "mac", "descr"));
+ $ret = $this->searchBase('wolentry', ['interface', 'mac', 'descr']);
+
+ foreach ($ret['rows'] ?? [] as $idx => $wol) {
+ /* not entirely accurate naming but it's too much effor to unwind this API */
+ $ret['rows'][$idx]['identifier'] =
+ (string)$this->getModel()->getNodeByReference('wolentry.' . $wol['uuid'])->interface;
+ }
+
+ return $ret;
}
+
public function getHostAction($uuid = null)
{
- $this->sessionClose();
return $this->getBase('host', 'wolentry', $uuid);
}
+
public function getwakeAction()
{
return $this->getBase('wake', 'wolentry', null);
}
+
public function addHostAction()
{
return $this->addBase('host', 'wolentry');
}
+
public function setHostAction($uuid)
{
return $this->setBase('host', 'wolentry', $uuid);
}
+
public function wakeallAction()
{
if (!$this->request->isPost()) {
@@ -100,6 +113,7 @@ class WolController extends ApiMutableModelControllerBase
}
return $results;
}
+
private function wakeHostByNode($wolent, &$result)
{
$backend = new Backend();
@@ -114,6 +128,7 @@ class WolController extends ApiMutableModelControllerBase
$broadcast_ip = escapeshellarg($this->calculateSubnetBroadcast($ipaddr, $cidr));
$result['status'] = trim($backend->configdRun("wol wake {$broadcast_ip} " . escapeshellarg((string)$wolent->mac)));
}
+
private function getInterfaceIP($if)
{
$cfg = Config::getInstance()->object();
@@ -128,6 +143,7 @@ class WolController extends ApiMutableModelControllerBase
return null;
}
}
+
private function getInterfaceSubnet($if)
{
$cfg = Config::getInstance()->object();
@@ -137,6 +153,7 @@ class WolController extends ApiMutableModelControllerBase
return null;
}
}
+
private function calculateSubnetBroadcast($ip_addr, $cidr)
{
// TODO undefined offset
diff --git a/net/wol/src/opnsense/www/js/widgets/WakeOnLan.js b/net/wol/src/opnsense/www/js/widgets/WakeOnLan.js
index 23d577f77..fa7d3fe33 100644
--- a/net/wol/src/opnsense/www/js/widgets/WakeOnLan.js
+++ b/net/wol/src/opnsense/www/js/widgets/WakeOnLan.js
@@ -50,10 +50,10 @@ export default class WakeOnLan extends BaseTableWidget {
const data = await this.ajaxCall('/api/wol/wol/searchHost');
let rows = [];
- if (data.total == 0) {
+ if (data.total == 0) {
const empty_list = [`${this.translations.msg_empty_wol}`];
rows.push(empty_list);
- } else {
+ } else {
const header = [`${this.translations.h_device}`,
`${this.translations.h_interface}`,
`${this.translations.h_status}`,
@@ -66,13 +66,13 @@ export default class WakeOnLan extends BaseTableWidget {
for(let it = 0; it < data.rows.length; it++){
const item = data.rows[it];
- let is_active = this.checkActive(arp, item.mac, item.interface);
+ let is_active = this.checkActive(arp, item.mac, item.identifier);
let row = [
`${item.descr.length !== 0 ? item.descr + '
': ''} ${item.mac}`,
`${item.interface}`,
`
${ is_active == 1 ? "Online" : "Offline"}`,
- `