차량 모니터 관리자 세션 확인 보강
This commit is contained in:
1 parent
36f5a30450
commit
e02e59dfcd
1 file changed
+16
-9
+16
-9
@@ -952,11 +952,16 @@ function car_monitor_launcher_session(): array
|
||||
|
||||
$cookieHeader = trim((string)($_SERVER['HTTP_COOKIE'] ?? ''));
|
||||
if ($cookieHeader !== '') {
|
||||
$adminSession = car_monitor_launcher_api_request('GET', 'https://chaegeon.com/custom/launcher/api.php?adminSession=1', null, $cookieHeader);
|
||||
if (is_array($adminSession) && !empty($adminSession['authenticated']) && !empty($adminSession['admin'])) {
|
||||
car_monitor_issue_cookie();
|
||||
$session = ['authenticated' => true, 'admin' => true];
|
||||
return $session;
|
||||
}
|
||||
|
||||
$remoteSession = car_monitor_launcher_api_request('GET', 'https://chaegeon.com/custom/launcher/api.php?session=1', null, $cookieHeader);
|
||||
if (is_array($remoteSession)) {
|
||||
if (!empty($remoteSession['authenticated'])) {
|
||||
car_monitor_issue_cookie();
|
||||
}
|
||||
if (is_array($remoteSession) && !empty($remoteSession['authenticated'])) {
|
||||
car_monitor_issue_cookie();
|
||||
$session = $remoteSession;
|
||||
return $session;
|
||||
}
|
||||
@@ -1086,11 +1091,13 @@ function car_monitor_issue_pwa_cookie_if_requested(): void
|
||||
}
|
||||
|
||||
$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'])) {
|
||||
car_monitor_issue_cookie();
|
||||
if ($cookieHeader !== '') {
|
||||
$adminSession = car_monitor_launcher_api_request('GET', 'https://chaegeon.com/custom/launcher/api.php?adminSession=1', null, $cookieHeader);
|
||||
$remoteSession = car_monitor_launcher_api_request('GET', 'https://chaegeon.com/custom/launcher/api.php?session=1', null, $cookieHeader);
|
||||
if ((is_array($adminSession) && !empty($adminSession['authenticated']))
|
||||
|| (is_array($remoteSession) && !empty($remoteSession['authenticated']))) {
|
||||
car_monitor_issue_cookie();
|
||||
}
|
||||
}
|
||||
|
||||
header('Location: /car/monitor.php', true, 302);
|
||||
|
||||
Reference in new issue
Block a user