mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-06 07:56:52 +08:00
refactor(schemas): 统一 message/notification 命名边界,旧名收敛至兼容映射表
- notification 域:渠道能力(MessageChannel→NotificationChannel、ChannelCapability* 迁入 notification.py) - message 域:消息收发(Notification→Message、NotificationType→MessageType、CommingMessage→IncomingMessage、NotificationHistoryItem→MessageHistoryItem、NotificationClear*→MessageClear*) - Agent 工具契约:send_notification_message→send_message、notification_callback→message_callback - 源码不保留旧名物理别名,旧导入经 app/runtime/compat/manifest.py SYMBOL_ALIASES 惰性解析 - API 路径与持久化键冻结不变,前端零改动 - 新增兼容守护测试与 docs/rules/07 命名边界规范
This commit is contained in:
@@ -6,8 +6,8 @@ from pywebpush import webpush, WebPushException
|
||||
from app.runtime.config import global_vars, settings
|
||||
from app.runtime.log import logger
|
||||
from app.modules import _ModuleBase, _MessageBase
|
||||
from app.schemas import Notification
|
||||
from app.schemas.types import ModuleType, MessageChannel
|
||||
from app.schemas import Message
|
||||
from app.schemas.types import ModuleType, NotificationChannel
|
||||
|
||||
|
||||
class WebPushModule(_ModuleBase, _MessageBase):
|
||||
@@ -18,7 +18,7 @@ class WebPushModule(_ModuleBase, _MessageBase):
|
||||
初始化模块
|
||||
"""
|
||||
super().init_service(service_name=self.get_name().lower())
|
||||
self._channel = MessageChannel.WebPush
|
||||
self._channel = NotificationChannel.WebPush
|
||||
|
||||
@staticmethod
|
||||
def get_name() -> str:
|
||||
@@ -32,11 +32,11 @@ class WebPushModule(_ModuleBase, _MessageBase):
|
||||
return ModuleType.Notification
|
||||
|
||||
@staticmethod
|
||||
def get_subtype() -> MessageChannel:
|
||||
def get_subtype() -> NotificationChannel:
|
||||
"""
|
||||
获取模块子类型
|
||||
"""
|
||||
return MessageChannel.WebPush
|
||||
return NotificationChannel.WebPush
|
||||
|
||||
@staticmethod
|
||||
def get_priority() -> int:
|
||||
@@ -59,7 +59,7 @@ class WebPushModule(_ModuleBase, _MessageBase):
|
||||
"""Web Push 使用全局 VAPID 配置,不提供模块级设置。"""
|
||||
pass
|
||||
|
||||
def post_message(self, message: Notification, **kwargs) -> None:
|
||||
def post_message(self, message: Message, **kwargs) -> None:
|
||||
"""
|
||||
发送消息
|
||||
:param message: 消息内容
|
||||
|
||||
Reference in New Issue
Block a user