为支持统一 webhook 的平台自动生成 webhook_uuid Args: platform_cfg (dict): 平台配置字典 Returns: bool: 如果生成了 webhook_uuid 则返回 True,否则返回 False
(platform_cfg: dict)
| 67 | |
| 68 | |
| 69 | def ensure_platform_webhook_config(platform_cfg: dict) -> bool: |
| 70 | """为支持统一 webhook 的平台自动生成 webhook_uuid |
| 71 | |
| 72 | Args: |
| 73 | platform_cfg (dict): 平台配置字典 |
| 74 | |
| 75 | Returns: |
| 76 | bool: 如果生成了 webhook_uuid 则返回 True,否则返回 False |
| 77 | """ |
| 78 | pt = platform_cfg.get("type", "") |
| 79 | if pt in WEBHOOK_SUPPORTED_PLATFORMS and not platform_cfg.get("webhook_uuid"): |
| 80 | platform_cfg["webhook_uuid"] = uuid.uuid4().hex[:16] |
| 81 | return True |
| 82 | return False |
no test coverage detected