feat(config,email_service): Add Cloud Mail API path auto-completion utility
- Add get_cloudmail_api_base() helper function to automatically append /api/public path to EMAIL_API_BASE - Update create_email_user() to use get_cloudmail_api_base() for consistent API endpoint construction - Update get_verification_code() to use get_cloudmail_api_base() for email list retrieval - Update fetch_email_content() to use get_cloudmail_api_base() for email list retrieval - Refactor telegram_bot.py to use centralized path completion logic instead of inline implementation - Improve API endpoint consistency across email service operations and reduce code duplication
This commit is contained in:
@@ -4506,7 +4506,12 @@ class ProvisionerBot:
|
||||
if not EMAIL_DOMAINS:
|
||||
return False, "未配置 email.domains"
|
||||
|
||||
url = f"{EMAIL_API_BASE}/emailList"
|
||||
# 自动补全 /api/public 路径
|
||||
api_base = EMAIL_API_BASE.rstrip("/")
|
||||
if not api_base.endswith("/api/public"):
|
||||
api_base = f"{api_base}/api/public"
|
||||
|
||||
url = f"{api_base}/emailList"
|
||||
headers = {
|
||||
"Authorization": EMAIL_API_AUTH,
|
||||
"Content-Type": "application/json"
|
||||
|
||||
Reference in New Issue
Block a user