차량 모니터 관리자 버튼 표시 보강
This commit is contained in:
1 parent
e02e59dfcd
commit
ce9fe85934
1 file changed
+23
-2
+23
-2
@@ -2407,7 +2407,7 @@ $carMonitorSession = car_monitor_launcher_session();
|
||||
|
||||
let currentLang = 'ko';
|
||||
const DEFAULT_USAGE_REFRESH_INTERVAL_SEC = 10;
|
||||
const CAR_MONITOR_SESSION = <?php echo json_encode($carMonitorSession, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); ?>;
|
||||
let CAR_MONITOR_SESSION = <?php echo json_encode($carMonitorSession, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); ?>;
|
||||
|
||||
const CMD_MAP = {
|
||||
se: { label: 'cmdStatus', icon: 'fa-search', bg: 'var(--box-bg-blue)', color: 'var(--accent-blue)' },
|
||||
@@ -2924,11 +2924,13 @@ $carMonitorSession = car_monitor_launcher_session();
|
||||
}
|
||||
}
|
||||
|
||||
function initCalibrationSettings() {
|
||||
function showCalibrationSettings() {
|
||||
const btn = document.getElementById('settings-btn');
|
||||
if (!btn || !CAR_MONITOR_SESSION?.admin) return;
|
||||
|
||||
btn.classList.remove('d-none');
|
||||
if (btn.dataset.ready === '1') return;
|
||||
btn.dataset.ready = '1';
|
||||
btn.addEventListener('click', openCalibrationModal);
|
||||
|
||||
document.getElementById('calibration-close-btn')?.addEventListener('click', closeCalibrationModal);
|
||||
@@ -2940,6 +2942,25 @@ $carMonitorSession = car_monitor_launcher_session();
|
||||
});
|
||||
}
|
||||
|
||||
async function initCalibrationSettings() {
|
||||
if (CAR_MONITOR_SESSION?.admin) {
|
||||
showCalibrationSettings();
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const res = await fetch('https://chaegeon.com/custom/launcher/api.php?adminSession=1', {
|
||||
credentials: 'include',
|
||||
cache: 'no-store',
|
||||
});
|
||||
const data = await res.json();
|
||||
if (res.ok && data?.authenticated && data?.admin) {
|
||||
CAR_MONITOR_SESSION = { ...CAR_MONITOR_SESSION, authenticated: true, admin: true };
|
||||
showCalibrationSettings();
|
||||
}
|
||||
} catch (_) {}
|
||||
}
|
||||
|
||||
function openCalibrationModal() {
|
||||
const overlay = document.getElementById('calibration-overlay');
|
||||
if (!overlay) return;
|
||||
|
||||
Reference in new issue
Block a user