该提交新增了完整的BlueBubbles渠道插件,支持通过BlueBubbles Server集成iMessage功能,包含以下核心能力: 1. 支持私聊和群聊会话管理,自动区分会话类型 2. 完整的消息收发支持,包括文本、图片、语音、文件、视频消息 3. 支持消息反应、已读回执、消息编辑与撤回 4. 内置去重、防抖处理机制 5. 支持Webhook和WebSocket两种事件接收方式 6. 完善的权限与安全校验机制 7. 历史消息同步与抓包功能 8. TTS语音合成与发送支持 9. 群组管理能力,包括重命名、修改头像、增减成员等
66 lines
1.6 KiB
Python
66 lines
1.6 KiB
Python
from yuxi.channel.extensions.bluebubbles.probe import ServerInfo, is_macos26_or_higher
|
|
|
|
|
|
def build_action_gate(
|
|
account_config: dict,
|
|
server_info: ServerInfo,
|
|
is_group: bool = False,
|
|
) -> set[str]:
|
|
configured_actions = account_config.get("actions", {})
|
|
allowed = set(configured_actions.keys()) if configured_actions else None
|
|
|
|
gate = {"send_text", "send_attachment", "send_multipart"}
|
|
|
|
if not server_info.private_api_enabled:
|
|
if allowed is not None:
|
|
gate = gate & allowed
|
|
return gate
|
|
|
|
gate.add("react")
|
|
gate.add("unsend")
|
|
gate.add("reply")
|
|
gate.add("send_with_effect")
|
|
gate.add("force_notify")
|
|
gate.add("schedule_message")
|
|
gate.add("list_scheduled")
|
|
gate.add("update_schedule")
|
|
gate.add("delete_schedule")
|
|
|
|
if not is_macos26_or_higher(server_info):
|
|
gate.add("edit")
|
|
|
|
if is_group:
|
|
gate.add("rename_group")
|
|
gate.add("set_group_icon")
|
|
gate.add("remove_group_icon")
|
|
gate.add("add_participant")
|
|
gate.add("remove_participant")
|
|
gate.add("leave_group")
|
|
|
|
if allowed is not None:
|
|
gate = gate & allowed
|
|
|
|
return gate
|
|
|
|
|
|
PRIVATE_API_ACTIONS = frozenset(
|
|
{
|
|
"react",
|
|
"unsend",
|
|
"reply",
|
|
"send_with_effect",
|
|
"edit",
|
|
"rename_group",
|
|
"set_group_icon",
|
|
"remove_group_icon",
|
|
"add_participant",
|
|
"remove_participant",
|
|
"leave_group",
|
|
"force_notify",
|
|
"schedule_message",
|
|
"list_scheduled",
|
|
"update_schedule",
|
|
"delete_schedule",
|
|
}
|
|
)
|