From d27ef0d1160ed741cdc61e0ccfbb1c157482ae6b Mon Sep 17 00:00:00 2001 From: imsyy Date: Tue, 5 Nov 2024 15:58:22 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat:=20=E6=94=AF=E6=8C=81=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E6=B3=9B=E5=9F=9F=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env | 6 +++--- src/app.tsx | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.env b/.env index fcec0173..421e5fa0 100644 --- a/.env +++ b/.env @@ -2,11 +2,11 @@ PORT = 6688 # 允许的域名 -ALLOWED_DOMAIN = "https://api-hot.imsyy.top" +ALLOWED_DOMAIN = "*" -# 允许的主域名,请填写为 imsyy.top +# 允许的主域名,填写格式为 imsyy.top ## 若填写该项,将忽略 ALLOWED_DOMAIN -ALLOWED_HOST = "imsyy.top" +ALLOWED_HOST = "" # ROBOT DISALLOW_ROBOT = true diff --git a/src/app.tsx b/src/app.tsx index 336eec98..36892bc8 100644 --- a/src/app.tsx +++ b/src/app.tsx @@ -30,7 +30,7 @@ app.use( // 可写为数组 origin: (origin) => { // 是否指定域名 - const isSame = origin.endsWith(config.ALLOWED_HOST); + const isSame = config.ALLOWED_HOST && origin.endsWith(config.ALLOWED_HOST); return isSame ? origin : config.ALLOWED_DOMAIN; }, allowMethods: ["POST", "GET", "OPTIONS"],