fix: accept vehicle API token via header

This commit is contained in:
seo committed 2026-10-30 22:18:24 +09:00
1 parent 629e9c5dc5
commit 5a234f2f0d
1 file changed
+4 -1
+4 -1
View File
@@ -18,7 +18,10 @@ if (!in_array($clientIp, ALLOWED_IPS, true)) {
} }
$params = ($requestMethod === 'POST') ? $_POST : $_GET; $params = ($requestMethod === 'POST') ? $_POST : $_GET;
$token = $params['token'] ?? ''; $headerToken = $_SERVER['HTTP_X_CAR_TOKEN'] ?? '';
$token = is_string($headerToken) && $headerToken !== ''
? $headerToken
: ($params['token'] ?? '');
if (!hash_equals(AUTH_TOKEN, $token)) { if (!hash_equals(AUTH_TOKEN, $token)) {
json_exit([ json_exit([