mirror of
https://github.com/AstrBotDevs/AstrBot
synced 2026-07-15 17:30:13 +08:00
feat: rename CORS_ALLOW_ORIGIN to ASTRBOT_CORS_ALLOW_ORIGIN and add it to .env.example
This commit is contained in:
@@ -80,6 +80,12 @@ ASTRBOT_SYSTEMD=1
|
||||
# 默认 Default: True
|
||||
ASTRBOT_DASHBOARD_ENABLE=True
|
||||
|
||||
# 允许跨域请求的来源域名(多个用逗号分隔,允许所有则用 *)
|
||||
# Allowed CORS origins for WebUI dashboard (comma-separated, or * for all)
|
||||
# 示例 Example: https://dash.astrbot.men
|
||||
# 默认 Default: *
|
||||
# ASTRBOT_CORS_ALLOW_ORIGIN="*"
|
||||
|
||||
# ------------------------------------------
|
||||
# 国际化配置 / Internationalization Configuration
|
||||
# ------------------------------------------
|
||||
|
||||
@@ -236,9 +236,9 @@ class AstrBotDashboard:
|
||||
self.app.json.sort_keys = False
|
||||
|
||||
# 配置 CORS
|
||||
# 支持通过环境变量 CORS_ALLOW_ORIGIN 配置允许的域名,多个域名用逗号分隔
|
||||
# 支持通过环境变量 ASTRBOT_CORS_ALLOW_ORIGIN 配置允许的域名,多个域名用逗号分隔
|
||||
# 如果前端使用 withCredentials:true,需要设置具体的域名而非 "*"
|
||||
cors_allow_origin = os.environ.get("CORS_ALLOW_ORIGIN", "*")
|
||||
cors_allow_origin = os.environ.get("ASTRBOT_CORS_ALLOW_ORIGIN", "*")
|
||||
cors_allow_credentials = False
|
||||
if cors_allow_origin != "*":
|
||||
cors_allow_origin = [
|
||||
|
||||
Reference in New Issue
Block a user