diff --git a/public/api.php b/public/api.php
index 03fb1e8..4f6cbb9 100644
--- a/public/api.php
+++ b/public/api.php
@@ -2798,7 +2798,7 @@ function lan_client_rows(array $leases, array $aliases, array $wifiMacs = [], st
'connected_time' => $isFdbVisible ? 'N/A' : '-',
'inactive_time' => '-',
'presence' => $isFdbVisible ? 'fdb' : 'lease',
- 'wol_available' => true,
+ 'wol_available' => !$isFdbVisible,
'rx_bytes' => 0,
'tx_bytes' => 0,
'rx_packets' => 0,
@@ -2822,7 +2822,12 @@ function send_wake_on_lan(string $mac, string $broadcast = '192.168.50.255', int
throw new InvalidArgumentException('unknown_dhcp_client');
}
- $lanMacs = array_fill_keys(array_merge(lan_fdb_macs(), observed_lan_macs($leases)), true);
+ $activeLanMacs = array_fill_keys(lan_fdb_macs(), true);
+ if (isset($activeLanMacs[$mac])) {
+ throw new InvalidArgumentException('device_already_online');
+ }
+
+ $lanMacs = array_fill_keys(array_merge(array_keys($activeLanMacs), observed_lan_macs($leases)), true);
if (!isset($lanMacs[$mac])) {
throw new InvalidArgumentException('not_lan_client');
}
diff --git a/public/assets/app.js b/public/assets/app.js
index 594f6d3..0f59ec6 100644
--- a/public/assets/app.js
+++ b/public/assets/app.js
@@ -187,6 +187,7 @@
wolConfirm: ({ hostname, mac }) => `Send one Wake-on-LAN request to ${hostname || mac}?`,
wolSent: 'Wake-on-LAN request sent.',
wolFailed: 'Wake-on-LAN request failed',
+ wolAlreadyOnline: 'LAN device is already online.',
show: 'Show',
hide: 'Hide',
translateButton: 'Translate',
@@ -338,6 +339,7 @@
wolConfirm: ({ hostname, mac }) => `${hostname || mac} 기기에 WOL 요청을 1회 보낼까요?`,
wolSent: 'WOL 요청을 보냈습니다.',
wolFailed: 'WOL 요청 실패',
+ wolAlreadyOnline: 'LAN 기기가 이미 켜져 있습니다.',
show: '보기',
hide: '숨기기',
translateButton: '번역',
@@ -603,6 +605,13 @@
message,
}, options));
+ function apiErrorMessage(message) {
+ const map = {
+ device_already_online: t('wolAlreadyOnline'),
+ };
+ return map[message] || message;
+ }
+
async function api(action, body = null) {
const opts = {
method: body ? 'POST' : 'GET',
@@ -627,7 +636,7 @@
const res = await fetch(url, opts);
const json = await res.json();
if (!res.ok || !json.ok) {
- throw new Error(json?.message || json?.error || 'API error');
+ throw new Error(apiErrorMessage(json?.message || json?.error || 'API error'));
}
return json.data;
}
diff --git a/public/index.php b/public/index.php
index b955831..e91701b 100644
--- a/public/index.php
+++ b/public/index.php
@@ -363,7 +363,7 @@ html[data-theme="light"] .details-panel{background:#edf3fa;border-color:#b8c7da}
-
+