온라인 LAN 기기 WOL 차단
This commit is contained in:
+7
-2
@@ -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');
|
||||
}
|
||||
|
||||
+10
-1
@@ -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;
|
||||
}
|
||||
|
||||
+1
-1
@@ -363,7 +363,7 @@ html[data-theme="light"] .details-panel{background:#edf3fa;border-color:#b8c7da}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="/assets/app.js?v=20260721_sensor_charts1"></script>
|
||||
<script src="/assets/app.js?v=20260721_lan_wol_guard1"></script>
|
||||
<script src="/assets/wakelock.js?v=20260607_prefs1"></script>
|
||||
<?php endif; ?>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user