新增BlueBubbles适配器全套核心工具类与服务,包含会话管理、消息去重、Webhook验证、缓存系统、账号配置解析、聊天消息处理等完整功能模块,支持iMessage消息收发、群管理、反应特效、语音合成等能力,提供完善的健康检查与配置校验流程。
67 lines
2.7 KiB
Python
67 lines
2.7 KiB
Python
from __future__ import annotations
|
|
|
|
from typing import Any
|
|
|
|
|
|
class SetupSurface:
|
|
@staticmethod
|
|
def get_config_schema() -> dict[str, Any]:
|
|
return {
|
|
"type": "object",
|
|
"properties": {
|
|
"server_url": {
|
|
"type": "string",
|
|
"title": "Server URL",
|
|
"description": "BlueBubbles server address",
|
|
"default": "http://localhost:1234",
|
|
},
|
|
"password": {
|
|
"type": "string",
|
|
"title": "Server Password",
|
|
"description": "Password from BlueBubbles server settings",
|
|
"format": "password",
|
|
},
|
|
"dm_policy": {
|
|
"type": "string",
|
|
"title": "DM Policy",
|
|
"description": "Policy for direct messages",
|
|
"enum": ["open", "pairing", "allowlist", "blocklist"],
|
|
"default": "pairing",
|
|
},
|
|
"group_policy": {
|
|
"type": "string",
|
|
"title": "Group Policy",
|
|
"description": "Policy for group messages",
|
|
"enum": ["open", "allowlist", "blocklist"],
|
|
"default": "allowlist",
|
|
},
|
|
"require_mention": {
|
|
"type": "boolean",
|
|
"title": "Require @Mention",
|
|
"description": "Only respond to group messages that @mention the bot",
|
|
"default": False,
|
|
},
|
|
"tapback_enabled": {
|
|
"type": "boolean",
|
|
"title": "Enable Tapback Reactions",
|
|
"description": "Allow the bot to send Tapback reactions",
|
|
"default": True,
|
|
},
|
|
},
|
|
"required": ["server_url", "password"],
|
|
}
|
|
|
|
@staticmethod
|
|
def get_help_texts() -> dict[str, str]:
|
|
return {
|
|
"server_url": "The URL of your BlueBubbles server (e.g., http://192.168.1.100:1234)",
|
|
"password": "Found in BlueBubbles app → Settings → Server → Password",
|
|
"dm_policy": (
|
|
"open: allow all DMs | pairing: auto-accept new DMs | "
|
|
"allowlist: only listed contacts | blocklist: block listed contacts"
|
|
),
|
|
"group_policy": "open: allow all groups | allowlist: only listed groups | blocklist: block listed groups",
|
|
"require_mention": "When enabled, the bot only responds to group messages that @mention it",
|
|
"tapback_enabled": "Enable/disable the bot's ability to send iMessage Tapback reactions",
|
|
}
|