Add WeCom machine name for multi-node push labels.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-30 17:28:32 +08:00
parent 021b0d0a22
commit 8ceb521049
6 changed files with 62 additions and 5 deletions
+7 -1
View File
@@ -558,19 +558,20 @@ async def put_runtime_settings(
class NotifySettingsBody(BaseModel):
enabled: bool | None = None
webhook_url: str | None = None
machine_name: str | None = Field(default=None, max_length=64)
def _notify_payload() -> dict:
from ..notify import wecom
from ..env_store import mask_secret
s = get_settings()
url = wecom.wecom_webhook_url()
return {
"enabled": wecom.wecom_enabled(),
"webhook_configured": bool(url),
"webhook_url_masked": mask_secret(url) if url else None,
"venue_label": wecom.venue_label(),
"machine_name": wecom.wecom_machine_name() or "",
}
@@ -591,8 +592,13 @@ async def put_notify_settings(
if body.webhook_url is not None and body.webhook_url.strip():
updates["WECOM_WEBHOOK_URL"] = body.webhook_url.strip()
get_db().set_setting("wecom_webhook_url", body.webhook_url.strip())
if body.machine_name is not None:
name = body.machine_name.strip()[:64]
updates["WECOM_MACHINE_NAME"] = name
get_db().set_setting("wecom_machine_name", name)
if updates:
upsert_env_keys(updates)
get_settings.cache_clear()
return _notify_payload()