新增 Bark(iOS) 推送通知支持 + Windows 声音音效化增强#6
Open
PAKingdom wants to merge 6 commits into
Open
Conversation
- 新增 bark-notify.js:BarkNotifier + notifyTaskCompletion,POST JSON 到 ${server}/${key}
- env-config.js 增加 getBarkConfig(),纳入 getAllConfig()
- notification-manager.js 注册 bark 通知器,补全名称/图标/结果汇总
- notify-system.js 将 bark 配置透传给 NotificationManager
- .env.example / README.md / SETUP.md 补充 Bark 配置说明
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- notify-system.js:移除机器人语音,改播 wav/mp3 音效(.wav 走 SoundPlayer, mp3/m4a/wma 走 MediaPlayer);新增 --sound 命令行参数覆盖 SOUND_FILE, 可给不同 hook 配不同音效;静音黑窗、detached 让长音频播完不被打断 - env-config.js:SOUND_FILE 环境变量纳入声音配置 - .env.example / SETUP.md:补充 SOUND_FILE(支持 wav/mp3)说明 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- bark-notify.js:重写 payload 构建,支持 icon(默认 Claude 图标)、level(时效性/重要警告)、 group(项目名分组)、isArchive(归档)、call(持续响铃);新增 AES-CBC/ECB 端到端加密(crypto), 支持固定 IV(BARK_ENCRYPT_IV)或每次随机 - env-config.js:getBarkConfig 增加图标/级别/分组/归档/重要警告/响铃/加密(含 IV)等配置项 - notify-system.js:按事件(Stop/ask)解析归档、重要警告、持续响铃; 修复交互式终端下 --task 读 stdin 卡死(改为仅管道输入时读); mp3 缺失/加载失败时蜂鸣兜底,避免静默无声 - notification-manager.js:BarkNotifier 改用配置对象构造 - .env.example / SETUP.md:补充 Bark 扩展功能文档,并标注固定 IV 的隐私权衡 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Stop/Notification hook 运行时 PATH 常不含 System32,spawn('powershell')
会 ENOENT,导致「bark 能收到但 Windows 不发声」(连蜂鸣兜底也因同样原因失败)。
改用 %SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe 绝对路径定位。
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- bark-notify.js:payload 支持 sound 字段(iOS 预置或自定义音效名) - env-config.js:getBarkConfig 增加 BARK_SOUND(默认空=不启用) - .env.example / SETUP.md:列出全部 iOS 预置音效名与用法(默认注释关闭) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Stop/Notification hook 触发时,声音原本是 detached 后台进程 + 3 秒定时退出; hook 进程被回收时该子进程会被一并 kill、还没播完就没了(bark 走 https 不受影响, 故表现为「收到 bark 但 Windows 没声音」)。改为 spawnSync 同步阻塞、播完再退出, 声音在 hook 进程存活期间即播完。实测 Stop 与 Notification 两个 hook status=0 均正常发声。 - notify-system.js:playWindowsSound 拆为 buildSoundPsScript;sendSoundNotification 改用 spawnSync 阻塞播放(powershell 仍用绝对路径),异常退回蜂鸣; sendAllNotifications 播完即退出,移除 detached 与 3 秒定时;删除无用 playBeep Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
这个 PR 做了什么
在现有飞书 / Telegram / Windows 声音提醒之外,新增完整的 Bark(iOS) 推送支持,
并把 Windows 声音从「机器人语音」改为音效文件,顺带修复了 hook 环境下的两个发声问题。
Bark(iOS) 推送(新增
bark-notify.js)BARK_KEY/BARK_SERVER(默认api.day.app)BARK_ENCRYPT_KEY/BARK_ENCRYPT_IV/BARK_ENCRYPT_MODE),中继服务器只见密文BARK_ICON、通知级别BARK_LEVEL(时效性)、重要警告BARK_CRITICALBARK_ARCHIVE_*,Stop 存 / 等待事件不存)、持续响铃BARK_CALLBARK_SOUND(内置预置清单)Windows 声音增强(重构
notify-system.js).wav/.mp3音效(SoundPlayer / MediaPlayer),可配SOUND_FILE--event/SOUND_FILE_ASK)spawnSync同步阻塞播放,修复 hook 环境下「PATH 缺 System32」与「子进程被回收」导致的收到通知却不发声--task测试命令卡死兼容性
BARK_KEY时 Bark 自动跳过;未配SOUND_FILE用系统默认通知音crypto,声音用 Windows 自带 PowerShell用法
在
.env里填BARK_KEY=你的设备key即可用;扩展项见.env.example与SETUP.md。测试
Windows 11 实测通过:Bark 推送(含加密往返,输出与 Bark 官方文档参考密文逐字节一致)、Stop 与 Notification 两类真实 hook 均正常发声。