from __future__ import annotations COMMON_CONFIG_SCHEMA = { "$schema": "https://json-schema.org/draft-07/schema#", "type": "object", "title": "阿里云短信渠道配置", "properties": { "accessKeyId": { "type": "string", "title": "AccessKey ID", "description": "阿里云 RAM 访问密钥 ID", }, "accessKeySecret": { "type": "string", "title": "AccessKey Secret", "x-ui-password": True, "description": "阿里云 RAM 访问密钥 Secret", }, "signName": { "type": "string", "title": "短信签名", "description": "已通过审核的短信签名名称", }, "templateCodes": { "type": "object", "title": "短信模板 CODE", "description": "模板 CODE 映射", "properties": { "notification": {"type": "string", "title": "通知类模板 CODE"}, "verification": {"type": "string", "title": "验证码类模板 CODE"}, "marketing": {"type": "string", "title": "营销类模板 CODE"}, }, }, "defaultTemplate": { "type": "string", "title": "默认模板类型", "enum": ["notification", "verification", "marketing"], "default": "notification", "description": "默认使用的短信模板类型", }, "region": { "type": "string", "title": "地域", "enum": ["cn-hangzhou", "ap-southeast-1"], "default": "cn-hangzhou", "description": "API 服务地域", }, "callbackUrl": { "type": "string", "title": "回调 URL", "format": "uri", "description": "MO 上行消息和状态回执的 HTTP 回调地址", }, "dmPolicy": { "type": "string", "title": "DM 安全策略", "enum": ["open", "pairing", "allowlist", "disabled"], "default": "open", "description": "私聊安全策略", }, "allowFrom": { "type": "array", "title": "白名单手机号", "items": {"type": "string"}, "description": "仅 dmPolicy 为 allowlist 时生效", }, "sessionTtlMinutes": { "type": "integer", "title": "会话超时(分钟)", "default": 5, "minimum": 1, "maximum": 60, "description": "MO 上行消息的会话超时时间", }, "maxSegments": { "type": "integer", "title": "最大分段数", "default": 3, "minimum": 1, "maximum": 10, "description": "长文本最多拆分为几条短信发送", }, "phoneMaskEnabled": { "type": "boolean", "title": "手机号脱敏", "default": True, "description": "日志和存储中是否对手机号脱敏处理", }, "sslVerify": { "type": "boolean", "title": "SSL 证书验证", "default": True, "description": "是否验证 SSL 证书(内网环境可关闭)", }, "enabled": { "type": "boolean", "title": "启用", "default": False, }, }, "required": ["accessKeyId", "accessKeySecret", "signName", "templateCodes"], }