From b22dfd56326ac902c8581a474e430dd42b81d756 Mon Sep 17 00:00:00 2001 From: seo Date: Tue, 28 Jul 2026 22:57:37 +0900 Subject: [PATCH] =?UTF-8?q?=EB=9F=B0=EC=B2=98=20API=20=EA=B5=90=EC=B0=A8?= =?UTF-8?q?=20=EC=B6=9C=EC=B2=98=20=EC=84=B8=EC=85=98=20=ED=99=95=EC=9D=B8?= =?UTF-8?q?=20=ED=97=88=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/api.php b/api.php index 8007dd7..022b955 100644 --- a/api.php +++ b/api.php @@ -6,6 +6,20 @@ require_once __DIR__ . '/../common/ha.php'; header('Content-Type: application/json; charset=utf-8'); header('Cache-Control: no-store'); +$origin = (string)($_SERVER['HTTP_ORIGIN'] ?? ''); +if (preg_match('#^https://([a-z0-9-]+\.)?chaegeon\.com$#i', $origin) === 1) { + header('Access-Control-Allow-Origin: ' . $origin); + header('Access-Control-Allow-Credentials: true'); + header('Access-Control-Allow-Headers: Content-Type, X-Requested-With'); + header('Access-Control-Allow-Methods: GET, POST, OPTIONS'); + header('Vary: Origin'); +} + +if ($_SERVER['REQUEST_METHOD'] === 'OPTIONS') { + http_response_code(204); + exit; +} + $config = custom_config(); function launcher_is_digit_password(string $password): bool