nocobase-app-plugin-notification-web-push
它能做什么
这项技能为 NocoBase 3 应用添加 Web Push 推送通知,使用户能在浏览器和设备上收到提醒。适合希望通过安全的设备订阅发送推送提醒的开发者。
适用场景
- ✓当你希望用户通过 NocoBase 应用收到浏览器推送提醒时。
- ✓当你需要让用户在设置页面中管理其设备的推送偏好时。
- ✓当你需要为 Web Push 配置 HTTPS 和 VAPID 密钥时。
技能链接
https://github.com/nocobase/nocobase/blob/v3-develop/packages/plugins/app-plugin-notification-web-push/skills/nocobase-app-plugin-notification-web-push/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请帮我为 NocoBase 应用设置浏览器推送通知,让订单获批时用户能收到提醒。”
每周 5 个新技能,1 分钟读完。
工作原理
AI 会注册 Web Push 插件,添加其配置,并把偏好组件放在已登录用户可见的页面上。随后,通知会通过现有的通知服务发送到所选的设备或用户。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Web Push integration
Read this package's README before integration. Register its server plugin after authentication, authorization and notification, and its client factory for localized device preferences. Add pushConfig under push to application default configuration and configure notification.channels.webPush.type as web-push. Mount the exported PushPreferences on an authenticated preferences page and call unsubscribeDevice during sign-out. Provide HTTPS, persistent VAPID and secrets keys, and application-owned installation metadata using pushManifest where installation is needed.
Send title/body/url/dedupeKey with explicit device and user recipients using the existing notification service. URLs include the application's public base path. Business authorization and foreground takeover belong to the application; use the optional named beforeSend hook on every attempt and never put business state into the generic channel. A missing named hook refuses delivery.
The device API is fixed at /api/webPush; browser storage and logout use the framework defaults. defineWebPushPlugin({ title, icon }) accepts application branding, and the worker remains at <publicBasePath>/push-worker.js. Register named afterSubscribe hooks on the service for application initialization after a device is saved; do not mount aliases or customize browser protocols.
Subscriptions accept application language identifiers; untranslated test notifications fall back to English. Renewing an existing subscription preserves its enabled state. Device JSON bodies are strict: listing includes meta.total, PATCH returns the updated device, DELETE returns 204 (404 for missing or unowned devices), and test submission returns 202. Click URLs must be root-relative within the public base path. Message validation rejects the final serialized title/body/url/dedupeKey payload above 3993 UTF-8 bytes before queueing, reserving the aes128gcm encryption overhead within 4096 bytes.
常见问题
它需要 HTTPS 吗?
需要。技能说明,应用必须通过 HTTPS 提供服务,推送才能生效。
发送推送之前,应用可以检查业务规则吗?
可以。应用可以提供一个命名钩子,在每次发送前运行。
退出登录时会发生什么?
技能说明应在退出登录时取消该设备的订阅。
详情
作者的原始描述
Integrate encrypted browser push subscriptions and the Web Push notification channel in a NocoBase 3 application.
repo: nocobase/nocobase
热度
- GitHub 星标
- 25k
- 排名
- #10102
- 许可证
- —
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
nocobase-app-development
25k帮你的智能体为完整的 NocoBase 3 业务应用构建页面、路由、数据、权限和测试。
shadcn
25k帮你的智能体在 Web 项目中查找、添加、修复和美化 shadcn/ui 组件,并使用其官方文档和注册表。
nocobase-app-plugin-development
25k帮你的智能体在现有应用中创建和维护 NocoBase 3 插件,包括服务端、客户端、数据库和注册部分。
nocobase-app-upgrade
25k帮你的智能体把 NocoBase 应用升级到较新的模板版本,引入模板的更改,同时保留你自己的工作。