온라인 LAN 기기 WOL 차단
This commit is contained in:
+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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user