mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-11-03 05:44:44 +08:00
fix(apppush): preserve full notification text for web details
This commit is contained in:
@@ -260,7 +260,7 @@ class AppPushModule(_ModuleBase, _MessageBase[object]):
|
||||
try:
|
||||
result = self._request(conf, "POST", "messages", {
|
||||
"owner": owner, "title": (message.title or "MoviePilot")[:256],
|
||||
"body": (message.text or "")[:1000], "route": route,
|
||||
"body": message.text or "", "route": route,
|
||||
**({"image": image} if image else {}),
|
||||
})
|
||||
if result.get("failed"):
|
||||
|
||||
@@ -98,6 +98,12 @@ Web 会话沿用当前用户;无渠道调用不携带收件人,插件回执
|
||||
只清理登录会话,保留通知绑定。`pair` 返回的绑定码十分钟有效且只能使用一次,完成绑定后无需保留或重新生成。
|
||||
AppPush 向中心传递独立海报(旧消息回退到图片);通知网页点开后显示本条通知的标题、正文和海报,
|
||||
并提供 `moviepilot-app://notification` 链接。应先更新 Server,再更新 MoviePilot;图片由接收设备加载,系统通知中的图片展示以浏览器实际支持为准。
|
||||
正文不再截取前1000个字符;Server 接受最多65536个字符,系统推送只携带预览和随机消息标识。
|
||||
全文在 Server Redis 按设备绑定版本暂存,每个绑定最多20条、每条24小时;网页用自身绑定能力读取,
|
||||
不在 URL 中传递正文或令牌。网页也短期暂存最近通知,用于冷启动、恢复和重载时恢复详情,解绑/换绑时清除;
|
||||
超过暂存期限或读取失败会给出明确提示,永久历史仍在 MoviePilot 通知中心。
|
||||
网页本地绑定记录缺失时,Server 可校验浏览器现存订阅的完整端点与密钥,恢复原设备能力;
|
||||
这不需要生成新的绑定码,也不会更改 MoviePilot 登录态或建立另一份订阅。
|
||||
AppPush 地址 `PUSH_SERVER_URL` 留空时使用 `MP_SERVER_HOST`;首次操作自动生成并先行持久保存256位实例凭据,再向中心幂等登记现有 `user_uid`。UID 只关联来源,不能据此获取、重置或认领已有凭据。内部 `AppPushCredentials` 按中心地址隔离,不进入通知渠道配置;中心只保存凭据摘要。已有 `PUSH_RELAY_KEY` 手工配置继续兼容。
|
||||
`POST /api/v1/notification/app/instance` 仅容器超级管理员可调用,正文为 `{"action":"rotate","source":"已保存的渠道名称"}`。轮换保留设备,候选凭据先落库,响应丢失可在重启后接续;返回值不包含密钥。普通用户的 `/notification/app` 不接受该动作。
|
||||
Apple/VAPID 私钥只放在中心 Server,不放入 App 或用户容器。
|
||||
|
||||
@@ -101,7 +101,7 @@ def test_apppush_preserves_poster_and_keeps_invalid_images_out_of_relay(monkeypa
|
||||
monkeypatch.setattr(module, "get_configs", lambda: {conf.name: conf})
|
||||
monkeypatch.setattr(module, "_request", lambda *args: calls.append(args) or {"accepted": 1})
|
||||
message = Message(mtype=MessageType.Download, targets={"apppush": "a" * 32}, title="下载完成",
|
||||
text="第一行\n第二行", link="/history", poster=poster, image=image)
|
||||
text="第一行\n第二行" + "长正文与海报应完整交接。\n" * 500, link="/history", poster=poster, image=image)
|
||||
message.set_notification_route_scope("user")
|
||||
module.post_message(message)
|
||||
assert len(calls) == 1
|
||||
|
||||
Reference in New Issue
Block a user