mirror of
https://github.com/AstrBotDevs/AstrBot.git
synced 2026-08-30 17:33:24 +08:00
fix: hide internal personal WeChat settings (#9827)
This commit is contained in:
@@ -19,11 +19,13 @@ PERSONAL_WECHAT_CONFIG_METADATA = {
|
||||
"description": "扫码参数 bot_type",
|
||||
"type": "string",
|
||||
"hint": "默认值: 3",
|
||||
"invisible": True,
|
||||
},
|
||||
"weixin_oc_qr_poll_interval": {
|
||||
"description": "二维码状态轮询间隔(秒)",
|
||||
"type": "int",
|
||||
"hint": "每隔多少秒轮询一次二维码状态。",
|
||||
"invisible": True,
|
||||
},
|
||||
"weixin_oc_long_poll_timeout_ms": {
|
||||
"description": "getUpdates 长轮询超时时间(毫秒)",
|
||||
@@ -40,7 +42,11 @@ PERSONAL_WECHAT_CONFIG_METADATA = {
|
||||
"type": "string",
|
||||
"hint": "扫码登录成功后会自动写入;高级场景可手动填写。",
|
||||
"secret": True,
|
||||
"invisible": True,
|
||||
},
|
||||
"weixin_oc_account_id": {"invisible": True},
|
||||
"weixin_oc_sync_buf": {"invisible": True},
|
||||
"weixin_oc_context_tokens": {"invisible": True},
|
||||
}
|
||||
|
||||
WEBHOOK_SUPPORTED_PLATFORMS = [
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
"""Tests for personal WeChat configuration metadata."""
|
||||
|
||||
from astrbot.core.config.default import PERSONAL_WECHAT_CONFIG_METADATA
|
||||
|
||||
|
||||
def test_personal_wechat_only_exposes_user_adjustable_fields():
|
||||
"""Show only the personal WeChat fields intended for user adjustment."""
|
||||
visible_fields = {
|
||||
key
|
||||
for key, metadata in PERSONAL_WECHAT_CONFIG_METADATA.items()
|
||||
if not metadata.get("invisible", False)
|
||||
}
|
||||
|
||||
assert visible_fields == {
|
||||
"weixin_oc_base_url",
|
||||
"weixin_oc_long_poll_timeout_ms",
|
||||
"weixin_oc_api_timeout_ms",
|
||||
}
|
||||
|
||||
|
||||
def test_personal_wechat_runtime_state_fields_are_hidden():
|
||||
"""Hide login state persisted outside the personal WeChat template."""
|
||||
for key in (
|
||||
"weixin_oc_account_id",
|
||||
"weixin_oc_sync_buf",
|
||||
"weixin_oc_context_tokens",
|
||||
):
|
||||
assert PERSONAL_WECHAT_CONFIG_METADATA[key]["invisible"] is True
|
||||
Reference in New Issue
Block a user