From a1a9f29fccb81021c3e61cd3c55d8ab4f6ff31ad Mon Sep 17 00:00:00 2001 From: seo Date: Tue, 28 Jul 2026 18:43:52 +0900 Subject: [PATCH] Remove car monitor auth DB fallback --- monitor.php | 43 ++++++------------------------------------- 1 file changed, 6 insertions(+), 37 deletions(-) diff --git a/monitor.php b/monitor.php index 51c761e..1df9a01 100644 --- a/monitor.php +++ b/monitor.php @@ -891,30 +891,6 @@ function car_monitor_launcher_session(): array } } - $commonAuth = '/mnt/synology-web/custom/common/auth.php'; - if (is_readable($commonAuth)) { - require_once $commonAuth; - - if (function_exists('custom_has_auth_cookie') && custom_has_auth_cookie()) { - $isAdmin = function_exists('custom_auth_cookie_is_admin') && custom_auth_cookie_is_admin(); - $session = ['authenticated' => true, 'admin' => $isAdmin]; - return $session; - } - - if (function_exists('custom_is_site_admin') && custom_is_site_admin()) { - if (function_exists('custom_issue_auth_cookie')) { - custom_issue_auth_cookie(true); - } - $session = ['authenticated' => true, 'admin' => true]; - return $session; - } - } - - if ($cookieHeader === '') { - $session = ['authenticated' => false, 'admin' => false]; - return $session; - } - $session = ['authenticated' => false, 'admin' => false]; return $session; } @@ -1040,12 +1016,13 @@ function car_monitor_issue_pwa_cookie_if_requested(): void require_once $commonAuth; if (function_exists('custom_issue_auth_cookie')) { - if (function_exists('custom_has_auth_cookie') && custom_has_auth_cookie()) { - header('Location: /car/monitor.php', true, 302); - exit; + $cookieHeader = trim((string)($_SERVER['HTTP_COOKIE'] ?? '')); + $remoteSession = $cookieHeader !== '' + ? car_monitor_launcher_api_request('GET', 'https://chaegeon.com/custom/launcher/api.php?session=1', null, $cookieHeader) + : null; + if (is_array($remoteSession) && !empty($remoteSession['authenticated'])) { + custom_issue_auth_cookie(!empty($remoteSession['admin'])); } - $isAdmin = function_exists('custom_is_site_admin') && custom_is_site_admin(); - custom_issue_auth_cookie($isAdmin); } header('Location: /car/monitor.php', true, 302); @@ -1083,14 +1060,6 @@ function car_monitor_auth_api(): void json_response(['result' => 'ok']); } - try { - if (function_exists('custom_verify_password') && custom_verify_password($password)) { - custom_issue_auth_cookie(false); - json_response(['result' => 'ok']); - } - } catch (Throwable $e) { - } - json_response(['result' => 'fail'], 401); }