该提交新增了完整的BlueBubbles渠道插件,支持通过BlueBubbles Server集成iMessage功能,包含以下核心能力: 1. 支持私聊和群聊会话管理,自动区分会话类型 2. 完整的消息收发支持,包括文本、图片、语音、文件、视频消息 3. 支持消息反应、已读回执、消息编辑与撤回 4. 内置去重、防抖处理机制 5. 支持Webhook和WebSocket两种事件接收方式 6. 完善的权限与安全校验机制 7. 历史消息同步与抓包功能 8. TTS语音合成与发送支持 9. 群组管理能力,包括重命名、修改头像、增减成员等
53 lines
989 B
Python
53 lines
989 B
Python
class BlueBubblesError(Exception):
|
|
pass
|
|
|
|
|
|
class AuthenticationError(BlueBubblesError):
|
|
pass
|
|
|
|
|
|
class NotFoundError(BlueBubblesError):
|
|
pass
|
|
|
|
|
|
class ConflictError(BlueBubblesError):
|
|
pass
|
|
|
|
|
|
class ServerError(BlueBubblesError):
|
|
pass
|
|
|
|
|
|
class NetworkTimeoutError(BlueBubblesError):
|
|
pass
|
|
|
|
|
|
class ConnectionRefusedError(BlueBubblesError):
|
|
pass
|
|
|
|
|
|
class PrivateApiUnavailableError(BlueBubblesError):
|
|
pass
|
|
|
|
|
|
class EmptyMessageError(BlueBubblesError):
|
|
pass
|
|
|
|
|
|
class MediaSecurityError(BlueBubblesError):
|
|
pass
|
|
|
|
|
|
HTTP_STATUS_TO_ERROR: dict[int, type[BlueBubblesError]] = {
|
|
401: AuthenticationError,
|
|
404: NotFoundError,
|
|
409: ConflictError,
|
|
}
|
|
|
|
|
|
def classify_response_error(status_code: int, message: str = "") -> BlueBubblesError:
|
|
if status_code >= 500:
|
|
return ServerError(message or f"Server error: {status_code}")
|
|
error_cls = HTTP_STATUS_TO_ERROR.get(status_code, BlueBubblesError)
|
|
return error_cls(message or f"HTTP {status_code}")
|