차량 모니터 PWA 진입 인증 정리

This commit is contained in:
seo
2026-07-03 14:18:05 +09:00
parent 0afee4a018
commit 758158e816
3 changed files with 29 additions and 1 deletions
+27
View File
@@ -982,6 +982,31 @@ window.addEventListener('DOMContentLoaded', function () {
exit;
}
function car_monitor_issue_pwa_cookie_if_requested(): void
{
if (($_GET['pwa'] ?? '') !== '1') {
return;
}
$fetchDest = strtolower((string)($_SERVER['HTTP_SEC_FETCH_DEST'] ?? ''));
if ($fetchDest !== '' && $fetchDest !== 'document') {
return;
}
$commonAuth = '/mnt/synology-web/custom/common/auth.php';
if (!is_readable($commonAuth)) {
return;
}
require_once $commonAuth;
if (function_exists('custom_issue_auth_cookie')) {
custom_issue_auth_cookie(false);
}
header('Location: /car/monitor.php', true, 302);
exit;
}
function car_monitor_auth_api(): void
{
$commonAuth = '/mnt/synology-web/custom/common/auth.php';
@@ -1016,6 +1041,8 @@ if (isset($_GET['mode']) && $_GET['mode'] === 'auth-login') {
car_monitor_auth_api();
}
car_monitor_issue_pwa_cookie_if_requested();
if (isset($_GET['mode']) && $_GET['mode'] === 'ajax') {
car_monitor_require_access(true);