mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-11-02 21:34:32 +08:00
fix(notification): preserve architecture and locale contracts
This commit is contained in:
@@ -6,7 +6,6 @@ from app.api.dependencies.auth import get_current_active_superuser
|
||||
from app.api.response import ResponseAPIRouter
|
||||
from app.application.configuration import get_configured_system_config
|
||||
from app.chain.notification import NotificationChain
|
||||
from app.modules.wechatclawbot.wechatclawbot import WechatClawBot
|
||||
from app.schemas.common import ManageRequest as _SchemaManageRequest
|
||||
from app.schemas.response import Response as _SchemaResponse
|
||||
from app.schemas.system import NotificationConf
|
||||
@@ -58,19 +57,18 @@ async def save_config(
|
||||
saved = await get_configured_system_config().async_set(SystemConfigKey.Notifications, current)
|
||||
if saved is False:
|
||||
return _SchemaResponse(success=False, message="通知配置保存失败")
|
||||
try:
|
||||
# 配置写入成功后再同步 ClawBot 缓存,避免持久化失败留下半完成的登录状态。
|
||||
result = WechatClawBot.reconcile_cached_states(previous_data, current)
|
||||
except Exception as error:
|
||||
# 配置写入成功后再同步 ClawBot 缓存,避免持久化失败留下半完成的登录状态。
|
||||
result = NotificationChain().manage_channel(
|
||||
channel="WechatClawBot",
|
||||
action="reconcile_config",
|
||||
previous=previous_data,
|
||||
current=current,
|
||||
)
|
||||
# ClawBot 模块未加载时无需阻断其它通知渠道的配置保存;模块加载后由链路完成缓存同步。
|
||||
if result and not result.get("success") and result.get("message") != "该通知渠道未启用或不支持此管理动作":
|
||||
return _SchemaResponse(
|
||||
success=False,
|
||||
message=f"通知配置已保存,但缓存同步失败,请重试:{error}",
|
||||
data={"value": current},
|
||||
)
|
||||
if not result.get("success"):
|
||||
return _SchemaResponse(
|
||||
success=False,
|
||||
message=f"通知配置已保存,但缓存同步失败,请重试:{result.get('message')}",
|
||||
message="通知配置已保存,但缓存同步失败,请重试",
|
||||
data={"value": current},
|
||||
)
|
||||
return _SchemaResponse(success=True, message="通知配置保存成功", data={"value": current})
|
||||
|
||||
@@ -112,6 +112,9 @@
|
||||
"TMDB请求失败": "TMDB request failed",
|
||||
"媒体服务器请求失败": "Media server request failed",
|
||||
"附件保存失败": "Failed to save attachment",
|
||||
"通知配置保存成功": "Notification configuration saved successfully",
|
||||
"通知配置保存失败": "Failed to save notification configuration",
|
||||
"通知配置已保存,但缓存同步失败,请重试": "Notification configuration was saved, but cache synchronization failed. Please try again",
|
||||
"该选择已失效,请重新发起选择": "This selection has expired. Please start the selection again",
|
||||
"会话不存在或无权访问": "The conversation does not exist or you do not have access",
|
||||
"会话保存失败": "Failed to save conversation",
|
||||
|
||||
@@ -108,6 +108,9 @@
|
||||
"TMDB请求失败": "TMDB 請求失敗",
|
||||
"媒体服务器请求失败": "媒體伺服器請求失敗",
|
||||
"附件保存失败": "附件儲存失敗",
|
||||
"通知配置保存成功": "通知設定儲存成功",
|
||||
"通知配置保存失败": "通知設定儲存失敗",
|
||||
"通知配置已保存,但缓存同步失败,请重试": "通知設定已儲存,但快取同步失敗,請重試",
|
||||
"该选择已失效,请重新发起选择": "此選擇已失效,請重新發起選擇",
|
||||
"会话不存在或无权访问": "會話不存在或無權存取",
|
||||
"会话保存失败": "會話儲存失敗",
|
||||
|
||||
Reference in New Issue
Block a user